Author: adulceanu
Date: Thu Feb 9 11:35:54 2017
New Revision: 1782313
URL: http://svn.apache.org/viewvc?rev=1782313&view=rev
Log:
OAK-5604 - The check command should accept a non-argument bin option for
checking binaries
Modified:
jackrabbit/oak/branches/1.6/oak-doc/src/site/markdown/nodestore/segment/overview.md
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java
Modified:
jackrabbit/oak/branches/1.6/oak-doc/src/site/markdown/nodestore/segment/overview.md
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-doc/src/site/markdown/nodestore/segment/overview.md?rev=1782313&r1=1782312&r2=1782313&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.6/oak-doc/src/site/markdown/nodestore/segment/overview.md
(original)
+++
jackrabbit/oak/branches/1.6/oak-doc/src/site/markdown/nodestore/segment/overview.md
Thu Feb 9 11:35:54 2017
@@ -514,7 +514,7 @@ This tool is the counterpart of `backup`
### <a name="check"/> Check
```
-java -jar oak-run.jar check PATH [--journal JOURNAL] [--notify SECS] [--bin
LENGTH]
+java -jar oak-run.jar check PATH [--journal JOURNAL] [--notify SECS] [--bin]
```
The `check` tool inspects an existing Segment Store at `PATH` for eventual
inconsistencies.
@@ -529,11 +529,9 @@ If the `--notify` option is specified, t
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`.
-The default value for `LENGTH` is `0`, effectively disabling the traversal of
binary properties.
-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.
-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.
### <a name="compact"/> Compact
Modified:
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java?rev=1782313&r1=1782312&r2=1782313&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
(original)
+++
jackrabbit/oak/branches/1.6/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CheckCommand.java
Thu Feb 9 11:35:54 2017
@@ -40,9 +40,7 @@ class CheckCommand implements Command {
ArgumentAcceptingOptionSpec<Long> notify = parser.accepts(
"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);
+ OptionSpec bin = parser.accepts("bin", "read the content of binary
properties");
OptionSpec segment = parser.accepts("segment", "Use oak-segment
instead of oak-segment-tar");
OptionSet options = parser.parse(args);
@@ -56,7 +54,12 @@ class CheckCommand implements Command {
File dir = isValidFileStoreOrFail(new
File(options.nonOptionArguments().get(0).toString()));
String journalFileName = journal.value(options);
long debugLevel = notify.value(options);
- long binLen = bin.value(options);
+
+ long binLen = 0L;
+
+ if (options.has(bin)) {
+ binLen = -1L;
+ }
if (options.has(deep)) {
printUsage(parser, "The --deep option was deprecated! Please do
not use it in the future!"
Modified:
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java?rev=1782313&r1=1782312&r2=1782313&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java
(original)
+++
jackrabbit/oak/branches/1.6/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java
Thu Feb 9 11:35:54 2017
@@ -176,7 +176,7 @@ public class ConsistencyChecker implemen
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());
@@ -198,9 +198,9 @@ public class ConsistencyChecker implemen
traverse(blob, binLen);
}
} else {
+ propertyCount++;
propertyState.getValue(type);
}
- propertyCount++;
}
for (ChildNodeEntry cne : node.getChildNodeEntries()) {
String childName = cne.getName();
@@ -219,7 +219,7 @@ public class ConsistencyChecker implemen
}
}
- 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;
}
@@ -234,6 +234,8 @@ public class ConsistencyChecker implemen
} finally {
s.close();
}
+
+ propertyCount++;
}
}