This is an automated email from the ASF dual-hosted git repository. adulceanu pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push: new 2b734cfba6 OAK-10917 - Make persistent cache related arguments optional for Azure compaction (#1555) 2b734cfba6 is described below commit 2b734cfba6e8300e9846097c459398c65d75cdb0 Author: Andrei Dulceanu <dulce...@users.noreply.github.com> AuthorDate: Mon Jun 24 16:47:24 2024 +0200 OAK-10917 - Make persistent cache related arguments optional for Azure compaction (#1555) --- .../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);