From f8d41bc8bcd0434de88111da1552d95966a52843 Mon Sep 17 00:00:00 2001 From: Alexandre Dutra Date: Tue, 21 Nov 2023 19:23:19 +0100 Subject: [PATCH] Fix wrong cache capacity unit in `NessiePersistCache` (#7746) Leftover from https://github.com/projectnessie/nessie/pull/7643. --- .../storage/testextension/ClassPersistInstances.java | 4 ++-- .../storage/testextension/NessiePersistCache.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java index 0422b6e0c38..bc652b99df4 100644 --- a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java +++ b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/ClassPersistInstances.java @@ -52,8 +52,8 @@ final class ClassPersistInstances { NessiePersistCache nessiePersistCache = PersistExtension.annotationInstance(context, NessiePersistCache.class); cacheBackend = - nessiePersistCache != null - ? PersistCaches.newBackend(nessiePersistCache.capacity(), null) + nessiePersistCache != null && nessiePersistCache.capacityMb() >= 0 + ? PersistCaches.newBackend(nessiePersistCache.capacityMb(), null) : null; backendTestFactory = reusableTestBackend.backendTestFactory(context); diff --git a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java index d95a0de7484..49ca29afbe0 100644 --- a/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java +++ b/versioned/storage/testextension/src/main/java/org/projectnessie/versioned/storage/testextension/NessiePersistCache.java @@ -23,12 +23,14 @@ /** * Adds a cache in front of the created {@link - * org.projectnessie.versioned.storage.common.persist.Persist} instances, if the {@link #capacity()} - * is {@code >= 0}. + * org.projectnessie.versioned.storage.common.persist.Persist} instances, if the {@link + * #capacityMb()} is {@code >= 0}. */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface NessiePersistCache { - long capacity() default 1024 * 1024; + + /** The maximum capacity of the cache in MB. Default is 1 MB. */ + long capacityMb() default 1; }