Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/extensions] Modified local node response #4862

Merged
merged 9 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Modified EnvironmentSettingsRequest to pass entire Settings object ([#4731](https:/opensearch-project/OpenSearch/pull/4731))
- Added contentParser method to ExtensionRestRequest ([#4760](https:/opensearch-project/OpenSearch/pull/4760))
- Enforce type safety for RegisterTransportActionsRequest([#4796](https:/opensearch-project/OpenSearch/pull/4796))
- Modified local node request to return Discovery Node ([#4862](https:/opensearch-project/OpenSearch/pull/4862))

## [2.x]

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.opensearch.action.admin.cluster.state.ClusterStateResponse;
import org.opensearch.client.node.NodeClient;
import org.opensearch.cluster.ClusterSettingsResponse;
import org.opensearch.cluster.LocalNodeResponse;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.io.FileSystemUtils;
Expand Down Expand Up @@ -77,7 +76,6 @@ public class ExtensionsOrchestrator implements ReportingService<PluginsAndModule
public static final String INDICES_EXTENSION_POINT_ACTION_NAME = "indices:internal/extensions";
public static final String INDICES_EXTENSION_NAME_ACTION_NAME = "indices:internal/name";
public static final String REQUEST_EXTENSION_CLUSTER_STATE = "internal:discovery/clusterstate";
public static final String REQUEST_EXTENSION_LOCAL_NODE = "internal:discovery/localnode";
public static final String REQUEST_EXTENSION_CLUSTER_SETTINGS = "internal:discovery/clustersettings";
public static final String REQUEST_EXTENSION_ENVIRONMENT_SETTINGS = "internal:discovery/enviornmentsettings";
public static final String REQUEST_EXTENSION_ADD_SETTINGS_UPDATE_CONSUMER = "internal:discovery/addsettingsupdateconsumer";
Expand All @@ -102,7 +100,6 @@ public class ExtensionsOrchestrator implements ReportingService<PluginsAndModule
*/
public static enum RequestType {
REQUEST_EXTENSION_CLUSTER_STATE,
REQUEST_EXTENSION_LOCAL_NODE,
REQUEST_EXTENSION_CLUSTER_SETTINGS,
REQUEST_EXTENSION_ACTION_LISTENER_ON_FAILURE,
REQUEST_EXTENSION_REGISTER_REST_ACTIONS,
Expand Down Expand Up @@ -235,14 +232,6 @@ private void registerRequestHandler() {
ExtensionRequest::new,
((request, channel, task) -> channel.sendResponse(handleExtensionRequest(request)))
);
transportService.registerRequestHandler(
REQUEST_EXTENSION_LOCAL_NODE,
ThreadPool.Names.GENERIC,
false,
false,
ExtensionRequest::new,
((request, channel, task) -> channel.sendResponse(handleExtensionRequest(request)))
);
transportService.registerRequestHandler(
REQUEST_EXTENSION_CLUSTER_SETTINGS,
ThreadPool.Names.GENERIC,
Expand Down Expand Up @@ -430,8 +419,6 @@ TransportResponse handleExtensionRequest(ExtensionRequest extensionRequest) thro
switch (extensionRequest.getRequestType()) {
case REQUEST_EXTENSION_CLUSTER_STATE:
return new ClusterStateResponse(clusterService.getClusterName(), clusterService.state(), false);
case REQUEST_EXTENSION_LOCAL_NODE:
return new LocalNodeResponse(clusterService);
case REQUEST_EXTENSION_CLUSTER_SETTINGS:
return new ClusterSettingsResponse(clusterService);
case REQUEST_EXTENSION_ENVIRONMENT_SETTINGS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.opensearch.action.admin.cluster.state.ClusterStateResponse;
import org.opensearch.client.node.NodeClient;
import org.opensearch.cluster.ClusterSettingsResponse;
import org.opensearch.cluster.LocalNodeResponse;
import org.opensearch.env.EnvironmentSettingsResponse;
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
Expand Down Expand Up @@ -455,9 +454,6 @@ public void testHandleExtensionRequest() throws Exception {
);
assertEquals(ClusterSettingsResponse.class, extensionsOrchestrator.handleExtensionRequest(clusterSettingRequest).getClass());

ExtensionRequest localNodeRequest = new ExtensionRequest(ExtensionsOrchestrator.RequestType.REQUEST_EXTENSION_LOCAL_NODE);
assertEquals(LocalNodeResponse.class, extensionsOrchestrator.handleExtensionRequest(localNodeRequest).getClass());

ExtensionRequest environmentSettingsRequest = new ExtensionRequest(
ExtensionsOrchestrator.RequestType.REQUEST_EXTENSION_ENVIRONMENT_SETTINGS
);
Expand Down Expand Up @@ -672,7 +668,7 @@ public void testRegisterHandler() throws Exception {
settings,
client
);
verify(mockTransportService, times(10)).registerRequestHandler(anyString(), anyString(), anyBoolean(), anyBoolean(), any(), any());
verify(mockTransportService, times(9)).registerRequestHandler(anyString(), anyString(), anyBoolean(), anyBoolean(), any(), any());
}

private static class Example implements NamedWriteable {
Expand Down