Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ private void clean(CompactionInfo ci, long minOpenTxn, boolean metricsEnabled) t

private void cleanUsingLocation(CompactionInfo ci, String path, boolean requiresLock) throws MetaException {
List<Path> deleted;
ci.setSoftDelete(true);
if (requiresLock) {
LockRequest lockRequest = createLockRequest(ci);
LockResponse res = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public class CompactionInfo implements Comparable<CompactionInfo> {
private String fullPartitionName = null;
private String fullTableName = null;
private StringableMap propertiesMap;
private boolean softDelete;

public CompactionInfo(String dbname, String tableName, String partName, CompactionType type) {
this.dbname = dbname;
Expand Down Expand Up @@ -190,6 +191,7 @@ public String toString() {
.append("numberOfBuckets", numberOfBuckets)
.append("orderByClause", orderByClause)
.append("minOpenWriteTxnId", minOpenWriteTxnId)
.append("softDelete", softDelete)
.build();
}

Expand Down Expand Up @@ -368,4 +370,12 @@ public void setWriteIds(boolean hasUncompactedAborts, Set<Long> writeIds) {
public boolean isAbortedTxnCleanup() {
return type == CompactionType.ABORT_TXN_CLEANUP;
}

public void setSoftDelete(boolean softDelete) {
this.softDelete = softDelete;
}

public boolean isSoftDelete() {
return softDelete;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public MarkCleanedFunction(CompactionInfo info) {
public Void execute(MultiDataSourceJdbcResource jdbcResource) throws MetaException {
NamedParameterJdbcTemplate jdbcTemplate = jdbcResource.getJdbcTemplate();
MapSqlParameterSource param;
if (info.isSoftDelete()) {
// Remove compaction queue record and return
removeCompactionAndAbortRetryEntries(info, jdbcTemplate);
return null;
}
if (!info.isAbortedTxnCleanup()) {
param = new MapSqlParameterSource()
.addValue("id", info.id)
Expand Down Expand Up @@ -175,7 +180,7 @@ private void removeCompactionAndAbortRetryEntries(CompactionInfo info, NamedPara
String deleteQuery = """
DELETE FROM "COMPACTION_QUEUE" WHERE "CQ_ID" = :id
""";
if (!info.isAbortedTxnCleanup()) {
if (!info.isAbortedTxnCleanup() && !info.isSoftDelete()) {
deleteQuery += """
OR ("CQ_DATABASE" = :db AND "CQ_TABLE" = :table
AND (:partition is NULL OR "CQ_PARTITION" = :partition)
Expand Down
Loading