keith-turner commented on code in PR #3901:
URL: https://github.com/apache/accumulo/pull/3901#discussion_r1375006123
##########
core/src/main/java/org/apache/accumulo/core/manager/balancer/AssignmentParamsImpl.java:
##########
@@ -50,16 +55,23 @@ public static AssignmentParamsImpl fromThrift(
Map<KeyExtent,TServerInstance> unassigned,
Map<KeyExtent,TServerInstance> assignmentsOut) {
SortedMap<TabletServerId,TServerStatus> currentStatusNew = new TreeMap<>();
- currentStatus.forEach((tsi, status) -> currentStatusNew.put(new
TabletServerIdImpl(tsi),
- TServerStatusImpl.fromThrift(status)));
-
Map<String,Set<TabletServerId>> tserverGroups = new HashMap<>();
- currentTServerGrouping.forEach((k, v) -> {
+ currentTServerGrouping.forEach((group, serversInGroup) -> {
Set<TabletServerId> servers = new HashSet<>();
- v.forEach(tsi -> servers.add(TabletServerIdImpl.fromThrift(tsi)));
- tserverGroups.put(k, servers);
+ serversInGroup.forEach(tsi -> {
+ TabletServerIdImpl id = TabletServerIdImpl.fromThrift(tsi);
+ if (currentStatus.containsKey(tsi)) {
+ currentStatusNew.put(id,
TServerStatusImpl.fromThrift(currentStatus.get(tsi)));
+ servers.add(id);
+ } else {
+ LOG.debug("Dropping tserver {} from group as it's not in set of all
servers", id, group);
Review Comment:
```suggestion
LOG.debug("Dropping tserver {} from group {} as it's not in set of
all servers", id, group);
```
##########
core/src/main/java/org/apache/accumulo/core/manager/balancer/AssignmentParamsImpl.java:
##########
@@ -50,16 +55,23 @@ public static AssignmentParamsImpl fromThrift(
Map<KeyExtent,TServerInstance> unassigned,
Map<KeyExtent,TServerInstance> assignmentsOut) {
SortedMap<TabletServerId,TServerStatus> currentStatusNew = new TreeMap<>();
- currentStatus.forEach((tsi, status) -> currentStatusNew.put(new
TabletServerIdImpl(tsi),
- TServerStatusImpl.fromThrift(status)));
-
Map<String,Set<TabletServerId>> tserverGroups = new HashMap<>();
- currentTServerGrouping.forEach((k, v) -> {
+ currentTServerGrouping.forEach((group, serversInGroup) -> {
Set<TabletServerId> servers = new HashSet<>();
- v.forEach(tsi -> servers.add(TabletServerIdImpl.fromThrift(tsi)));
- tserverGroups.put(k, servers);
+ serversInGroup.forEach(tsi -> {
+ TabletServerIdImpl id = TabletServerIdImpl.fromThrift(tsi);
+ if (currentStatus.containsKey(tsi)) {
+ currentStatusNew.put(id,
TServerStatusImpl.fromThrift(currentStatus.get(tsi)));
+ servers.add(id);
+ } else {
+ LOG.debug("Dropping tserver {} from group as it's not in set of all
servers", id, group);
+ }
+ });
+ tserverGroups.put(group, servers);
Review Comment:
Should we still add this to the map if the servers set is empty?
--
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]