From 1c81f29c13ce0491be1d29be97f6437dd7da7962 Mon Sep 17 00:00:00 2001 From: Martin Gaievski Date: Wed, 11 Jan 2023 15:44:00 -0800 Subject: [PATCH] Add vex extension to the list, add code comments Signed-off-by: Martin Gaievski --- src/main/java/org/opensearch/knn/index/util/Lucene.java | 2 +- src/main/java/org/opensearch/knn/plugin/KNNPlugin.java | 9 +++++++++ .../org/opensearch/knn/index/util/KNNEngineTests.java | 2 +- .../java/org/opensearch/knn/index/util/LuceneTests.java | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/opensearch/knn/index/util/Lucene.java b/src/main/java/org/opensearch/knn/index/util/Lucene.java index b6f3df118..bfa6cb040 100644 --- a/src/main/java/org/opensearch/knn/index/util/Lucene.java +++ b/src/main/java/org/opensearch/knn/index/util/Lucene.java @@ -77,6 +77,6 @@ public float score(float rawScore, SpaceType spaceType) { @Override public List mmapFileExtensions() { - return List.of("vec", "vem"); + return List.of("vec", "vex"); } } diff --git a/src/main/java/org/opensearch/knn/plugin/KNNPlugin.java b/src/main/java/org/opensearch/knn/plugin/KNNPlugin.java index f3c7c24ed..efa9065de 100644 --- a/src/main/java/org/opensearch/knn/plugin/KNNPlugin.java +++ b/src/main/java/org/opensearch/knn/plugin/KNNPlugin.java @@ -342,8 +342,17 @@ public Collection getSystemIndexDescriptors(Settings sett return ImmutableList.of(new SystemIndexDescriptor(MODEL_INDEX_NAME, "Index for storing models used for k-NN indices")); } + /** + * Plugin can provide additional node settings, that includes new settings or overrides for existing one from core. + * + * @return settings that are set by plugin + */ @Override public Settings additionalSettings() { + // We add engine specific extensions to the core list for HybridFS store type. We read existing values + // and append ours because in core setting will be replaced by override. + // Values are set as cluster defaults and are used at index creation time. Index specific overrides will take priority over values + // that are set here. final List engineSettings = Arrays.stream(KNNEngine.values()) .flatMap(engine -> engine.mmapFileExtensions().stream()) .collect(Collectors.toList()); diff --git a/src/test/java/org/opensearch/knn/index/util/KNNEngineTests.java b/src/test/java/org/opensearch/knn/index/util/KNNEngineTests.java index ecabbf44f..bed0b7908 100644 --- a/src/test/java/org/opensearch/knn/index/util/KNNEngineTests.java +++ b/src/test/java/org/opensearch/knn/index/util/KNNEngineTests.java @@ -57,7 +57,7 @@ public void testMmapFileExtensions() { .flatMap(engine -> engine.mmapFileExtensions().stream()) .collect(Collectors.toList()); assertNotNull(mmapExtensions); - final List expectedSettings = List.of("vem", "vec"); + final List expectedSettings = List.of("vex", "vec"); assertTrue(expectedSettings.containsAll(mmapExtensions)); assertTrue(mmapExtensions.containsAll(expectedSettings)); } diff --git a/src/test/java/org/opensearch/knn/index/util/LuceneTests.java b/src/test/java/org/opensearch/knn/index/util/LuceneTests.java index c36b3ab8f..f5c8e45b9 100644 --- a/src/test/java/org/opensearch/knn/index/util/LuceneTests.java +++ b/src/test/java/org/opensearch/knn/index/util/LuceneTests.java @@ -119,7 +119,7 @@ public void testVersion() { public void testMmapFileExtensions() { final List luceneMmapExtensions = Lucene.INSTANCE.mmapFileExtensions(); assertNotNull(luceneMmapExtensions); - final List expectedSettings = List.of("vem", "vec"); + final List expectedSettings = List.of("vex", "vec"); assertTrue(expectedSettings.containsAll(luceneMmapExtensions)); assertTrue(luceneMmapExtensions.containsAll(expectedSettings)); }