diff --git oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlob.java oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlob.java
index ad67d8d..f00bfe0 100644
--- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlob.java
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlob.java
@@ -48,6 +48,26 @@ public abstract class AbstractBlob implements Blob {
     }
 
     public static boolean equal(Blob a, Blob b) {
+        String ai = a.getContentIdentity();
+        String bi = b.getContentIdentity();
+
+        //Check for identity first. If they are same then its
+        //definitely same blob. If not we need to check further.
+        //For e.g. for SegmentBlob the id is recordId which might
+        //differ
+        if (ai != null && bi != null && ai.equals(bi)){
+            return true;
+        }
+
+        String ar = a.getReference();
+        String br = b.getReference();
+
+        //Check for reference as second option. If they
+        //are same then blobs are definitely same
+        if (ar != null && br != null && ar.equals(br)){
+            return true;
+        }
+
         // shortcut: first compare lengths if known in advance
         long al = a.length();
         long bl = b.length();
diff --git oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlobTest.java oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlobTest.java
new file mode 100644
index 0000000..f5abd68
--- /dev/null
+++ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/AbstractBlobTest.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.plugins.memory;
+
+import java.io.InputStream;
+import java.util.Random;
+
+import javax.annotation.Nonnull;
+
+import org.apache.jackrabbit.oak.api.Blob;
+import org.junit.Test;
+
+import static com.google.common.base.Preconditions.checkState;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class AbstractBlobTest {
+    private Random rnd = new Random();
+
+    @Test
+    public void blobComparisonBasedOnContentIdentity() throws Exception {
+        byte[] data = bytes(100);
+        Blob a = new TestBlob(data, "id1", null, false);
+        Blob b = new TestBlob(data, "id1", null, false);
+        assertTrue(AbstractBlob.equal(a, b));
+
+        Blob a2 = new TestBlob(data, "id1", null, true);
+        Blob b2 = new TestBlob(data, "id2", null, true);
+        assertTrue("Blobs with different id but same content should match", AbstractBlob.equal(a2, b2));
+    }
+
+    @Test
+    public void blobComparisonBasedOnReference() throws Exception {
+        byte[] data = bytes(100);
+        Blob a = new TestBlob(data, null, "ref1", false);
+        Blob b = new TestBlob(data, null, "ref1", false);
+        assertTrue(AbstractBlob.equal(a, b));
+
+        Blob a2 = new TestBlob(data, null, "ref1", true);
+        Blob b2 = new TestBlob(data, null, "ref2", true);
+        assertTrue("Blobs with different references but same content should match", AbstractBlob.equal(a2, b2));
+    }
+
+    @Test
+    public void blobComparisonBasedOnLength() throws Exception {
+        Blob a = new TestBlob(bytes(100), null, null, false);
+        Blob b = new TestBlob(bytes(50), null, null, false);
+        assertFalse("Blob comparison should not fallback on content if lengths not same", AbstractBlob.equal(a, b));
+    }
+
+    private byte[] bytes(int size) {
+        byte[] data = new byte[size];
+        rnd.nextBytes(data);
+        return data;
+    }
+
+    private static class TestBlob extends ArrayBasedBlob {
+        private final String id;
+        private final String ref;
+        private final boolean allowAccessToContent;
+
+        public TestBlob(byte[] value, String id, String ref, boolean allowAccessToContent) {
+            super(value);
+            this.id = id;
+            this.ref = ref;
+            this.allowAccessToContent = allowAccessToContent;
+        }
+
+        @Override
+        public String getReference() {
+            return ref;
+        }
+
+        @Override
+        public String getContentIdentity() {
+            return id;
+        }
+
+        @Nonnull
+        @Override
+        public InputStream getNewStream() {
+            checkState(allowAccessToContent, "Cannot access the stream");
+            return super.getNewStream();
+        }
+    }
+}
