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 14a7404e28 Fixes performance bug in GroupBalancer (#5432)
14a7404e28 is described below
commit 14a7404e2835ad0749f4d40567cd4141b58f7a0e
Author: Keith Turner <[email protected]>
AuthorDate: Thu Mar 27 11:44:46 2025 -0400
Fixes performance bug in GroupBalancer (#5432)
Code in GroupBalancer was calling
`HashBasedTable.columnKeySet().removeAll(aList)`. The Guava
HashBasedTable code would iterator over all of its rows and columns and
then call contains on the list passed in by GroupBalancer. So this code
was doing `ROWS*COLS*LIST_SIZE` operations. Changed the list to a
hashset in this PR so now it only does `ROW*COLS` operations.
---
.../java/org/apache/accumulo/core/spi/balancer/GroupBalancer.java | 5 +++--
1 file changed, 3 insertions(+), 2 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 dd41ef1c63..d96de4aced 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
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -487,7 +488,7 @@ public abstract class GroupBalancer implements
TabletBalancer {
}
ArrayList<Pair<String,TabletServerId>> serversGroupsToRemove = new
ArrayList<>();
- ArrayList<TabletServerId> serversToRemove = new ArrayList<>();
+ HashSet<TabletServerId> serversToRemove = new HashSet<>();
for (TserverGroupInfo destTgi : tservers.values()) {
if (surplusExtra.isEmpty()) {
@@ -611,7 +612,7 @@ public abstract class GroupBalancer implements
TabletBalancer {
}
}
- ArrayList<TabletServerId> emptyServers = new ArrayList<>();
+ HashSet<TabletServerId> emptyServers = new HashSet<>();
ArrayList<Pair<String,TabletServerId>> emptyServerGroups = new
ArrayList<>();
for (TserverGroupInfo destTgi : tservers.values()) {
if (extraSurplus.isEmpty()) {