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


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java:
##########
@@ -2145,4 +2150,27 @@ 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);
+
+    final Text scanRangeStart = (range.getStartKey() == null) ? null : 
range.getStartKey().getRow();
+    TableId tableId = context.getTableId(tableName);
+
+    TabletsMetadata tabletsMetadata =
+        
context.getAmple().readTablets().forTable(tableId).overlapping(scanRangeStart, 
true, null)
+            .fetch(HOSTING_GOAL, PREV_ROW).checkConsistency().build();
+
+    return tabletsMetadata.stream().peek(tm -> {
+      if (scanRangeStart != null && tm.getEndRow() != null
+          && tm.getEndRow().compareTo(scanRangeStart) < 0) {
+        log.debug(">>>> tablet {} is before scan start range: {}", 
tm.getExtent(), scanRangeStart);
+        throw new RuntimeException("Bug in ample or this code.");
+      }
+    }).takeWhile(tm -> !(tm.getPrevEndRow() != null
+        && range.afterEndKey(new 
Key(tm.getPrevEndRow()).followingKey(PartialKey.ROW))))

Review Comment:
   I think the following is a bit more clear, but thats just my opinion. Either 
was is correct.
   
   ```suggestion
       }).takeWhile(tm -> tm.getPrevEndRow() == null
           || !range.afterEndKey(new 
Key(tm.getPrevEndRow()).followingKey(PartialKey.ROW)))
   ```



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