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 d4e2ae729a reduce the frequency that the list of scan servers is sorted (#4547) d4e2ae729a is described below commit d4e2ae729a34b419148f2d8bd62c12276f4f7733 Author: Keith Turner <ktur...@apache.org> AuthorDate: Mon May 13 10:46:39 2024 -0400 reduce the frequency that the list of scan servers is sorted (#4547) The provided plugin for working with scan servers sorts the list of scan servers fairly frequently. This list will not change too often, so it could be sorted less to offer a better amortized cost as the total number of scan servers grows. Also outside of the plugin, the plugin was being reset every 100ms. Removed this to give the plugin more control. Also there is currently no way to change client config for a created Accumulo client, so there is no need to recreate the plugin. --- .../main/java/org/apache/accumulo/core/clientImpl/ClientContext.java | 4 ++-- .../apache/accumulo/core/spi/scan/ConfigurableScanServerSelector.java | 2 +- 2 files changed, 3 insertions(+), 3 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 d02a2c743e..e4ba0028c9 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 @@ -19,6 +19,7 @@ package org.apache.accumulo.core.clientImpl; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Suppliers.memoize; import static com.google.common.base.Suppliers.memoizeWithExpiration; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; @@ -232,8 +233,7 @@ public class ClientContext implements AccumuloClient { saslSupplier = memoizeWithExpiration( () -> SaslConnectionParams.from(getConfiguration(), getCredentials().getToken()), 100, MILLISECONDS); - scanServerSelectorSupplier = - memoizeWithExpiration(this::createScanServerSelector, 100, MILLISECONDS); + scanServerSelectorSupplier = memoize(this::createScanServerSelector); this.singletonReservation = Objects.requireNonNull(reservation); this.tableops = new TableOperationsImpl(this); this.namespaceops = new NamespaceOperationsImpl(this, tableops); diff --git a/core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerSelector.java b/core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerSelector.java index 2e792180cc..c77231216f 100644 --- a/core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerSelector.java +++ b/core/src/main/java/org/apache/accumulo/core/spi/scan/ConfigurableScanServerSelector.java @@ -303,7 +303,7 @@ public class ConfigurableScanServerSelector implements ScanServerSelector { .computeIfAbsent(sserver.getGroup(), k -> new ArrayList<>()).add(sserver.getAddress())); groupedServers.values().forEach(ssAddrs -> Collections.sort(ssAddrs)); return groupedServers; - }, 100, TimeUnit.MILLISECONDS); + }, 3, TimeUnit.SECONDS); var opts = params.getOptions();