Class PeerRecoveryTargetService

java.lang.Object
org.elasticsearch.indices.recovery.PeerRecoveryTargetService
All Implemented Interfaces:
IndexEventListener

public class PeerRecoveryTargetService extends Object implements IndexEventListener
The recovery target handles recoveries of peer shards of the shard+node to recover to.

Note, it can be safely assumed that there will only be a single recovery per shard (index+id) and not several of them (since we don't allocate several shard replicas to the same node).

  • Constructor Details

  • Method Details

    • beforeIndexShardClosed

      public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard, Settings indexSettings)
      Description copied from interface: IndexEventListener
      Called before the index shard gets closed.
      Specified by:
      beforeIndexShardClosed in interface IndexEventListener
      indexShard - The index shard
    • startRecovery

      public void startRecovery(IndexShard indexShard, DiscoveryNode sourceNode, PeerRecoveryTargetService.RecoveryListener listener)
    • retryRecovery

      protected void retryRecovery(long recoveryId, Throwable reason, org.elasticsearch.core.TimeValue retryAfter, org.elasticsearch.core.TimeValue activityTimeout)
    • retryRecovery

      protected void retryRecovery(long recoveryId, String reason, org.elasticsearch.core.TimeValue retryAfter, org.elasticsearch.core.TimeValue activityTimeout)
    • reestablishRecovery

      protected void reestablishRecovery(StartRecoveryRequest request, String reason, org.elasticsearch.core.TimeValue retryAfter)
    • getStartRecoveryRequest

      public static StartRecoveryRequest getStartRecoveryRequest(org.apache.logging.log4j.Logger logger, DiscoveryNode localNode, RecoveryTarget recoveryTarget, long startingSeqNo)
      Prepare the start recovery request.
      Parameters:
      logger - the logger
      localNode - the local node of the recovery target
      recoveryTarget - the target of the recovery
      startingSeqNo - a sequence number that an operation-based peer recovery can start with. This is the first operation after the local checkpoint of the safe commit if exists.
      Returns:
      a start recovery request