diff --git a/build.gradle b/build.gradle index ccbfaf1e..ead3cae9 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ import org.opensearch.gradle.test.RestIntegTestTask buildscript { ext { isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.8.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.10.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") // e.g. 2.0.0-rc1-SNAPSHOT -> 2.0.0.0-rc1-SNAPSHOT version_tokens = opensearch_version.tokenize('-') @@ -54,7 +54,7 @@ buildscript { plugin_previous_version = opensearch_previous_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2') common_utils_version = System.getProperty("common_utils.version", opensearch_build) - kotlin_version = System.getProperty("kotlin.version", "1.6.0") + kotlin_version = System.getProperty("kotlin.version", "1.8.21") // For fetching security zip from Maven. // https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.1.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-security-2.1.0.0.zip @@ -141,13 +141,13 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}" implementation "org.jetbrains:annotations:13.0" implementation "com.github.seancfoley:ipaddress:5.3.3" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlin_version}" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0" // Moving away from kotlin_version implementation "org.opensearch:common-utils:${common_utils_version}" testImplementation "org.opensearch.test:framework:${opensearch_version}" testImplementation "org.assertj:assertj-core:3.17.2" testImplementation "org.opensearch.client:opensearch-rest-high-level-client:${opensearch_version}" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${kotlin_version}" + testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0" // Moving away from kotlin_version testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}" testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" } diff --git a/src/main/kotlin/org/opensearch/replication/ReplicationException.kt b/src/main/kotlin/org/opensearch/replication/ReplicationException.kt index 891be0a3..83e59220 100644 --- a/src/main/kotlin/org/opensearch/replication/ReplicationException.kt +++ b/src/main/kotlin/org/opensearch/replication/ReplicationException.kt @@ -13,10 +13,10 @@ package org.opensearch.replication import org.opensearch.OpenSearchException import org.opensearch.OpenSearchStatusException -import org.opensearch.action.ShardOperationFailedException +import org.opensearch.core.action.ShardOperationFailedException import org.opensearch.cluster.metadata.IndexMetadata.INDEX_UUID_NA_VALUE -import org.opensearch.index.shard.ShardId -import org.opensearch.rest.RestStatus +import org.opensearch.core.index.shard.ShardId +import org.opensearch.core.rest.RestStatus /** * Base class replication exceptions. Note: Replication process may throw exceptions that do not derive from this such as diff --git a/src/main/kotlin/org/opensearch/replication/ReplicationPlugin.kt b/src/main/kotlin/org/opensearch/replication/ReplicationPlugin.kt index 4254412c..7d66c976 100644 --- a/src/main/kotlin/org/opensearch/replication/ReplicationPlugin.kt +++ b/src/main/kotlin/org/opensearch/replication/ReplicationPlugin.kt @@ -84,8 +84,8 @@ import org.opensearch.cluster.service.ClusterService import org.opensearch.common.CheckedFunction import org.opensearch.core.ParseField import org.opensearch.common.component.LifecycleComponent -import org.opensearch.common.io.stream.NamedWriteableRegistry -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.NamedWriteableRegistry +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.common.settings.ClusterSettings import org.opensearch.common.settings.IndexScopedSettings import org.opensearch.common.settings.Setting diff --git a/src/main/kotlin/org/opensearch/replication/action/autofollow/AutoFollowClusterManagerNodeRequest.kt b/src/main/kotlin/org/opensearch/replication/action/autofollow/AutoFollowClusterManagerNodeRequest.kt index f9199ea0..216809d8 100644 --- a/src/main/kotlin/org/opensearch/replication/action/autofollow/AutoFollowClusterManagerNodeRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/autofollow/AutoFollowClusterManagerNodeRequest.kt @@ -14,8 +14,8 @@ package org.opensearch.replication.action.autofollow import org.opensearch.commons.authuser.User import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.master.MasterNodeRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/action/autofollow/TransportAutoFollowClusterManagerNodeAction.kt b/src/main/kotlin/org/opensearch/replication/action/autofollow/TransportAutoFollowClusterManagerNodeAction.kt index e3c59444..cc93d88a 100644 --- a/src/main/kotlin/org/opensearch/replication/action/autofollow/TransportAutoFollowClusterManagerNodeAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/autofollow/TransportAutoFollowClusterManagerNodeAction.kt @@ -39,7 +39,7 @@ import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.common.settings.IndexScopedSettings import org.opensearch.replication.ReplicationException import org.opensearch.threadpool.ThreadPool diff --git a/src/main/kotlin/org/opensearch/replication/action/autofollow/UpdateAutoFollowPatternRequest.kt b/src/main/kotlin/org/opensearch/replication/action/autofollow/UpdateAutoFollowPatternRequest.kt index a7077793..165ede8b 100644 --- a/src/main/kotlin/org/opensearch/replication/action/autofollow/UpdateAutoFollowPatternRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/autofollow/UpdateAutoFollowPatternRequest.kt @@ -17,8 +17,8 @@ import org.opensearch.replication.util.ValidationUtil.validateName import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.master.AcknowledgedRequest import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.common.settings.Settings import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent diff --git a/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesRequest.kt b/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesRequest.kt index d3aeb8e7..43e1fa33 100644 --- a/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesRequest.kt @@ -14,9 +14,9 @@ package org.opensearch.replication.action.changes import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.single.shard.SingleShardRequest import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.index.shard.ShardId import org.opensearch.transport.RemoteClusterAwareRequest class GetChangesRequest : SingleShardRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesResponse.kt b/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesResponse.kt index f3adaf2e..c71b4795 100644 --- a/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/changes/GetChangesResponse.kt @@ -12,8 +12,8 @@ package org.opensearch.replication.action.changes import org.opensearch.action.ActionResponse -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.index.translog.Translog class GetChangesResponse(val changes: List, diff --git a/src/main/kotlin/org/opensearch/replication/action/changes/TransportGetChangesAction.kt b/src/main/kotlin/org/opensearch/replication/action/changes/TransportGetChangesAction.kt index c483ebad..a3995999 100644 --- a/src/main/kotlin/org/opensearch/replication/action/changes/TransportGetChangesAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/changes/TransportGetChangesAction.kt @@ -23,10 +23,10 @@ import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.routing.ShardsIterator import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.common.unit.TimeValue -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.translog.Translog import org.opensearch.indices.IndicesService import org.opensearch.replication.ReplicationPlugin.Companion.REPLICATION_INDEX_TRANSLOG_PRUNING_ENABLED_SETTING diff --git a/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexClusterManagerNodeRequest.kt b/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexClusterManagerNodeRequest.kt index 63f77023..0b741d4e 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexClusterManagerNodeRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexClusterManagerNodeRequest.kt @@ -14,8 +14,8 @@ package org.opensearch.replication.action.index import org.opensearch.commons.authuser.User import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.master.MasterNodeRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexRequest.kt b/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexRequest.kt index bb0f9aaf..6024798a 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexRequest.kt @@ -18,8 +18,8 @@ import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.common.settings.Settings import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent diff --git a/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexResponse.kt b/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexResponse.kt index 6ab3cc75..31963036 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/ReplicateIndexResponse.kt @@ -12,8 +12,8 @@ package org.opensearch.replication.action.index import org.opensearch.action.support.master.AcknowledgedResponse -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput class ReplicateIndexResponse(val ack: Boolean) : AcknowledgedResponse(ack) { constructor(inp: StreamInput) : this(inp.readBoolean()) diff --git a/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexClusterManagerNodeAction.kt b/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexClusterManagerNodeAction.kt index 1a926798..36fe81f2 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexClusterManagerNodeAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/TransportReplicateIndexClusterManagerNodeAction.kt @@ -40,14 +40,14 @@ import org.opensearch.cluster.metadata.IndexMetadata import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.common.settings.IndexScopedSettings import org.opensearch.index.IndexNotFoundException import org.opensearch.persistent.PersistentTasksService import org.opensearch.replication.ReplicationPlugin import org.opensearch.replication.util.stackTraceToString import org.opensearch.repositories.RepositoriesService -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/action/index/block/TransportUpddateIndexBlockAction.kt b/src/main/kotlin/org/opensearch/replication/action/index/block/TransportUpddateIndexBlockAction.kt index 189e7acc..55e569aa 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/block/TransportUpddateIndexBlockAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/block/TransportUpddateIndexBlockAction.kt @@ -31,7 +31,7 @@ import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/action/index/block/UpdateIndexBlockRequest.kt b/src/main/kotlin/org/opensearch/replication/action/index/block/UpdateIndexBlockRequest.kt index d9b51933..4c766468 100644 --- a/src/main/kotlin/org/opensearch/replication/action/index/block/UpdateIndexBlockRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/index/block/UpdateIndexBlockRequest.kt @@ -16,8 +16,8 @@ import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject diff --git a/src/main/kotlin/org/opensearch/replication/action/pause/PauseIndexReplicationRequest.kt b/src/main/kotlin/org/opensearch/replication/action/pause/PauseIndexReplicationRequest.kt index e69dcb44..fce15d2e 100644 --- a/src/main/kotlin/org/opensearch/replication/action/pause/PauseIndexReplicationRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/pause/PauseIndexReplicationRequest.kt @@ -17,8 +17,8 @@ import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject diff --git a/src/main/kotlin/org/opensearch/replication/action/pause/TransportPauseIndexReplicationAction.kt b/src/main/kotlin/org/opensearch/replication/action/pause/TransportPauseIndexReplicationAction.kt index abd54403..eaf828a1 100644 --- a/src/main/kotlin/org/opensearch/replication/action/pause/TransportPauseIndexReplicationAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/pause/TransportPauseIndexReplicationAction.kt @@ -37,7 +37,7 @@ import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesRequest.kt b/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesRequest.kt index 7ac35526..a7366b1a 100644 --- a/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesRequest.kt @@ -12,9 +12,9 @@ package org.opensearch.replication.action.replay import org.opensearch.action.support.replication.ReplicatedWriteRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.translog.Translog class ReplayChangesRequest : ReplicatedWriteRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesResponse.kt b/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesResponse.kt index b0bab6fb..5fe155f4 100644 --- a/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/replay/ReplayChangesResponse.kt @@ -13,7 +13,7 @@ package org.opensearch.replication.action.replay import org.opensearch.action.support.WriteResponse import org.opensearch.action.support.replication.ReplicationResponse -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput class ReplayChangesResponse : ReplicationResponse, WriteResponse { diff --git a/src/main/kotlin/org/opensearch/replication/action/replay/TransportReplayChangesAction.kt b/src/main/kotlin/org/opensearch/replication/action/replay/TransportReplayChangesAction.kt index 9b3a78b6..c874e92f 100644 --- a/src/main/kotlin/org/opensearch/replication/action/replay/TransportReplayChangesAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/replay/TransportReplayChangesAction.kt @@ -39,10 +39,10 @@ import org.opensearch.cluster.action.index.MappingUpdatedAction import org.opensearch.cluster.action.shard.ShardStateAction import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.bytes.BytesReference +import org.opensearch.core.common.bytes.BytesReference import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.common.settings.Settings import org.opensearch.common.xcontent.XContentType import org.opensearch.index.IndexingPressureService diff --git a/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/TransportUpdateReplicationStateDetails.kt b/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/TransportUpdateReplicationStateDetails.kt index ada0aefa..0b744482 100644 --- a/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/TransportUpdateReplicationStateDetails.kt +++ b/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/TransportUpdateReplicationStateDetails.kt @@ -30,7 +30,7 @@ import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService diff --git a/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/UpdateReplicationStateDetailsRequest.kt b/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/UpdateReplicationStateDetailsRequest.kt index 04fedd0a..1b139495 100644 --- a/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/UpdateReplicationStateDetailsRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/replicationstatedetails/UpdateReplicationStateDetailsRequest.kt @@ -14,8 +14,8 @@ package org.opensearch.replication.action.replicationstatedetails import org.opensearch.replication.metadata.state.ReplicationStateParams import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.master.AcknowledgedRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput class UpdateReplicationStateDetailsRequest: AcknowledgedRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkRequest.kt b/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkRequest.kt index 8f9213b1..d959866e 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkRequest.kt @@ -13,9 +13,9 @@ package org.opensearch.replication.action.repository import org.opensearch.action.ActionRequestValidationException import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.store.StoreFileMetadata class GetFileChunkRequest : RemoteClusterRepositoryRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkResponse.kt b/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkResponse.kt index 5e292138..325e20f0 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/GetFileChunkResponse.kt @@ -12,9 +12,9 @@ package org.opensearch.replication.action.repository import org.opensearch.action.ActionResponse -import org.opensearch.common.bytes.BytesReference -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.bytes.BytesReference +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.index.store.StoreFileMetadata class GetFileChunkResponse : ActionResponse { diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataRequest.kt b/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataRequest.kt index f8940730..d26e37e1 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataRequest.kt @@ -13,8 +13,8 @@ package org.opensearch.replication.action.repository import org.opensearch.action.ActionRequestValidationException import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.index.shard.ShardId class GetStoreMetadataRequest : RemoteClusterRepositoryRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataResponse.kt b/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataResponse.kt index baeb62b5..9ef97259 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/GetStoreMetadataResponse.kt @@ -12,8 +12,8 @@ package org.opensearch.replication.action.repository import org.opensearch.action.ActionResponse -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.index.store.Store class GetStoreMetadataResponse : ActionResponse { diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/ReleaseLeaderResourcesRequest.kt b/src/main/kotlin/org/opensearch/replication/action/repository/ReleaseLeaderResourcesRequest.kt index 2ea55a01..97908e9f 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/ReleaseLeaderResourcesRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/ReleaseLeaderResourcesRequest.kt @@ -13,8 +13,8 @@ package org.opensearch.replication.action.repository import org.opensearch.action.ActionRequestValidationException import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.index.shard.ShardId class ReleaseLeaderResourcesRequest: RemoteClusterRepositoryRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/RemoteClusterRepositoryRequest.kt b/src/main/kotlin/org/opensearch/replication/action/repository/RemoteClusterRepositoryRequest.kt index 8a600a4e..8dd702d9 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/RemoteClusterRepositoryRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/RemoteClusterRepositoryRequest.kt @@ -13,9 +13,9 @@ package org.opensearch.replication.action.repository import org.opensearch.action.support.single.shard.SingleShardRequest import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.index.shard.ShardId import org.opensearch.transport.RemoteClusterAwareRequest abstract class RemoteClusterRepositoryRequest?>: diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetFileChunkAction.kt b/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetFileChunkAction.kt index 2564a0e3..9b8b13e1 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetFileChunkAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetFileChunkAction.kt @@ -20,11 +20,11 @@ import org.opensearch.cluster.ClusterState import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.routing.ShardsIterator import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.bytes.BytesArray +import org.opensearch.core.common.bytes.BytesArray import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.Writeable +import org.opensearch.core.index.shard.ShardId import org.opensearch.indices.IndicesService import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportActionProxy diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetStoreMetadataAction.kt b/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetStoreMetadataAction.kt index e3c677d8..44ce8570 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetStoreMetadataAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/TransportGetStoreMetadataAction.kt @@ -20,9 +20,9 @@ import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.routing.ShardsIterator import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.Writeable +import org.opensearch.core.index.shard.ShardId import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportActionProxy import org.opensearch.transport.TransportService diff --git a/src/main/kotlin/org/opensearch/replication/action/repository/TransportReleaseLeaderResourcesAction.kt b/src/main/kotlin/org/opensearch/replication/action/repository/TransportReleaseLeaderResourcesAction.kt index 9818ebcc..62a615b3 100644 --- a/src/main/kotlin/org/opensearch/replication/action/repository/TransportReleaseLeaderResourcesAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/repository/TransportReleaseLeaderResourcesAction.kt @@ -21,9 +21,9 @@ import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.routing.ShardsIterator import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.Writeable +import org.opensearch.core.index.shard.ShardId import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportActionProxy import org.opensearch.transport.TransportService diff --git a/src/main/kotlin/org/opensearch/replication/action/resume/ResumeIndexReplicationRequest.kt b/src/main/kotlin/org/opensearch/replication/action/resume/ResumeIndexReplicationRequest.kt index dd219272..10220a7f 100644 --- a/src/main/kotlin/org/opensearch/replication/action/resume/ResumeIndexReplicationRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/resume/ResumeIndexReplicationRequest.kt @@ -15,8 +15,8 @@ import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.* class ResumeIndexReplicationRequest : AcknowledgedRequest, IndicesRequest.Replaceable, ToXContentObject { diff --git a/src/main/kotlin/org/opensearch/replication/action/resume/TransportResumeIndexReplicationAction.kt b/src/main/kotlin/org/opensearch/replication/action/resume/TransportResumeIndexReplicationAction.kt index 9ca85549..a1128913 100644 --- a/src/main/kotlin/org/opensearch/replication/action/resume/TransportResumeIndexReplicationAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/resume/TransportResumeIndexReplicationAction.kt @@ -50,10 +50,10 @@ import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.env.Environment import org.opensearch.index.IndexNotFoundException -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService import java.io.IOException @@ -130,9 +130,9 @@ class TransportResumeIndexReplicationAction @Inject constructor(transportService private suspend fun isResumable(params :IndexReplicationParams): Boolean { var isResumable = true val remoteClient = client.getRemoteClusterClient(params.leaderAlias) - val shards = clusterService.state().routingTable.indicesRouting().get(params.followerIndexName).shards() + val shards = clusterService.state().routingTable.indicesRouting().get(params.followerIndexName)?.shards() val retentionLeaseHelper = RemoteClusterRetentionLeaseHelper(clusterService.clusterName.value(), clusterService.state().metadata.clusterUUID(), remoteClient) - shards.forEach { + shards?.forEach { val followerShardId = it.value.shardId if (!retentionLeaseHelper.verifyRetentionLeaseExist(ShardId(params.leaderIndex, followerShardId.id), followerShardId)) { @@ -146,7 +146,7 @@ class TransportResumeIndexReplicationAction @Inject constructor(transportService // clean up all retention leases we may have accidentally took while doing verifyRetentionLeaseExist . // Idempotent Op which does no harm - shards.forEach { + shards?.forEach { val followerShardId = it.value.shardId log.debug("Removing lease for $followerShardId.id ") retentionLeaseHelper.attemptRetentionLeaseRemoval(ShardId(params.leaderIndex, followerShardId.id), followerShardId) diff --git a/src/main/kotlin/org/opensearch/replication/action/setup/SetupChecksRequest.kt b/src/main/kotlin/org/opensearch/replication/action/setup/SetupChecksRequest.kt index 57b9fffb..44e53460 100644 --- a/src/main/kotlin/org/opensearch/replication/action/setup/SetupChecksRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/setup/SetupChecksRequest.kt @@ -14,8 +14,8 @@ package org.opensearch.replication.action.setup import org.opensearch.replication.metadata.store.ReplicationContext import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.master.AcknowledgedRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/action/setup/TransportSetupChecksAction.kt b/src/main/kotlin/org/opensearch/replication/action/setup/TransportSetupChecksAction.kt index 82315e37..0b1169b6 100644 --- a/src/main/kotlin/org/opensearch/replication/action/setup/TransportSetupChecksAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/setup/TransportSetupChecksAction.kt @@ -26,7 +26,7 @@ import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject import org.opensearch.common.util.concurrent.ThreadContext import org.opensearch.replication.util.stackTraceToString -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.tasks.Task import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.ActionNotFoundTransportException diff --git a/src/main/kotlin/org/opensearch/replication/action/setup/ValidatePermissionsRequest.kt b/src/main/kotlin/org/opensearch/replication/action/setup/ValidatePermissionsRequest.kt index 430fe9b8..7808fd85 100644 --- a/src/main/kotlin/org/opensearch/replication/action/setup/ValidatePermissionsRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/setup/ValidatePermissionsRequest.kt @@ -15,8 +15,8 @@ import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsAction.kt b/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsAction.kt index 0878d377..3c7b60fe 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsAction.kt @@ -15,9 +15,9 @@ import org.opensearch.action.ActionType import org.opensearch.action.FailedNodeException import org.opensearch.action.TaskOperationFailure import org.opensearch.action.support.tasks.BaseTasksResponse -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContent.EMPTY_PARAMS import org.opensearch.core.xcontent.ToXContentObject diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsRequest.kt b/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsRequest.kt index 93102cf5..7bce9a0d 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/AutoFollowStatsRequest.kt @@ -13,8 +13,8 @@ package org.opensearch.replication.action.stats import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.tasks.BaseTasksRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.replication.task.autofollow.AutoFollowTask import org.opensearch.tasks.Task import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerNodeStatsResponse.kt b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerNodeStatsResponse.kt index cdff07ab..a20ae942 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerNodeStatsResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerNodeStatsResponse.kt @@ -13,9 +13,9 @@ package org.opensearch.replication.action.stats import org.opensearch.action.support.nodes.BaseNodeResponse import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.index.shard.ShardId import org.opensearch.replication.task.shard.FollowerShardMetric import org.opensearch.replication.task.shard.FollowerShardMetric.FollowerStats import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsAction.kt b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsAction.kt index 8ecafb98..9d07bea1 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsAction.kt @@ -12,7 +12,7 @@ package org.opensearch.replication.action.stats import org.opensearch.action.ActionType -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.Writeable class FollowerStatsAction : ActionType(NAME, reader) { companion object { diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsRequest.kt b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsRequest.kt index e79e4d2e..9dfdf8f5 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsRequest.kt @@ -12,8 +12,8 @@ package org.opensearch.replication.action.stats import org.opensearch.action.support.nodes.BaseNodesRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import java.io.IOException /** diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsResponse.kt b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsResponse.kt index 53271fe4..9d4ae15c 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/FollowerStatsResponse.kt @@ -17,14 +17,14 @@ import org.opensearch.action.FailedNodeException import org.opensearch.action.support.nodes.BaseNodesResponse import org.opensearch.cluster.ClusterName import org.opensearch.common.Strings -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent.EMPTY_PARAMS import org.opensearch.core.xcontent.ToXContent.Params import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.replication.metadata.ReplicationOverallState import org.opensearch.replication.metadata.state.REPLICATION_LAST_KNOWN_OVERALL_STATE import org.opensearch.replication.metadata.state.ReplicationStateMetadata diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderNodeStatsResponse.kt b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderNodeStatsResponse.kt index a326772b..cdc4b4d8 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderNodeStatsResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderNodeStatsResponse.kt @@ -13,9 +13,9 @@ package org.opensearch.replication.action.stats import org.opensearch.action.support.nodes.BaseNodeResponse import org.opensearch.cluster.node.DiscoveryNode -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.index.shard.ShardId import org.opensearch.replication.seqno.RemoteShardMetric import org.opensearch.replication.seqno.RemoteShardMetric.RemoteStats import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsAction.kt b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsAction.kt index be7b3cd4..83c100d7 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsAction.kt @@ -12,7 +12,7 @@ package org.opensearch.replication.action.stats import org.opensearch.action.ActionType -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.Writeable class LeaderStatsAction : ActionType(NAME, reader) { companion object { diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsRequest.kt b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsRequest.kt index 5523a859..53ed027b 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsRequest.kt @@ -12,8 +12,8 @@ package org.opensearch.replication.action.stats import org.opensearch.action.support.nodes.BaseNodesRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import java.io.IOException /** diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsResponse.kt b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsResponse.kt index 47333152..29abc78c 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/LeaderStatsResponse.kt @@ -17,8 +17,8 @@ import org.opensearch.action.FailedNodeException import org.opensearch.action.support.nodes.BaseNodesResponse import org.opensearch.cluster.ClusterName import org.opensearch.common.Strings -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent.EMPTY_PARAMS import org.opensearch.core.xcontent.ToXContent.Params import org.opensearch.core.xcontent.ToXContentObject diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/NodeStatsRequest.kt b/src/main/kotlin/org/opensearch/replication/action/stats/NodeStatsRequest.kt index 19e180da..6e71b8e6 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/NodeStatsRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/NodeStatsRequest.kt @@ -12,8 +12,8 @@ package org.opensearch.replication.action.stats import org.opensearch.action.support.nodes.BaseNodeRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import java.io.IOException class NodeStatsRequest : BaseNodeRequest { diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/TransportFollowerStatsAction.kt b/src/main/kotlin/org/opensearch/replication/action/stats/TransportFollowerStatsAction.kt index e33d9a0c..7a258ef1 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/TransportFollowerStatsAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/TransportFollowerStatsAction.kt @@ -20,7 +20,7 @@ import org.opensearch.action.support.nodes.TransportNodesAction import org.opensearch.client.node.NodeClient import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.replication.metadata.state.ReplicationStateMetadata import org.opensearch.replication.seqno.RemoteClusterStats import org.opensearch.replication.task.shard.FollowerClusterStats diff --git a/src/main/kotlin/org/opensearch/replication/action/stats/TransportLeaderStatsAction.kt b/src/main/kotlin/org/opensearch/replication/action/stats/TransportLeaderStatsAction.kt index 7cc9ec11..f6a91f2c 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stats/TransportLeaderStatsAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stats/TransportLeaderStatsAction.kt @@ -20,8 +20,8 @@ import org.opensearch.action.support.nodes.TransportNodesAction import org.opensearch.client.node.NodeClient import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.index.shard.ShardId +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.index.shard.ShardId import org.opensearch.indices.IndicesService import org.opensearch.replication.seqno.RemoteClusterRetentionLeaseHelper.Companion.RETENTION_LEASE_PREFIX import org.opensearch.replication.seqno.RemoteClusterStats diff --git a/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusAction.kt b/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusAction.kt index f2416354..eb4de39f 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusAction.kt @@ -12,7 +12,7 @@ package org.opensearch.replication.action.status import org.opensearch.action.ActionType -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.Writeable class ReplicationStatusAction : ActionType(NAME, reader) { companion object { diff --git a/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusResponse.kt b/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusResponse.kt index a4832381..dc982cee 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/ReplicationStatusResponse.kt @@ -12,10 +12,10 @@ package org.opensearch.replication.action.status -import org.opensearch.action.support.DefaultShardOperationFailedException +import org.opensearch.core.action.support.DefaultShardOperationFailedException import org.opensearch.action.support.broadcast.BroadcastResponse -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent.Params import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoRequest.kt b/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoRequest.kt index 024dd976..67e09d6c 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoRequest.kt @@ -14,8 +14,8 @@ package org.opensearch.replication.action.status import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.broadcast.BroadcastRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoResponse.kt b/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoResponse.kt index af111889..528e86df 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoResponse.kt @@ -14,12 +14,12 @@ package org.opensearch.replication.action.status import org.opensearch.action.support.broadcast.BroadcastResponse import org.opensearch.action.support.broadcast.BroadcastShardResponse import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import java.io.IOException class ShardInfoResponse : BroadcastShardResponse, ToXContentObject { diff --git a/src/main/kotlin/org/opensearch/replication/action/status/ShardsInfoAction.kt b/src/main/kotlin/org/opensearch/replication/action/status/ShardsInfoAction.kt index 81f6ba4e..d77cd714 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/ShardsInfoAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/ShardsInfoAction.kt @@ -12,7 +12,7 @@ package org.opensearch.replication.action.status import org.opensearch.action.ActionType -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.Writeable class ShardsInfoAction : ActionType(NAME, reader) { diff --git a/src/main/kotlin/org/opensearch/replication/action/status/TranportShardsInfoAction.kt b/src/main/kotlin/org/opensearch/replication/action/status/TranportShardsInfoAction.kt index d3f542d8..4fd73b2f 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/TranportShardsInfoAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/TranportShardsInfoAction.kt @@ -13,7 +13,7 @@ package org.opensearch.replication.action.status import org.apache.logging.log4j.LogManager import org.opensearch.action.support.ActionFilters -import org.opensearch.action.support.DefaultShardOperationFailedException +import org.opensearch.core.action.support.DefaultShardOperationFailedException import org.opensearch.action.support.broadcast.node.TransportBroadcastByNodeAction import org.opensearch.cluster.ClusterState import org.opensearch.cluster.block.ClusterBlockException @@ -21,8 +21,8 @@ import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.routing.* import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.index.IndexService import org.opensearch.indices.IndicesService import org.opensearch.threadpool.ThreadPool diff --git a/src/main/kotlin/org/opensearch/replication/action/stop/StopIndexReplicationRequest.kt b/src/main/kotlin/org/opensearch/replication/action/stop/StopIndexReplicationRequest.kt index 2f447eb8..3ae5eff9 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stop/StopIndexReplicationRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stop/StopIndexReplicationRequest.kt @@ -16,8 +16,8 @@ import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.* class StopIndexReplicationRequest : AcknowledgedRequest, IndicesRequest.Replaceable, ToXContentObject { diff --git a/src/main/kotlin/org/opensearch/replication/action/stop/TransportStopIndexReplicationAction.kt b/src/main/kotlin/org/opensearch/replication/action/stop/TransportStopIndexReplicationAction.kt index 8a6fdf71..f18cbb30 100644 --- a/src/main/kotlin/org/opensearch/replication/action/stop/TransportStopIndexReplicationAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/stop/TransportStopIndexReplicationAction.kt @@ -51,7 +51,7 @@ import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.metadata.Metadata import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.common.settings.Settings import org.opensearch.replication.util.stackTraceToString import org.opensearch.persistent.PersistentTasksCustomMetadata diff --git a/src/main/kotlin/org/opensearch/replication/action/update/TransportUpdateIndexReplicationAction.kt b/src/main/kotlin/org/opensearch/replication/action/update/TransportUpdateIndexReplicationAction.kt index 7ca866d8..333ed9f7 100644 --- a/src/main/kotlin/org/opensearch/replication/action/update/TransportUpdateIndexReplicationAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/update/TransportUpdateIndexReplicationAction.kt @@ -33,7 +33,7 @@ import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamInput import org.opensearch.common.settings.IndexScopedSettings import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.TransportService diff --git a/src/main/kotlin/org/opensearch/replication/action/update/UpdateIndexReplicationRequest.kt b/src/main/kotlin/org/opensearch/replication/action/update/UpdateIndexReplicationRequest.kt index 753e2f62..b498ed92 100644 --- a/src/main/kotlin/org/opensearch/replication/action/update/UpdateIndexReplicationRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/action/update/UpdateIndexReplicationRequest.kt @@ -16,8 +16,8 @@ import org.opensearch.action.IndicesRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.master.AcknowledgedRequest import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.common.settings.Settings import org.opensearch.common.settings.Settings.readSettingsFromStream import org.opensearch.core.xcontent.* diff --git a/src/main/kotlin/org/opensearch/replication/metadata/TransportUpdateMetadataAction.kt b/src/main/kotlin/org/opensearch/replication/metadata/TransportUpdateMetadataAction.kt index 2fab74ab..21b1643f 100644 --- a/src/main/kotlin/org/opensearch/replication/metadata/TransportUpdateMetadataAction.kt +++ b/src/main/kotlin/org/opensearch/replication/metadata/TransportUpdateMetadataAction.kt @@ -40,8 +40,8 @@ import org.opensearch.cluster.metadata.* import org.opensearch.cluster.metadata.AliasAction.RemoveIndex import org.opensearch.cluster.service.ClusterService import org.opensearch.common.inject.Inject -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.index.Index +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.index.Index import org.opensearch.index.IndexNotFoundException import org.opensearch.replication.util.stackTraceToString import org.opensearch.rest.action.admin.indices.AliasesNotFoundException @@ -274,8 +274,8 @@ class TransportUpdateMetadataAction @Inject constructor( val indexAsArray = arrayOf(concreteIndex) val aliasMetadata = metadata.findAliases(action, indexAsArray) val finalAliases: MutableList = ArrayList() - for (curAliases in aliasMetadata.values()) { - for (aliasMeta in curAliases.value) { + for (curAliases in aliasMetadata.values) { + for (aliasMeta in curAliases) { finalAliases.add(aliasMeta.alias()) } } diff --git a/src/main/kotlin/org/opensearch/replication/metadata/UpdateIndexBlockTask.kt b/src/main/kotlin/org/opensearch/replication/metadata/UpdateIndexBlockTask.kt index 8d9d385f..e67293b6 100644 --- a/src/main/kotlin/org/opensearch/replication/metadata/UpdateIndexBlockTask.kt +++ b/src/main/kotlin/org/opensearch/replication/metadata/UpdateIndexBlockTask.kt @@ -22,10 +22,10 @@ import org.opensearch.cluster.block.ClusterBlockException import org.opensearch.cluster.block.ClusterBlockLevel import org.opensearch.cluster.block.ClusterBlocks import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.collect.ImmutableOpenMap import org.opensearch.index.IndexNotFoundException -import org.opensearch.rest.RestStatus -import java.util.* +import org.opensearch.core.rest.RestStatus +import java.util.Collections +import java.util.EnumSet /* This is our custom index block to prevent changes to follower @@ -49,11 +49,11 @@ fun checkIfIndexBlockedWithLevel(clusterService: ClusterService, clusterBlockLevel: ClusterBlockLevel) { clusterService.state().routingTable.index(indexName) ?: throw IndexNotFoundException("Index with name:$indexName doesn't exist") - val writeIndexBlockMap : ImmutableOpenMap> = clusterService.state().blocks() + val writeIndexBlockMap : Map> = clusterService.state().blocks() .indices(clusterBlockLevel) if (!writeIndexBlockMap.containsKey(indexName)) return - val clusterBlocksSet : Set = writeIndexBlockMap.get(indexName) + val clusterBlocksSet : Set = writeIndexBlockMap.getOrDefault(indexName, Collections.emptySet()) if (clusterBlocksSet.contains(INDEX_REPLICATION_BLOCK) && clusterBlocksSet.size > 1) throw ClusterBlockException(clusterBlocksSet) diff --git a/src/main/kotlin/org/opensearch/replication/metadata/UpdateMetadataRequest.kt b/src/main/kotlin/org/opensearch/replication/metadata/UpdateMetadataRequest.kt index 25abe070..5f2e4488 100644 --- a/src/main/kotlin/org/opensearch/replication/metadata/UpdateMetadataRequest.kt +++ b/src/main/kotlin/org/opensearch/replication/metadata/UpdateMetadataRequest.kt @@ -18,8 +18,8 @@ import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest import org.opensearch.action.admin.indices.open.OpenIndexRequest import org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest import org.opensearch.action.support.master.AcknowledgedRequest -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput class UpdateMetadataRequest : AcknowledgedRequest { var indexName: String diff --git a/src/main/kotlin/org/opensearch/replication/metadata/state/ReplicationStateMetadata.kt b/src/main/kotlin/org/opensearch/replication/metadata/state/ReplicationStateMetadata.kt index d6d5c6d9..b87ed1da 100644 --- a/src/main/kotlin/org/opensearch/replication/metadata/state/ReplicationStateMetadata.kt +++ b/src/main/kotlin/org/opensearch/replication/metadata/state/ReplicationStateMetadata.kt @@ -18,8 +18,8 @@ import org.opensearch.cluster.DiffableUtils.getStringKeySerializer import org.opensearch.cluster.NamedDiff import org.opensearch.cluster.metadata.Metadata import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser diff --git a/src/main/kotlin/org/opensearch/replication/metadata/store/ReplicationMetadata.kt b/src/main/kotlin/org/opensearch/replication/metadata/store/ReplicationMetadata.kt index 86cd80c2..891d9970 100644 --- a/src/main/kotlin/org/opensearch/replication/metadata/store/ReplicationMetadata.kt +++ b/src/main/kotlin/org/opensearch/replication/metadata/store/ReplicationMetadata.kt @@ -13,9 +13,9 @@ package org.opensearch.replication.metadata.store import org.opensearch.commons.authuser.User import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.common.settings.Settings import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent diff --git a/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterMultiChunkTransfer.kt b/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterMultiChunkTransfer.kt index f0995346..b3097f13 100644 --- a/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterMultiChunkTransfer.kt +++ b/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterMultiChunkTransfer.kt @@ -28,7 +28,7 @@ import org.opensearch.client.Client import org.opensearch.cluster.node.DiscoveryNode import org.opensearch.common.unit.ByteSizeValue import org.opensearch.common.util.concurrent.ThreadContext -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.store.Store import org.opensearch.index.store.StoreFileMetadata import org.opensearch.indices.recovery.MultiChunkTransfer diff --git a/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterRepository.kt b/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterRepository.kt index 1e5fac38..f5e7a149 100644 --- a/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterRepository.kt +++ b/src/main/kotlin/org/opensearch/replication/repository/RemoteClusterRepository.kt @@ -51,7 +51,7 @@ import org.opensearch.common.component.AbstractLifecycleComponent import org.opensearch.common.metrics.CounterMetric import org.opensearch.common.settings.Settings import org.opensearch.index.mapper.MapperService -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.snapshots.IndexShardSnapshotStatus import org.opensearch.index.store.Store import org.opensearch.indices.recovery.RecoverySettings @@ -193,8 +193,8 @@ class RemoteClusterRepository(private val repositoryMetadata: RepositoryMetadata override fun getRepositoryData(listener: ActionListener) { val clusterState = getLeaderClusterState(false, false) val shardGenerations = ShardGenerations.builder() - clusterState.metadata.indices.values() - .map { it.value } + clusterState.metadata.indices.values + .map { it } .forEach { indexMetadata -> val indexId = IndexId(indexMetadata.index.name, indexMetadata.indexUUID) for (i in 0 until indexMetadata.numberOfShards) { @@ -215,7 +215,7 @@ class RemoteClusterRepository(private val repositoryMetadata: RepositoryMetadata override fun getSnapshotInfo(snapshotId: SnapshotId): SnapshotInfo { val leaderClusterState = getLeaderClusterState(false, false) assert(REMOTE_SNAPSHOT_NAME.equals(snapshotId.name), { "SnapshotName differs" }) - val indices = leaderClusterState.metadata().indices().keys().map { x -> x.value } + val indices = leaderClusterState.metadata().indices().keys.toList() return SnapshotInfo(snapshotId, indices, emptyList(), SnapshotState.SUCCESS, Version.CURRENT) } @@ -244,7 +244,7 @@ class RemoteClusterRepository(private val repositoryMetadata: RepositoryMetadata builder.remove(REPLICATION_INDEX_TRANSLOG_PRUNING_ENABLED_SETTING.key) val indexMdBuilder = IndexMetadata.builder(indexMetadata).settings(builder) - indexMetadata.aliases.valuesIt().forEach { + indexMetadata.aliases.values.forEach { indexMdBuilder.putAlias(it) } return indexMdBuilder.build() diff --git a/src/main/kotlin/org/opensearch/replication/rest/AutoFollowStatsHandler.kt b/src/main/kotlin/org/opensearch/replication/rest/AutoFollowStatsHandler.kt index 42421eb4..f9055c70 100644 --- a/src/main/kotlin/org/opensearch/replication/rest/AutoFollowStatsHandler.kt +++ b/src/main/kotlin/org/opensearch/replication/rest/AutoFollowStatsHandler.kt @@ -15,7 +15,7 @@ import org.opensearch.rest.RestChannel import org.opensearch.rest.RestHandler import org.opensearch.rest.RestRequest import org.opensearch.rest.RestResponse -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.rest.action.RestResponseListener import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/rest/FollowerStatsHandler.kt b/src/main/kotlin/org/opensearch/replication/rest/FollowerStatsHandler.kt index ce5013f6..3dc0e4dc 100644 --- a/src/main/kotlin/org/opensearch/replication/rest/FollowerStatsHandler.kt +++ b/src/main/kotlin/org/opensearch/replication/rest/FollowerStatsHandler.kt @@ -15,7 +15,7 @@ import org.opensearch.rest.RestChannel import org.opensearch.rest.RestHandler import org.opensearch.rest.RestRequest import org.opensearch.rest.RestResponse -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.rest.action.RestResponseListener import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/rest/LeaderStatsHandler.kt b/src/main/kotlin/org/opensearch/replication/rest/LeaderStatsHandler.kt index d71379bf..17acc842 100644 --- a/src/main/kotlin/org/opensearch/replication/rest/LeaderStatsHandler.kt +++ b/src/main/kotlin/org/opensearch/replication/rest/LeaderStatsHandler.kt @@ -15,7 +15,7 @@ import org.opensearch.rest.RestChannel import org.opensearch.rest.RestHandler import org.opensearch.rest.RestRequest import org.opensearch.rest.RestResponse -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.rest.action.RestResponseListener import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/rest/UpdateAutoFollowPatternsHandler.kt b/src/main/kotlin/org/opensearch/replication/rest/UpdateAutoFollowPatternsHandler.kt index ccb9463a..a8a738e2 100644 --- a/src/main/kotlin/org/opensearch/replication/rest/UpdateAutoFollowPatternsHandler.kt +++ b/src/main/kotlin/org/opensearch/replication/rest/UpdateAutoFollowPatternsHandler.kt @@ -19,7 +19,7 @@ import org.opensearch.rest.BaseRestHandler import org.opensearch.rest.BaseRestHandler.RestChannelConsumer import org.opensearch.rest.RestHandler import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.rest.action.RestToXContentListener class UpdateAutoFollowPatternsHandler : BaseRestHandler() { diff --git a/src/main/kotlin/org/opensearch/replication/rest/UpdateIndexHandler.kt b/src/main/kotlin/org/opensearch/replication/rest/UpdateIndexHandler.kt index 22e4a6e1..9a5eb086 100644 --- a/src/main/kotlin/org/opensearch/replication/rest/UpdateIndexHandler.kt +++ b/src/main/kotlin/org/opensearch/replication/rest/UpdateIndexHandler.kt @@ -17,7 +17,7 @@ import org.opensearch.replication.task.index.IndexReplicationExecutor.Companion. import org.opensearch.action.support.IndicesOptions import org.opensearch.client.Requests import org.opensearch.client.node.NodeClient -import org.opensearch.common.Strings +import org.opensearch.core.common.Strings import org.opensearch.rest.BaseRestHandler import org.opensearch.rest.BaseRestHandler.RestChannelConsumer import org.opensearch.rest.RestChannel diff --git a/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterRetentionLeaseHelper.kt b/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterRetentionLeaseHelper.kt index a1c1ee2f..823f61c0 100644 --- a/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterRetentionLeaseHelper.kt +++ b/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterRetentionLeaseHelper.kt @@ -23,7 +23,7 @@ import org.opensearch.index.seqno.RetentionLeaseAlreadyExistsException import org.opensearch.index.seqno.RetentionLeaseInvalidRetainingSeqNoException import org.opensearch.index.seqno.RetentionLeaseNotFoundException import org.opensearch.index.shard.IndexShard -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.replication.metadata.store.ReplicationMetadata import org.opensearch.replication.repository.RemoteClusterRepository import org.opensearch.replication.task.index.IndexReplicationParams @@ -136,9 +136,9 @@ class RemoteClusterRetentionLeaseHelper constructor(var followerClusterNameWithU val remoteMetadata = getLeaderIndexMetadata(replMetadata.connectionName, replMetadata.leaderContext.resource) val params = IndexReplicationParams(replMetadata.connectionName, remoteMetadata.index, followerIndexName) val remoteClient = client.getRemoteClusterClient(params.leaderAlias) - val shards = clusterService.state().routingTable.indicesRouting().get(params.followerIndexName).shards() + val shards = clusterService.state().routingTable.indicesRouting().get(params.followerIndexName)?.shards() val retentionLeaseHelper = RemoteClusterRetentionLeaseHelper(clusterService.clusterName.value(), followerClusterUUID, remoteClient) - shards.forEach { + shards?.forEach { val followerShardId = it.value.shardId log.debug("Removing lease for $followerShardId.id ") retentionLeaseHelper.attemptRetentionLeaseRemoval(ShardId(params.leaderIndex, followerShardId.id), followerShardId) diff --git a/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterStats.kt b/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterStats.kt index cc565d03..80a9d6d2 100644 --- a/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterStats.kt +++ b/src/main/kotlin/org/opensearch/replication/seqno/RemoteClusterStats.kt @@ -13,13 +13,13 @@ package org.opensearch.replication.seqno import org.opensearch.common.component.AbstractLifecycleComponent import org.opensearch.common.inject.Singleton -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentFragment import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import java.util.concurrent.atomic.AtomicLong class RemoteShardMetric { diff --git a/src/main/kotlin/org/opensearch/replication/task/CrossClusterReplicationTask.kt b/src/main/kotlin/org/opensearch/replication/task/CrossClusterReplicationTask.kt index 75477625..7f03dd79 100644 --- a/src/main/kotlin/org/opensearch/replication/task/CrossClusterReplicationTask.kt +++ b/src/main/kotlin/org/opensearch/replication/task/CrossClusterReplicationTask.kt @@ -34,20 +34,20 @@ import org.opensearch.action.ActionListener import org.opensearch.action.ActionResponse import org.opensearch.client.Client import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.common.settings.Settings import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.index.IndexService import org.opensearch.index.shard.IndexShard -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.indices.cluster.IndicesClusterStateService import org.opensearch.persistent.AllocatedPersistentTask import org.opensearch.persistent.PersistentTaskState import org.opensearch.persistent.PersistentTasksService import org.opensearch.replication.util.stackTraceToString -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.tasks.TaskId import org.opensearch.tasks.TaskManager import org.opensearch.threadpool.ThreadPool diff --git a/src/main/kotlin/org/opensearch/replication/task/IndexCloseListener.kt b/src/main/kotlin/org/opensearch/replication/task/IndexCloseListener.kt index ecd87698..cbc4f676 100644 --- a/src/main/kotlin/org/opensearch/replication/task/IndexCloseListener.kt +++ b/src/main/kotlin/org/opensearch/replication/task/IndexCloseListener.kt @@ -15,7 +15,7 @@ import org.opensearch.common.settings.Settings import org.opensearch.index.IndexService import org.opensearch.index.shard.IndexEventListener import org.opensearch.index.shard.IndexShard -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.indices.cluster.IndicesClusterStateService import java.util.Collections import java.util.concurrent.ConcurrentHashMap diff --git a/src/main/kotlin/org/opensearch/replication/task/ReplicationState.kt b/src/main/kotlin/org/opensearch/replication/task/ReplicationState.kt index 3a81f74e..1f0763b8 100644 --- a/src/main/kotlin/org/opensearch/replication/task/ReplicationState.kt +++ b/src/main/kotlin/org/opensearch/replication/task/ReplicationState.kt @@ -11,9 +11,9 @@ package org.opensearch.replication.task -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentFragment import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowParams.kt b/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowParams.kt index 9bcecf64..2de3ad8e 100644 --- a/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowParams.kt +++ b/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowParams.kt @@ -13,8 +13,8 @@ package org.opensearch.replication.task.autofollow import org.opensearch.Version import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowTask.kt b/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowTask.kt index 15c22922..d47843d6 100644 --- a/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowTask.kt +++ b/src/main/kotlin/org/opensearch/replication/task/autofollow/AutoFollowTask.kt @@ -29,8 +29,8 @@ import org.opensearch.action.admin.indices.get.GetIndexRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.client.Client import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.common.logging.Loggers import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder @@ -39,7 +39,7 @@ import org.opensearch.replication.ReplicationException import org.opensearch.replication.action.status.ReplicationStatusAction import org.opensearch.replication.action.status.ShardInfoRequest import org.opensearch.replication.action.status.ShardInfoResponse -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.tasks.Task import org.opensearch.tasks.TaskId import org.opensearch.threadpool.Scheduler diff --git a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt index efaf2af6..6a758b8f 100644 --- a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt +++ b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationParams.kt @@ -14,14 +14,14 @@ package org.opensearch.replication.task.index import org.opensearch.Version import org.opensearch.core.ParseField import org.opensearch.common.Strings -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.common.xcontent.XContentType -import org.opensearch.index.Index +import org.opensearch.core.index.Index import org.opensearch.persistent.PersistentTaskParams import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationState.kt b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationState.kt index 010d1447..d55accd7 100644 --- a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationState.kt +++ b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationState.kt @@ -14,13 +14,13 @@ package org.opensearch.replication.task.index import org.opensearch.replication.task.ReplicationState import org.opensearch.replication.task.shard.ShardReplicationParams import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.persistent.PersistentTaskState import org.opensearch.persistent.PersistentTasksCustomMetadata.PersistentTask import java.io.IOException diff --git a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationTask.kt b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationTask.kt index 4d2537ad..f520926b 100644 --- a/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationTask.kt +++ b/src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationTask.kt @@ -68,7 +68,7 @@ import org.opensearch.cluster.RestoreInProgress import org.opensearch.cluster.metadata.IndexMetadata import org.opensearch.cluster.routing.allocation.decider.EnableAllocationDecider import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.common.logging.Loggers import org.opensearch.common.settings.Setting import org.opensearch.common.settings.Settings @@ -79,11 +79,11 @@ import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.common.xcontent.XContentType -import org.opensearch.index.Index +import org.opensearch.core.index.Index import org.opensearch.index.IndexService import org.opensearch.index.IndexSettings import org.opensearch.index.shard.IndexShard -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.indices.cluster.IndicesClusterStateService import org.opensearch.indices.recovery.RecoveryState import org.opensearch.persistent.PersistentTaskState @@ -94,7 +94,7 @@ import org.opensearch.persistent.PersistentTasksService import org.opensearch.replication.ReplicationException import org.opensearch.replication.MappingNotAvailableException import org.opensearch.replication.ReplicationPlugin.Companion.REPLICATION_INDEX_TRANSLOG_PRUNING_ENABLED_SETTING -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.tasks.TaskId import org.opensearch.tasks.TaskManager import org.opensearch.threadpool.ThreadPool @@ -346,9 +346,9 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript val clusterState = clusterService.state() val persistentTasks = clusterState.metadata.custom(PersistentTasksCustomMetadata.TYPE) - val followerShardIds = clusterService.state().routingTable.indicesRouting().get(followerIndexName).shards() - .map { shard -> shard.value.shardId } - .stream().collect(Collectors.toSet()) + val followerShardIds = clusterService.state().routingTable.indicesRouting().get(followerIndexName)?.shards() + ?.map { shard -> shard.value.shardId } + ?.stream()?.collect(Collectors.toSet()).orEmpty() val runningShardTasksForIndex = persistentTasks.findTasks(ShardReplicationExecutor.TASK_NAME, Predicate { true }).stream() .map { task -> task.params as ShardReplicationParams } .filter {taskParam -> followerShardIds.contains(taskParam.followerShardId) } @@ -434,16 +434,16 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript // If we we want to retrieve just the version of settings and alias versions, there are two options // 1. Include this in GetChanges and communicate it to IndexTask via Metadata // 2. Add another API to retrieve version of settings & aliases. Persist current version in Metadata - var leaderSettings = settingsResponse.indexToSettings.get(this.leaderIndex.name) - leaderSettings = leaderSettings.filter { k: String? -> + var leaderSettings = settingsResponse.indexToSettings.getOrDefault(this.leaderIndex.name, Settings.EMPTY) + leaderSettings = leaderSettings.filter { k: String -> !blockListedSettings.contains(k) } gsr = GetSettingsRequest().includeDefaults(false).indices(this.followerIndexName) settingsResponse = client.suspending(client.admin().indices()::getSettings, injectSecurityContext = true)(gsr) - var followerSettings = settingsResponse.indexToSettings.get(this.followerIndexName) + var followerSettings = settingsResponse.indexToSettings.getOrDefault(this.followerIndexName, Settings.EMPTY) - followerSettings = followerSettings.filter { k: String? -> + followerSettings = followerSettings.filter { k: String -> k != REPLICATED_INDEX_SETTING.key } @@ -516,11 +516,11 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript //Alias var getAliasesRequest = GetAliasesRequest().indices(this.leaderIndex.name) var getAliasesRes = remoteClient.suspending(remoteClient.admin().indices()::getAliases, injectSecurityContext = true)(getAliasesRequest) - var leaderAliases = getAliasesRes.aliases.get(this.leaderIndex.name) + var leaderAliases = getAliasesRes.aliases.getOrDefault(this.leaderIndex.name, Collections.emptyList()) getAliasesRequest = GetAliasesRequest().indices(followerIndexName) getAliasesRes = client.suspending(client.admin().indices()::getAliases, injectSecurityContext = true)(getAliasesRequest) - var followerAliases = getAliasesRes.aliases.get(followerIndexName) + var followerAliases = getAliasesRes.aliases.getOrDefault(followerIndexName, Collections.emptyList()) var request :IndicesAliasesRequest? @@ -606,8 +606,8 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript try { //Step 1 : Remove the tasks - val shards = clusterService.state().routingTable.indicesRouting().get(followerIndexName).shards() - shards.forEach { + val shards = clusterService.state().routingTable.indicesRouting().get(followerIndexName)?.shards() + shards?.forEach { persistentTasksService.removeTask(ShardReplicationTask.taskIdForShard(it.value.shardId)) } @@ -748,7 +748,7 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript suspend fun startNewOrMissingShardTasks(): Map> { assert(clusterService.state().routingTable.hasIndex(followerIndexName)) { "Can't find index $followerIndexName" } - val shards = clusterService.state().routingTable.indicesRouting().get(followerIndexName).shards() + val shards = clusterService.state().routingTable.indicesRouting().get(followerIndexName)?.shards() val persistentTasks = clusterService.state().metadata.custom(PersistentTasksCustomMetadata.TYPE) val runningShardTasks = persistentTasks.findTasks(ShardReplicationExecutor.TASK_NAME, Predicate { true }).stream() .map { task -> task as PersistentTask } @@ -757,14 +757,14 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript {t: PersistentTask -> t.params!!.followerShardId}, {t: PersistentTask -> t})) - val tasks = shards.map { + val tasks = shards?.map { it.value.shardId - }.associate { shardId -> + }?.associate { shardId -> val task = runningShardTasks.getOrElse(shardId) { startReplicationTask(ShardReplicationParams(leaderAlias, ShardId(leaderIndex, shardId.id), shardId)) } return@associate shardId to task - } + }.orEmpty() return tasks } @@ -865,9 +865,9 @@ open class IndexReplicationTask(id: Long, type: String, action: String, descript This can happen if there was a badly timed cluster manager node failure.""".trimIndent()) } } else if (restore.state() == RestoreInProgress.State.FAILURE) { - val failureReason = restore.shards().values().find { - it.value.state() == RestoreInProgress.State.FAILURE - }!!.value.reason() + val failureReason = restore.shards().values.find { + it.state() == RestoreInProgress.State.FAILURE + }!!.reason() return FailedState(Collections.emptyMap(), failureReason) } else { return InitFollowState diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt b/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt index db112a1f..77cfb672 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt @@ -13,13 +13,13 @@ package org.opensearch.replication.task.shard import org.apache.logging.log4j.LogManager import org.opensearch.common.inject.Singleton -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentFragment import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.common.xcontent.XContentType -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import java.util.concurrent.atomic.AtomicLong class FollowerShardMetric { diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt index d8f790a1..c1981de1 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationParams.kt @@ -14,17 +14,17 @@ package org.opensearch.replication.task.shard import org.opensearch.Version import org.opensearch.core.ParseField import org.opensearch.common.Strings -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser import org.opensearch.common.xcontent.XContentType -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.persistent.PersistentTaskParams import java.io.IOException -import org.opensearch.index.Index +import org.opensearch.core.index.Index class ShardReplicationParams : PersistentTaskParams { diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationState.kt b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationState.kt index f0c3fc88..33efd3ca 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationState.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationState.kt @@ -14,8 +14,8 @@ package org.opensearch.replication.task.shard import org.opensearch.replication.task.ReplicationState import org.opensearch.OpenSearchException import org.opensearch.core.ParseField -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput import org.opensearch.core.xcontent.ObjectParser import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationTask.kt b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationTask.kt index e393805e..e165c916 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationTask.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/ShardReplicationTask.kt @@ -47,10 +47,10 @@ import org.opensearch.common.logging.Loggers import org.opensearch.index.seqno.RetentionLeaseActions import org.opensearch.index.seqno.RetentionLeaseInvalidRetainingSeqNoException import org.opensearch.index.seqno.RetentionLeaseNotFoundException -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.persistent.PersistentTaskState import org.opensearch.persistent.PersistentTasksNodeService -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.tasks.TaskId import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.NodeNotConnectedException diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/TranslogSequencer.kt b/src/main/kotlin/org/opensearch/replication/task/shard/TranslogSequencer.kt index d8c976dc..bbb6837a 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/TranslogSequencer.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/TranslogSequencer.kt @@ -29,14 +29,14 @@ import org.opensearch.OpenSearchException import org.opensearch.action.support.TransportActions import org.opensearch.common.logging.Loggers import org.opensearch.index.IndexNotFoundException -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.translog.Translog import org.opensearch.replication.util.indicesService import org.opensearch.tasks.TaskId import java.util.ArrayList import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.TimeUnit -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus /** diff --git a/src/main/kotlin/org/opensearch/replication/util/Extensions.kt b/src/main/kotlin/org/opensearch/replication/util/Extensions.kt index 643cc010..1928ad6b 100644 --- a/src/main/kotlin/org/opensearch/replication/util/Extensions.kt +++ b/src/main/kotlin/org/opensearch/replication/util/Extensions.kt @@ -31,13 +31,13 @@ import org.opensearch.client.Client import org.opensearch.common.util.concurrent.ThreadContext import org.opensearch.core.concurrency.OpenSearchRejectedExecutionException import org.opensearch.index.IndexNotFoundException -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.store.Store import org.opensearch.indices.recovery.RecoveryState import org.opensearch.replication.ReplicationException import org.opensearch.replication.util.stackTraceToString import org.opensearch.repositories.IndexId -import org.opensearch.rest.RestStatus +import org.opensearch.core.rest.RestStatus import org.opensearch.snapshots.SnapshotId import org.opensearch.transport.ConnectTransportException import org.opensearch.transport.NodeDisconnectedException diff --git a/src/test/kotlin/org/opensearch/index/translog/ReplicationTranslogDeletionPolicyTests.kt b/src/test/kotlin/org/opensearch/index/translog/ReplicationTranslogDeletionPolicyTests.kt index 8378bbbb..a59e75fe 100644 --- a/src/test/kotlin/org/opensearch/index/translog/ReplicationTranslogDeletionPolicyTests.kt +++ b/src/test/kotlin/org/opensearch/index/translog/ReplicationTranslogDeletionPolicyTests.kt @@ -14,14 +14,14 @@ import org.apache.lucene.store.ByteArrayDataOutput import org.hamcrest.Matchers.equalTo import org.mockito.Mockito import org.opensearch.common.UUIDs -import org.opensearch.common.bytes.BytesArray +import org.opensearch.core.common.bytes.BytesArray import org.opensearch.common.bytes.ReleasableBytesReference import org.opensearch.common.collect.Tuple import org.opensearch.common.util.BigArrays import org.opensearch.common.util.io.IOUtils import org.opensearch.index.seqno.RetentionLease import org.opensearch.index.seqno.RetentionLeases -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.test.OpenSearchTestCase import java.io.IOException import java.nio.channels.FileChannel diff --git a/src/test/kotlin/org/opensearch/replication/bwc/BackwardsCompatibilityIT.kt b/src/test/kotlin/org/opensearch/replication/bwc/BackwardsCompatibilityIT.kt index f6f2c893..e8e803a8 100644 --- a/src/test/kotlin/org/opensearch/replication/bwc/BackwardsCompatibilityIT.kt +++ b/src/test/kotlin/org/opensearch/replication/bwc/BackwardsCompatibilityIT.kt @@ -82,6 +82,7 @@ class BackwardsCompatibilityIT : MultiClusterRestTestCase() { ClusterStatus.ONE_THIRD_UPGRADED, ClusterStatus.TWO_THIRD_UPGRADED, ClusterStatus.ROLLING_UPGRADED, ClusterStatus.FULL_CLUSTER_RESTART -> verifyReplication() ClusterStatus.COMPLETE_SUITE -> {} // Do nothing as all tests have run already + else -> {throw AssertionError("${ClusterStatus.from(System.getProperty("tests.bwcTask"))} is not a valid option for ClusterStatus")} } } 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 94257594..99a18171 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityCustomRolesIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityCustomRolesIT.kt @@ -228,7 +228,7 @@ class SecurityCustomRolesIT: SecurityBase() { "1", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) settings = Settings.builder() @@ -243,7 +243,7 @@ class SecurityCustomRolesIT: SecurityBase() { "checksum", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName]["index.shard.check_on_startup"] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)["index.shard.check_on_startup"] ) }, 30L, TimeUnit.SECONDS) } @@ -273,7 +273,7 @@ class SecurityCustomRolesIT: SecurityBase() { "1", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) settings = Settings.builder() .put("index.shard.check_on_startup", "checksum") diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityDlsFlsIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityDlsFlsIT.kt index 5198d2d0..b8ababe8 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityDlsFlsIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/SecurityDlsFlsIT.kt @@ -128,7 +128,7 @@ class SecurityDlsFlsIT: SecurityBase() { "1", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) settings = Settings.builder() .put("index.shard.check_on_startup", "checksum") diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt index e6355d33..da783f6b 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/StartReplicationIT.kt @@ -130,7 +130,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "3", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) }, 15, TimeUnit.SECONDS) } @@ -289,7 +289,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "0", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) }, 30L, TimeUnit.SECONDS) } @@ -448,7 +448,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "0", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) settings = Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 2) @@ -469,14 +469,14 @@ class StartReplicationIT: MultiClusterRestTestCase() { "2", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) assertEqualAliases() }, 30L, TimeUnit.SECONDS) // Case 2 : Blocklisted setting are not copied Assert.assertNull(followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName].get("index.routing.allocation.enable")) + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY).get("index.routing.allocation.enable")) //Alias test case 2: Update existing alias aliasAction = IndicesAliasesRequest.AliasActions.add() .index(leaderIndexName) @@ -500,19 +500,19 @@ class StartReplicationIT: MultiClusterRestTestCase() { "3", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) Assert.assertEquals( "10s", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName]["index.search.idle.after"] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)["index.search.idle.after"] ) Assert.assertEquals( "none", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName]["index.routing.allocation.enable"] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)["index.routing.allocation.enable"] ) assertEqualAliases() }, 30L, TimeUnit.SECONDS) @@ -539,7 +539,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { null, followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName]["index.search.idle.after"] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)["index.search.idle.after"] ) assertEqualAliases() }, 30L, TimeUnit.SECONDS) @@ -568,7 +568,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "1", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) settings = Settings.builder() .put("index.shard.check_on_startup", "checksum") @@ -579,7 +579,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "checksum", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName]["index.shard.check_on_startup"] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)["index.shard.check_on_startup"] ) } @@ -1138,7 +1138,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "2", leaderClient.indices() .getSettings(getLeaderSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[leaderIndexName][IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey()] + .indexToSettings.getOrDefault(leaderIndexName, Settings.EMPTY)[IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey()] ) }, 15, TimeUnit.SECONDS) @@ -1198,7 +1198,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "2", leaderClient.indices() .getSettings(getLeaderSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[leaderIndexName][IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey()] + .indexToSettings.getOrDefault(leaderIndexName, Settings.EMPTY)[IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey()] ) }, 15, TimeUnit.SECONDS) @@ -1250,7 +1250,7 @@ class StartReplicationIT: MultiClusterRestTestCase() { "2", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[followerIndexName][IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey()] + .indexToSettings.getOrDefault(followerIndexName, Settings.EMPTY)[IndexMetadata.SETTING_WAIT_FOR_ACTIVE_SHARDS.getKey()] ) }, 15, TimeUnit.SECONDS) } finally { diff --git a/src/test/kotlin/org/opensearch/replication/integ/rest/UpdateAutoFollowPatternIT.kt b/src/test/kotlin/org/opensearch/replication/integ/rest/UpdateAutoFollowPatternIT.kt index 9393bc32..2234bd86 100644 --- a/src/test/kotlin/org/opensearch/replication/integ/rest/UpdateAutoFollowPatternIT.kt +++ b/src/test/kotlin/org/opensearch/replication/integ/rest/UpdateAutoFollowPatternIT.kt @@ -177,7 +177,7 @@ class UpdateAutoFollowPatternIT: MultiClusterRestTestCase() { "3", followerClient.indices() .getSettings(getSettingsRequest, RequestOptions.DEFAULT) - .indexToSettings[leaderIndexName][IndexMetadata.SETTING_NUMBER_OF_REPLICAS] + .indexToSettings.getOrDefault(leaderIndexName, Settings.EMPTY)[IndexMetadata.SETTING_NUMBER_OF_REPLICAS] ) followerClient.waitForShardTaskStart(leaderIndexName, waitForShardTask) }, 15, TimeUnit.SECONDS) diff --git a/src/test/kotlin/org/opensearch/replication/singleCluster/SingleClusterSanityIT.kt b/src/test/kotlin/org/opensearch/replication/singleCluster/SingleClusterSanityIT.kt index 9760e7c2..24b9bb15 100644 --- a/src/test/kotlin/org/opensearch/replication/singleCluster/SingleClusterSanityIT.kt +++ b/src/test/kotlin/org/opensearch/replication/singleCluster/SingleClusterSanityIT.kt @@ -45,6 +45,7 @@ class SingleClusterSanityIT : MultiClusterRestTestCase() { fun testReplicationPluginWithSingleCluster() { when(ClusterState.from(System.getProperty("tests.sanitySingleCluster"))) { ClusterState.SINGLE_CLUSTER_SANITY_SUITE -> basicReplicationSanityWithSingleCluster() + else -> {throw AssertionError("${System.getProperty("tests.sanitySingleCluster")} is not a valid option for ClusterState")} } } diff --git a/src/test/kotlin/org/opensearch/replication/task/index/IndexReplicationTaskTests.kt b/src/test/kotlin/org/opensearch/replication/task/index/IndexReplicationTaskTests.kt index 2032cc26..00bde557 100644 --- a/src/test/kotlin/org/opensearch/replication/task/index/IndexReplicationTaskTests.kt +++ b/src/test/kotlin/org/opensearch/replication/task/index/IndexReplicationTaskTests.kt @@ -33,8 +33,8 @@ import org.opensearch.common.settings.Settings import org.opensearch.common.settings.SettingsModule import org.opensearch.common.unit.TimeValue import org.opensearch.core.xcontent.NamedXContentRegistry -import org.opensearch.index.Index -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.Index +import org.opensearch.core.index.shard.ShardId import org.opensearch.persistent.PersistentTaskParams import org.opensearch.persistent.PersistentTasksCustomMetadata import org.opensearch.persistent.PersistentTasksService diff --git a/src/test/kotlin/org/opensearch/replication/task/index/NoOpClient.kt b/src/test/kotlin/org/opensearch/replication/task/index/NoOpClient.kt index 35af7cb4..606d7a18 100644 --- a/src/test/kotlin/org/opensearch/replication/task/index/NoOpClient.kt +++ b/src/test/kotlin/org/opensearch/replication/task/index/NoOpClient.kt @@ -29,14 +29,13 @@ import org.opensearch.action.get.GetAction import org.opensearch.action.get.GetResponse import org.opensearch.action.support.master.AcknowledgedResponse import org.opensearch.common.UUIDs -import org.opensearch.common.bytes.BytesReference -import org.opensearch.common.collect.ImmutableOpenMap +import org.opensearch.core.common.bytes.BytesReference import org.opensearch.common.settings.Settings import org.opensearch.core.xcontent.ToXContent import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.index.Index +import org.opensearch.core.index.Index import org.opensearch.index.get.GetResult -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.indices.recovery.RecoveryState import org.opensearch.persistent.PersistentTaskResponse import org.opensearch.persistent.PersistentTasksCustomMetadata @@ -55,8 +54,7 @@ import org.opensearch.snapshots.RestoreInfo import org.opensearch.test.OpenSearchTestCase import org.opensearch.test.client.NoOpNodeClient import java.lang.reflect.Field -import java.util.ArrayList -import java.util.HashMap +import java.util.* open class NoOpClient(testName :String) : NoOpNodeClient(testName) { @Override @@ -109,9 +107,7 @@ open class NoOpClient(testName :String) : NoOpNodeClient(testName) { val indexToSettings = HashMap() indexToSettings[IndexReplicationTaskTests.followerIndex] = desiredSettingsBuilder.build() - - val settingsMap = ImmutableOpenMap.builder().putAll(indexToSettings).build() - var settingResponse = GetSettingsResponse(settingsMap, settingsMap) + var settingResponse = GetSettingsResponse(indexToSettings, indexToSettings) listener.onResponse(settingResponse as Response) } else if (action == RecoveryAction.INSTANCE) { val shardRecoveryStates: MutableMap> = HashMap() diff --git a/src/test/kotlin/org/opensearch/replication/task/shard/ShardReplicationExecutorTests.kt b/src/test/kotlin/org/opensearch/replication/task/shard/ShardReplicationExecutorTests.kt index 630234f8..39275542 100644 --- a/src/test/kotlin/org/opensearch/replication/task/shard/ShardReplicationExecutorTests.kt +++ b/src/test/kotlin/org/opensearch/replication/task/shard/ShardReplicationExecutorTests.kt @@ -12,8 +12,8 @@ import org.opensearch.cluster.metadata.Metadata import org.opensearch.cluster.routing.* import org.opensearch.common.unit.TimeValue import org.opensearch.core.xcontent.NamedXContentRegistry -import org.opensearch.index.Index -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.Index +import org.opensearch.core.index.shard.ShardId import org.opensearch.replication.ReplicationSettings import org.opensearch.replication.metadata.ReplicationMetadataManager import org.opensearch.replication.metadata.store.ReplicationMetadataStore diff --git a/src/test/kotlin/org/opensearch/replication/task/shard/TranslogSequencerTests.kt b/src/test/kotlin/org/opensearch/replication/task/shard/TranslogSequencerTests.kt index fe6ad1c8..730289ed 100644 --- a/src/test/kotlin/org/opensearch/replication/task/shard/TranslogSequencerTests.kt +++ b/src/test/kotlin/org/opensearch/replication/task/shard/TranslogSequencerTests.kt @@ -24,7 +24,7 @@ import org.opensearch.action.support.replication.ReplicationResponse.ShardInfo import org.opensearch.common.settings.Settings import org.opensearch.index.IndexService import org.opensearch.index.shard.IndexShard -import org.opensearch.index.shard.ShardId +import org.opensearch.core.index.shard.ShardId import org.opensearch.index.translog.Translog import org.opensearch.indices.IndicesService import org.opensearch.replication.action.changes.GetChangesResponse