This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new 66229f5f76 fixes bug with waitForBalance signaling (#4947)
66229f5f76 is described below

commit 66229f5f76b68f3f75a1a72f3eb882a97117f9d7
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Mon Oct 7 11:08:39 2024 -0400

    fixes bug with waitForBalance signaling (#4947)
    
    The code that signals no balancing happened would sometimes skip
    balancing for user tablets and still signal no balancing happened.
    Modified to only signal when balancing had run on all levels.
---
 .../src/main/java/org/apache/accumulo/manager/Manager.java        | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java 
b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
index 77c9da57ae..d02345905b 100644
--- a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
@@ -1035,6 +1035,7 @@ public class Manager extends AbstractServer
       long totalMigrationsOut = 0;
       final Map<DataLevel,Set<KeyExtent>> partitionedMigrations =
           partitionMigrations(migrationsSnapshot());
+      int levelsCompleted = 0;
 
       for (DataLevel dl : DataLevel.values()) {
         if (dl == DataLevel.USER && tabletsNotHosted > 0) {
@@ -1072,14 +1073,17 @@ public class Manager extends AbstractServer
           }
         } while (migrationsOutForLevel > 0 && (dl == DataLevel.ROOT || dl == 
DataLevel.METADATA));
         totalMigrationsOut += migrationsOutForLevel;
+
+        // increment this at end of loop to signal complete run w/o any 
continue
+        levelsCompleted++;
       }
       balancerMetrics.assignMigratingCount(migrations::size);
 
-      if (totalMigrationsOut == 0) {
+      if (totalMigrationsOut == 0 && levelsCompleted == 
DataLevel.values().length) {
         synchronized (balancedNotifier) {
           balancedNotifier.notifyAll();
         }
-      } else {
+      } else if (totalMigrationsOut > 0) {
         nextEvent.event("Migrating %d more tablets, %d total", 
totalMigrationsOut,
             migrations.size());
       }

Reply via email to