Skip to content

Commit

Permalink
Refactor _status API to use uniform status constants (#332)
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Kumar <[email protected]>
  • Loading branch information
saikaranam-amazon authored Mar 10, 2022
1 parent e5c847c commit c21dd4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit c21dd4a

Please sign in to comment.