fabriziofortino commented on code in PR #1437:
URL: https://github.com/apache/jackrabbit-oak/pull/1437#discussion_r1589411607


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexerBase.java:
##########
@@ -247,6 +254,29 @@ public IndexStore buildStore(String initialCheckpoint, 
String finalCheckpoint) t
             predicate = 
predicate.and(indexerSupport.getFilterPredicateBasedOnCustomRegex(Pattern.compile(customExcludeEntriesRegex),
 Function.identity()));
         }
 
+        // Handle custom excluded paths if provided. This is only applicable 
if regex path filtering is enabled.
+        // Any paths whose ancestor is in the custom excluded paths list will 
be excluded from incremental index store.
+        // This is to keep in line with the custom  exclude paths 
implementation in the pipelined strategy.
+        boolean regexPathFiltering = ConfigHelper.getSystemPropertyAsBoolean(
+                OAK_INDEXER_PIPELINED_MONGO_REGEX_PATH_FILTERING,
+                DEFAULT_OAK_INDEXER_PIPELINED_MONGO_REGEX_PATH_FILTERING);
+        List<String> customExcludedPaths;
+        String excludePathsString = ConfigHelper.getSystemPropertyAsString(
+                OAK_INDEXER_PIPELINED_MONGO_CUSTOM_EXCLUDED_PATHS,
+                DEFAULT_OAK_INDEXER_PIPELINED_MONGO_CUSTOM_EXCLUDED_PATHS
+        ).trim();
+
+        if (regexPathFiltering && !excludePathsString.isEmpty()) {
+            customExcludedPaths = Arrays.stream(excludePathsString.split(","))
+                    .map(String::trim)
+                    .collect(Collectors.toList());
+
+            if (customExcludedPaths.size() > 0) {

Review Comment:
   you might want to use 
   ```suggestion
               if (!customExcludedPaths.isEmpty()) {
   ```
   to improve readability 



##########
oak-run/src/test/java/org/apache/jackrabbit/oak/index/IncrementalStoreTest.java:
##########
@@ -153,23 +156,48 @@ public void testWithGzipCompression() throws Exception {
         // LZ4 compression is used by default - so disable that, fallback is 
gzip
         System.setProperty(OAK_INDEXER_USE_LZ4, "false");
         algorithm = IndexStoreUtils.compressionAlgorithm();
-        incrementalFFSTest(false);
+        incrementalFFSTest(false, false);
         System.clearProperty(OAK_INDEXER_USE_LZ4);
     }
 
     @Test
     public void testWithLz4Compression() throws Exception {
         algorithm = IndexStoreUtils.compressionAlgorithm();
-        incrementalFFSTest(false);
+        incrementalFFSTest(false, false);
     }
 
     @Test
     public void testWithLz4CompressionWithCustomRegexFilter() throws Exception 
{
-        
System.setProperty("oak.indexer.pipelined.mongoCustomExcludeEntriesRegex",
+        
System.setProperty(OAK_INDEXER_PIPELINED_MONGO_CUSTOM_EXCLUDE_ENTRIES_REGEX,
                 
"(.*/jcr:content/renditions/foo\\.metadata\\.xml.*$)|(.*/jcr:content/renditions/foo\\.metadata\\..*$)|(.*/jcr:content/metadata/fooBar$)");
         algorithm = IndexStoreUtils.compressionAlgorithm();
-        incrementalFFSTest(true);
-        
System.clearProperty("oak.indexer.pipelined.mongoCustomExcludeEntriesRegex");
+        incrementalFFSTest(true, false);
+        
System.clearProperty(OAK_INDEXER_PIPELINED_MONGO_CUSTOM_EXCLUDE_ENTRIES_REGEX);
+    }
+
+    @Test
+    public void testWithLz4CompressionWithCustomExcludedPaths() throws 
Exception {
+        System.setProperty(OAK_INDEXER_PIPELINED_MONGO_REGEX_PATH_FILTERING,
+                "true");
+        System.setProperty(OAK_INDEXER_PIPELINED_MONGO_CUSTOM_EXCLUDED_PATHS, 
"/oak:index,/var/foo");
+        algorithm = IndexStoreUtils.compressionAlgorithm();
+        incrementalFFSTest(false, true);
+        System.clearProperty(OAK_INDEXER_PIPELINED_MONGO_REGEX_PATH_FILTERING);
+        
System.clearProperty(OAK_INDEXER_PIPELINED_MONGO_CUSTOM_EXCLUDED_PATHS);

Review Comment:
   +1



##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexerBase.java:
##########
@@ -247,6 +254,29 @@ public IndexStore buildStore(String initialCheckpoint, 
String finalCheckpoint) t
             predicate = 
predicate.and(indexerSupport.getFilterPredicateBasedOnCustomRegex(Pattern.compile(customExcludeEntriesRegex),
 Function.identity()));
         }
 
+        // Handle custom excluded paths if provided. This is only applicable 
if regex path filtering is enabled.
+        // Any paths whose ancestor is in the custom excluded paths list will 
be excluded from incremental index store.
+        // This is to keep in line with the custom  exclude paths 
implementation in the pipelined strategy.

Review Comment:
   nitpick
   ```suggestion
           // This is to keep in line with the custom exclude paths 
implementation in the pipelined strategy.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to