You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ad...@apache.org on 2017/02/03 09:47:47 UTC
svn commit: r1781520 - in /jackrabbit/oak/trunk:
oak-doc/src/site/markdown/nodestore/segment/overview.md
oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
Author: adulceanu
Date: Fri Feb 3 09:47:47 2017
New Revision: 1781520
URL: http://svn.apache.org/viewvc?rev=1781520&view=rev
Log:
OAK-5277 - The check command defines a useless default value for the bin option
Modified:
jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segment/overview.md
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segment/overview.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segment/overview.md?rev=1781520&r1=1781519&r2=1781520&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segment/overview.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/segment/overview.md Fri Feb 3 09:47:47 2017
@@ -548,9 +548,9 @@ If not specified, progress information m
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`.
-The default value for `LENGTH` is `0`, effectively disabling the traversal of binary properties.
+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 `-1`, binary properties are fully 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.
### <a name="compact"/> Compact
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java?rev=1781520&r1=1781519&r2=1781520&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java Fri Feb 3 09:47:47 2017
@@ -20,6 +20,7 @@ package org.apache.jackrabbit.oak.run;
import static org.apache.jackrabbit.oak.plugins.segment.FileStoreHelper.isValidFileStoreOrFail;
import java.io.File;
+import java.io.IOException;
import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.OptionParser;
@@ -40,23 +41,30 @@ class CheckCommand implements Command {
"notify", "number of seconds between progress notifications")
.withRequiredArg().ofType(Long.class).defaultsTo(Long.MAX_VALUE);
ArgumentAcceptingOptionSpec<Long> bin = parser.accepts(
- "bin", "read the n first bytes from binary properties. -1 for all bytes.")
- .withOptionalArg().ofType(Long.class).defaultsTo(0L);
+ "bin", "read the first n bytes from binary properties.")
+ .withRequiredArg().ofType(Long.class);
OptionSpec segment = parser.accepts("segment", "Use oak-segment instead of oak-segment-tar");
OptionSet options = parser.parse(args);
if (options.nonOptionArguments().size() != 1) {
- System.err.println("usage: check path/to/segmentstore <options>");
- parser.printHelpOn(System.err);
- System.exit(1);
+ printUsage(parser);
}
File dir = isValidFileStoreOrFail(new File(options.nonOptionArguments().get(0).toString()));
String journalFileName = journal.value(options);
boolean fullTraversal = options.has(deep);
long debugLevel = notify.value(options);
- long binLen = bin.value(options);
+
+ long binLen = -1L;
+
+ if (options.has(bin)) {
+ binLen = bin.value(options);
+
+ if (binLen < 0) {
+ printUsage(parser, "The value for --bin option must be a positive number!");
+ }
+ }
if (options.has(segment)) {
SegmentUtils.check(dir, journalFileName, fullTraversal, debugLevel, binLen);
@@ -65,4 +73,14 @@ class CheckCommand implements Command {
}
}
+ private void printUsage(OptionParser parser, String... messages) throws IOException {
+ for (String message : messages) {
+ System.err.println(message);
+ }
+
+ System.err.println("usage: check path/to/segmentstore <options>");
+ parser.printHelpOn(System.err);
+ System.exit(1);
+ }
+
}