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

ddanielr 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 bd72ec33ba adds trace logging of groups to GroupBalancer (#5978)
bd72ec33ba is described below

commit bd72ec33bab02d5f3e2b2c9a1f87da2968816bf1
Author: Keith Turner <[email protected]>
AuthorDate: Mon Nov 17 07:59:30 2025 -0500

    adds trace logging of groups to GroupBalancer (#5978)
    
    fixes #5973
---
 .../accumulo/core/spi/balancer/GroupBalancer.java  | 23 +++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/spi/balancer/GroupBalancer.java 
b/core/src/main/java/org/apache/accumulo/core/spi/balancer/GroupBalancer.java
index d96de4aced..99e3c290d0 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/spi/balancer/GroupBalancer.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/spi/balancer/GroupBalancer.java
@@ -44,6 +44,8 @@ import org.apache.accumulo.core.util.ComparablePair;
 import org.apache.accumulo.core.util.MapCounter;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.commons.lang3.mutable.MutableInt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.HashBasedTable;
 import com.google.common.collect.HashMultimap;
@@ -67,6 +69,8 @@ import com.google.common.collect.Multimap;
  */
 public abstract class GroupBalancer implements TabletBalancer {
 
+  private final Logger log = LoggerFactory.getLogger(GroupBalancer.class);
+
   protected BalancerEnvironment environment;
   private final TableId tableId;
 
@@ -82,6 +86,19 @@ public abstract class GroupBalancer implements 
TabletBalancer {
    */
   protected abstract Function<TabletId,String> getPartitioner();
 
+  private Function<TabletId,String> getLoggingPartitioner() {
+    Function<TabletId,String> partitioner = getPartitioner();
+    if (log.isTraceEnabled()) {
+      return tabletId -> {
+        String group = partitioner.apply(tabletId);
+        log.trace("Extracted group {} from tablet {}", group, tabletId);
+        return group;
+      };
+    } else {
+      return partitioner;
+    }
+  }
+
   public GroupBalancer(TableId tableId) {
     this.tableId = tableId;
   }
@@ -124,7 +141,7 @@ public abstract class GroupBalancer implements 
TabletBalancer {
       return;
     }
 
-    Function<TabletId,String> partitioner = getPartitioner();
+    Function<TabletId,String> partitioner = getLoggingPartitioner();
 
     List<ComparablePair<String,TabletId>> tabletsByGroup = new ArrayList<>();
     for (Entry<TabletId,TabletServerId> entry : 
params.unassignedTablets().entrySet()) {
@@ -225,7 +242,7 @@ public abstract class GroupBalancer implements 
TabletBalancer {
       tservers.put(tsi, new TserverGroupInfo(tsi));
     }
 
-    Function<TabletId,String> partitioner = getPartitioner();
+    Function<TabletId,String> partitioner = getLoggingPartitioner();
 
     // collect stats about current state
     for (var tablet : getLocationProvider().entrySet()) {
@@ -713,7 +730,7 @@ public abstract class GroupBalancer implements 
TabletBalancer {
       return;
     }
 
-    Function<TabletId,String> partitioner = getPartitioner();
+    Function<TabletId,String> partitioner = getLoggingPartitioner();
 
     for (var tablet : getLocationProvider().entrySet()) {
       String group = partitioner.apply(tablet.getKey());

Reply via email to