From 3ab85bacdd4b6f6e637e23be19de3a86001026df Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Sun, 1 Jul 2012 21:51:19 +0200 Subject: [PATCH] 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 --- .../state/shards/LocalGatewayShardsState.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/elasticsearch/gateway/local/state/shards/LocalGatewayShardsState.java b/src/main/java/org/elasticsearch/gateway/local/state/shards/LocalGatewayShardsState.java index ff7873ba4f3..066cb7acd4e 100644 --- a/src/main/java/org/elasticsearch/gateway/local/state/shards/LocalGatewayShardsState.java +++ b/src/main/java/org/elasticsearch/gateway/local/state/shards/LocalGatewayShardsState.java @@ -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 - for (Map.Entry entry : currentState.entrySet()) { - ShardId shardId = entry.getKey(); - if (!newState.containsKey(shardId)) { - if (!metaState.isDangling(shardId.index().name())) { - deleteShardState(shardId); - } - } - } +// for (Map.Entry entry : currentState.entrySet()) { +// ShardId shardId = entry.getKey(); +// if (!newState.containsKey(shardId)) { +// if (!metaState.isDangling(shardId.index().name())) { +// deleteShardState(shardId); +// } +// } +// } this.currentState = newState; }