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 @@ -158,6 +158,7 @@ private void clean(CompactionInfo ci, long minOpenTxn, boolean metricsEnabled) t
cleanUsingAcidDir(ci, t, path, cleanerWaterMark);
}
} else {
ci.setSoftDelete(true);
Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we set softDelete flag inside cleanUsingLocation? i think we call it only in case of DB/table/partition softDelete
we should also skip adding entries for soft-deleted partitions

cleanUsingLocation(ci, location, false);
}
} catch (Exception e) {
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,7 +50,7 @@ public MarkCleanedFunction(CompactionInfo info) {
public Void execute(MultiDataSourceJdbcResource jdbcResource) throws MetaException {
NamedParameterJdbcTemplate jdbcTemplate = jdbcResource.getJdbcTemplate();
MapSqlParameterSource param;
if (!info.isAbortedTxnCleanup()) {
if (!info.isAbortedTxnCleanup() && !info.isSoftDelete()) {
Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just add at the top

if (info.isSoftDelete()) {
      removeTxnComponents(info, jdbcResource);
      return
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not soft delete, we want to add a row to COMPLETED_COMPACTIONS, delete row from COMPACTION_QUEUE(in removeCompactionAndAbortRetryEntries()), delete rows from COMPLETED_TXN_COMPONENTS and TXN_COMPONENTS too. Have refactored a bit to avoid !info.isSoftDelete() at too many places now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, updated the snipper, removed NOT

param = new MapSqlParameterSource()
.addValue("id", info.id)
.addValue("succeeded", Character.toString(SUCCEEDED_STATE), Types.CHAR);
Expand Down Expand Up @@ -85,6 +85,10 @@ public Void execute(MultiDataSourceJdbcResource jdbcResource) throws MetaExcepti
*/
removeCompactionAndAbortRetryEntries(info, jdbcTemplate);

if (info.isSoftDelete()) {
return null;
}

if (!info.isAbortedTxnCleanup()) {
// Remove entries from completed_txn_components as well, so we don't start looking there
// again but only up to the highest write ID include in this compaction job.
Expand Down Expand Up @@ -175,7 +179,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