HIVE-29601: ACID: Cleaner finds base directories valid with writeId above the cleaner highWaterMark#6470
Merged
Merged
Conversation
…bove the cleaner highWaterMark
deniskuzZ
reviewed
May 11, 2026
| */ | ||
| @Override | ||
| public boolean isWriteIdAborted(long writeId) { | ||
| if (writeId > highWatermark) { |
Member
There was a problem hiding this comment.
is this another bug? how about isWriteIdRangeAborted, do we need similar check?
Contributor
Author
There was a problem hiding this comment.
Fortunately isWriteIdRangeAborted already contains check against the highWaterMark
if (highWatermark < minWriteId) {
return RangeResponse.NONE;
}
In isWriteIdAborted I think it is indeed another bug.
…bove the cleaner highWaterMark - test fixes
|
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?
Fix the base directory validation in AcidUtils.isValidBase by removing the shortcut to accept base directories with writeId below the minOpenWriteId without checking against the cleaner's highWaterMark.
Why are the changes needed?
It can happen that the minOpenWriteId is set and greater than the highWaterMark. Without checking against the highWaterMark, base directories above the highWaterMark will be considered valid. Because of this the cleaner will delete base directories above its highWaterMark causing the following cleaner runs fail due to missing base directories. In special cases, the cleaner can pick a base directory belongs to an aborted insert overwrite as latest valid base. This will lead to data loss.
Does this PR introduce any user-facing change?
No
How was this patch tested?
The scenarios are covered in TestCleaner unit test. Also added unit test for AcidUtils.isValidBase