From 953d5f73f0b99a63c05f7c9d58464c62711b0f72 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Thu, 8 Sep 2022 21:23:04 +0000 Subject: [PATCH 01/15] Added support for enviornment settings requests and unit tests Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 21 +++++++++ .../EnvironmentSettingsResponseHandler.java | 47 +++++++++++++++++++ .../opensearch/sdk/TestExtensionsRunner.java | 9 ++++ 3 files changed, 77 insertions(+) create mode 100644 src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index aaa563ca..8f5a2225 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -43,6 +43,7 @@ import org.opensearch.transport.SharedGroupFactory; import org.opensearch.sdk.handlers.ClusterSettingsResponseHandler; import org.opensearch.sdk.handlers.ClusterStateResponseHandler; +import org.opensearch.sdk.handlers.EnvironmentSettingsResponseHandler; import org.opensearch.sdk.handlers.LocalNodeResponseHandler; import org.opensearch.sdk.handlers.RegisterRestActionsResponseHandler; import org.opensearch.search.SearchModule; @@ -476,6 +477,26 @@ public void sendLocalNodeRequest(TransportService transportService) { } } + /** + * Requests the environment settings from OpenSearch. The result will be handled by a {@link EnvironmentSettingsResponseHandler}. + * + * @param transportService The TransportService defining the connection to OpenSearch. + */ + public void sendEnvironmentSettingsRequest(TransportService transportService) { + logger.info("Sending Environment Settings request to OpenSearch"); + EnvironmentSettingsResponseHandler environmentSettingsResponseHandler = new EnvironmentSettingsResponseHandler(); + try { + transportService.sendRequest( + opensearchNode, + ExtensionsOrchestrator.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS, + new ExtensionRequest(ExtensionsOrchestrator.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS), + environmentSettingsResponseHandler + ); + } catch (Exception e) { + logger.info("Failed to send Environment Settings request to OpenSearch", e); + } + } + private Settings getSettings() { return settings; } diff --git a/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java b/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java new file mode 100644 index 00000000..56aa0d72 --- /dev/null +++ b/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java @@ -0,0 +1,47 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ +package org.opensearch.sdk.handlers; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.opensearch.env.EnvironmentSettingsResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.sdk.ExtensionsRunner; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; + +import java.io.IOException; + +/** + * This class handles the response from OpenSearch to a {@link ExtensionsRunner#sendEnvironmentSettingsRequest(TransportService)} call. + */ +public class EnvironmentSettingsResponseHandler implements TransportResponseHandler { + private static final Logger logger = LogManager.getLogger(EnvironmentSettingsResponseHandler.class); + + @Override + public void handleResponse(EnvironmentSettingsResponse response) { + logger.info("received {}", response); + } + + @Override + public void handleException(TransportException exp) { + logger.info("EnvironmentSettingsRequest failed", exp); + } + + @Override + public String executor() { + return ThreadPool.Names.GENERIC; + } + + @Override + public EnvironmentSettingsResponse read(StreamInput in) throws IOException { + return new EnvironmentSettingsResponse(in); + } +} diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 30bd6c11..9c855b0f 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -47,6 +47,7 @@ import org.opensearch.rest.RestStatus; import org.opensearch.sdk.handlers.ClusterSettingsResponseHandler; import org.opensearch.sdk.handlers.ClusterStateResponseHandler; +import org.opensearch.sdk.handlers.EnvironmentSettingsResponseHandler; import org.opensearch.sdk.handlers.LocalNodeResponseHandler; import org.opensearch.sdk.handlers.RegisterRestActionsResponseHandler; import org.opensearch.test.OpenSearchTestCase; @@ -184,6 +185,14 @@ public void testLocalNodeRequest() { verify(transportService, times(1)).sendRequest(any(), anyString(), any(), any(LocalNodeResponseHandler.class)); } + @Test + public void testEnvironmentSettingsRequest() { + + extensionsRunner.sendEnvironmentSettingsRequest(transportService); + + verify(transportService, times(1)).sendRequest(any(), anyString(), any(), any(EnvironmentSettingsResponseHandler.class)); + } + @Test public void testRegisterRestActionsRequest() { From 0ce5b3831bc89d3d470723e9cbba3bcf666215a9 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Mon, 12 Sep 2022 19:09:55 +0000 Subject: [PATCH 02/15] updated environment settings support for create components Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 5 +++-- src/test/java/org/opensearch/sdk/TestExtensionsRunner.java | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 4d43a683..ccb1e414 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -29,6 +29,7 @@ import org.opensearch.extensions.ExtensionBooleanResponse; import org.opensearch.discovery.InitializeExtensionsRequest; import org.opensearch.discovery.InitializeExtensionsResponse; +import org.opensearch.extensions.EnvironmentSettingsRequest; import org.opensearch.extensions.ExtensionRequest; import org.opensearch.extensions.ExtensionsOrchestrator; import org.opensearch.index.IndicesModuleRequest; @@ -481,14 +482,14 @@ public void sendLocalNodeRequest(TransportService transportService) { * * @param transportService The TransportService defining the connection to OpenSearch. */ - public void sendEnvironmentSettingsRequest(TransportService transportService) { + public void sendEnvironmentSettingsRequest(TransportService transportService, List componentSettingKeys) { logger.info("Sending Environment Settings request to OpenSearch"); EnvironmentSettingsResponseHandler environmentSettingsResponseHandler = new EnvironmentSettingsResponseHandler(); try { transportService.sendRequest( opensearchNode, ExtensionsOrchestrator.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS, - new ExtensionRequest(ExtensionsOrchestrator.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS), + new EnvironmentSettingsRequest(componentSettingKeys), environmentSettingsResponseHandler ); } catch (Exception e) { diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 743b7301..bc67a19a 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -25,8 +25,10 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -188,7 +190,8 @@ public void testLocalNodeRequest() { @Test public void testEnvironmentSettingsRequest() { - extensionsRunner.sendEnvironmentSettingsRequest(transportService); + List componentSettingKeys = new ArrayList<>(); + extensionsRunner.sendEnvironmentSettingsRequest(transportService, componentSettingKeys); verify(transportService, times(1)).sendRequest(any(), anyString(), any(), any(EnvironmentSettingsResponseHandler.class)); } From 7f5e9455232a8798df114b2216bcda3ea06f457f Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Mon, 12 Sep 2022 20:48:17 +0000 Subject: [PATCH 03/15] Updating javadocs for environmentsetting request/ response handlers Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 3 ++- .../sdk/handlers/EnvironmentSettingsResponseHandler.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index ccb1e414..0acb68bd 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -478,8 +478,9 @@ public void sendLocalNodeRequest(TransportService transportService) { } /** - * Requests the environment settings from OpenSearch. The result will be handled by a {@link EnvironmentSettingsResponseHandler}. + * Requests the environment setting values from OpenSearch for the corresponding component setting keys . The result will be handled by a {@link EnvironmentSettingsResponseHandler}. * + * @param componentSettingKeys The component ssetting keys that correspond to the values provided by the environment settings * @param transportService The TransportService defining the connection to OpenSearch. */ public void sendEnvironmentSettingsRequest(TransportService transportService, List componentSettingKeys) { diff --git a/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java b/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java index 56aa0d72..a210f30f 100644 --- a/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java @@ -20,7 +20,7 @@ import java.io.IOException; /** - * This class handles the response from OpenSearch to a {@link ExtensionsRunner#sendEnvironmentSettingsRequest(TransportService)} call. + * This class handles the response from OpenSearch to a {@link ExtensionsRunner#sendEnvironmentSettingsRequest} call. */ public class EnvironmentSettingsResponseHandler implements TransportResponseHandler { private static final Logger logger = LogManager.getLogger(EnvironmentSettingsResponseHandler.class); From 71520fbd766ee59415f91127c9e5470bc6bd57d4 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Wed, 14 Sep 2022 23:14:11 +0000 Subject: [PATCH 04/15] Adding inital support for AddSettingsUpdateConsumer Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 84 ++++++++++++++++++- ...SettingsUpdateConsumerResponseHandler.java | 46 ++++++++++ .../EnvironmentSettingsResponseHandler.java | 1 - .../opensearch/sdk/TestExtensionsRunner.java | 13 ++- 4 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 0acb68bd..a6caa5eb 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -24,12 +24,16 @@ import org.opensearch.extensions.rest.RestExecuteOnExtensionResponse; import org.opensearch.common.network.NetworkModule; import org.opensearch.common.network.NetworkService; +import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; import org.opensearch.common.util.PageCacheRecycler; import org.opensearch.extensions.ExtensionBooleanResponse; import org.opensearch.discovery.InitializeExtensionsRequest; import org.opensearch.discovery.InitializeExtensionsResponse; +import org.opensearch.extensions.DiscoveryExtension; import org.opensearch.extensions.EnvironmentSettingsRequest; +import org.opensearch.extensions.AddSettingsUpdateConsumerRequest; +import org.opensearch.extensions.UpdateSettingsRequest; import org.opensearch.extensions.ExtensionRequest; import org.opensearch.extensions.ExtensionsOrchestrator; import org.opensearch.index.IndicesModuleRequest; @@ -42,6 +46,7 @@ import org.opensearch.rest.RestResponse; import org.opensearch.transport.netty4.Netty4Transport; import org.opensearch.transport.SharedGroupFactory; +import org.opensearch.sdk.handlers.AddSettingsUpdateConsumerResponseHandler; import org.opensearch.sdk.handlers.ClusterSettingsResponseHandler; import org.opensearch.sdk.handlers.ClusterStateResponseHandler; import org.opensearch.sdk.handlers.EnvironmentSettingsResponseHandler; @@ -61,9 +66,11 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.function.Consumer; import static java.util.Collections.emptySet; import static org.opensearch.common.UUIDs.randomBase64UUID; @@ -80,6 +87,7 @@ public class ExtensionsRunner { private String uniqueId; private DiscoveryNode opensearchNode; + private DiscoveryExtension extensionNode; private TransportService extensionTransportService = null; private ExtensionRestPathRegistry extensionRestPathRegistry = new ExtensionRestPathRegistry(); @@ -92,6 +100,7 @@ public class ExtensionsRunner { * https://github.com/opensearch-project/opensearch-sdk-java/issues/119 */ private TransportActions transportActions = new TransportActions(new HashMap<>()); + private Map settingUpdateConsumers = new HashMap<>(); /** * Instantiates a new Extensions Runner using test settings. @@ -154,6 +163,10 @@ private void setOpensearchNode(DiscoveryNode opensearchNode) { this.opensearchNode = opensearchNode; } + private void setExtensionNode(DiscoveryExtension extensionNode) { + this.extensionNode = extensionNode; + } + DiscoveryNode getOpensearchNode() { return opensearchNode; } @@ -174,6 +187,7 @@ InitializeExtensionsResponse handleExtensionInitRequest(InitializeExtensionsRequ } finally { // After sending successful response to initialization, send the REST API setOpensearchNode(opensearchNode); + setExtensionNode(extensionInitRequest.getExtension()); extensionTransportService.connectToNode(opensearchNode); sendRegisterRestActionsRequest(extensionTransportService); transportActions.sendRegisterTransportActionsRequest(extensionTransportService, opensearchNode); @@ -224,6 +238,31 @@ ExtensionBooleanResponse handleIndicesModuleNameRequest(IndicesModuleRequest ind return indicesModuleNameResponse; } + /** + * Handles a request to update a setting from OpenSearch. Extensions must register their setting keys and consumers within the settingUpdateConsumer map + * + * @param updateSettingsRequest The request to handle. + * @return A response acknowledging the request. + */ + ExtensionBooleanResponse handleUpdateSettingsRequest(UpdateSettingsRequest updateSettingsRequest) { + logger.info("Registering UpdateSettingsRequest received from OpenSearch"); + + boolean settingUpdateStatus = false; + String settingKey = updateSettingsRequest.getSettingKey(); + Object data = updateSettingsRequest.getData(); + + // Cross reference setting key with settings registered in settingUpdateConsumer map + if (settingUpdateConsumers.isEmpty() == false) { + + // Retrieve consumer and accept transported data to execute the consumer + Consumer consumer = this.settingUpdateConsumers.get(settingKey); + consumer.accept(data); + settingUpdateStatus = true; + } + + return new ExtensionBooleanResponse(settingUpdateStatus); + } + /** * Handles a request from OpenSearch to execute a REST request on the extension. * @@ -394,6 +433,15 @@ public void startTransportService(TransportService transportService) { ((request, channel, task) -> channel.sendResponse(handleRestExecuteOnExtensionRequest(request))) ); + transportService.registerRequestHandler( + ExtensionsOrchestrator.REQUEST_EXTENSION_UPDATE_SETTINGS, + ThreadPool.Names.GENERIC, + false, + false, + UpdateSettingsRequest::new, + ((request, channel, task) -> channel.sendResponse(handleUpdateSettingsRequest(request))) + ); + } /** @@ -478,7 +526,7 @@ public void sendLocalNodeRequest(TransportService transportService) { } /** - * Requests the environment setting values from OpenSearch for the corresponding component setting keys . The result will be handled by a {@link EnvironmentSettingsResponseHandler}. + * Requests the environment setting values from OpenSearch for the corresponding component setting keys. The result will be handled by a {@link EnvironmentSettingsResponseHandler}. * * @param componentSettingKeys The component ssetting keys that correspond to the values provided by the environment settings * @param transportService The TransportService defining the connection to OpenSearch. @@ -498,6 +546,40 @@ public void sendEnvironmentSettingsRequest(TransportService transportService, Li } } + /** + * Registers the setting key from {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. + * Extensions will use this method instead of invoking ClusterSettings#addSettingsUpdateConsumer + * + * @param settingKey + * @param consumer The TransportService defining the connection to OpenSearch. + */ + public void registerSettingUpdateConsumer(String settingKey, Consumer consumer) { + this.settingUpdateConsumers.put(settingKey, consumer); + } + + /** + * Requests the environment setting values from OpenSearch for the corresponding component setting keys. + * This should be called after extension components have registered all their setting update consumers with the settingUpdateConsumers map. + * The result will be handled by a {@link EnvironmentSettingsResponseHandler}. + * + * @param transportService The TransportService defining the connection to OpenSearch. + * @param componentSettingKeys The component setting keys that correspond to the values provided by the environment settings + */ + public void sendAddSettingsUpdateConsumerRequest(TransportService transportService, List componentSettings) { + logger.info("Sending Add Settings Update Consumer request to OpenSearch"); + AddSettingsUpdateConsumerResponseHandler addSettingsUpdateConsumerResponseHandler = new AddSettingsUpdateConsumerResponseHandler(); + try { + transportService.sendRequest( + opensearchNode, + ExtensionsOrchestrator.REQUEST_EXTENSION_ADD_SETTINGS_UPDATE_CONSUMER, + new AddSettingsUpdateConsumerRequest(this.extensionNode, componentSettings), + addSettingsUpdateConsumerResponseHandler + ); + } catch (Exception e) { + logger.info("Failed to send Add Settings Update Consumer request to OpenSearch", e); + } + } + private Settings getSettings() { return settings; } diff --git a/src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java b/src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java new file mode 100644 index 00000000..c7ad51cf --- /dev/null +++ b/src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java @@ -0,0 +1,46 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ +package org.opensearch.sdk.handlers; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.opensearch.extensions.ExtensionBooleanResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.sdk.ExtensionsRunner; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportResponseHandler; + +import java.io.IOException; + +/** + * This class handles the response from OpenSearch to a {@link ExtensionsRunner#sendAddSettingsUpdateConsumerRequest} call. + */ +public class AddSettingsUpdateConsumerResponseHandler implements TransportResponseHandler { + private static final Logger logger = LogManager.getLogger(AddSettingsUpdateConsumerResponseHandler.class); + + @Override + public void handleResponse(ExtensionBooleanResponse response) { + logger.info("received {}", response); + } + + @Override + public void handleException(TransportException exp) { + logger.info("AddSettingsUpdateConsumerResponse failed", exp); + } + + @Override + public String executor() { + return ThreadPool.Names.GENERIC; + } + + @Override + public ExtensionBooleanResponse read(StreamInput in) throws IOException { + return new ExtensionBooleanResponse(in); + } +} diff --git a/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java b/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java index a210f30f..3e72ac56 100644 --- a/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/EnvironmentSettingsResponseHandler.java @@ -15,7 +15,6 @@ import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.TransportException; import org.opensearch.transport.TransportResponseHandler; -import org.opensearch.transport.TransportService; import java.io.IOException; diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index bc67a19a..42134992 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -40,6 +40,7 @@ import org.opensearch.discovery.InitializeExtensionsRequest; import org.opensearch.discovery.InitializeExtensionsResponse; import org.opensearch.extensions.DiscoveryExtension; +import org.opensearch.extensions.ExtensionBooleanResponse; import org.opensearch.extensions.ExtensionsOrchestrator.OpenSearchRequestType; import org.opensearch.extensions.OpenSearchRequest; import org.opensearch.extensions.rest.RestExecuteOnExtensionRequest; @@ -47,6 +48,9 @@ import org.opensearch.rest.BytesRestResponse; import org.opensearch.rest.RestRequest.Method; import org.opensearch.rest.RestStatus; +import org.opensearch.common.settings.Setting; +import org.opensearch.extensions.UpdateSettingsRequest; +import org.opensearch.sdk.handlers.AddSettingsUpdateConsumerResponseHandler; import org.opensearch.sdk.handlers.ClusterSettingsResponseHandler; import org.opensearch.sdk.handlers.ClusterStateResponseHandler; import org.opensearch.sdk.handlers.EnvironmentSettingsResponseHandler; @@ -103,7 +107,7 @@ public void testTransportServiceAcceptedIncomingRequests() { public void testRegisterRequestHandler() { extensionsRunner.startTransportService(transportService); - verify(transportService, times(6)).registerRequestHandler(anyString(), anyString(), anyBoolean(), anyBoolean(), any(), any()); + verify(transportService, times(7)).registerRequestHandler(anyString(), anyString(), anyBoolean(), anyBoolean(), any(), any()); } @Test @@ -163,6 +167,13 @@ public void testHandleRestExecuteOnExtensionRequest() throws Exception { assertTrue(responseStr.contains("/foo")); } + @Test + public void testHandleUpdateSettingsRequest() throws Exception { + + UpdateSettingsRequest request = new UpdateSettingsRequest("", null); + assertEquals(ExtensionBooleanResponse.class, extensionsRunner.handleUpdateSettingsRequest(request).getClass()); + } + @Test public void testClusterStateRequest() { From 8fc89929f5baaba70adbd80f3353595d683fb840 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Thu, 15 Sep 2022 17:18:56 +0000 Subject: [PATCH 05/15] Updated implementation in preparation for getSettings support integration Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 31 ++++++++++--------- .../opensearch/sdk/TestExtensionsRunner.java | 12 ++++--- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index a6caa5eb..d1698e87 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -100,7 +100,7 @@ public class ExtensionsRunner { * https://github.com/opensearch-project/opensearch-sdk-java/issues/119 */ private TransportActions transportActions = new TransportActions(new HashMap<>()); - private Map settingUpdateConsumers = new HashMap<>(); + private Map, Consumer> settingUpdateConsumers = new HashMap<>(); /** * Instantiates a new Extensions Runner using test settings. @@ -248,14 +248,15 @@ ExtensionBooleanResponse handleUpdateSettingsRequest(UpdateSettingsRequest updat logger.info("Registering UpdateSettingsRequest received from OpenSearch"); boolean settingUpdateStatus = false; - String settingKey = updateSettingsRequest.getSettingKey(); + Setting componentSetting = updateSettingsRequest.getComponentSetting(); Object data = updateSettingsRequest.getData(); // Cross reference setting key with settings registered in settingUpdateConsumer map if (settingUpdateConsumers.isEmpty() == false) { + // TODO : After getSettings support is added, handle consumer parameterization // Retrieve consumer and accept transported data to execute the consumer - Consumer consumer = this.settingUpdateConsumers.get(settingKey); + Consumer consumer = this.settingUpdateConsumers.get(componentSetting); consumer.accept(data); settingUpdateStatus = true; } @@ -526,19 +527,19 @@ public void sendLocalNodeRequest(TransportService transportService) { } /** - * Requests the environment setting values from OpenSearch for the corresponding component setting keys. The result will be handled by a {@link EnvironmentSettingsResponseHandler}. + * Requests the environment setting values from OpenSearch for the corresponding component settings. The result will be handled by a {@link EnvironmentSettingsResponseHandler}. * - * @param componentSettingKeys The component ssetting keys that correspond to the values provided by the environment settings + * @param componentSettings The component setting that correspond to the values provided by the environment settings * @param transportService The TransportService defining the connection to OpenSearch. */ - public void sendEnvironmentSettingsRequest(TransportService transportService, List componentSettingKeys) { + public void sendEnvironmentSettingsRequest(TransportService transportService, List> componentSettings) { logger.info("Sending Environment Settings request to OpenSearch"); EnvironmentSettingsResponseHandler environmentSettingsResponseHandler = new EnvironmentSettingsResponseHandler(); try { transportService.sendRequest( opensearchNode, ExtensionsOrchestrator.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS, - new EnvironmentSettingsRequest(componentSettingKeys), + new EnvironmentSettingsRequest(componentSettings), environmentSettingsResponseHandler ); } catch (Exception e) { @@ -547,25 +548,25 @@ public void sendEnvironmentSettingsRequest(TransportService transportService, Li } /** - * Registers the setting key from {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. + * Registers the component {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. * Extensions will use this method instead of invoking ClusterSettings#addSettingsUpdateConsumer * - * @param settingKey - * @param consumer The TransportService defining the connection to OpenSearch. + * @param componentSetting The component setting associated with the consumer + * @param consumer The setting update consumer associated with the component setting */ - public void registerSettingUpdateConsumer(String settingKey, Consumer consumer) { - this.settingUpdateConsumers.put(settingKey, consumer); + public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { + this.settingUpdateConsumers.put(componentSetting, consumer); } /** - * Requests the environment setting values from OpenSearch for the corresponding component setting keys. + * Requests the environment setting values from OpenSearch for the corresponding component settings. * This should be called after extension components have registered all their setting update consumers with the settingUpdateConsumers map. * The result will be handled by a {@link EnvironmentSettingsResponseHandler}. * * @param transportService The TransportService defining the connection to OpenSearch. - * @param componentSettingKeys The component setting keys that correspond to the values provided by the environment settings + * @param componentSettings The component settings that correspond to the values provided by the environment settings */ - public void sendAddSettingsUpdateConsumerRequest(TransportService transportService, List componentSettings) { + public void sendAddSettingsUpdateConsumerRequest(TransportService transportService, List> componentSettings) { logger.info("Sending Add Settings Update Consumer request to OpenSearch"); AddSettingsUpdateConsumerResponseHandler addSettingsUpdateConsumerResponseHandler = new AddSettingsUpdateConsumerResponseHandler(); try { diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 42134992..8fae687b 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -36,6 +36,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.common.io.stream.NamedWriteableRegistryResponse; import org.opensearch.common.settings.Settings; +import org.opensearch.common.settings.Setting.Property; import org.opensearch.common.transport.TransportAddress; import org.opensearch.discovery.InitializeExtensionsRequest; import org.opensearch.discovery.InitializeExtensionsResponse; @@ -50,7 +51,6 @@ import org.opensearch.rest.RestStatus; import org.opensearch.common.settings.Setting; import org.opensearch.extensions.UpdateSettingsRequest; -import org.opensearch.sdk.handlers.AddSettingsUpdateConsumerResponseHandler; import org.opensearch.sdk.handlers.ClusterSettingsResponseHandler; import org.opensearch.sdk.handlers.ClusterStateResponseHandler; import org.opensearch.sdk.handlers.EnvironmentSettingsResponseHandler; @@ -169,8 +169,10 @@ public void testHandleRestExecuteOnExtensionRequest() throws Exception { @Test public void testHandleUpdateSettingsRequest() throws Exception { - - UpdateSettingsRequest request = new UpdateSettingsRequest("", null); + + Setting fallbackSetting = Setting.intSetting("component.fallback.setting.key", 0, 0, Property.Dynamic); + Setting componentSetting = Setting.intSetting("component.setting.key", fallbackSetting, Property.Dynamic); + UpdateSettingsRequest request = new UpdateSettingsRequest(componentSetting, null); assertEquals(ExtensionBooleanResponse.class, extensionsRunner.handleUpdateSettingsRequest(request).getClass()); } @@ -201,8 +203,8 @@ public void testLocalNodeRequest() { @Test public void testEnvironmentSettingsRequest() { - List componentSettingKeys = new ArrayList<>(); - extensionsRunner.sendEnvironmentSettingsRequest(transportService, componentSettingKeys); + List> componentSettings = new ArrayList<>(); + extensionsRunner.sendEnvironmentSettingsRequest(transportService, componentSettings); verify(transportService, times(1)).sendRequest(any(), anyString(), any(), any(EnvironmentSettingsResponseHandler.class)); } From 0eddec4f2eed7ee394fb144ddf250ac23f53f6d9 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 16 Sep 2022 20:26:31 +0000 Subject: [PATCH 06/15] Updated sendAddSettingsUpdateConsumerRequest to pull settings list directly from setting update consumer registry Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index d1698e87..27886249 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -63,6 +63,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -564,21 +565,34 @@ public void registerSettingUpdateConsumer(Setting componentSetting, Consu * The result will be handled by a {@link EnvironmentSettingsResponseHandler}. * * @param transportService The TransportService defining the connection to OpenSearch. - * @param componentSettings The component settings that correspond to the values provided by the environment settings + * @throws Exception if there are no setting update consumers registered within the settingUpdateConsumers map */ - public void sendAddSettingsUpdateConsumerRequest(TransportService transportService, List> componentSettings) { + public void sendAddSettingsUpdateConsumerRequest(TransportService transportService) throws Exception { logger.info("Sending Add Settings Update Consumer request to OpenSearch"); - AddSettingsUpdateConsumerResponseHandler addSettingsUpdateConsumerResponseHandler = new AddSettingsUpdateConsumerResponseHandler(); - try { - transportService.sendRequest( - opensearchNode, - ExtensionsOrchestrator.REQUEST_EXTENSION_ADD_SETTINGS_UPDATE_CONSUMER, - new AddSettingsUpdateConsumerRequest(this.extensionNode, componentSettings), - addSettingsUpdateConsumerResponseHandler - ); - } catch (Exception e) { - logger.info("Failed to send Add Settings Update Consumer request to OpenSearch", e); + + // Determine if setting update consumers have been registered + if (this.settingUpdateConsumers.isEmpty()) { + throw new Exception("There are no setting update consumers registered"); + } else { + + // Extract registered settings from setting update consumer map + List> componentSettings = new ArrayList<>(this.settingUpdateConsumers.size()); + componentSettings.addAll(this.settingUpdateConsumers.keySet()); + + AddSettingsUpdateConsumerResponseHandler addSettingsUpdateConsumerResponseHandler = + new AddSettingsUpdateConsumerResponseHandler(); + try { + transportService.sendRequest( + opensearchNode, + ExtensionsOrchestrator.REQUEST_EXTENSION_ADD_SETTINGS_UPDATE_CONSUMER, + new AddSettingsUpdateConsumerRequest(this.extensionNode, componentSettings), + addSettingsUpdateConsumerResponseHandler + ); + } catch (Exception e) { + logger.info("Failed to send Add Settings Update Consumer request to OpenSearch", e); + } } + } private Settings getSettings() { From 6700813a4dd20ffdb3b312821c840bec1dd6440e Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 16 Sep 2022 22:50:18 +0000 Subject: [PATCH 07/15] Integrated writeable settings support Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 55 ++++++++++++++++--- .../opensearch/sdk/TestExtensionsRunner.java | 7 ++- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 27886249..8899b512 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -60,6 +60,9 @@ import org.opensearch.transport.TransportService; import org.opensearch.transport.TransportSettings; import org.opensearch.transport.TransportResponse; +import org.opensearch.common.settings.WriteableSetting; +import org.opensearch.common.unit.ByteSizeValue; +import org.opensearch.common.unit.TimeValue; import java.io.File; import java.io.IOException; @@ -245,21 +248,55 @@ ExtensionBooleanResponse handleIndicesModuleNameRequest(IndicesModuleRequest ind * @param updateSettingsRequest The request to handle. * @return A response acknowledging the request. */ + @SuppressWarnings("unchecked") ExtensionBooleanResponse handleUpdateSettingsRequest(UpdateSettingsRequest updateSettingsRequest) { logger.info("Registering UpdateSettingsRequest received from OpenSearch"); - boolean settingUpdateStatus = false; + boolean settingUpdateStatus = true; + + WriteableSetting.WriteableSettingGenericType settingType = updateSettingsRequest.getSettingType(); Setting componentSetting = updateSettingsRequest.getComponentSetting(); Object data = updateSettingsRequest.getData(); - // Cross reference setting key with settings registered in settingUpdateConsumer map - if (settingUpdateConsumers.isEmpty() == false) { - - // TODO : After getSettings support is added, handle consumer parameterization - // Retrieve consumer and accept transported data to execute the consumer - Consumer consumer = this.settingUpdateConsumers.get(componentSetting); - consumer.accept(data); - settingUpdateStatus = true; + // Setting updater in OpenSearch performs setting change validation, only need to cast the consumer to the corresponding type and + // invoke the consumer + try { + switch (settingType) { + case Boolean: + Consumer boolConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + boolConsumer.accept(Boolean.parseBoolean(data.toString())); + case Integer: + Consumer intConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + intConsumer.accept(Integer.parseInt(data.toString())); + case Long: + Consumer longConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + longConsumer.accept(Long.parseLong(data.toString())); + case Float: + Consumer floatConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + floatConsumer.accept(Float.parseFloat(data.toString())); + case Double: + Consumer doubleConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + doubleConsumer.accept(Double.parseDouble(data.toString())); + case String: + Consumer stringConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + stringConsumer.accept(data.toString()); + case TimeValue: + Consumer timeValueConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + timeValueConsumer.accept(TimeValue.parseTimeValue(data.toString(), componentSetting.getKey())); + case ByteSizeValue: + Consumer byteSizeValueConsumer = (Consumer) this.settingUpdateConsumers.get( + componentSetting + ); + byteSizeValueConsumer.accept(ByteSizeValue.parseBytesSizeValue(data.toString(), componentSetting.getKey())); + case Version: + Consumer versionConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + versionConsumer.accept((Version) data); + default: + throw new UnsupportedOperationException("Setting Update Consumer type does not exist and is not handled here"); + } + } catch (Exception e) { + logger.info(e.getMessage()); + settingUpdateStatus = false; } return new ExtensionBooleanResponse(settingUpdateStatus); diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 8fae687b..16a5caee 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -59,6 +59,7 @@ import org.opensearch.test.OpenSearchTestCase; import org.opensearch.transport.Transport; import org.opensearch.transport.TransportService; +import org.opensearch.common.settings.WriteableSetting; public class TestExtensionsRunner extends OpenSearchTestCase { @@ -172,7 +173,11 @@ public void testHandleUpdateSettingsRequest() throws Exception { Setting fallbackSetting = Setting.intSetting("component.fallback.setting.key", 0, 0, Property.Dynamic); Setting componentSetting = Setting.intSetting("component.setting.key", fallbackSetting, Property.Dynamic); - UpdateSettingsRequest request = new UpdateSettingsRequest(componentSetting, null); + UpdateSettingsRequest request = new UpdateSettingsRequest( + WriteableSetting.WriteableSettingGenericType.Integer, + componentSetting, + null + ); assertEquals(ExtensionBooleanResponse.class, extensionsRunner.handleUpdateSettingsRequest(request).getClass()); } From b084c20456b544d0f1c8a88ff8192e5d4ce1658f Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Mon, 19 Sep 2022 20:57:25 +0000 Subject: [PATCH 08/15] Updating writeable settings integration for setting type Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 2 +- src/test/java/org/opensearch/sdk/TestExtensionsRunner.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 8899b512..1c1ba849 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -254,7 +254,7 @@ ExtensionBooleanResponse handleUpdateSettingsRequest(UpdateSettingsRequest updat boolean settingUpdateStatus = true; - WriteableSetting.WriteableSettingGenericType settingType = updateSettingsRequest.getSettingType(); + WriteableSetting.SettingType settingType = updateSettingsRequest.getSettingType(); Setting componentSetting = updateSettingsRequest.getComponentSetting(); Object data = updateSettingsRequest.getData(); diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 16a5caee..e3cfc5d3 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -173,11 +173,7 @@ public void testHandleUpdateSettingsRequest() throws Exception { Setting fallbackSetting = Setting.intSetting("component.fallback.setting.key", 0, 0, Property.Dynamic); Setting componentSetting = Setting.intSetting("component.setting.key", fallbackSetting, Property.Dynamic); - UpdateSettingsRequest request = new UpdateSettingsRequest( - WriteableSetting.WriteableSettingGenericType.Integer, - componentSetting, - null - ); + UpdateSettingsRequest request = new UpdateSettingsRequest(WriteableSetting.SettingType.Integer, componentSetting, null); assertEquals(ExtensionBooleanResponse.class, extensionsRunner.handleUpdateSettingsRequest(request).getClass()); } From 3f25da708a1df59f3f40bcf89aa68a9f71c6eabc Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 21:39:26 +0000 Subject: [PATCH 09/15] Replacing AddSettingsUpdateConsumerResponseHandler with ExtensionBooleanResponseHandler, moving handleUpdateSettings method to seperate class Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 79 ++----------- ...SettingsUpdateConsumerResponseHandler.java | 46 -------- .../UpdateSettingsRequestHandler.java | 108 ++++++++++++++++++ .../opensearch/sdk/TestExtensionsRunner.java | 5 +- 4 files changed, 122 insertions(+), 116 deletions(-) delete mode 100644 src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java create mode 100644 src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 7cf4dfab..6e694b97 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -48,11 +48,12 @@ import org.opensearch.transport.netty4.Netty4Transport; import org.opensearch.transport.SharedGroupFactory; import org.opensearch.sdk.handlers.ActionListenerOnFailureResponseHandler; -import org.opensearch.sdk.handlers.AddSettingsUpdateConsumerResponseHandler; import org.opensearch.sdk.handlers.ClusterSettingsResponseHandler; import org.opensearch.sdk.handlers.ClusterStateResponseHandler; import org.opensearch.sdk.handlers.EnvironmentSettingsResponseHandler; +import org.opensearch.sdk.handlers.ExtensionBooleanResponseHandler; import org.opensearch.sdk.handlers.LocalNodeResponseHandler; +import org.opensearch.sdk.handlers.UpdateSettingsRequestHandler; import org.opensearch.sdk.handlers.ExtensionStringResponseHandler; import org.opensearch.search.SearchModule; import org.opensearch.threadpool.ThreadPool; @@ -62,9 +63,6 @@ import org.opensearch.transport.TransportService; import org.opensearch.transport.TransportSettings; import org.opensearch.transport.TransportResponse; -import org.opensearch.common.settings.WriteableSetting; -import org.opensearch.common.unit.ByteSizeValue; -import org.opensearch.common.unit.TimeValue; import java.io.File; import java.io.IOException; @@ -110,6 +108,7 @@ public class ExtensionsRunner { */ private TransportActions transportActions = new TransportActions(new HashMap<>()); private Map, Consumer> settingUpdateConsumers = new HashMap<>(); + UpdateSettingsRequestHandler updateSettingsRequestHandler = new UpdateSettingsRequestHandler(); /** * Instantiates a new Extensions Runner using test settings. @@ -251,66 +250,6 @@ ExtensionBooleanResponse handleIndicesModuleNameRequest(IndicesModuleRequest ind return indicesModuleNameResponse; } - /** - * Handles a request to update a setting from OpenSearch. Extensions must register their setting keys and consumers within the settingUpdateConsumer map - * - * @param updateSettingsRequest The request to handle. - * @return A response acknowledging the request. - */ - @SuppressWarnings("unchecked") - ExtensionBooleanResponse handleUpdateSettingsRequest(UpdateSettingsRequest updateSettingsRequest) { - logger.info("Registering UpdateSettingsRequest received from OpenSearch"); - - boolean settingUpdateStatus = true; - - WriteableSetting.SettingType settingType = updateSettingsRequest.getSettingType(); - Setting componentSetting = updateSettingsRequest.getComponentSetting(); - Object data = updateSettingsRequest.getData(); - - // Setting updater in OpenSearch performs setting change validation, only need to cast the consumer to the corresponding type and - // invoke the consumer - try { - switch (settingType) { - case Boolean: - Consumer boolConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - boolConsumer.accept(Boolean.parseBoolean(data.toString())); - case Integer: - Consumer intConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - intConsumer.accept(Integer.parseInt(data.toString())); - case Long: - Consumer longConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - longConsumer.accept(Long.parseLong(data.toString())); - case Float: - Consumer floatConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - floatConsumer.accept(Float.parseFloat(data.toString())); - case Double: - Consumer doubleConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - doubleConsumer.accept(Double.parseDouble(data.toString())); - case String: - Consumer stringConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - stringConsumer.accept(data.toString()); - case TimeValue: - Consumer timeValueConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - timeValueConsumer.accept(TimeValue.parseTimeValue(data.toString(), componentSetting.getKey())); - case ByteSizeValue: - Consumer byteSizeValueConsumer = (Consumer) this.settingUpdateConsumers.get( - componentSetting - ); - byteSizeValueConsumer.accept(ByteSizeValue.parseBytesSizeValue(data.toString(), componentSetting.getKey())); - case Version: - Consumer versionConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); - versionConsumer.accept((Version) data); - default: - throw new UnsupportedOperationException("Setting Update Consumer type does not exist and is not handled here"); - } - } catch (Exception e) { - logger.info(e.getMessage()); - settingUpdateStatus = false; - } - - return new ExtensionBooleanResponse(settingUpdateStatus); - } - /** * Handles a request from OpenSearch to execute a REST request on the extension. * @@ -494,7 +433,7 @@ public void startTransportService(TransportService transportService) { false, false, UpdateSettingsRequest::new, - ((request, channel, task) -> channel.sendResponse(handleUpdateSettingsRequest(request))) + ((request, channel, task) -> channel.sendResponse(updateSettingsRequestHandler.handleUpdateSettingsRequest(request))) ); } @@ -646,14 +585,17 @@ public void sendEnvironmentSettingsRequest(TransportService transportService, Li } /** - * Registers the component {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. + * Registers the component {@link Setting} and the corresponding consumer. * Extensions will use this method instead of invoking ClusterSettings#addSettingsUpdateConsumer * * @param componentSetting The component setting associated with the consumer * @param consumer The setting update consumer associated with the component setting */ public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { + // register for setting consumer map for AddSettingUpdateConsumerRequests this.settingUpdateConsumers.put(componentSetting, consumer); + // register for setting consumer map for UpdateSettingsRequests + this.updateSettingsRequestHandler.registerSettingUpdateConsumer(componentSetting, consumer); } /** @@ -676,14 +618,13 @@ public void sendAddSettingsUpdateConsumerRequest(TransportService transportServi List> componentSettings = new ArrayList<>(this.settingUpdateConsumers.size()); componentSettings.addAll(this.settingUpdateConsumers.keySet()); - AddSettingsUpdateConsumerResponseHandler addSettingsUpdateConsumerResponseHandler = - new AddSettingsUpdateConsumerResponseHandler(); + ExtensionBooleanResponseHandler extensionBooleanResponseHandler = new ExtensionBooleanResponseHandler(); try { transportService.sendRequest( opensearchNode, ExtensionsOrchestrator.REQUEST_EXTENSION_ADD_SETTINGS_UPDATE_CONSUMER, new AddSettingsUpdateConsumerRequest(this.extensionNode, componentSettings), - addSettingsUpdateConsumerResponseHandler + extensionBooleanResponseHandler ); } catch (Exception e) { logger.info("Failed to send Add Settings Update Consumer request to OpenSearch", e); diff --git a/src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java b/src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java deleted file mode 100644 index c7ad51cf..00000000 --- a/src/main/java/org/opensearch/sdk/handlers/AddSettingsUpdateConsumerResponseHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ -package org.opensearch.sdk.handlers; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.opensearch.extensions.ExtensionBooleanResponse; -import org.opensearch.common.io.stream.StreamInput; -import org.opensearch.sdk.ExtensionsRunner; -import org.opensearch.threadpool.ThreadPool; -import org.opensearch.transport.TransportException; -import org.opensearch.transport.TransportResponseHandler; - -import java.io.IOException; - -/** - * This class handles the response from OpenSearch to a {@link ExtensionsRunner#sendAddSettingsUpdateConsumerRequest} call. - */ -public class AddSettingsUpdateConsumerResponseHandler implements TransportResponseHandler { - private static final Logger logger = LogManager.getLogger(AddSettingsUpdateConsumerResponseHandler.class); - - @Override - public void handleResponse(ExtensionBooleanResponse response) { - logger.info("received {}", response); - } - - @Override - public void handleException(TransportException exp) { - logger.info("AddSettingsUpdateConsumerResponse failed", exp); - } - - @Override - public String executor() { - return ThreadPool.Names.GENERIC; - } - - @Override - public ExtensionBooleanResponse read(StreamInput in) throws IOException { - return new ExtensionBooleanResponse(in); - } -} diff --git a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java new file mode 100644 index 00000000..9711c72c --- /dev/null +++ b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java @@ -0,0 +1,108 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ +package org.opensearch.sdk.handlers; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Consumer; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.opensearch.Version; +import org.opensearch.common.settings.Setting; +import org.opensearch.common.settings.WriteableSetting; +import org.opensearch.common.unit.ByteSizeValue; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.extensions.ExtensionBooleanResponse; +import org.opensearch.extensions.UpdateSettingsRequest; + +public class UpdateSettingsRequestHandler { + + private static final Logger logger = LogManager.getLogger(UpdateSettingsRequestHandler.class); + + private Map, Consumer> settingUpdateConsumers; + + /** + * Instantiates a new Update Setting Request Handler + */ + public UpdateSettingsRequestHandler() { + this.settingUpdateConsumers = new HashMap<>(); + } + + /** + * Registers the component {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. + * This map is used only when handling {@link UpdateSettingRequest} + * + * @param componentSetting The component setting associated with the consumer + * @param consumer The setting update consumer associated with the component setting + */ + public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { + this.settingUpdateConsumers.put(componentSetting, consumer); + } + + /** + * Handles a request to update a setting from OpenSearch. Extensions must register their setting keys and consumers within the settingUpdateConsumer map + * + * @param updateSettingsRequest The request to handle. + * @return A response acknowledging the request. + */ + @SuppressWarnings("unchecked") + public ExtensionBooleanResponse handleUpdateSettingsRequest(UpdateSettingsRequest updateSettingsRequest) { + + logger.info("Registering UpdateSettingsRequest received from OpenSearch"); + + boolean settingUpdateStatus = true; + + WriteableSetting.SettingType settingType = updateSettingsRequest.getSettingType(); + Setting componentSetting = updateSettingsRequest.getComponentSetting(); + Object data = updateSettingsRequest.getData(); + + // Setting updater in OpenSearch performs setting change validation, only need to cast the consumer to the corresponding type and + // invoke the consumer + try { + switch (settingType) { + case Boolean: + Consumer boolConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + boolConsumer.accept(Boolean.parseBoolean(data.toString())); + case Integer: + Consumer intConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + intConsumer.accept(Integer.parseInt(data.toString())); + case Long: + Consumer longConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + longConsumer.accept(Long.parseLong(data.toString())); + case Float: + Consumer floatConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + floatConsumer.accept(Float.parseFloat(data.toString())); + case Double: + Consumer doubleConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + doubleConsumer.accept(Double.parseDouble(data.toString())); + case String: + Consumer stringConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + stringConsumer.accept(data.toString()); + case TimeValue: + Consumer timeValueConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + timeValueConsumer.accept(TimeValue.parseTimeValue(data.toString(), componentSetting.getKey())); + case ByteSizeValue: + Consumer byteSizeValueConsumer = (Consumer) this.settingUpdateConsumers.get( + componentSetting + ); + byteSizeValueConsumer.accept(ByteSizeValue.parseBytesSizeValue(data.toString(), componentSetting.getKey())); + case Version: + Consumer versionConsumer = (Consumer) this.settingUpdateConsumers.get(componentSetting); + versionConsumer.accept((Version) data); + default: + throw new UnsupportedOperationException("Setting Update Consumer type does not exist and is not handled here"); + } + } catch (Exception e) { + logger.info(e.getMessage()); + settingUpdateStatus = false; + } + + return new ExtensionBooleanResponse(settingUpdateStatus); + } +} diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 71e0b54c..66e3a7ea 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -179,7 +179,10 @@ public void testHandleUpdateSettingsRequest() throws Exception { Setting fallbackSetting = Setting.intSetting("component.fallback.setting.key", 0, 0, Property.Dynamic); Setting componentSetting = Setting.intSetting("component.setting.key", fallbackSetting, Property.Dynamic); UpdateSettingsRequest request = new UpdateSettingsRequest(WriteableSetting.SettingType.Integer, componentSetting, null); - assertEquals(ExtensionBooleanResponse.class, extensionsRunner.handleUpdateSettingsRequest(request).getClass()); + assertEquals( + ExtensionBooleanResponse.class, + extensionsRunner.updateSettingsRequestHandler.handleUpdateSettingsRequest(request).getClass() + ); } @Test From 9c779f0edb7a1ae110beb9808ebab274895af26c Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 22:05:12 +0000 Subject: [PATCH 10/15] refactoring sendAddSettingsUpdateConsumerRequest. Now each component will only need to provide a map of setting and consumer, and upon sending the addsettingupdateconsumer request, this map will be registered within the updateSettingsRequestHandler Signed-off-by: Joshua Palis --- .../org/opensearch/sdk/ExtensionsRunner.java | 35 +++++++------------ .../UpdateSettingsRequestHandler.java | 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 6e694b97..77fc3062 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -107,7 +107,6 @@ public class ExtensionsRunner { * https://github.com/opensearch-project/opensearch-sdk-java/issues/119 */ private TransportActions transportActions = new TransportActions(new HashMap<>()); - private Map, Consumer> settingUpdateConsumers = new HashMap<>(); UpdateSettingsRequestHandler updateSettingsRequestHandler = new UpdateSettingsRequestHandler(); /** @@ -585,38 +584,30 @@ public void sendEnvironmentSettingsRequest(TransportService transportService, Li } /** - * Registers the component {@link Setting} and the corresponding consumer. - * Extensions will use this method instead of invoking ClusterSettings#addSettingsUpdateConsumer - * - * @param componentSetting The component setting associated with the consumer - * @param consumer The setting update consumer associated with the component setting - */ - public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { - // register for setting consumer map for AddSettingUpdateConsumerRequests - this.settingUpdateConsumers.put(componentSetting, consumer); - // register for setting consumer map for UpdateSettingsRequests - this.updateSettingsRequestHandler.registerSettingUpdateConsumer(componentSetting, consumer); - } - - /** - * Requests the environment setting values from OpenSearch for the corresponding component settings. - * This should be called after extension components have registered all their setting update consumers with the settingUpdateConsumers map. + * Registers settings and setting consumers with the {@link UpdateSettingsRequestHandler} Requests the environment setting values from OpenSearch for the corresponding component settings * The result will be handled by a {@link EnvironmentSettingsResponseHandler}. * * @param transportService The TransportService defining the connection to OpenSearch. + * @param settingUpdateConsumers A map of setting objects and their corresponding consumers * @throws Exception if there are no setting update consumers registered within the settingUpdateConsumers map */ - public void sendAddSettingsUpdateConsumerRequest(TransportService transportService) throws Exception { + public void sendAddSettingsUpdateConsumerRequest(TransportService transportService, Map, Consumer> settingUpdateConsumers) + throws Exception { logger.info("Sending Add Settings Update Consumer request to OpenSearch"); // Determine if setting update consumers have been registered - if (this.settingUpdateConsumers.isEmpty()) { - throw new Exception("There are no setting update consumers registered"); + if (settingUpdateConsumers.isEmpty()) { + throw new Exception("There are no setting update consumers to be registered"); } else { + // Register setting update consumers to UpdateSettingsRequestHandler + for (Map.Entry, Consumer> entry : settingUpdateConsumers.entrySet()) { + this.updateSettingsRequestHandler.registerSettingUpdateConsumer(entry.getKey(), entry.getValue()); + } + // Extract registered settings from setting update consumer map - List> componentSettings = new ArrayList<>(this.settingUpdateConsumers.size()); - componentSettings.addAll(this.settingUpdateConsumers.keySet()); + List> componentSettings = new ArrayList<>(settingUpdateConsumers.size()); + componentSettings.addAll(settingUpdateConsumers.keySet()); ExtensionBooleanResponseHandler extensionBooleanResponseHandler = new ExtensionBooleanResponseHandler(); try { diff --git a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java index 9711c72c..e29ad5df 100644 --- a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java @@ -41,7 +41,7 @@ public UpdateSettingsRequestHandler() { * @param componentSetting The component setting associated with the consumer * @param consumer The setting update consumer associated with the component setting */ - public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { + public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { this.settingUpdateConsumers.put(componentSetting, consumer); } From 4d94bd58452524e0707906e3715e5d7751369867 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 22:10:19 +0000 Subject: [PATCH 11/15] simplifying settingUpdateConsumer registration Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 4 +--- .../sdk/handlers/UpdateSettingsRequestHandler.java | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 77fc3062..9b05ecc9 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -601,9 +601,7 @@ public void sendAddSettingsUpdateConsumerRequest(TransportService transportServi } else { // Register setting update consumers to UpdateSettingsRequestHandler - for (Map.Entry, Consumer> entry : settingUpdateConsumers.entrySet()) { - this.updateSettingsRequestHandler.registerSettingUpdateConsumer(entry.getKey(), entry.getValue()); - } + this.updateSettingsRequestHandler.registerSettingUpdateConsumer(settingUpdateConsumers); // Extract registered settings from setting update consumer map List> componentSettings = new ArrayList<>(settingUpdateConsumers.size()); diff --git a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java index e29ad5df..27307d4c 100644 --- a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java @@ -38,11 +38,10 @@ public UpdateSettingsRequestHandler() { * Registers the component {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. * This map is used only when handling {@link UpdateSettingRequest} * - * @param componentSetting The component setting associated with the consumer - * @param consumer The setting update consumer associated with the component setting + * @param settingUpdateConsumers The settings and their corresponding update consumers to register */ - public void registerSettingUpdateConsumer(Setting componentSetting, Consumer consumer) { - this.settingUpdateConsumers.put(componentSetting, consumer); + public void registerSettingUpdateConsumer(Map, Consumer> settingUpdateConsumers) { + this.settingUpdateConsumers.putAll(settingUpdateConsumers); } /** From 9f46643fb5fb89d512ffdb059d0c4e2a4f34a01d Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 22:24:57 +0000 Subject: [PATCH 12/15] Fixing javadocs Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 9b05ecc9..d602f57a 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -584,18 +584,18 @@ public void sendEnvironmentSettingsRequest(TransportService transportService, Li } /** - * Registers settings and setting consumers with the {@link UpdateSettingsRequestHandler} Requests the environment setting values from OpenSearch for the corresponding component settings - * The result will be handled by a {@link EnvironmentSettingsResponseHandler}. + * Registers settings and setting consumers with the {@link UpdateSettingsRequestHandler} and then sends a request to OpenSearch to register these Setting objects with a callback to this extension. + * The result will be handled by a {@link ExtensionBooleanResponseHandler}. * * @param transportService The TransportService defining the connection to OpenSearch. * @param settingUpdateConsumers A map of setting objects and their corresponding consumers - * @throws Exception if there are no setting update consumers registered within the settingUpdateConsumers map + * @throws Exception if there are no setting update consumers within the settingUpdateConsumers map */ public void sendAddSettingsUpdateConsumerRequest(TransportService transportService, Map, Consumer> settingUpdateConsumers) throws Exception { logger.info("Sending Add Settings Update Consumer request to OpenSearch"); - // Determine if setting update consumers have been registered + // Determine if there are setting update consumers to be registered if (settingUpdateConsumers.isEmpty()) { throw new Exception("There are no setting update consumers to be registered"); } else { From e7624bc91f30f95bca3516370b172a4b8fc5a1fb Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 22:44:17 +0000 Subject: [PATCH 13/15] fixing javadocs Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 2 +- .../opensearch/sdk/handlers/UpdateSettingsRequestHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index d602f57a..4f3506fb 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -584,7 +584,7 @@ public void sendEnvironmentSettingsRequest(TransportService transportService, Li } /** - * Registers settings and setting consumers with the {@link UpdateSettingsRequestHandler} and then sends a request to OpenSearch to register these Setting objects with a callback to this extension. + * Registers settings and setting consumers with the {@link UpdateSettingsRequestHandler} and then sends a request to OpenSearch to register these Setting objects with a callback to this extension. * The result will be handled by a {@link ExtensionBooleanResponseHandler}. * * @param transportService The TransportService defining the connection to OpenSearch. diff --git a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java index 27307d4c..7ba4177a 100644 --- a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java @@ -36,7 +36,7 @@ public UpdateSettingsRequestHandler() { /** * Registers the component {@link Setting} and the corresponding consumer to the settingsUpdateConsumer map. - * This map is used only when handling {@link UpdateSettingRequest} + * This map is used only when handling {@link UpdateSettingsRequest} * * @param settingUpdateConsumers The settings and their corresponding update consumers to register */ From 3540be385ccaf548d246292025b7a0b1dfd0d334 Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 23:13:35 +0000 Subject: [PATCH 14/15] adding missing javadocs Signed-off-by: Joshua Palis --- src/main/java/org/opensearch/sdk/ExtensionsRunner.java | 3 +++ .../sdk/handlers/UpdateSettingsRequestHandler.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java index 4f3506fb..6a5c9cc8 100644 --- a/src/main/java/org/opensearch/sdk/ExtensionsRunner.java +++ b/src/main/java/org/opensearch/sdk/ExtensionsRunner.java @@ -107,6 +107,9 @@ public class ExtensionsRunner { * https://github.com/opensearch-project/opensearch-sdk-java/issues/119 */ private TransportActions transportActions = new TransportActions(new HashMap<>()); + /** + * Instantiates a new update settings request handler + */ UpdateSettingsRequestHandler updateSettingsRequestHandler = new UpdateSettingsRequestHandler(); /** diff --git a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java index 7ba4177a..d788f446 100644 --- a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java @@ -21,6 +21,11 @@ import org.opensearch.extensions.ExtensionBooleanResponse; import org.opensearch.extensions.UpdateSettingsRequest; +/** + * Handles requests to update settings + * + * @opensearch.internal + */ public class UpdateSettingsRequestHandler { private static final Logger logger = LogManager.getLogger(UpdateSettingsRequestHandler.class); From 4a0335ce6826f6d179dd7de9e36e1ce3226da06e Mon Sep 17 00:00:00 2001 From: Joshua Palis Date: Fri, 23 Sep 2022 23:32:06 +0000 Subject: [PATCH 15/15] fixing javadocs Signed-off-by: Joshua Palis --- .../opensearch/sdk/handlers/UpdateSettingsRequestHandler.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java index d788f446..0e8e32db 100644 --- a/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java +++ b/src/main/java/org/opensearch/sdk/handlers/UpdateSettingsRequestHandler.java @@ -23,8 +23,6 @@ /** * Handles requests to update settings - * - * @opensearch.internal */ public class UpdateSettingsRequestHandler {