This is an automated email from the ASF dual-hosted git repository. adulceanu pushed a commit to branch issues/OAK-10311 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 4000431899e3afb83240d085377398a2bd2afd58 Author: dulceanu <[email protected]> AuthorDate: Fri Oct 13 11:31:00 2023 +0200 OAK-10311 - Optimize SegmentBlob#equals for segment blobs that originate from the same blob store --- .../java/org/apache/jackrabbit/oak/segment/SegmentBlob.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java index 3bc438bcbb..25d525236a 100644 --- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java +++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Set; import org.apache.jackrabbit.oak.api.Blob; +import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier; import org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob; import org.apache.jackrabbit.oak.plugins.blob.datastore.InMemoryDataRecord; import org.apache.jackrabbit.oak.plugins.memory.AbstractBlob; @@ -41,6 +42,10 @@ import org.jetbrains.annotations.Nullable; * A BLOB (stream of bytes). This is a record of type "VALUE". */ public class SegmentBlob extends Record implements Blob { + private static final boolean FAST_EQUALS_SAME_BLOBSTORE = SystemPropertySupplier + .create("oak.segment.blob.fastEquals.same.blobstore", false) + .formatSetMessage( (name, value) -> String.format("%s set to: %s", name, value) ) + .get(); @Nullable private final BlobStore blobStore; @@ -192,6 +197,14 @@ public class SegmentBlob extends Record implements Blob { } } + if (FAST_EQUALS_SAME_BLOBSTORE) { + if (blobStore != null && this.blobStore.equals(that.blobStore) && this.isExternal() && that.isExternal()) { + if (this.getContentIdentity() != null && that.getContentIdentity() != null) { + return this.getContentIdentity().equals(that.getContentIdentity()); + } + } + } + if (this.length() != that.length()) { return false; }
