cshannon commented on code in PR #4546:
URL: https://github.com/apache/accumulo/pull/4546#discussion_r1605502579
##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -306,40 +307,50 @@ public List<Short> check(Environment env, Mutation
mutation) {
} else {
if (!isValidColumn(columnUpdate)) {
violations = addViolation(violations, 2);
- } else if (new
ColumnFQ(columnUpdate).equals(TabletColumnFamily.PREV_ROW_COLUMN)
- && columnUpdate.getValue().length > 0
- && (violations == null || !violations.contains((short) 4))) {
- KeyExtent ke = KeyExtent.fromMetaRow(new Text(mutation.getRow()));
+ } else {
+ final var column = new ColumnFQ(columnUpdate);
+ if (column.equals(TabletColumnFamily.PREV_ROW_COLUMN)
+ && columnUpdate.getValue().length > 0
+ && (violations == null || !violations.contains((short) 4))) {
+ KeyExtent ke = KeyExtent.fromMetaRow(new Text(mutation.getRow()));
- Text per = TabletColumnFamily.decodePrevEndRow(new
Value(columnUpdate.getValue()));
+ Text per = TabletColumnFamily.decodePrevEndRow(new
Value(columnUpdate.getValue()));
- boolean prevEndRowLessThanEndRow =
- per == null || ke.endRow() == null || per.compareTo(ke.endRow())
< 0;
+ boolean prevEndRowLessThanEndRow =
+ per == null || ke.endRow() == null ||
per.compareTo(ke.endRow()) < 0;
- if (!prevEndRowLessThanEndRow) {
- violations = addViolation(violations, 3);
- }
- } else if (new
ColumnFQ(columnUpdate).equals(ServerColumnFamily.LOCK_COLUMN)) {
- if (zooCache == null) {
- zooCache = new ZooCache(context.getZooReader(), null);
- CleanerUtil.zooCacheClearer(this, zooCache);
- }
+ if (!prevEndRowLessThanEndRow) {
+ violations = addViolation(violations, 3);
+ }
+ } else if (column.equals(ServerColumnFamily.LOCK_COLUMN)) {
+ if (zooCache == null) {
+ zooCache = new ZooCache(context.getZooReader(), null);
+ CleanerUtil.zooCacheClearer(this, zooCache);
+ }
- if (zooRoot == null) {
- zooRoot = context.getZooKeeperRoot();
- }
+ if (zooRoot == null) {
+ zooRoot = context.getZooKeeperRoot();
+ }
- boolean lockHeld = false;
- String lockId = new String(columnUpdate.getValue(), UTF_8);
+ boolean lockHeld = false;
+ String lockId = new String(columnUpdate.getValue(), UTF_8);
- try {
- lockHeld = ServiceLock.isLockHeld(zooCache, new
ZooUtil.LockID(zooRoot, lockId));
- } catch (Exception e) {
- log.debug("Failed to verify lock was held {} {}", lockId,
e.getMessage());
- }
+ try {
+ lockHeld = ServiceLock.isLockHeld(zooCache, new
ZooUtil.LockID(zooRoot, lockId));
+ } catch (Exception e) {
+ log.debug("Failed to verify lock was held {} {}", lockId,
e.getMessage());
+ }
- if (!lockHeld) {
- violations = addViolation(violations, 7);
+ if (!lockHeld) {
+ violations = addViolation(violations, 7);
+ }
+ } else if (column.equals(SuspendLocationColumn.SUSPEND_COLUMN)
+ && columnUpdate.getValue().length > 0) {
Review Comment:
Well in theory we should not based on the current code. Everything is
funneled through
[SuspendingTServer](https://github.com/apache/accumulo/blob/1261ec24726f65fca3b7314d00c17c062a8dfd6c/core/src/main/java/org/apache/accumulo/core/metadata/SuspendingTServer.java#L49)
and the Value is the server and time appended when
[writing](https://github.com/apache/accumulo/blob/1261ec24726f65fca3b7314d00c17c062a8dfd6c/server/base/src/main/java/org/apache/accumulo/server/metadata/TabletMutatorBase.java#L207)
inside of TabletMutatorBase
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]