This is an automated email from the ASF dual-hosted git repository.
dlmarion 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 a94d255b68 Modified shell getsplits command to match against obscured
extents (#5983)
a94d255b68 is described below
commit a94d255b689f30c99a8c540f18abb0e6b77aec58
Author: Dave Marion <[email protected]>
AuthorDate: Wed Nov 19 07:34:30 2025 -0500
Modified shell getsplits command to match against obscured extents (#5983)
This commit modifies the shell getsplits command to optionally
accept 1 or more arguments to the `-v` option. When supplied, the
getsplits command will only print information for the splits where
the value in the first column (the obfuscated extent information)
matches one of the supplied arguments. Example invocation:
getsplits -t <table> -v <extent1> <extent2> ...
Closes #5970
Co-authored-by: Keith Turner <[email protected]>
---
.../accumulo/shell/commands/GetSplitsCommand.java | 31 +++++++++++++++++-----
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git
a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
index afe5536e90..1cef6d3151 100644
---
a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
+++
b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java
@@ -20,7 +20,9 @@ package org.apache.accumulo.shell.commands;
import java.io.IOException;
import java.util.Base64;
+import java.util.HashSet;
import java.util.Map.Entry;
+import java.util.Set;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -60,6 +62,14 @@ public class GetSplitsCommand extends Command {
final int maxSplits = m == null ? 0 : Integer.parseInt(m);
final boolean encode = cl.hasOption(base64Opt.getOpt());
final boolean verbose = cl.hasOption(verboseOpt.getOpt());
+ final String[] obscuredExtentMatches =
cl.getOptionValues(verboseOpt.getOpt());
+ final Set<String> matches = new HashSet<>();
+
+ if (obscuredExtentMatches != null) {
+ for (String s : obscuredExtentMatches) {
+ matches.add(s);
+ }
+ }
try (PrintLine p =
outputFile == null ? new PrintShell(shellState.getReader()) : new
PrintFile(outputFile)) {
@@ -79,12 +89,15 @@ public class GetSplitsCommand extends Command {
for (final Entry<Key,Value> next : scanner) {
if (TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(next.getKey())) {
KeyExtent extent = KeyExtent.fromMetaPrevRow(next);
- final String pr = encode(encode, extent.prevEndRow());
- final String er = encode(encode, extent.endRow());
- final String line =
- String.format("%-26s (%s, %s%s", extent.obscured(), pr == null
? "-inf" : pr,
- er == null ? "+inf" : er, er == null ? ") Default Tablet "
: "]");
- p.print(line);
+ final String obscured = extent.obscured();
+ if (matches.size() == 0 || matches.contains(obscured)) {
+ final String pr = encode(encode, extent.prevEndRow());
+ final String er = encode(encode, extent.endRow());
+ final String line =
+ String.format("%-26s (%s, %s%s", obscured, pr == null ?
"-inf" : pr,
+ er == null ? "+inf" : er, er == null ? ") Default Tablet
" : "]");
+ p.print(line);
+ }
}
}
} else {
@@ -133,7 +146,11 @@ public class GetSplitsCommand extends Command {
base64Opt = new Option("b64", "base64encoded", false, "encode the split
points");
verboseOpt =
- new Option("v", "verbose", false, "print out the tablet information
with start/end rows");
+ new Option("v", "verbose", false, "print out the obscured tablets with
start/end rows, "
+ + "will limit output to matching obscured extents if match
arguments are supplied");
+ verboseOpt.setOptionalArg(true);
+ verboseOpt.setArgs(Option.UNLIMITED_VALUES);
+ verboseOpt.setArgName("match");
opts.addOption(outputFileOpt);
opts.addOption(maxSplitsOpt);