Also resend shard started message if shard state is in POST_RECOVERY and master thinks it's initializing.

Closes #4009
This commit is contained in:
Boaz Leskes 2013-10-30 11:23:58 +01:00
parent 8f21d2831a
commit 542f021d6f
1 changed files with 6 additions and 5 deletions

View File

@ -620,14 +620,15 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
if (indexService.hasShard(shardId)) { if (indexService.hasShard(shardId)) {
IndexShard indexShard = indexService.shardSafe(shardId); IndexShard indexShard = indexService.shardSafe(shardId);
if (indexShard.state() == IndexShardState.STARTED) { if (indexShard.state() == IndexShardState.STARTED || indexShard.state() == IndexShardState.POST_RECOVERY) {
// the master thinks we are initializing, but we are already started // the master thinks we are initializing, but we are already started or on POST_RECOVERY and waiting
// (either master failover, or a cluster event before we managed to tell the master we started), mark us as started // for master to confirm a shard started message (either master failover, or a cluster event before
// we managed to tell the master we started), mark us as started
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
logger.trace("[{}][{}] master [{}] marked shard as initializing, but shard already created, mark shard as started"); logger.trace("[{}][{}] master [{}] marked shard as initializing, but shard has state [{}], mark shard as started", indexShard.state());
} }
shardStateAction.shardStarted(shardRouting, indexMetaData.getUUID(), shardStateAction.shardStarted(shardRouting, indexMetaData.getUUID(),
"master " + nodes.masterNode() + " marked shard as initializing, but shard already started, mark shard as started"); "master " + nodes.masterNode() + " marked shard as initializing, but shard state is [" + indexShard.state() + "], mark shard as started");
return; return;
} else { } else {
if (indexShard.ignoreRecoveryAttempt()) { if (indexShard.ignoreRecoveryAttempt()) {