ctubbsii commented on a change in pull request #2334:
URL: https://github.com/apache/accumulo/pull/2334#discussion_r745026716
##########
File path:
server/tserver/src/main/java/org/apache/accumulo/tserver/AssignmentHandler.java
##########
@@ -233,4 +237,43 @@ public void run() {
}, reschedule, TimeUnit.MILLISECONDS);
}
}
+
+ public static boolean checkTabletMetadata(KeyExtent extent, TServerInstance
instance,
+ TabletMetadata meta) throws AccumuloException {
+
+ if (meta == null) {
+ log.info(METADETA_ISSUE + "{}, its metadata was not found.", extent);
+ return false;
+ }
+
+ if (!meta.sawPrevEndRow()) {
+ throw new AccumuloException(METADETA_ISSUE + "metadata entry does not
have prev row ("
+ + meta.getTableId() + " " + meta.getEndRow() + ")");
+ }
+
+ if (!extent.equals(meta.getExtent())) {
+ log.info(METADETA_ISSUE + "tablet extent mismatch {} {}", extent,
meta.getExtent());
+ return false;
+ }
+
+ if (meta.getDirName() == null) {
+ throw new AccumuloException(
+ METADETA_ISSUE + "metadata entry does not have directory (" +
meta.getExtent() + ")");
+ }
+
+ if (meta.getTime() == null && !extent.equals(RootTable.EXTENT)) {
+ throw new AccumuloException(
+ METADETA_ISSUE + "metadata entry does not have time (" +
meta.getExtent() + ")");
+ }
+
+ TabletMetadata.Location loc = meta.getLocation();
+
+ if (loc == null || loc.getType() != TabletMetadata.LocationType.FUTURE
+ || !instance.equals(loc)) {
+ log.info(METADETA_ISSUE + "Unexpected location {} {}", extent, loc);
+ return false;
Review comment:
```suggestion
log.info(METADATA_ISSUE + "{}, its metadata was not found.", extent);
return false;
}
if (!meta.sawPrevEndRow()) {
throw new AccumuloException(METADATA_ISSUE + "metadata entry does not
have prev row ("
+ meta.getTableId() + " " + meta.getEndRow() + ")");
}
if (!extent.equals(meta.getExtent())) {
log.info(METADATA_ISSUE + "tablet extent mismatch {} {}", extent,
meta.getExtent());
return false;
}
if (meta.getDirName() == null) {
throw new AccumuloException(
METADATA_ISSUE + "metadata entry does not have directory (" +
meta.getExtent() + ")");
}
if (meta.getTime() == null && !extent.equals(RootTable.EXTENT)) {
throw new AccumuloException(
METADATA_ISSUE + "metadata entry does not have time (" +
meta.getExtent() + ")");
}
TabletMetadata.Location loc = meta.getLocation();
if (loc == null || loc.getType() != TabletMetadata.LocationType.FUTURE
|| !instance.equals(loc)) {
log.info(METADATA_ISSUE + "Unexpected location {} {}", extent, loc);
return false;
```
--
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]