From a80797714382faf353e1a14e785910a63076565f Mon Sep 17 00:00:00 2001 From: aggarwalShivani Date: Thu, 27 Jun 2024 13:33:18 +0530 Subject: [PATCH] Updating comments for unfollow action handler Signed-off-by: aggarwalShivani --- .../stop/TransportUnfollowIndexReplicationAction.kt | 8 +++++++- .../opensearch/replication/MultiClusterRestTestCase.kt | 2 -- .../org/opensearch/replication/integ/rest/SecurityBase.kt | 7 ------- .../replication/integ/rest/SecurityCustomRolesIT.kt | 2 -- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/org/opensearch/replication/action/stop/TransportUnfollowIndexReplicationAction.kt b/src/main/kotlin/org/opensearch/replication/action/stop/TransportUnfollowIndexReplicationAction.kt index 121be218..2ce2f4f5 100755 --- a/src/main/kotlin/org/opensearch/replication/action/stop/TransportUnfollowIndexReplicationAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stop/TransportUnfollowIndexReplicationAction.kt @@ -27,6 +27,12 @@ import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService +/** + * This action transforms the request from ActionRequest type to StopIndexReplicationRequest + * and performs the TransportStopIndexReplicationAction on it. + * While TransportStopIndexReplicationAction is used directly by the _stop replication REST API, + * this action is used for inter-plugin communication by ism plugin to unfollow i.e. stop replication. + */ class TransportUnfollowIndexReplicationAction @Inject constructor ( val name: String, val transportService: TransportService, @@ -50,7 +56,7 @@ class TransportUnfollowIndexReplicationAction @Inject constructor ( try { var response = client.suspendExecute(STOP_REPLICATION_ACTION_TYPE, transformedRequest, true) - log.info("Stop replication successful for index[${transformedRequest.indexName}], response: " + response.isAcknowledged) + log.info("Stop replication successful for index[${transformedRequest.indexName}] with response: " + response.isAcknowledged) listener?.onResponse(AcknowledgedResponse(true)) } catch (e: Exception) { log.error("Stop replication failed for index[${transformedRequest.indexName}] with error ${e.stackTraceToString()}") diff --git a/src/test/kotlin/org/opensearch/replication/MultiClusterRestTestCase.kt b/src/test/kotlin/org/opensearch/replication/MultiClusterRestTestCase.kt index 8024722a..57b54758 100644 --- a/src/test/kotlin/org/opensearch/replication/MultiClusterRestTestCase.kt +++ b/src/test/kotlin/org/opensearch/replication/MultiClusterRestTestCase.kt @@ -12,7 +12,6 @@ package org.opensearch.replication import org.opensearch.commons.replication.action.ReplicationActions.STOP_REPLICATION_ACTION_NAME -import org.opensearch.commons.replication.action.ReplicationActions.UNFOLLOW_REPLICATION_ACTION_NAME import org.opensearch.replication.MultiClusterAnnotations.ClusterConfiguration import org.opensearch.replication.MultiClusterAnnotations.ClusterConfigurations import org.opensearch.replication.MultiClusterAnnotations.getAnnotationsFromClass @@ -332,7 +331,6 @@ abstract class MultiClusterRestTestCase : OpenSearchTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityBase.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityBase.kt index a496c103..b370cc43 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityBase.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityBase.kt @@ -18,7 +18,6 @@ import org.apache.hc.core5.http.io.entity.StringEntity import org.opensearch.client.Request import org.junit.BeforeClass import org.opensearch.commons.replication.action.ReplicationActions.STOP_REPLICATION_ACTION_NAME -import org.opensearch.commons.replication.action.ReplicationActions.UNFOLLOW_REPLICATION_ACTION_NAME const val INTEG_TEST_PASSWORD = "ccr-integ-test@123" @@ -77,7 +76,6 @@ abstract class SecurityBase : MultiClusterRestTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] @@ -110,7 +108,6 @@ abstract class SecurityBase : MultiClusterRestTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] @@ -124,7 +121,6 @@ abstract class SecurityBase : MultiClusterRestTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] @@ -157,7 +153,6 @@ abstract class SecurityBase : MultiClusterRestTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] @@ -190,7 +185,6 @@ abstract class SecurityBase : MultiClusterRestTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] @@ -265,7 +259,6 @@ abstract class SecurityBase : MultiClusterRestTestCase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ] diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityCustomRolesIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityCustomRolesIT.kt index da616643..db9ce5a1 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityCustomRolesIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityCustomRolesIT.kt @@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit import org.opensearch.replication.task.autofollow.AutoFollowExecutor import org.opensearch.tasks.TaskInfo import org.junit.Before -import org.opensearch.commons.replication.action.ReplicationActions.UNFOLLOW_REPLICATION_ACTION_NAME import org.opensearch.commons.replication.action.ReplicationActions.STOP_REPLICATION_ACTION_NAME @MultiClusterAnnotations.ClusterConfigurations( @@ -416,7 +415,6 @@ class SecurityCustomRolesIT: SecurityBase() { "indices:admin/plugins/replication/index/pause", "indices:admin/plugins/replication/index/resume", "$STOP_REPLICATION_ACTION_NAME", - "$UNFOLLOW_REPLICATION_ACTION_NAME", "indices:admin/plugins/replication/index/update", "indices:admin/plugins/replication/index/status_check" ]