Author: chetanm
Date: Wed Jun 29 06:40:26 2016
New Revision: 1750606

URL: http://svn.apache.org/viewvc?rev=1750606&view=rev
Log:
OAK-4180 - Use another NodeStore as a local cache for a remote Document store

Disable support for excluded paths as per current logic once a NodeState is 
loaded from secondary store it assumes that complete subtree for that path 
should be present in secondary store.

To support excluded path we would need to check on every child access in 
DelegatingDocumentNodeState that if child is part of secondary or primary. If 
part of primary then read call needs to be routed to primary. If required we 
can support that later

Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheService.java
    
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheServiceTest.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheService.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheService.java?rev=1750606&r1=1750605&r2=1750606&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheService.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheService.java
 Wed Jun 29 06:40:26 2016
@@ -19,6 +19,7 @@
 
 package org.apache.jackrabbit.oak.plugins.document.secondary;
 
+import java.util.Collections;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
@@ -100,14 +101,6 @@ public class SecondaryStoreCacheService
     )
     private static final String PROP_INCLUDES = "includedPaths";
 
-    @Property(unbounded = PropertyUnbounded.ARRAY,
-            label = "Excluded Paths",
-            description = "List of paths which are to be excluded in the 
secondary store",
-            value = {}
-    )
-    private static final String PROP_EXCLUDES = "excludedPaths";
-
-
     private static final boolean PROP_ASYNC_OBSERVER_DEFAULT = true;
     @Property(
             boolValue = PROP_ASYNC_OBSERVER_DEFAULT,
@@ -141,9 +134,11 @@ public class SecondaryStoreCacheService
         bundleContext = context;
         whiteboard = new OsgiWhiteboard(context);
         String[] includedPaths = toStringArray(config.get(PROP_INCLUDES), new 
String[]{"/"});
-        String[] excludedPaths = toStringArray(config.get(PROP_EXCLUDES), new 
String[]{""});
 
-        pathFilter = new PathFilter(asList(includedPaths), 
asList(excludedPaths));
+        //TODO Support for exclude is not possible as once a NodeState is 
loaded from secondary
+        //store it assumes that complete subtree is in same store. With 
exclude it would need to
+        //check for each child access and route to primary
+        pathFilter = new PathFilter(asList(includedPaths), 
Collections.<String>emptyList());
 
         SecondaryStoreBuilder builder = new 
SecondaryStoreBuilder(secondaryStoreProvider.getNodeStore())
                 .differ(differ)

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheServiceTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheServiceTest.java?rev=1750606&r1=1750605&r2=1750606&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheServiceTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheServiceTest.java
 Wed Jun 29 06:40:26 2016
@@ -100,11 +100,10 @@ public class SecondaryStoreCacheServiceT
     public void configurePathFilter() throws Exception{
         Map<String, Object> config = new HashMap<>();
         config.put("includedPaths", new String[] {"/a"});
-        config.put("excludedPaths", new String[] {"/a/b"});
         MockOsgi.activate(cacheService, context.bundleContext(), config);
 
         assertEquals(PathFilter.Result.INCLUDE, 
cacheService.getPathFilter().filter("/a"));
-        assertEquals(PathFilter.Result.EXCLUDE, 
cacheService.getPathFilter().filter("/a/b/c"));
+        assertEquals(PathFilter.Result.EXCLUDE, 
cacheService.getPathFilter().filter("/b"));
     }
 
 }
\ No newline at end of file


Reply via email to