Ignore append locks for compaction when using concurrent locks#16316
Merged
AmatyaAvadhanula merged 2 commits intoapache:masterfrom Apr 22, 2024
Merged
Conversation
kfaraz
reviewed
Apr 22, 2024
Comment on lines
+964
to
+969
| Boolean.TRUE.equals(lockFilter.getContext().getOrDefault( | ||
| Tasks.USE_CONCURRENT_LOCKS, | ||
| Tasks.DEFAULT_USE_CONCURRENT_LOCKS)) | ||
| || TaskLockType.REPLACE.name().equals(lockFilter.getContext().getOrDefault( | ||
| Tasks.TASK_LOCK_TYPE, | ||
| Tasks.DEFAULT_TASK_LOCK_TYPE)); |
Contributor
There was a problem hiding this comment.
Slightly reformatted for better readability since this condition has become a little difficult now.
Suggested change
| Boolean.TRUE.equals(lockFilter.getContext().getOrDefault( | |
| Tasks.USE_CONCURRENT_LOCKS, | |
| Tasks.DEFAULT_USE_CONCURRENT_LOCKS)) | |
| || TaskLockType.REPLACE.name().equals(lockFilter.getContext().getOrDefault( | |
| Tasks.TASK_LOCK_TYPE, | |
| Tasks.DEFAULT_TASK_LOCK_TYPE)); | |
| Boolean.TRUE.equals( | |
| lockFilter.getContext().getOrDefault( | |
| Tasks.USE_CONCURRENT_LOCKS, | |
| Tasks.DEFAULT_USE_CONCURRENT_LOCKS | |
| ) | |
| ) | |
| || TaskLockType.REPLACE.name().equals( | |
| lockFilter.getContext().getOrDefault( | |
| Tasks.TASK_LOCK_TYPE, | |
| Tasks.DEFAULT_TASK_LOCK_TYPE | |
| ) | |
| ); |
You may also consider breaking up the condition.
final boolean isUsingConcurrentLocks = condition1;
final boolean isUsingReplaceLock = condition2;
final boolean ignoreAppendLocks = isUsingConcurrentLocks || isReplaceLock;
Contributor
Author
There was a problem hiding this comment.
Thanks, I've broken up the condition.
I've also verified that the USE_CONCURRENT_LOCKS flag is being used wherever TASK_LOCK_TYPE is, and also that it supersedes the latter.
kfaraz
approved these changes
Apr 22, 2024
Contributor
kfaraz
left a comment
There was a problem hiding this comment.
thanks for the fix, @AmatyaAvadhanula !
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.
When using the new concurrent lock REPLACE, compaction should not skip intervals locked by APPEND locks.
There was a check in place for the context value
TASK_LOCK_TYPE.This PR adds the check for the key
USE_CONCURRENT_LOCKSand also adds a relevant test.This PR has: