dlmarion commented on code in PR #5340:
URL: https://github.com/apache/accumulo/pull/5340#discussion_r1962283460


##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -558,6 +560,57 @@ private static Optional<TServerInstance> 
checkServer(ClientContext context, Stri
         .map(address -> new TServerInstance(address, 
stat.getEphemeralOwner()));
   }
 
+  public static void validate(TabletMetadata tm) {
+    if (tm == null) {
+      throw new IllegalStateException("TabletMetadata cannot be null");
+    }
+
+    Text prevEndRowText = tm.getPrevEndRow();
+    Text endRowText = tm.getEndRow();
+
+    // Allow validation even if prevEndRow is missing, as long as endRowText 
exists
+    Key prevEndRowKey = (prevEndRowText != null) ? new Key(prevEndRowText) : 
null;
+    Key endRowKey = (endRowText != null) ? new Key(endRowText) : null;
+
+    Collection<StoredTabletFile> files = tm.getFiles();
+    if (files == null || files.isEmpty()) {
+      return;
+    }

Review Comment:
   I think you can move this up before you get the prevEndRow and endRow. If 
there are no files to validate, then just exit early.



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