From 773f26c3cd8232d08613a89889a3c0d2a25a8b3b Mon Sep 17 00:00:00 2001 From: Amanda Villarreal Date: Thu, 20 Aug 2026 16:58:51 -0500 Subject: [PATCH 1/4] Obscure keyExtents in outstanding migrations output to remove TODO --- .../accumulo/core/clientImpl/ClientContext.java | 5 ----- .../util/ThrottledBalancerProblemReporter.java | 15 ++++++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java index cb8f9e5ec39..64af0dbfce0 100644 --- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java +++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java @@ -334,11 +334,6 @@ public ClientContext(ClientInfo info, AccumuloConfiguration serverConf, }); zkLockChecker = memoize(() -> { - // make this use its own ZooSession and ZooCache, because this is used by the - // tablet location cache, which is a static singleton reused by multiple clients - // so, it can't rely on being able to continue to use the same client's ZooCache, - // because that client could be closed, and its ZooSession also closed - // this needs to be fixed; TODO https://github.com/apache/accumulo/issues/2301 var zk = info.getZooKeeperSupplier(ZookeeperLockChecker.class.getSimpleName(), ZooUtil.getRoot(getInstanceID())).get(); return new ZookeeperLockChecker(new ZooCache(zk, Set.of(Constants.ZTSERVERS))); diff --git a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java index 41dd35f52c0..b4c435059b4 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import org.apache.accumulo.core.data.TabletId; +import org.apache.accumulo.core.dataImpl.KeyExtent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,13 +78,17 @@ public void setMigrations(Set migrations) { @Override public void report() { log.warn("Not balancing due to {} outstanding migrations.", migrations.size()); - /* - * TODO ACCUMULO-2938 redact key extents in this output to avoid leaking protected - * information. - */ + + // convert each tabletId in migrations to keyExtent + Set keyExtents = migrations.stream().map(tabletId -> { + KeyExtent extent = KeyExtent.fromTabletId(tabletId); + extent.obscured(); + return extent; + }).collect(Collectors.toSet()); + if (log.isDebugEnabled()) { log.debug("Sample up to 10 outstanding migrations: {}", - migrations.stream().limit(10).map(String::valueOf).collect(Collectors.joining(", "))); + keyExtents.stream().limit(10).map(String::valueOf).collect(Collectors.joining(", "))); } // Now that we've reported, clear out the migrations list so we don't hold it in memory. migrations = Collections.emptySet(); From 6a3cfe4f71531af8ff3defdf50e7990b3806ba4b Mon Sep 17 00:00:00 2001 From: avillarreal Date: Fri, 21 Aug 2026 12:53:49 -0500 Subject: [PATCH 2/4] Combine streams into the logger --- .../util/ThrottledBalancerProblemReporter.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java index b4c435059b4..cef6befc666 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java @@ -78,17 +78,14 @@ public void setMigrations(Set migrations) { @Override public void report() { log.warn("Not balancing due to {} outstanding migrations.", migrations.size()); - - // convert each tabletId in migrations to keyExtent - Set keyExtents = migrations.stream().map(tabletId -> { - KeyExtent extent = KeyExtent.fromTabletId(tabletId); - extent.obscured(); - return extent; - }).collect(Collectors.toSet()); - if (log.isDebugEnabled()) { + // convert each tabletId in migrations to keyExtent for redacting log.debug("Sample up to 10 outstanding migrations: {}", - keyExtents.stream().limit(10).map(String::valueOf).collect(Collectors.joining(", "))); + String.join(", ", migrations.stream().limit(10).map(tabletId -> { + KeyExtent extent = KeyExtent.fromTabletId(tabletId); + extent.obscured(); + return extent.toString(); + }).map(String::valueOf).collect(Collectors.toSet()))); } // Now that we've reported, clear out the migrations list so we don't hold it in memory. migrations = Collections.emptySet(); From 4d7afaa170ada96e4bbd3dfeb3a57bcbe885303e Mon Sep 17 00:00:00 2001 From: avillarreal Date: Fri, 21 Aug 2026 13:36:21 -0500 Subject: [PATCH 3/4] Fix stream to collect into 1 set --- .../spi/balancer/util/ThrottledBalancerProblemReporter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java index cef6befc666..7b21a646ca1 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java @@ -81,11 +81,11 @@ public void report() { if (log.isDebugEnabled()) { // convert each tabletId in migrations to keyExtent for redacting log.debug("Sample up to 10 outstanding migrations: {}", - String.join(", ", migrations.stream().limit(10).map(tabletId -> { + migrations.stream().limit(10).map(tabletId -> { KeyExtent extent = KeyExtent.fromTabletId(tabletId); extent.obscured(); return extent.toString(); - }).map(String::valueOf).collect(Collectors.toSet()))); + }).collect(Collectors.joining(", "))); } // Now that we've reported, clear out the migrations list so we don't hold it in memory. migrations = Collections.emptySet(); From 6428ce40f50894c9eacd3529eb58df5ebf77e30f Mon Sep 17 00:00:00 2001 From: avillarreal Date: Fri, 21 Aug 2026 14:18:14 -0500 Subject: [PATCH 4/4] Fix return obscured keyExtent --- .../balancer/util/ThrottledBalancerProblemReporter.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java index 7b21a646ca1..3bc14cd6663 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/balancer/util/ThrottledBalancerProblemReporter.java @@ -81,11 +81,9 @@ public void report() { if (log.isDebugEnabled()) { // convert each tabletId in migrations to keyExtent for redacting log.debug("Sample up to 10 outstanding migrations: {}", - migrations.stream().limit(10).map(tabletId -> { - KeyExtent extent = KeyExtent.fromTabletId(tabletId); - extent.obscured(); - return extent.toString(); - }).collect(Collectors.joining(", "))); + migrations.stream().limit(10) + .map(tabletId -> KeyExtent.fromTabletId(tabletId).obscured()) + .collect(Collectors.joining(", "))); } // Now that we've reported, clear out the migrations list so we don't hold it in memory. migrations = Collections.emptySet();