diff --git a/core/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java b/core/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java index e441fd81113..4db922d5aeb 100644 --- a/core/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java +++ b/core/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java @@ -390,7 +390,7 @@ public final class ShardRouting implements Writeable, ToXContent { assert primary : this; return new ShardRouting(shardId, currentNodeId, null, primary, ShardRoutingState.INITIALIZING, StoreRecoverySource.EXISTING_STORE_INSTANCE, new UnassignedInfo(UnassignedInfo.Reason.REINITIALIZED, null), - AllocationId.newInitializing(), UNAVAILABLE_EXPECTED_SHARD_SIZE); + allocationId, UNAVAILABLE_EXPECTED_SHARD_SIZE); } /** diff --git a/core/src/main/java/org/elasticsearch/cluster/routing/allocation/IndexMetaDataUpdater.java b/core/src/main/java/org/elasticsearch/cluster/routing/allocation/IndexMetaDataUpdater.java index f476972b216..52ace3744cd 100644 --- a/core/src/main/java/org/elasticsearch/cluster/routing/allocation/IndexMetaDataUpdater.java +++ b/core/src/main/java/org/elasticsearch/cluster/routing/allocation/IndexMetaDataUpdater.java @@ -93,11 +93,6 @@ public class IndexMetaDataUpdater extends RoutingChangesObserver.AbstractRouting removeAllocationId(removedRelocationSource); } - @Override - public void startedPrimaryReinitialized(ShardRouting startedPrimaryShard, ShardRouting initializedShard) { - removeAllocationId(startedPrimaryShard); - } - /** * Updates the current {@link MetaData} based on the changes of this RoutingChangesObserver. Specifically * we update {@link IndexMetaData#getInSyncAllocationIds()} and {@link IndexMetaData#primaryTerm(int)} based on diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/AllocationIdTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/AllocationIdTests.java index 036c168eee8..48fb1f1c952 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/AllocationIdTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/AllocationIdTests.java @@ -122,7 +122,7 @@ public class AllocationIdTests extends ESTestCase { shard = shard.reinitializePrimaryShard(); assertThat(shard.allocationId().getId(), notNullValue()); assertThat(shard.allocationId().getRelocationId(), nullValue()); - assertThat(shard.allocationId().getId(), not(equalTo(allocationId.getId()))); + assertThat(shard.allocationId().getId(), equalTo(allocationId.getId())); } public void testSerialization() throws IOException {