Repository: accumulo Updated Branches: refs/heads/1.8 0dee0d854 -> e94cc38ce
Update PrintInfo.java Update MultiLevelIndex.java Update RFile.java Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/5757c89c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/5757c89c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/5757c89c Branch: refs/heads/1.8 Commit: 5757c89c2ef519a96c001e8451cea70152a2c8af Parents: 0dee0d8 Author: matthpeterson <[email protected]> Authored: Mon Jun 19 10:34:07 2017 -0400 Committer: Michael Wall <[email protected]> Committed: Tue Jun 20 12:54:35 2017 -0400 ---------------------------------------------------------------------- .../accumulo/core/file/rfile/MultiLevelIndex.java | 9 +++++++++ .../apache/accumulo/core/file/rfile/PrintInfo.java | 4 +++- .../org/apache/accumulo/core/file/rfile/RFile.java | 16 ++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/5757c89c/core/src/main/java/org/apache/accumulo/core/file/rfile/MultiLevelIndex.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/MultiLevelIndex.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/MultiLevelIndex.java index f99560e..7ac253d 100644 --- a/core/src/main/java/org/apache/accumulo/core/file/rfile/MultiLevelIndex.java +++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/MultiLevelIndex.java @@ -23,6 +23,7 @@ import java.io.DataInputStream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; +import java.io.PrintStream; import java.util.AbstractList; import java.util.ArrayList; import java.util.Collections; @@ -82,6 +83,14 @@ public class MultiLevelIndex { } } + public void printInfo(PrintStream out) { + out.println("Key: " + key.toString() + + " NumEntries: " + entries + + " Offset: " + offset + + " CompressedSize: " + compressedSize + + " RawSize: " + rawSize); + } + @Override public void write(DataOutput out) throws IOException { key.write(out); http://git-wip-us.apache.org/repos/asf/accumulo/blob/5757c89c/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java index 6b94cee..8e388e5 100644 --- a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java +++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java @@ -55,6 +55,8 @@ public class PrintInfo implements KeywordExecutable { boolean hash = false; @Parameter(names = {"--histogram"}, description = "print a histogram of the key-value sizes") boolean histogram = false; + @Parameter(names = {"--printIndex"}, description = "prints information about all the index entries") + boolean printIndex = false; @Parameter(names = {"--useSample"}, description = "Use sample data for --dump, --vis, --histogram options") boolean useSample = false; @Parameter(names = {"--keyStats"}, description = "print key length statistics for index and all data") @@ -153,7 +155,7 @@ public class PrintInfo implements KeywordExecutable { if (opts.vis || opts.hash) iter.registerMetrics(vmg); - iter.printInfo(); + iter.printInfo(opts.printIndex); System.out.println(); org.apache.accumulo.core.file.rfile.bcfile.PrintInfo.main(new String[] {arg}); http://git-wip-us.apache.org/repos/asf/accumulo/blob/5757c89c/core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java b/core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java index 26343ba..7ffc5c8 100644 --- a/core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java +++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java @@ -284,7 +284,7 @@ public class RFile { indexWriter.close(out); } - public void printInfo(boolean isSample) throws IOException { + public void printInfo(boolean isSample, boolean includeIndexDetails) throws IOException { PrintStream out = System.out; out.printf("%-24s : %s\n", (isSample ? "Sample " : "") + "Locality group ", (isDefaultLG ? "<DEFAULT>" : name)); if (version == RINDEX_VER_3 || version == RINDEX_VER_4 || version == RINDEX_VER_6 || version == RINDEX_VER_7) { @@ -309,7 +309,11 @@ public class RFile { long numKeys = 0; IndexIterator countIter = indexReader.lookup(new Key()); while (countIter.hasNext()) { - numKeys += countIter.next().getNumEntries(); + IndexEntry indexEntry = countIter.next(); + numKeys += indexEntry.getNumEntries(); + if (includeIndexDetails) { + indexEntry.printInfo(out); + } } out.printf("\t%-22s : %,d\n", "Num entries", numKeys); @@ -1380,12 +1384,16 @@ public class RFile { } public void printInfo() throws IOException { + printInfo(false); + } + + public void printInfo(boolean includeIndexDetails) throws IOException { System.out.printf("%-24s : %d\n", "RFile Version", rfileVersion); System.out.println(); for (LocalityGroupMetadata lgm : localityGroups) { - lgm.printInfo(false); + lgm.printInfo(false, includeIndexDetails); } if (sampleGroups.size() > 0) { @@ -1397,7 +1405,7 @@ public class RFile { System.out.println(); for (LocalityGroupMetadata lgm : sampleGroups) { - lgm.printInfo(true); + lgm.printInfo(true, includeIndexDetails); } } }
