chibulcuteanu commented on code in PR #2173:
URL: https://github.com/apache/jackrabbit-oak/pull/2173#discussion_r2000500305
##########
oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexImporterTest.java:
##########
@@ -142,6 +144,50 @@ public void switchLanes() throws Exception{
assertEquals(AsyncLaneSwitcher.getTempLaneName("async"),
idxb.getString(ASYNC_PROPERTY_NAME));
}
+ @Test
+ public void switchLanesLuceneToElastic() throws Exception{
+ NodeBuilder builder = store.getRoot().builder();
+ builder.child("idx-a").setProperty("type", "elasticsearch");
+ builder.child("idx-a").setProperty("async", "elastic-async");
+
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+ createIndexDirs("/idx-a");
+
+ builder.child("idx-a").setProperty("type", "lucene");
+ builder.child("idx-a").setProperty("async", asList("async", "nrt"),
Type.STRINGS);
+
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+
+ IndexImporter importer = new IndexImporter(store,
temporaryFolder.getRoot(), provider, NOOP_LOCK);
+ importer.switchLanes();
+
+ NodeState idxa = NodeStateUtils.getNode(store.getRoot(), "/idx-a");
+ assertEquals(AsyncLaneSwitcher.getTempLaneName("elastic-async"),
idxa.getString(ASYNC_PROPERTY_NAME));
Review Comment:
the type is not changed during this switch lane operation, so the type
remains the same.
##########
oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/importer/IndexImporterTest.java:
##########
@@ -142,6 +144,50 @@ public void switchLanes() throws Exception{
assertEquals(AsyncLaneSwitcher.getTempLaneName("async"),
idxb.getString(ASYNC_PROPERTY_NAME));
}
+ @Test
+ public void switchLanesLuceneToElastic() throws Exception{
+ NodeBuilder builder = store.getRoot().builder();
+ builder.child("idx-a").setProperty("type", "elasticsearch");
+ builder.child("idx-a").setProperty("async", "elastic-async");
+
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+ createIndexDirs("/idx-a");
+
+ builder.child("idx-a").setProperty("type", "lucene");
+ builder.child("idx-a").setProperty("async", asList("async", "nrt"),
Type.STRINGS);
+
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+
+ IndexImporter importer = new IndexImporter(store,
temporaryFolder.getRoot(), provider, NOOP_LOCK);
+ importer.switchLanes();
+
+ NodeState idxa = NodeStateUtils.getNode(store.getRoot(), "/idx-a");
+ assertEquals(AsyncLaneSwitcher.getTempLaneName("elastic-async"),
idxa.getString(ASYNC_PROPERTY_NAME));
+ assertEquals(idxa.getStrings(ASYNC_PREVIOUS),
List.of("elastic-async"));
+ }
+
+ @Test
+ public void switchLanesElasticToLucene() throws Exception{
+ NodeBuilder builder = store.getRoot().builder();
+ builder.child("idx-a").setProperty("type", "lucene");
+ builder.child("idx-a").setProperty("async", List.of("async"),
Type.STRINGS);
+
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+ createIndexDirs("/idx-a");
+
+ builder.child("idx-a").setProperty("type", "elasticsearch");
+ builder.child("idx-a").setProperty("async", List.of("elastic-async"),
Type.STRINGS);
+
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+
+ IndexImporter importer = new IndexImporter(store,
temporaryFolder.getRoot(), provider, NOOP_LOCK);
+ importer.switchLanes();
+
+ NodeState idxa = NodeStateUtils.getNode(store.getRoot(), "/idx-a");
+ assertEquals(AsyncLaneSwitcher.getTempLaneName("async"),
idxa.getString(ASYNC_PROPERTY_NAME));
+ assertEquals(idxa.getStrings(ASYNC_PREVIOUS), List.of("async"));
Review Comment:
the type is not changed during this switch lane operation, so the type
remains the same.
--
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]