nfsantos commented on code in PR #875:
URL: https://github.com/apache/jackrabbit-oak/pull/875#discussion_r1143181961


##########
oak-run/src/test/java/org/apache/jackrabbit/oak/indexversion/LucenePurgeOldIndexVersionTest.java:
##########
@@ -176,6 +176,67 @@ public void noDeleteIfNoActiveIndex() throws Exception {
         }
     }
 
+    // Test the scenario where the latest index is an OOB index but is 
disabled, and a lower versioned custom index is actually the only active index 
serving queries.
+    // Verify that the lower versioned index that is being used for queries 
should not get purged.
+    @Test
+    public void noDeleteIfLatestOOBIndexIsDisabled() throws Exception {
+        LogCustomizer custom = 
LogCustomizer.forLogger("org.apache.jackrabbit.oak.indexversion.IndexVersionOperation")
+                .enable(Level.INFO)
+                .create();
+        try {
+            custom.starting();
+            createTestData(false);
+            createCustomIndex(TEST_INDEX_PATH, 2, 1, false);
+            createCustomIndex(TEST_INDEX_PATH, 3, 0, false);
+            createCustomIndex(TEST_INDEX_PATH, 3, 1, false);
+            createCustomIndex(TEST_INDEX_PATH, 3, 2, false);
+            createCustomIndex(TEST_INDEX_PATH, 3, 3, false);
+            createCustomIndex(TEST_INDEX_PATH, 4, 0, false);
+
+            NodeStore store = fixture.getNodeStore();
+            NodeBuilder rootBuilder = store.getRoot().builder();
+            rootBuilder.getChildNode("oak:index")
+                    .getChildNode("fooIndex-4")
+                    .setProperty("type", "disabled");
+            rootBuilder.getChildNode("oak:index")
+                    .getChildNode("fooIndex-3-custom-3")
+                    .setProperty("type", "disabled")
+                    .setProperty(":originalType", "lucene");
+            store.merge(rootBuilder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+
+            addMockHiddenOakMount(fixture.getNodeStore(), 
Arrays.asList("fooIndex-3-custom-1", "fooIndex-3-custom-2"));

Review Comment:
   Since OAK now requires Java 11 as a baseline, we can now use the List.of() 
factory method which was introduced in Java 9.



-- 
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