This is an automated email from the ASF dual-hosted git repository.

adulceanu pushed a commit to branch issues/OAK-10917
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 262973e58288f843f2bd76d0d69a7223f1580f7e
Author: Andrei Dulceanu <dulce...@adobe.com>
AuthorDate: Mon Jun 24 16:02:13 2024 +0200

    OAK-10917 - Make persistent cache related arguments optional for Azure 
compaction
---
 .../org/apache/jackrabbit/oak/run/CompactCommand.java    | 14 ++++++--------
 .../jackrabbit/oak/segment/azure/tool/AzureCompact.java  | 16 ++++++++++------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git 
a/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CompactCommand.java 
b/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CompactCommand.java
index f955278931..ced75fc6be 100644
--- a/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CompactCommand.java
+++ b/oak-run/src/main/java/org/apache/jackrabbit/oak/run/CompactCommand.java
@@ -99,24 +99,22 @@ class CompactCommand implements Command {
                 System.exit(-1);
             }
 
-            if (persistentCachePath.value(options) == null) {
-                System.err.println("A path for the persistent disk cache needs 
to be specified");
-                parser.printHelpOn(System.err);
-                System.exit(-1);
-            }
-
             AzureCompact.Builder azureBuilder = AzureCompact.builder()
                     .withPath(path)
                     .withTargetPath(targetPath.value(options))
-                    
.withPersistentCachePath(persistentCachePath.value(options))
-                    
.withPersistentCacheSizeGb(persistentCacheSizeGb.value(options))
                     .withForce(options.has(forceArg))
                     .withGCLogInterval(Long.getLong("compaction-progress-log", 
150000))
                     .withConcurrency(nThreads.value(options));
 
+            if (options.has(persistentCachePath)) {
+                
azureBuilder.withPersistentCachePath(persistentCachePath.value(options));
+                
azureBuilder.withPersistentCacheSizeGb(persistentCacheSizeGb.value(options));
+            }
+
             if (options.has(tailArg)) {
                 azureBuilder.withGCType(SegmentGCOptions.GCType.TAIL);
             }
+
             if (options.has(compactor)) {
                 
azureBuilder.withCompactorType(CompactorType.fromDescription(compactor.value(options)));
             }
diff --git 
a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/tool/AzureCompact.java
 
b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/tool/AzureCompact.java
index 747a44fa66..3e79f11837 100644
--- 
a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/tool/AzureCompact.java
+++ 
b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/tool/AzureCompact.java
@@ -258,13 +258,13 @@ public class AzureCompact {
 
     private final int concurrency;
 
-    private String persistentCachePath;
+    private final String persistentCachePath;
 
-    private Integer persistentCacheSizeGb;
+    private final Integer persistentCacheSizeGb;
 
-    private CloudBlobDirectory sourceCloudBlobDirectory;
+    private final CloudBlobDirectory sourceCloudBlobDirectory;
 
-    private CloudBlobDirectory destinationCloudBlobDirectory;
+    private final CloudBlobDirectory destinationCloudBlobDirectory;
 
     private AzureCompact(Builder builder) {
         this.path = builder.path;
@@ -287,13 +287,17 @@ public class AzureCompact {
         SegmentNodeStorePersistence roPersistence;
         SegmentNodeStorePersistence rwPersistence;
         if (sourceCloudBlobDirectory != null && destinationCloudBlobDirectory 
!= null) {
-            roPersistence = decorateWithCache(new 
AzurePersistence(sourceCloudBlobDirectory), persistentCachePath, 
persistentCacheSizeGb);
+            roPersistence = new AzurePersistence(sourceCloudBlobDirectory);
             rwPersistence = new 
AzurePersistence(destinationCloudBlobDirectory);
         } else {
-            roPersistence = 
newSegmentNodeStorePersistence(SegmentStoreType.AZURE, path, 
persistentCachePath, persistentCacheSizeGb);
+            roPersistence = 
newSegmentNodeStorePersistence(SegmentStoreType.AZURE, path);
             rwPersistence = 
newSegmentNodeStorePersistence(SegmentStoreType.AZURE, targetPath);
         }
 
+        if (persistentCachePath != null) {
+            roPersistence = decorateWithCache(roPersistence, 
persistentCachePath, persistentCacheSizeGb);
+        }
+
         SegmentNodeStorePersistence splitPersistence = new 
SplitPersistence(roPersistence, rwPersistence);
 
         SegmentArchiveManager roArchiveManager = 
createArchiveManager(roPersistence);

Reply via email to