ctubbsii commented on a change in pull request #1774:
URL: https://github.com/apache/accumulo/pull/1774#discussion_r525315192
##########
File path:
server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
##########
@@ -79,21 +79,13 @@ public GroupBalancer(TableId tableId) {
this.tableId = tableId;
}
- protected Iterable<Pair<KeyExtent,Location>> getLocationProvider() {
- return () -> {
- try {
- return TabletsMetadata.builder().forTable(tableId).fetch(LOCATION,
PREV_ROW).build(context)
- .stream().map(tm -> {
- Location loc = Location.NONE;
- if (tm.hasCurrent()) {
- loc = new Location(new TServerInstance(tm.getLocation()));
- }
- return new Pair<>(tm.getExtent(), loc);
- }).iterator();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- };
+ protected Map<KeyExtent,TServerInstance> getLocationProvider() {
+ Map<KeyExtent,TServerInstance> tablets = new LinkedHashMap<>();
+ for (var tm : TabletsMetadata.builder().forTable(tableId).fetch(LOCATION,
PREV_ROW)
+ .build(context)) {
+ tablets.put(tm.getExtent(), tm.getLocation());
+ }
+ return tablets;
Review comment:
Nice cleanup here.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]