-
Notifications
You must be signed in to change notification settings - Fork 468
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,14 @@ | |
| import org.apache.accumulo.core.client.admin.TabletAvailability; | ||
| import org.apache.accumulo.core.clientImpl.thrift.TableOperation; | ||
| import org.apache.accumulo.core.data.NamespaceId; | ||
| import org.apache.accumulo.core.data.Range; | ||
| import org.apache.accumulo.core.data.RowRange; | ||
| import org.apache.accumulo.core.data.TableId; | ||
| import org.apache.accumulo.core.dataImpl.thrift.TRange; | ||
| import org.apache.accumulo.core.fate.FateId; | ||
| import org.apache.accumulo.core.fate.Repo; | ||
| import org.apache.accumulo.core.fate.zookeeper.DistributedReadWriteLock; | ||
| import org.apache.accumulo.core.fate.zookeeper.LockRange; | ||
| import org.apache.accumulo.manager.Manager; | ||
| import org.apache.accumulo.manager.tableOps.ManagerRepo; | ||
| import org.apache.accumulo.manager.tableOps.Utils; | ||
|
|
@@ -48,10 +51,18 @@ public LockTable(TableId tableId, NamespaceId namespaceId, TRange range, | |
|
|
||
| @Override | ||
| public long isReady(FateId fateId, Manager manager) throws Exception { | ||
| final Range range = new Range(tRange); | ||
| final RowRange rowRange = RowRange.range( | ||
| range.isInfiniteStartKey() ? null : range.getStartKey().getRow(), | ||
| range.isStartKeyInclusive(), range.isInfiniteStopKey() ? null : range.getEndKey().getRow(), | ||
| range.isEndKeyInclusive()); | ||
| final LockRange lockRange = LockRange.of(rowRange); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is a RowRange object needed in this method? Seems like more info is computed than needed (inclusive start/end). Can just have |
||
|
|
||
| return Utils.reserveNamespace(manager.getContext(), namespaceId, fateId, | ||
| DistributedReadWriteLock.LockType.READ, true, TableOperation.SET_TABLET_AVAILABILITY) | ||
| + Utils.reserveTable(manager.getContext(), tableId, fateId, | ||
| DistributedReadWriteLock.LockType.WRITE, true, TableOperation.SET_TABLET_AVAILABILITY); | ||
| DistributedReadWriteLock.LockType.WRITE, true, TableOperation.SET_TABLET_AVAILABILITY, | ||
| lockRange); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
Not anything for this PR but is a bit confusing that Range uses both "Stop Key" and "End Key" to mean the same thing