You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "rishabhdaim (via GitHub)" <gi...@apache.org> on 2026/10/14 07:55:15 UTC

Re: [PR] OAK-12455: Add --continue-on-error option to oak-run check to report all inconsistent nodes [jackrabbit-oak]

rishabhdaim commented on code in PR #3215:
URL: https://github.com/apache/jackrabbit-oak/pull/3215#discussion_r4268169974


##########
oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckValidRepositoryTest.java:
##########
@@ -396,4 +398,33 @@ public void testNewNodeFilterWithoutValidRevision() throws Exception {
         assertExpectedOutput(strOut.toString(), List.of("Searched through 2 revisions", "No good revision found"));
         assertExpectedOutput(strErr.toString(), List.of("Error while traversing /z", "Path /z not found"));
     }
+
+    @Test
+    public void testSuccessfulFullCheckWithContinueOnError() throws Exception {
+        StringWriter strOut = new StringWriter();
+        StringWriter strErr = new StringWriter();
+
+        PrintWriter outWriter = new PrintWriter(strOut, true);
+        PrintWriter errWriter = new PrintWriter(strErr, true);
+
+        int result = Check.builder()
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(Set.of("/"))
+            .withContinueOnError(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
+        outWriter.close();
+        errWriter.close();

Review Comment:
   same as above.



##########
oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckRepositoryTestBase.java:
##########
@@ -166,6 +167,34 @@ protected void addInvalidRevisionWithCorruptNewNodeProperty() throws InvalidFile
         corruptRecord(valueRecordId, "data00001a.tar", RecordType.VALUE);
     }
 
+    protected void addInvalidRevisionWithOtherCorruptPaths() throws InvalidFileStoreVersionException, IOException, CommitFailedException {
+        FileStore fileStore = FileStoreBuilder.fileStoreBuilder(temporaryFolder.getRoot()).withMaxFileSize(256)
+            .withSegmentCacheSize(64).build();
+
+        SegmentNodeStore nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
+        NodeBuilder builder = nodeStore.getRoot().builder();
+
+        // replace the nodes corrupted by addInvalidRevision with new ones
+        for (String name : List.of("a", "z")) {
+            NodeBuilder replacement = EmptyNodeState.EMPTY_NODE.builder();
+            replacement.setProperty(name + "0", name + "0");
+            builder.setChildNode(name, replacement.getNodeState());
+        }
+
+        addChildWithProperties(nodeStore, builder, "d", 5);
+        addChildWithProperties(nodeStore, builder, "e", 6);
+
+        NodeState after = nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+
+        RecordId dRecordId = ((SegmentNodeState) after.getChildNode("d")).getRecordId();
+        RecordId eRecordId = ((SegmentNodeState) after.getChildNode("e")).getRecordId();
+
+        fileStore.close();

Review Comment:
   please use try-with-resources here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org