stefan-egli commented on code in PR #1328:
URL: https://github.com/apache/jackrabbit-oak/pull/1328#discussion_r1504304416


##########
oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java:
##########
@@ -460,6 +494,97 @@ private void sweep(RevisionsOptions options, Closer closer)
         SweepHelper.sweep(store, new RevisionContextWrapper(ns, clusterId), 
seeker);
     }
 
+    private void cleanup(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(documentStore, documentNodeStore, workingDocument);

Review Comment:
   As was discussed offline, we'd need to change this into a way which calls GC 
in general (or if that is unfeasible at least call DetailedGC in general).



-- 
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