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 c53d6a9db0 Adds per table trace logging to HostRegexTableLoadBalancer (#5508) c53d6a9db0 is described below commit c53d6a9db0a10bf845a215533119ee38461ce7ef Author: Keith Turner <ktur...@apache.org> AuthorDate: Thu Apr 24 16:42:21 2025 -0400 Adds per table trace logging to HostRegexTableLoadBalancer (#5508) Wanted to know how much time the HostRegexTableLoadBalancer was spending on each table. Added some trace logging to provide this information. Tested this by running unit test for the class and inspecting the log messages. --- .../accumulo/core/spi/balancer/HostRegexTableLoadBalancer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancer.java b/core/src/main/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancer.java index aad49dc238..05efab3424 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancer.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/balancer/HostRegexTableLoadBalancer.java @@ -35,6 +35,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; +import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -56,6 +57,7 @@ import org.apache.accumulo.core.spi.balancer.data.TableStatistics; import org.apache.accumulo.core.spi.balancer.data.TabletMigration; import org.apache.accumulo.core.spi.balancer.data.TabletServerId; import org.apache.accumulo.core.spi.balancer.data.TabletStatistics; +import org.apache.accumulo.core.util.Timer; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.slf4j.Logger; @@ -352,6 +354,7 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer { .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); // Send a view of the current servers to the tables tablet balancer + Timer assignmentTimer = Timer.startNew(); for (Entry<TableId,Map<TabletId,TabletServerId>> e : groupedUnassigned.entrySet()) { Map<TabletId,TabletServerId> newAssignments = new HashMap<>(); String tableName = tableIdToTableName.get(e.getKey()); @@ -369,8 +372,11 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer { } LOG.debug("Sending {} tablets to balancer for table {} for assignment within tservers {}", e.getValue().size(), tableName, currentView.keySet()); + assignmentTimer.restart(); getBalancerForTable(e.getKey()) .getAssignments(new AssignmentParamsImpl(currentView, e.getValue(), newAssignments)); + LOG.trace("assignment results table:{} assignments:{} time:{}ms", tableName, + newAssignments.size(), assignmentTimer.elapsed(TimeUnit.MILLISECONDS)); newAssignments.forEach(params::addAssignment); } } @@ -500,6 +506,7 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer { migrationsFromLastPass.clear(); } + Timer balanceTimer = Timer.startNew(); for (TableId tableId : tableIdMap.values()) { String tableName = tableIdToTableName.get(tableId); String regexTableName = getPoolNameForTable(tableName); @@ -509,8 +516,11 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer { continue; } ArrayList<TabletMigration> newMigrations = new ArrayList<>(); + balanceTimer.restart(); getBalancerForTable(tableId).balance(new BalanceParamsImpl(currentView, migrations, newMigrations, params.partitionName() + ":" + tableId, Map.of(tableName, tableId))); + LOG.trace("balance results tableId:{} migrations:{} time:{}ms", tableId, newMigrations.size(), + balanceTimer.elapsed(TimeUnit.MILLISECONDS)); if (newMigrations.isEmpty()) { tableToTimeSinceNoMigrations.remove(tableId);