Skip to content

Commit

Permalink
updated changelog and renamed localExecuteSupportedByAction
Browse files Browse the repository at this point in the history
Signed-off-by: Rajiv Kumar Vaidyanathan <[email protected]>
  • Loading branch information
rajiv-kv committed Mar 20, 2024
1 parent ef5def6 commit 4c1ff13
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Tiered caching] Add Stale keys Management and CacheCleaner to IndicesRequestCache ([#12625](https://github.com/opensearch-project/OpenSearch/pull/12625))
- [Tiered caching] Add serializer integration to allow ehcache disk cache to use non-primitive values ([#12709](https://github.com/opensearch-project/OpenSearch/pull/12709))
- [Admission Control] Integrated IO Based AdmissionController to AdmissionControl Framework ([#12583](https://github.com/opensearch-project/OpenSearch/pull/12583))
- Lightweight Transport action to verify local term before fetching cluster-state from remote ([#12252](https://github.com/opensearch-project/OpenSearch/pull/12252/))

### Dependencies
- Bump `peter-evans/find-comment` from 2 to 3 ([#12288](https://github.com/opensearch-project/OpenSearch/pull/12288))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private ClusterStateResponse buildResponse(final ClusterStateRequest request, fi
}

@Override
protected boolean canUseLocalNodeClusterState() {
protected boolean localExecuteSupportedByAction() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.io.IOException;

/**
* Request object to get cluster term
* Request object to get cluster term and version
*
* @opensearch.internal
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ protected void doStart(ClusterState clusterState) {
retryOnMasterChange(clusterState, null);
} else {
DiscoveryNode clusterManagerNode = nodes.getClusterManagerNode();
if (clusterManagerNode.getVersion().onOrAfter(V_3_0_0) && canUseLocalNodeClusterState()) {
if (clusterManagerNode.getVersion().onOrAfter(V_3_0_0) && localExecuteSupportedByAction()) {
BiConsumer<DiscoveryNode, ClusterState> executeOnLocalOrClusterManager = clusterStateLatestChecker(
this::executeOnLocalNode,
this::executeOnClusterManager
Expand Down Expand Up @@ -353,8 +353,8 @@ private ActionListener<Response> getDelegateForLocalExecute(ClusterState cluster
}

protected BiConsumer<DiscoveryNode, ClusterState> clusterStateLatestChecker(
Consumer<ClusterState> onLatestWithLocalState,
BiConsumer<DiscoveryNode, ClusterState> onMisMatchWithLocalState
Consumer<ClusterState> onLatestLocalState,
BiConsumer<DiscoveryNode, ClusterState> onStaleLocalState
) {
return (clusterManagerNode, clusterState) -> {
transportService.sendRequest(
Expand All @@ -371,9 +371,9 @@ public void handleResponse(GetTermVersionResponse response) {
isLatestClusterStatePresentOnLocalNode
);
if (isLatestClusterStatePresentOnLocalNode) {
onLatestWithLocalState.accept(clusterState);
onLatestLocalState.accept(clusterState);
} else {
onMisMatchWithLocalState.accept(clusterManagerNode, clusterState);
onStaleLocalState.accept(clusterManagerNode, clusterState);
}
}

Expand Down Expand Up @@ -462,13 +462,13 @@ protected String getMasterActionName(DiscoveryNode node) {
}

/**
* Override to true if the transport action need NOT be executed always on cluster-manager (example Read-only actions).
* Override to true if the transport action can be executed locally and need NOT be executed always on cluster-manager (Read actions).
* The action is executed locally if this method returns true AND
* the ClusterState on local node is in-sync with ClusterManager.
*
* @return - boolean if the action can be run locally
*/
protected boolean canUseLocalNodeClusterState() {
protected boolean localExecuteSupportedByAction() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected String executor() {
}

@Override
protected boolean canUseLocalNodeClusterState() {
protected boolean localExecuteSupportedByAction() {
return true;
}

Expand Down Expand Up @@ -276,7 +276,7 @@ public void testTermCheckNoMatchWithClusterManager() throws ExecutionException,

public void testTermCheckOnOldVersionClusterManager() throws ExecutionException, InterruptedException {

setUpCluster(Version.V_2_13_0);
setUpCluster(Version.V_2_12_0);
TransportClusterManagerTermCheckTests.Request request = new TransportClusterManagerTermCheckTests.Request();

PlainActionFuture<TransportClusterManagerTermCheckTests.Response> listener = new PlainActionFuture<>();
Expand Down

0 comments on commit 4c1ff13

Please sign in to comment.