-
Notifications
You must be signed in to change notification settings - Fork 471
Narrow table lock range for set tablet availability fate operation #5949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
kevinrr888
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/availability/LockTable.java
Outdated
Show resolved
Hide resolved
server/manager/src/main/java/org/apache/accumulo/manager/tableOps/availability/LockTable.java
Outdated
Show resolved
Hide resolved
|
I have converted this to draft for now. I think #5952 should be merged first as it might have some impact here. |
060b618 to
8d9ec18
Compare
|
Marking this as ready for review. I refactored things and took a slightly different approach. The main changes are now:
|
|
#5949 mentioned that we should look into using a read lock here instead of a write lock. I looked into it and here is what I came up with: If I'm understanding things correctly, a read lock will allow concurrent setTabletAvailability() calls. I think this means if two ops run at the same time, there is no guarantee which order they will run in so if they act on overlapping tablets, the outcome will just be whichever op had its conditional mutations run last for each tablet (and the overlap could end up mixed between the two ops). So TLDR: we should keep a write lock if we need these calls to run serially, otherwise a read lock should be fine. |
ddanielr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic seems straight forward to me.
The need to convert the tRange to a range, and then to a rowRange seemed excessive but I saw the removal of the zeroRowSuffix being done in toRowRange.
minor suggestion to skip the object creation if the range is already infinite.
| } | ||
|
|
||
| private static KeyExtent findContaining(Ample ample, TableId tableId, Text row) { | ||
| public static KeyExtent findContaining(Ample ample, TableId tableId, Text row) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public static KeyExtent findContaining(Ample ample, TableId tableId, Text row) { | |
| /** | |
| * Find all tablets that are contained within the provided table row | |
| */ | |
| public static KeyExtent findContaining(Ample ample, TableId tableId, Text row) { |
Since this is now public and used outside of Utils it should probably get a javadoc entry
| * be converted to a RowRange, an infinite LockRange is returned. | ||
| */ | ||
| private LockRange getLockRange(FateEnv env) { | ||
| Range range = new Range(tRange); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid the range conversions if the tRange is already infinite.
| Range range = new Range(tRange); | |
| if (tRange.infiniteStartKey && tRange.infiniteStopKey) { | |
| return LockRange.infinite(); | |
| } | |
| Range range = new Range(tRange); |
Fixes #5788
The main change here is to use the version of
Utils.reserveTable()that allows us to pass a range to only lock that portion.