diff --git oak-doc/src/site/markdown/nodestore/segment/overview.md oak-doc/src/site/markdown/nodestore/segment/overview.md index 92c9abc..9893ba4 100644 --- oak-doc/src/site/markdown/nodestore/segment/overview.md +++ oak-doc/src/site/markdown/nodestore/segment/overview.md @@ -531,7 +531,7 @@ This tool is the counterpart of `backup`. ### Check ``` -java -jar oak-run.jar check PATH [--journal JOURNAL] [--notify SECS] [--bin LENGTH] [--io-stats] +java -jar oak-run.jar check PATH [--journal JOURNAL] [--notify SECS] [--bin] [--io-stats] ``` The `check` tool inspects an existing Segment Store at `PATH` for eventual inconsistencies. @@ -546,11 +546,9 @@ If the `--notify` option is specified, the tool will print progress information If not specified, progress information messages will be disabled. If `SECS` equals `0`, every progress information message is printed. -If the `--bin` option is specified, the tool will scan the content of binary properties, up to the specified length `LENGTH`. -If not specified, the full traversal of binary properties is enabled. -If `LENGTH` is set to a value greater than `0`, only the initial `LENGTH` bytes of binary properties are traversed. -If `LENGTH` is set to `0`, the traversal is disabled. -The `--bin` property has no effect on binary properties stored in an external Blob Store. +If the `--bin` option is specified, the tool will scan the full content of binary properties. +If not specified, the binary properties will not be traversed. +The `--bin` option has no effect on binary properties stored in an external Blob Store. If the `--io-stats` option is specified, the tool will print some statistics about the I/O operations performed during the execution of the check command. This option is optional and is disabled by default. diff --git oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java index d3b538c..3a09afc 100644 --- oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java +++ oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java @@ -40,9 +40,7 @@ class CheckCommand implements Command { ArgumentAcceptingOptionSpec notify = parser.accepts( "notify", "number of seconds between progress notifications") .withRequiredArg().ofType(Long.class).defaultsTo(Long.MAX_VALUE); - ArgumentAcceptingOptionSpec bin = parser.accepts( - "bin", "read the first n bytes from binary properties.") - .withRequiredArg().ofType(Long.class); + OptionSpec bin = parser.accepts("bin", "read the content of binary properties"); OptionSpec segment = parser.accepts("segment", "Use oak-segment instead of oak-segment-tar"); OptionSpec ioStatistics = parser.accepts("io-stats", "Print I/O statistics (only for oak-segment-tar)"); @@ -56,14 +54,10 @@ class CheckCommand implements Command { String journalFileName = journal.value(options); long debugLevel = notify.value(options); - long binLen = -1L; + long binLen = 0L; if (options.has(bin)) { - binLen = bin.value(options); - - if (binLen < 0) { - printUsage(parser, "The value for --bin option must be a positive number!"); - } + binLen = -1L; } if (options.has(deep)) { diff --git oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java index 8d02e7d..1866184 100644 --- oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java +++ oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java @@ -222,7 +222,7 @@ public class ConsistencyChecker implements Closeable { propertyCount = 0; String result = traverse(SegmentNodeStoreBuilders.builder(store).build() .getRoot(), "/", true, binLen); - print("Traversed {} nodes and {} properties", nodeCount, propertyCount); + print("Checked {} nodes and {} properties", nodeCount, propertyCount); return result; } catch (RuntimeException e) { print("Error while traversing {}", revision, e.getMessage()); @@ -244,9 +244,9 @@ public class ConsistencyChecker implements Closeable { traverse(blob, binLen); } } else { + propertyCount++; propertyState.getValue(type); } - propertyCount++; } for (ChildNodeEntry cne : node.getChildNodeEntries()) { String childName = cne.getName(); @@ -265,7 +265,7 @@ public class ConsistencyChecker implements Closeable { } } - private static void traverse(Blob blob, long length) throws IOException { + private void traverse(Blob blob, long length) throws IOException { if (length < 0) { length = Long.MAX_VALUE; } @@ -280,6 +280,8 @@ public class ConsistencyChecker implements Closeable { } finally { s.close(); } + + propertyCount++; } }