HIVE-29522: Prevent cleaner from creating COMPLETED_COMPACTIONS entries for soft-deleted ACID tables#6399
Open
VenuReddy2103 wants to merge 1 commit intoapache:masterfrom
Open
HIVE-29522: Prevent cleaner from creating COMPLETED_COMPACTIONS entries for soft-deleted ACID tables#6399VenuReddy2103 wants to merge 1 commit intoapache:masterfrom
VenuReddy2103 wants to merge 1 commit intoapache:masterfrom
Conversation
…es for soft-deleted ACID tables
6b853b8 to
e455b50
Compare
|
deniskuzZ
reviewed
Apr 1, 2026
| } | ||
|
|
||
| public boolean isSoftDelete() { | ||
| return "true".equalsIgnoreCase(getProperty(AcidConstants.SOFT_DELETE_TABLE)); |
deniskuzZ
reviewed
Apr 1, 2026
| NamedParameterJdbcTemplate jdbcTemplate = jdbcResource.getJdbcTemplate(); | ||
| MapSqlParameterSource param; | ||
| if (!info.isAbortedTxnCleanup()) { | ||
| if (!info.isAbortedTxnCleanup() && !info.isSoftDelete()) { |
Member
There was a problem hiding this comment.
can we just add at the top
if (!info.isSoftDelete()) {
removeTxnComponents(info, jdbcResource);
return
}
deniskuzZ
reviewed
Apr 1, 2026
| rqst.setRunas(TxnUtils.findUserToRunAs(table.getSd().getLocation(), table, conf)); | ||
| rqst.putToProperties("location", table.getSd().getLocation()); | ||
| rqst.putToProperties("ifPurge", Boolean.toString(isMustPurge(tableEvent.getEnvironmentContext(), table))); | ||
| rqst.putToProperties(AcidConstants.SOFT_DELETE_TABLE, Boolean.TRUE.toString()); |
Member
There was a problem hiding this comment.
is that really needed?
check the CompactionCleaner#cleanUsingLocation(ci, location, false) maybe pass flag there?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What changes were proposed in this pull request?
When a table is soft deleted,
soft_deleteflag is recorded in COMPACTION_QUEUE table properties. This flag is used inMarkCleanedFunctionWhy are the changes needed?
When the configuration property hive.acid.createtable.softdelete is set to true, deletion of ACID table data is performed asynchronously by a background cleaner thread.
As part of this process, the cleaner thread removes entry corresponding to the acid table from the COMPACTION_QUEUE and records a completion entry in the COMPLETED_COMPACTIONS table using
org.apache.hadoop.hive.metastore.txn.TxnStore#markCleaned().However, by the time this operation is executed, the associated ACID table has already been deleted (soft-deleted) in HMS. As a result, a COMPLETED_COMPACTIONS entry is created for a table that no longer exists.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Tested manually