From e1c5187b2ede78a06c1a6ad16f6ea162802c4a10 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Tue, 3 Dec 2024 15:22:23 +1100 Subject: [PATCH] Assert for empty routing table when hiding state Routing table should always be empty when hiding cluster state for not-recovered block. This PR adds an explicit assertion for it. --- .../java/org/elasticsearch/gateway/ClusterStateUpdaters.java | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/main/java/org/elasticsearch/gateway/ClusterStateUpdaters.java b/server/src/main/java/org/elasticsearch/gateway/ClusterStateUpdaters.java index 8d8e661b3a010..9c16bcd9d2cc2 100644 --- a/server/src/main/java/org/elasticsearch/gateway/ClusterStateUpdaters.java +++ b/server/src/main/java/org/elasticsearch/gateway/ClusterStateUpdaters.java @@ -143,6 +143,7 @@ public static ClusterState hideStateIfNotRecovered(ClusterState state) { .coordinationMetadata(state.metadata().coordinationMetadata()) .build(); + assert state.routingTable().indicesRouting().isEmpty() : "routing table is not empty: " + state.routingTable().indicesRouting(); return ClusterState.builder(state).metadata(metadata).blocks(blocks.build()).build(); } return state;