Conversation
kasakrisz
reviewed
Sep 11, 2026
Comment on lines
+1077
to
+1079
| /** Opens two txns against (table), aborts both — leaves two aborted rows in | ||
| * TXN_COMPONENTS so the group's COUNT(*) exceeds an abortedThreshold of 1. */ | ||
| private void abortTwoTableUpdates(String table) throws Exception { |
Contributor
There was a problem hiding this comment.
Can abortedThreshold be set to 0?
Contributor
Author
There was a problem hiding this comment.
Yes, it can. We can use 0 and in this case one aborted transaction would be enough. I changed a code like this.
…compactions with ordering
kuczoram
force-pushed
the
HIVE-30026
branch
from
September 15, 2026 12:17
45ea612 to
63d69a9
Compare
|
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?
I propose to extend the SQL queries which are fetching the potential compaction with an oder by CTC_TXNID. Since the TXNID is an always increasing number, this way we can be sure that the older entries in the COMPLETED_TXN_COMPONENTS tables are fetched first. This way we can make sure that all tables will get into the compaction cycle at once.
Also propose to apply separate limit for the aborted txn cleaup. If the fetch limit is smaller then the compaction candidates, the aborted txns will never be fetched.
Why are the changes needed?
After HIVE-27444, if the number of candidates is bigger than the compactor.fetch.size value, it can happen that the Initiator doesn't schedule all tables for compaction.
For example: we have 4 tables, which are all eligible for compaction, but the fetch size is 2.
In the first initiator run, it will pick two of these tables. It would be expected that during the second run of the initiator it would pick the other two tables, so all 4 tables have been scheduled for compaction.
Since there is no ordering when selecting the tables for compaction, this was not always the case. It could happen that some tables never got compacted.
Also if the number of candidates is bigger than the compactor.fetch.size limit, the aborted txn candidates will never be picked up by the initiator. Because the "remaining budget" will always be 0 in the FindPotentialCompactionsFunction.
Set candidates = new HashSet<>(jdbcResource.execute(new CompactionCandidateHandler(lastChecked, fetchSize)));
int remaining = fetchSize - candidates.size();
if (collectAbortedTxns && remaining > 0) {
candidates.addAll(jdbcResource.execute(new AbortedTxnHandler(abortedTimeThreshold, abortedThreshold, remaining)));
}
This affects only the cases when the aborted txn clean-up is done by the compaction cycle and not just the cleaner.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Unit test