From 8342cab1af41b8faf47b6966d47fba9dd490eeed Mon Sep 17 00:00:00 2001 From: Naveen Tatikonda Date: Mon, 29 Aug 2022 14:33:51 -0500 Subject: [PATCH] Replace terminology 'master' with 'cluster manager' Signed-off-by: Naveen Tatikonda --- .../java/org/opensearch/knn/index/KNNCircuitBreaker.java | 2 +- .../java/org/opensearch/knn/indices/ModelGraveyard.java | 2 +- .../transport/UpdateModelGraveyardTransportAction.java | 8 +++++--- .../transport/UpdateModelMetadataTransportAction.java | 8 +++++--- .../UpdateModelGraveyardTransportActionTests.java | 6 +++--- .../UpdateModelMetadataTransportActionTests.java | 4 ++-- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/opensearch/knn/index/KNNCircuitBreaker.java b/src/main/java/org/opensearch/knn/index/KNNCircuitBreaker.java index 5375beddd..4f361ae37 100644 --- a/src/main/java/org/opensearch/knn/index/KNNCircuitBreaker.java +++ b/src/main/java/org/opensearch/knn/index/KNNCircuitBreaker.java @@ -72,7 +72,7 @@ public void initialize(ThreadPool threadPool, ClusterService clusterService, Cli } // Leader node untriggers CB if all nodes have not reached their max capacity - if (KNNSettings.isCircuitBreakerTriggered() && clusterService.state().nodes().isLocalNodeElectedMaster()) { + if (KNNSettings.isCircuitBreakerTriggered() && clusterService.state().nodes().isLocalNodeElectedClusterManager()) { KNNStatsRequest knnStatsRequest = new KNNStatsRequest(KNNStatsConfig.KNN_STATS.keySet()); knnStatsRequest.addStat(StatNames.CACHE_CAPACITY_REACHED.getName()); knnStatsRequest.timeout(new TimeValue(1000 * 10)); // 10 second timeout diff --git a/src/main/java/org/opensearch/knn/indices/ModelGraveyard.java b/src/main/java/org/opensearch/knn/indices/ModelGraveyard.java index 78499c1f3..ff7232bdf 100644 --- a/src/main/java/org/opensearch/knn/indices/ModelGraveyard.java +++ b/src/main/java/org/opensearch/knn/indices/ModelGraveyard.java @@ -148,7 +148,7 @@ public static ModelGraveyard fromXContent(XContentParser xContentParser) throws /** * The ModelGraveyardDiff class compares the previous modelGraveyard object with the current updated modelGraveyard object - * and returns only the diff of those 2 objects. So that, whenever there is a change in cluster state, master node only + * and returns only the diff of those 2 objects. So that, whenever there is a change in cluster state, clusterManager node only * sends the diff to all the data nodes instead of the full cluster state */ public static class ModelGraveyardDiff implements NamedDiff { diff --git a/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportAction.java b/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportAction.java index 68708a5e0..a7b5dc876 100644 --- a/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportAction.java +++ b/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportAction.java @@ -10,7 +10,7 @@ import org.opensearch.action.ActionListener; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.master.AcknowledgedResponse; -import org.opensearch.action.support.master.TransportMasterNodeAction; +import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; import org.opensearch.cluster.ClusterState; import org.opensearch.cluster.ClusterStateTaskConfig; import org.opensearch.cluster.ClusterStateTaskExecutor; @@ -38,7 +38,9 @@ * Transport action used to update model graveyard on the cluster manager node. */ @Log4j2 -public class UpdateModelGraveyardTransportAction extends TransportMasterNodeAction { +public class UpdateModelGraveyardTransportAction extends TransportClusterManagerNodeAction< + UpdateModelGraveyardRequest, + AcknowledgedResponse> { private UpdateModelGraveyardExecutor updateModelGraveyardExecutor; @Inject @@ -72,7 +74,7 @@ protected AcknowledgedResponse read(StreamInput streamInput) throws IOException } @Override - protected void masterOperation( + protected void clusterManagerOperation( UpdateModelGraveyardRequest request, ClusterState clusterState, ActionListener actionListener diff --git a/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportAction.java b/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportAction.java index c3ef866fd..2cfe04123 100644 --- a/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportAction.java +++ b/src/main/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportAction.java @@ -16,7 +16,7 @@ import org.opensearch.action.ActionListener; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.master.AcknowledgedResponse; -import org.opensearch.action.support.master.TransportMasterNodeAction; +import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; import org.opensearch.cluster.ClusterState; import org.opensearch.cluster.ClusterStateTaskConfig; import org.opensearch.cluster.ClusterStateTaskExecutor; @@ -45,7 +45,9 @@ /** * Transport action used to update metadata of model's on the cluster manager node. */ -public class UpdateModelMetadataTransportAction extends TransportMasterNodeAction { +public class UpdateModelMetadataTransportAction extends TransportClusterManagerNodeAction< + UpdateModelMetadataRequest, + AcknowledgedResponse> { public static Logger logger = LogManager.getLogger(UpdateModelMetadataTransportAction.class); @@ -82,7 +84,7 @@ protected AcknowledgedResponse read(StreamInput streamInput) throws IOException } @Override - protected void masterOperation( + protected void clusterManagerOperation( UpdateModelMetadataRequest request, ClusterState clusterState, ActionListener actionListener diff --git a/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportActionTests.java b/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportActionTests.java index 6216f985d..29ef6fab4 100644 --- a/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportActionTests.java +++ b/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelGraveyardTransportActionTests.java @@ -51,7 +51,7 @@ public void testClusterManagerOperation() throws InterruptedException { final CountDownLatch inProgressLatch1 = new CountDownLatch(1); client().admin().cluster().prepareState().execute(ActionListener.wrap(stateResponse1 -> { ClusterState clusterState1 = stateResponse1.getState(); - updateModelGraveyardTransportAction.masterOperation( + updateModelGraveyardTransportAction.clusterManagerOperation( addModelGraveyardRequest, clusterState1, ActionListener.wrap(acknowledgedResponse -> { @@ -81,7 +81,7 @@ public void testClusterManagerOperation() throws InterruptedException { final CountDownLatch inProgressLatch2 = new CountDownLatch(1); client().admin().cluster().prepareState().execute(ActionListener.wrap(stateResponse1 -> { ClusterState clusterState1 = stateResponse1.getState(); - updateModelGraveyardTransportAction.masterOperation( + updateModelGraveyardTransportAction.clusterManagerOperation( addModelGraveyardRequest1, clusterState1, ActionListener.wrap(acknowledgedResponse -> { @@ -123,7 +123,7 @@ public void testClusterManagerOperation() throws InterruptedException { final CountDownLatch inProgressLatch3 = new CountDownLatch(1); client().admin().cluster().prepareState().execute(ActionListener.wrap(stateResponse1 -> { ClusterState clusterState1 = stateResponse1.getState(); - updateModelGraveyardTransportAction.masterOperation( + updateModelGraveyardTransportAction.clusterManagerOperation( removeModelGraveyardRequest, clusterState1, ActionListener.wrap(acknowledgedResponse -> { diff --git a/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportActionTests.java b/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportActionTests.java index a56c4d2bd..6fe9222c8 100644 --- a/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportActionTests.java +++ b/src/test/java/org/opensearch/knn/plugin/transport/UpdateModelMetadataTransportActionTests.java @@ -79,7 +79,7 @@ public void testClusterManagerOperation() throws InterruptedException { final CountDownLatch inProgressLatch1 = new CountDownLatch(1); client().admin().cluster().prepareState().execute(ActionListener.wrap(stateResponse1 -> { ClusterState clusterState1 = stateResponse1.getState(); - updateModelMetadataTransportAction.masterOperation( + updateModelMetadataTransportAction.clusterManagerOperation( updateModelMetadataRequest, clusterState1, ActionListener.wrap(acknowledgedResponse -> { @@ -114,7 +114,7 @@ public void testClusterManagerOperation() throws InterruptedException { final CountDownLatch inProgressLatch2 = new CountDownLatch(1); client().admin().cluster().prepareState().execute(ActionListener.wrap(stateResponse1 -> { ClusterState clusterState1 = stateResponse1.getState(); - updateModelMetadataTransportAction.masterOperation( + updateModelMetadataTransportAction.clusterManagerOperation( removeModelMetadataRequest, clusterState1, ActionListener.wrap(acknowledgedResponse -> {