diff --git a/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index 5ed79afc9195d..303f3dcca7890 100644 --- a/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -1046,6 +1046,18 @@ private static DiscoveryNode findSourceNodeForReshardSplitRecovery( return null; } + if (sourceShardRouting.relocatingNodeId() != null) { + DiscoveryNode sourceNode = nodes.get(sourceShardRouting.relocatingNodeId()); + if (sourceNode == null) { + logger.trace( + "can't find relocation reshard split source node for shard {} because it is assigned to an unknown node [{}].", + sourceShardRouting.shardId(), + sourceShardRouting.relocatingNodeId() + ); + return null; + } + return sourceNode; + } DiscoveryNode sourceNode = nodes.get(sourceShardRouting.currentNodeId()); if (sourceNode == null) { assert false : "Source node for reshard does not exist: " + sourceShardRouting.currentNodeId();