keith-turner commented on code in PR #4546:
URL: https://github.com/apache/accumulo/pull/4546#discussion_r1605493213


##########
server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java:
##########
@@ -379,6 +390,8 @@ public String getViolationDescription(short violationCode) {
         return "Bulk load mutation contains either inconsistent files or 
multiple fateTX ids";
       case 9:
         return "Invalid data file metadata format";
+      case 10:
+        return "Suspended timestamp can not be negative";

Review Comment:
   Could fail for other reasons.
   
   ```suggestion
           return "Suspended timestamp is not valid";
   ```



##########
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:
   Do we write suspend columns w/ empty values?



-- 
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]

Reply via email to