Joscorbe commented on code in PR #1328:
URL: https://github.com/apache/jackrabbit-oak/pull/1328#discussion_r1514429813


##########
oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java:
##########
@@ -460,6 +479,55 @@ private void sweep(RevisionsOptions options, Closer closer)
         SweepHelper.sweep(store, new RevisionContextWrapper(ns, clusterId), 
seeker);
     }
 
+    private void pathCleanup(RevisionsOptions options, Closer closer) throws 
IOException {
+        String path = options.getPath();
+        if (path == null || path.isEmpty()) {
+            System.err.println("path option is required for " + 
RevisionsOptions.CMD_CLEANUP + " command");
+            return;
+        }
+
+        DocumentNodeStoreBuilder<?> builder = createDocumentMKBuilder(options, 
closer);
+        if (builder == null) {
+            System.err.println("revisions mode only available for 
DocumentNodeStore");
+            return;
+        }
+
+        DocumentStore documentStore = builder.getDocumentStore();
+        builder.setReadOnlyMode();
+        useMemoryBlobStore(builder);
+        DocumentNodeStore documentNodeStore = builder.build();
+        String id = 
org.apache.jackrabbit.oak.plugins.document.util.Utils.getIdFromPath(path);
+        NodeDocument workingDocument = documentStore.find(NODES, id);
+        //NodeDocumentRevisionCleaner revisionCleaner = new 
NodeDocumentRevisionCleaner(documentNodeStore, workingDocument);
+
+        VersionGarbageCollector gc = bootstrapVGC(options, closer, true);
+        // Set a LoggingGC monitor that will output the detailedGC operations
+        gc.setGCMonitor(new LoggingGCMonitor(LOG));
+        // Run detailedGC on the given document
+        UpdateOp op = gc.collectGarbageOnDocument(documentNodeStore, 
workingDocument);

Review Comment:
   Working on this, but I'm refactoring the `collectDetailedGarbage` to run all 
the logic on a single document. That way I think we will also improve the 
readability of that code.



-- 
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: dev-unsubscr...@jackrabbit.apache.org

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

Reply via email to