don't delete shards state in the state handle, but let the indices store eventually delete it based on its logic of when to delete a shard

This commit is contained in:
Shay Banon 2012-07-01 21:51:19 +02:00
parent 6cd9b92f95
commit 3ab85bacdd

View File

@ -157,15 +157,17 @@ public class LocalGatewayShardsState extends AbstractComponent implements Cluste
} }
} }
// REMOVED: don't delete shard state, rely on IndicesStore to delete the shard location
// only once all shards are allocated on another node
// now, go over the current ones and delete ones that are not in the new one // now, go over the current ones and delete ones that are not in the new one
for (Map.Entry<ShardId, ShardStateInfo> entry : currentState.entrySet()) { // for (Map.Entry<ShardId, ShardStateInfo> entry : currentState.entrySet()) {
ShardId shardId = entry.getKey(); // ShardId shardId = entry.getKey();
if (!newState.containsKey(shardId)) { // if (!newState.containsKey(shardId)) {
if (!metaState.isDangling(shardId.index().name())) { // if (!metaState.isDangling(shardId.index().name())) {
deleteShardState(shardId); // deleteShardState(shardId);
} // }
} // }
} // }
this.currentState = newState; this.currentState = newState;
} }