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/09 11:17:44 UTC

svn commit: r1782312 - in /jackrabbit/oak/trunk: oak-doc/src/site/markdown/nodestore/segment/ oak-run/src/main/java/org/apache/jackrabbit/oak/run/ oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/

Author: adulceanu
Date: Thu Feb  9 11:17:44 2017
New Revision: 1782312

URL: http://svn.apache.org/viewvc?rev=1782312&view=rev
Log:
OAK-5604 - The check command should accept a non-argument bin option for checking binaries

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
    jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.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=1782312&r1=1782311&r2=1782312&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 Thu Feb  9 11:17:44 2017
@@ -531,7 +531,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] [--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, 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`.
-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.

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=1782312&r1=1782311&r2=1782312&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 Thu Feb  9 11:17:44 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 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)) {

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java?rev=1782312&r1=1782311&r2=1782312&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java Thu Feb  9 11:17:44 2017
@@ -222,7 +222,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());
@@ -244,9 +244,9 @@ public class ConsistencyChecker implemen
                         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 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;
         }
@@ -280,6 +280,8 @@ public class ConsistencyChecker implemen
             } finally {
                 s.close();
             }
+            
+            propertyCount++;
         }
     }