Module org.elasticsearch.server
Class PeerRecoveryTargetService
java.lang.Object
org.elasticsearch.indices.recovery.PeerRecoveryTargetService
- All Implemented Interfaces:
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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
-
Constructor Summary
ConstructorsConstructorDescriptionPeerRecoveryTargetService
(Client client, ThreadPool threadPool, TransportService transportService, RecoverySettings recoverySettings, ClusterService clusterService, SnapshotFilesProvider snapshotFilesProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeIndexShardClosed
(ShardId shardId, IndexShard indexShard, Settings indexSettings) Called before the index shard gets closed.getRecoveryRef
(long recoveryId, ShardId shardId) Acquire a reference to the given recovery, throwing anIndexShardClosedException
if the recovery is unknown.static StartRecoveryRequest
getStartRecoveryRequest
(org.apache.logging.log4j.Logger logger, DiscoveryNode localNode, RecoveryTarget recoveryTarget, long startingSeqNo) Prepare the start recovery request.int
protected void
reestablishRecovery
(StartRecoveryRequest request, String reason, TimeValue retryAfter) protected void
retryRecovery
(long recoveryId, String reason, TimeValue retryAfter, TimeValue activityTimeout) protected void
retryRecovery
(long recoveryId, Throwable reason, TimeValue retryAfter, TimeValue activityTimeout) void
startRecovery
(IndexShard indexShard, DiscoveryNode sourceNode, long clusterStateVersion, PeerRecoveryTargetService.RecoveryListener listener) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.index.shard.IndexEventListener
afterFilesRestoredFromRepository, afterIndexCreated, afterIndexRemoved, afterIndexShardClosed, afterIndexShardClosing, afterIndexShardCreated, afterIndexShardDeleted, afterIndexShardRecovery, afterIndexShardStarted, beforeIndexAddedToCluster, beforeIndexCreated, beforeIndexRemoved, beforeIndexShardCreated, beforeIndexShardDeleted, beforeIndexShardRecovery, indexShardStateChanged, onStoreClosed, onStoreCreated, shardRoutingChanged
-
Constructor Details
-
PeerRecoveryTargetService
public PeerRecoveryTargetService(Client client, ThreadPool threadPool, TransportService transportService, RecoverySettings recoverySettings, ClusterService clusterService, SnapshotFilesProvider snapshotFilesProvider)
-
-
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 interfaceIndexEventListener
- Parameters:
indexShard
- The index shard
-
startRecovery
public void startRecovery(IndexShard indexShard, DiscoveryNode sourceNode, long clusterStateVersion, PeerRecoveryTargetService.RecoveryListener listener) -
retryRecovery
-
retryRecovery
-
reestablishRecovery
protected void reestablishRecovery(StartRecoveryRequest request, String reason, TimeValue retryAfter) -
tryAcquireSnapshotDownloadPermits
-
ongoingRecoveryCount
public int ongoingRecoveryCount() -
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 loggerlocalNode
- the local node of the recovery targetrecoveryTarget
- the target of the recoverystartingSeqNo
- 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
-
getRecoveryRef
Acquire a reference to the given recovery, throwing anIndexShardClosedException
if the recovery is unknown.
-