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 9274d39c..4cadea82 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoResponse.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/ShardInfoResponse.kt @@ -35,9 +35,9 @@ class ShardInfoResponse : BroadcastShardResponse, ToXContentObject { constructor(si: StreamInput) : super(si) { this.status = si.readString() - if (status.equals("SYNCING")) + if (status.equals(SYNCING)) this.replayDetails = ReplayDetails(si) - if (status.equals("BOOTSTRAPPING")) + if (status.equals(BOOTSTRAPPING)) this.restoreDetails = RestoreDetails(si) } 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 ee5e359e..d3f542d8 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/TranportShardsInfoAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/TranportShardsInfoAction.kt @@ -79,13 +79,13 @@ class TranportShardsInfoAction @Inject constructor(clusterService: ClusterServi var indexState = indexShard.recoveryState().index if (indexShard.recoveryState().recoverySource.type.equals(RecoverySource.Type.SNAPSHOT) and (indexState.recoveredBytesPercent() <100)) { - return ShardInfoResponse(shardRouting.shardId(),"BOOTSTRAPPING", + return ShardInfoResponse(shardRouting.shardId(),ShardInfoResponse.BOOTSTRAPPING, RestoreDetails(indexState.totalBytes(), indexState.recoveredBytes(), indexState.recoveredBytesPercent(), indexState.totalFileCount(), indexState.recoveredFileCount(), indexState.recoveredFilesPercent(), indexState.startTime(), indexState.time())) } var seqNo = indexShard.localCheckpoint + 1 - return ShardInfoResponse(shardRouting.shardId(),"SYNCING", ReplayDetails(indexShard.lastKnownGlobalCheckpoint, + return ShardInfoResponse(shardRouting.shardId(),ShardInfoResponse.SYNCING, ReplayDetails(indexShard.lastKnownGlobalCheckpoint, indexShard.lastSyncedGlobalCheckpoint, seqNo)) } diff --git a/src/main/kotlin/org/opensearch/replication/action/status/TransportReplicationStatusAction.kt b/src/main/kotlin/org/opensearch/replication/action/status/TransportReplicationStatusAction.kt index 3e2e2dda..317fb621 100644 --- a/src/main/kotlin/org/opensearch/replication/action/status/TransportReplicationStatusAction.kt +++ b/src/main/kotlin/org/opensearch/replication/action/status/TransportReplicationStatusAction.kt @@ -68,7 +68,7 @@ class TransportReplicationStatusAction @Inject constructor(transportService: Tra if (followerResponse.shardInfoResponse.size > 0) { status = followerResponse.shardInfoResponse.get(0).status } - if (!status.equals("BOOTSTRAPPING")) { + if (!status.equals(ShardInfoResponse.BOOTSTRAPPING)) { var shardResponses = followerResponse.shardInfoResponse leaderResponse.shardInfoResponse.listIterator().forEach { val leaderShardName = it.shardId.toString()