Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

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;
Expand Down Expand Up @@ -60,6 +62,14 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s
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)) {
Expand All @@ -79,12 +89,15 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s
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 {
Expand Down Expand Up @@ -133,7 +146,11 @@ public Options getOptions() {
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);
Expand Down