diff --git a/server/src/main/java/org/opensearch/index/engine/EngineConfigFactory.java b/server/src/main/java/org/opensearch/index/engine/EngineConfigFactory.java index 2c4d5d132028b..1eb70e21ea870 100644 --- a/server/src/main/java/org/opensearch/index/engine/EngineConfigFactory.java +++ b/server/src/main/java/org/opensearch/index/engine/EngineConfigFactory.java @@ -98,9 +98,9 @@ public EngineConfigFactory(PluginsService pluginsService, IndexSettings idxSetti } // get overriding CodecServiceFactory from EnginePlugin if (codecServiceFactory.isPresent() == false) { - codecServiceFactory = enginePlugin.getCustomCodecServiceFactory(); + codecServiceFactory = enginePlugin.getCustomCodecServiceFactory(idxSettings); codecServiceFactoryOverridingPlugin = enginePlugin.getClass().getName(); - } else if (enginePlugin.getCustomCodecServiceFactory().isPresent()) { + } else if (enginePlugin.getCustomCodecServiceFactory(idxSettings).isPresent()) { throw new IllegalStateException( "existing codec service factory already overridden in: " + codecServiceFactoryOverridingPlugin diff --git a/server/src/main/java/org/opensearch/plugins/EnginePlugin.java b/server/src/main/java/org/opensearch/plugins/EnginePlugin.java index c107ef35044f5..4c3a07d7b98d9 100644 --- a/server/src/main/java/org/opensearch/plugins/EnginePlugin.java +++ b/server/src/main/java/org/opensearch/plugins/EnginePlugin.java @@ -80,7 +80,7 @@ default Optional getCustomCodecService(IndexSettings indexSettings * the {@link CodecServiceFactory} through the plugin can ignore this method and the default Codec specified in the * {@link IndexSettings} will be used. */ - default Optional getCustomCodecServiceFactory() { + default Optional getCustomCodecServiceFactory(IndexSettings indexSettings) { return Optional.empty(); } diff --git a/server/src/test/java/org/opensearch/index/engine/EngineConfigFactoryTests.java b/server/src/test/java/org/opensearch/index/engine/EngineConfigFactoryTests.java index 73779f11a1650..1c0fca8df8e70 100644 --- a/server/src/test/java/org/opensearch/index/engine/EngineConfigFactoryTests.java +++ b/server/src/test/java/org/opensearch/index/engine/EngineConfigFactoryTests.java @@ -182,7 +182,7 @@ public Optional getEngineFactory(final IndexSettings indexSetting } @Override - public Optional getCustomCodecServiceFactory() { + public Optional getCustomCodecServiceFactory(IndexSettings indexSettings) { return Optional.of(config -> new CodecService(config.getMapperService(), LogManager.getLogger(getClass()))); } }