1
0
Эх сурвалжийг харах

Check that all active shards have their allocation id in the in-sync set

Yannick Welsch 9 жил өмнө
parent
commit
a74f77b632

+ 5 - 0
core/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java

@@ -128,6 +128,11 @@ public class IndexRoutingTable extends AbstractDiffable<IndexRoutingTable> imple
                     throw new IllegalStateException("shard routing has an index [" + shardRouting.index() + "] that is different " +
                                                     "from the routing table");
                 }
+                if (shardRouting.active() &&
+                    indexMetaData.activeAllocationIds(shardRouting.id()).contains(shardRouting.allocationId().getId()) == false) {
+                        throw new IllegalStateException("active shard routing " + shardRouting + " has no corresponding entry in the " +
+                            "in-sync allocation set " + indexMetaData.activeAllocationIds(shardRouting.id()));
+                    }
             }
         }
         return true;