Source node does not have the shard listed in its state as allocated on the node – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch tries to move a shard from one node to another, but the source node doesn’t have the shard listed as allocated to it. This could be due to a cluster state inconsistency or a network issue. To resolve this, you can try to manually reroute the shard using the cluster reroute API, or restart the node to refresh its state. If the problem persists, consider checking the cluster’s health and ensure that all nodes are properly connected and synchronized.

This guide will help you check for common problems that cause the log ” source node does not have the shard listed in its state as allocated on the node ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: recovery, indices, shard, node, source.

Log Context

Log “source node does not have the shard listed in its state as allocated on the node” class name is RecoverySourceHandler.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 logger.debug(
 "delaying recovery of {} as it is not listed as assigned to target node {}";
 request.shardId();
 request.targetNode()
 );
 throw new DelayRecoveryException("source node does not have the shard listed in its state as allocated on the node");
 }
 assert targetShardRouting.initializing() : "expected recovery target to be initializing but was " + targetShardRouting;
 retentionLeaseListener.onResponse(
 shard.getRetentionLeases().get(ReplicationTracker.getPeerRecoveryRetentionLeaseId(targetShardRouting))
 );

 

 [ratemypost]