From 3fed65e4862b4d155ab28b90cdd4dab69c9306da Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Tue, 17 Dec 2013 15:34:48 +0100 Subject: [PATCH] reuse shard identifier if possible --- .../cluster/routing/ImmutableShardRouting.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java b/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java index 7a3c5d99db3..7553786fb9c 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java +++ b/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java @@ -63,6 +63,9 @@ public class ImmutableShardRouting implements Streamable, Serializable, ShardRou this(copy.index(), copy.id(), copy.currentNodeId(), copy.primary(), copy.state(), copy.version()); this.relocatingNodeId = copy.relocatingNodeId(); this.restoreSource = copy.restoreSource(); + if (copy instanceof ImmutableShardRouting) { + this.shardIdentifier = ((ImmutableShardRouting) copy).shardIdentifier; + } } public ImmutableShardRouting(ShardRouting copy, long version) { @@ -70,6 +73,9 @@ public class ImmutableShardRouting implements Streamable, Serializable, ShardRou this.relocatingNodeId = copy.relocatingNodeId(); this.restoreSource = copy.restoreSource(); this.version = version; + if (copy instanceof ImmutableShardRouting) { + this.shardIdentifier = ((ImmutableShardRouting) copy).shardIdentifier; + } } public ImmutableShardRouting(String index, int shardId, String currentNodeId,