Hi,

Continuing to play with Robert's MultiplexingDocumentStore [1] I got a
failure in the oak-jcr module's LongPathTest.

That's due to the conversion of long paths to their hashed variants -
those cannot be used to locate the appropriate DocumentStore when
multiplexed, as that decision is based on the real path. In some cases
like UpdateOp the real path is saved alongside the hashed one, but not
always.

Removing the path hashing as shown in the below patch removes that
problem, and all oak-core tests pass with this change.

Is that hashing still needed, or was that created due to backend
limitations which are gone now?

If still needed, could it be made configurable so that users can make
their own tradeoff (MultiplexingDocumentStore vs. supporting backends
that require that), or are there other constraints?

-Bertrand

[1] https://github.com/bdelacretaz/jackrabbit-oak/tree/bertrand-multiplex



diff --git 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
index 4577c4b..d97ae76 100644
--- 
a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
+++ 
b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
@@ -254,6 +254,7 @@ public class Utils {
     }

     public static String getIdFromPath(String path) {
+        /*
         if (isLongPath(path)) {
             MessageDigest digest;
             try {
@@ -267,6 +268,7 @@ public class Utils {
             String name = PathUtils.getName(path);
             return depth + ":h" + Hex.encodeHexString(hash) + "/" + name;
         }
+        */
         int depth = Utils.pathDepth(path);
         return depth + ":" + path;
     }
diff --git 
a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java
b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java
index b9f619e..5ed1a95 100644
--- 
a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java
+++ 
b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java
@@ -32,6 +32,7 @@ import org.junit.Test;

 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;

@@ -62,7 +63,8 @@ public class UtilsTest {
         String longPath = PathUtils.concat("/"+Strings.repeat("p",
Utils.PATH_LONG + 1), "foo");
         assertTrue(Utils.isLongPath(longPath));

-        assertNull(Utils.getParentId(Utils.getIdFromPath(longPath)));
+        // updated to match the changes to Utils.getIdFromPath
+        assertNotNull(Utils.getParentId(Utils.getIdFromPath(longPath)));

         assertNull(Utils.getParentId(Utils.getIdFromPath("/")));
         assertEquals("1:/foo",Utils.getParentId("2:/foo/bar"));

Reply via email to