brianloss commented on a change in pull request #1891:
URL: https://github.com/apache/accumulo/pull/1891#discussion_r568111961
##########
File path: server/manager/src/main/java/org/apache/accumulo/master/Master.java
##########
@@ -852,34 +866,57 @@ private void
checkForHeldServer(SortedMap<TServerInstance,TabletServerStatus> ts
}
private long balanceTablets() {
- List<TabletMigration> migrationsOut = new ArrayList<>();
- long wait =
tabletBalancer.balance(Collections.unmodifiableSortedMap(tserverStatus),
- migrationsSnapshot(), migrationsOut);
-
- for (TabletMigration m :
TabletBalancer.checkMigrationSanity(tserverStatus.keySet(),
- migrationsOut)) {
- if (migrations.containsKey(m.tablet)) {
+ BalanceParamsImpl params =
BalanceParamsImpl.fromThrift(tserverStatusForBalancer,
+ tserverStatus, migrationsSnapshot());
+ long wait = tabletBalancer.balance(params);
+
+ for (TabletMigration m :
checkMigrationSanity(tserverStatusForBalancer.keySet(),
+ params.migrationsOut())) {
+ KeyExtent ke = TabletIdImpl.toKeyExtent(m.getTablet());
+ if (migrations.containsKey(ke)) {
log.warn("balancer requested migration more than once, skipping {}",
m);
continue;
}
- migrations.put(m.tablet, m.newServer);
+ TServerInstance tserverInstance =
TabletServerIdImpl.toThrift(m.getNewTabletServer());
+ migrations.put(ke, tserverInstance);
log.debug("migration {}", m);
}
- if (migrationsOut.isEmpty()) {
+ if (params.migrationsOut().isEmpty()) {
synchronized (balancedNotifier) {
balancedNotifier.notifyAll();
}
} else {
- nextEvent.event("Migrating %d more tablets, %d total",
migrationsOut.size(),
+ nextEvent.event("Migrating %d more tablets, %d total",
params.migrationsOut().size(),
migrations.size());
}
return wait;
}
+ private List<TabletMigration> checkMigrationSanity(Set<TabletServerId>
current,
+ List<TabletMigration> migrations) {
+ return migrations.stream().filter(m -> {
+ boolean includeMigration = false;
+ if (m.getTablet() == null) {
+ log.warn("Balancer gave back a null tablet {}", m);
+ } else if (m.getNewTabletServer() == null) {
+ log.warn("Balancer did not set the destination {}", m);
+ } else if (m.getOldTabletServer() == null) {
+ log.warn("Balancer did not set the source {}", m);
+ } else if (!current.contains(m.getOldTabletServer())) {
+ log.warn("Balancer wants to move a tablet from a server that is not
current: {}", m);
+ } else if (!current.contains(m.getNewTabletServer())) {
+ log.warn("Balancer wants to move a tablet to a server that is not
current: {}", m);
Review comment:
This is just a copy of the checkMigrationSanity method from the now
deprecated [TabletBalancer
class](https://github.com/apache/accumulo/blob/main/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java#L252).
I added it here since this was the only place it was used.
I think it makes sense to change the level to error, though. I can certainly
do that.
----------------------------------------------------------------
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]