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


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java:
##########
@@ -2145,4 +2150,37 @@ public void setTabletHostingGoal(String tableName, Range 
range, TabletHostingGoa
     }
   }
 
+  @Override
+  public Stream<HostingGoalForTablet> getTabletHostingGoal(final String 
tableName,
+      final Range range) throws TableNotFoundException {
+    EXISTING_TABLE_NAME.validate(tableName);
+
+    List<HostingGoalForTablet> hostingInfo = new ArrayList<>();
+
+    final Text scanRangeStart = (range.getStartKey() == null) ? null : 
range.getStartKey().getRow();
+    TableId tableId = context.getTableId(tableName);
+
+    try (TabletsMetadata m = context.getAmple().readTablets().forTable(tableId)
+        .overlapping(scanRangeStart, true, null).build()) {
+
+      for (TabletMetadata tm : m) {
+        final KeyExtent tabletExtent = tm.getExtent();
+        if (scanRangeStart != null && tm.getEndRow() != null
+            && tm.getEndRow().compareTo(scanRangeStart) < 0) {
+          // the end row of this tablet is before the start row, skip it
+          log.debug(">>>> tablet {} is before scan start range: {}", 
tabletExtent, scanRangeStart);
+          throw new RuntimeException("Bug in ample or this code.");
+        }
+        if (tm.getPrevEndRow() != null
+            && range.afterEndKey(new 
Key(tm.getPrevEndRow()).followingKey(PartialKey.ROW))) {
+          break;
+        }
+        hostingInfo
+            .add(new HostingGoalForTablet(new TabletIdImpl(tabletExtent), 
tm.getHostingGoal()));
+      }
+
+    }

Review Comment:
   @jmark99 it looks good.



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to