This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 8cd19db79c Modified ServerUtilOpts to extent Help, not ClientOpts
(#6117)
8cd19db79c is described below
commit 8cd19db79c650de96c13fb7280b8e3b7213b7f3c
Author: Dave Marion <[email protected]>
AuthorDate: Fri Feb 6 14:44:45 2026 -0500
Modified ServerUtilOpts to extent Help, not ClientOpts (#6117)
---
.../apache/accumulo/server/cli/ServerUtilOpts.java | 9 ++----
.../org/apache/accumulo/server/util/Admin.java | 2 +-
.../server/util/CheckForMetadataProblems.java | 6 ++--
.../accumulo/server/util/TableDiskUsage.java | 4 +--
.../server/util/VerifyTabletAssignments.java | 12 ++++----
.../org/apache/accumulo/test/TestBinaryRows.java | 4 +--
.../test/performance/scan/CollectTabletStats.java | 33 +++++++++++-----------
7 files changed, 32 insertions(+), 38 deletions(-)
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/cli/ServerUtilOpts.java
b/server/base/src/main/java/org/apache/accumulo/server/cli/ServerUtilOpts.java
index c83da8226b..c15b1ecb5d 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/cli/ServerUtilOpts.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/cli/ServerUtilOpts.java
@@ -18,20 +18,17 @@
*/
package org.apache.accumulo.server.cli;
-import org.apache.accumulo.core.cli.ClientOpts;
-import org.apache.accumulo.core.clientImpl.ClientInfo;
+import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.server.ServerContext;
-public class ServerUtilOpts extends ClientOpts {
+public class ServerUtilOpts extends Help {
private ServerContext context;
public synchronized ServerContext getServerContext() {
if (context == null) {
- context = getClientConfigFile() == null ? new
ServerContext(SiteConfiguration.auto())
- : ServerContext.withClientInfo(SiteConfiguration.auto(),
- ClientInfo.from(getClientProps()));
+ context = new ServerContext(SiteConfiguration.auto());
}
return context;
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index 8e1dfaab24..a2bce872c5 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -547,7 +547,7 @@ public class Admin implements KeywordExecutable {
} else if (cl.getParsedCommand().equals("volumes")) {
ListVolumesUsed.listVolumes(context);
} else if (cl.getParsedCommand().equals("verifyTabletAssigns")) {
- VerifyTabletAssignments.execute(opts.getClientProps(),
verifyTabletAssignmentsOpts.verbose);
+ VerifyTabletAssignments.execute(context,
verifyTabletAssignmentsOpts.verbose);
} else if (cl.getParsedCommand().equals("changeSecret")) {
ChangeSecret.execute(context, conf);
} else if (cl.getParsedCommand().equals("deleteZooInstance")) {
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
b/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
index dd4a186e4c..02b039cd86 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
@@ -25,8 +25,6 @@ import java.util.Map.Entry;
import java.util.TreeSet;
import java.util.function.Consumer;
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.data.Key;
@@ -124,8 +122,8 @@ public class CheckForMetadataProblems {
Map<TableId,TreeSet<KeyExtent>> tables = new HashMap<>();
boolean sawProblems = false;
- try (AccumuloClient client =
Accumulo.newClient().from(opts.getClientProps()).build();
- Scanner scanner = client.createScanner(tableNameToCheck,
Authorizations.EMPTY)) {
+ try (Scanner scanner =
+ opts.getServerContext().createScanner(tableNameToCheck,
Authorizations.EMPTY)) {
scanner.setRange(TabletsSection.getRange());
TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
index e60f944854..1af551663d 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
@@ -36,6 +36,7 @@ import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
+import org.apache.accumulo.core.cli.ClientOpts;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.TableNotFoundException;
@@ -45,7 +46,6 @@ import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.schema.DataFileValue;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.NumUtil;
-import org.apache.accumulo.server.cli.ServerUtilOpts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -319,7 +319,7 @@ public class TableDiskUsage {
}
}
- static class Opts extends ServerUtilOpts {
+ static class Opts extends ClientOpts {
@Parameter(required = true, description = " <table> { <table> ... } ")
List<String> tables = new ArrayList<>();
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
b/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
index 1cdfaf6b51..36997c549f 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
@@ -26,13 +26,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Properties;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.clientImpl.thrift.TInfo;
import org.apache.accumulo.core.data.Range;
@@ -52,6 +49,7 @@ import
org.apache.accumulo.core.tabletscan.thrift.TabletScanClientService;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.HostAndPortComparator;
import org.apache.accumulo.core.util.threads.ThreadPools;
+import org.apache.accumulo.server.ServerContext;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
import org.apache.thrift.TServiceClient;
@@ -66,12 +64,12 @@ import io.opentelemetry.context.Scope;
public class VerifyTabletAssignments {
private static final Logger log =
LoggerFactory.getLogger(VerifyTabletAssignments.class);
- public static void execute(Properties clientProps, boolean verbose) throws
Exception {
+ public static void execute(ServerContext context, boolean verbose) throws
Exception {
Span span = TraceUtil.startSpan(VerifyTabletAssignments.class, "main");
try (Scope scope = span.makeCurrent()) {
- try (AccumuloClient client =
Accumulo.newClient().from(clientProps).build()) {
- for (String table : client.tableOperations().list()) {
- checkTable((ClientContext) client, verbose, table, null);
+ try {
+ for (String table : context.tableOperations().list()) {
+ checkTable(context, verbose, table, null);
}
} finally {
span.end();
diff --git a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
index 91ec13c8e9..5a1352f7b7 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
@@ -25,6 +25,7 @@ import java.util.Iterator;
import java.util.Map.Entry;
import java.util.TreeSet;
+import org.apache.accumulo.core.cli.ClientOpts;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.BatchWriter;
@@ -35,7 +36,6 @@ import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.util.TextUtil;
-import org.apache.accumulo.server.cli.ServerUtilOpts;
import org.apache.hadoop.io.Text;
import com.beust.jcommander.Parameter;
@@ -80,7 +80,7 @@ public class TestBinaryRows {
return l;
}
- public static class Opts extends ServerUtilOpts {
+ public static class Opts extends ClientOpts {
@Parameter(names = "--mode",
description = "either 'ingest', 'delete', 'randomLookups', 'split',"
+ " 'verify', 'verifyDeleted'",
diff --git
a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
index 600d1906c7..06a1af1d86 100644
---
a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
+++
b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
@@ -36,7 +36,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.apache.accumulo.core.client.Accumulo;
+import org.apache.accumulo.core.cli.ClientOpts.AuthConverter;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.clientImpl.ClientContext;
@@ -91,6 +91,9 @@ public class CollectTabletStats {
private static final Logger log =
LoggerFactory.getLogger(CollectTabletStats.class);
static class CollectOptions extends ServerUtilOpts {
+ @Parameter(names = {"-auths", "--auths"}, converter = AuthConverter.class,
+ description = "the authorizations to use when reading or writing")
+ public Authorizations auths = Authorizations.EMPTY;
@Parameter(names = {"-t", "--table"}, required = true, description =
"table to use")
String tableName;
@Parameter(names = "--iterations", description = "number of iterations")
@@ -217,26 +220,24 @@ public class CollectTabletStats {
runTest("read tablet files w/ table iter stack", tests, opts.numThreads,
threadPool);
}
- try (AccumuloClient client =
Accumulo.newClient().from(opts.getClientProps()).build()) {
- for (int i = 0; i < opts.iterations; i++) {
- ArrayList<Test> tests = new ArrayList<>();
- for (final KeyExtent ke : tabletsToTest) {
- Test test = new Test(ke) {
- @Override
- public int runTest() throws Exception {
- return scanTablet(client, opts.tableName, opts.auths,
ke.prevEndRow(), ke.endRow(),
- columns);
- }
- };
- tests.add(test);
- }
- runTest("read tablet data through accumulo", tests, opts.numThreads,
threadPool);
+ for (int i = 0; i < opts.iterations; i++) {
+ ArrayList<Test> tests = new ArrayList<>();
+ for (final KeyExtent ke : tabletsToTest) {
+ Test test = new Test(ke) {
+ @Override
+ public int runTest() throws Exception {
+ return scanTablet(context, opts.tableName, opts.auths,
ke.prevEndRow(), ke.endRow(),
+ columns);
+ }
+ };
+ tests.add(test);
}
+ runTest("read tablet data through accumulo", tests, opts.numThreads,
threadPool);
for (final KeyExtent ke : tabletsToTest) {
threadPool.execute(() -> {
try {
- calcTabletStats(client, opts.tableName, opts.auths, ke, columns);
+ calcTabletStats(context, opts.tableName, opts.auths, ke, columns);
} catch (Exception e) {
log.error("Failed to calculate tablet stats.", e);
}