Skip to content

Commit 1786549

Browse files
author
Harsh Kothari
committed
Build and merge fixes
Signed-off-by: Harsh Kothari <techarsh@amazon.com>
1 parent 57903a7 commit 1786549

File tree

1 file changed

+18
-0
lines changed
  • server/src/main/java/org/opensearch/node

1 file changed

+18
-0
lines changed

server/src/main/java/org/opensearch/node/Node.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
import org.opensearch.index.recovery.RemoteStoreRestoreService;
161161
import org.opensearch.index.remote.RemoteIndexPathUploader;
162162
import org.opensearch.index.remote.RemoteStoreStatsTrackerFactory;
163+
import org.opensearch.index.store.DefaultCompositeDirectoryFactory;
163164
import org.opensearch.index.store.IndexStoreListener;
164165
import org.opensearch.index.store.RemoteSegmentStoreDirectoryFactory;
165166
import org.opensearch.index.store.remote.filecache.FileCache;
@@ -895,6 +896,22 @@ protected Node(
895896
});
896897
directoryFactories.putAll(builtInDirectoryFactories);
897898

899+
final Map<String, IndexStorePlugin.CompositeDirectoryFactory> compositeDirectoryFactories = new HashMap<>();
900+
pluginsService.filterPlugins(IndexStorePlugin.class)
901+
.stream()
902+
.map(IndexStorePlugin::getCompositeDirectoryFactories)
903+
.flatMap(m -> m.entrySet().stream())
904+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))
905+
.forEach((k, v) -> {
906+
if (k.equals("default")) {
907+
throw new IllegalStateException(
908+
"registered composite index store type [" + k + "] conflicts with a built-in default type"
909+
);
910+
}
911+
compositeDirectoryFactories.put(k, v);
912+
});
913+
compositeDirectoryFactories.put("default", new DefaultCompositeDirectoryFactory());
914+
898915
final Map<String, IndexStorePlugin.RecoveryStateFactory> recoveryStateFactories = pluginsService.filterPlugins(
899916
IndexStorePlugin.class
900917
)
@@ -953,6 +970,7 @@ protected Node(
953970
metaStateService,
954971
engineFactoryProviders,
955972
Map.copyOf(directoryFactories),
973+
Map.copyOf(compositeDirectoryFactories),
956974
searchModule.getValuesSourceRegistry(),
957975
recoveryStateFactories,
958976
remoteDirectoryFactory,

0 commit comments

Comments
 (0)