Class PeerRecoveryTargetService
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.indices.recovery.PeerRecoveryTargetService
-
- All Implemented Interfaces:
IndexEventListener
public class PeerRecoveryTargetService extends AbstractComponent 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).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PeerRecoveryTargetService.Actions
static interface
PeerRecoveryTargetService.RecoveryListener
-
Field Summary
-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
deprecationLogger, logger, settings
-
-
Constructor Summary
Constructors Constructor Description PeerRecoveryTargetService(Settings settings, ThreadPool threadPool, TransportService transportService, RecoverySettings recoverySettings, ClusterService clusterService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeIndexShardClosed(ShardId shardId, IndexShard indexShard, Settings indexSettings)
Called before the index shard gets closed.static long
getStartingSeqNo(org.apache.logging.log4j.Logger logger, RecoveryTarget recoveryTarget)
Get the starting sequence number for a sequence-number-based request.protected void
retryRecovery(long recoveryId, java.lang.String reason, TimeValue retryAfter, TimeValue activityTimeout)
protected void
retryRecovery(long recoveryId, java.lang.Throwable reason, TimeValue retryAfter, TimeValue activityTimeout)
void
startRecovery(IndexShard indexShard, DiscoveryNode sourceNode, PeerRecoveryTargetService.RecoveryListener listener)
-
Methods inherited from class org.elasticsearch.common.component.AbstractComponent
logDeprecatedSetting, logRemovedSetting, nodeName
-
Methods inherited from interface org.elasticsearch.index.shard.IndexEventListener
afterIndexCreated, afterIndexRemoved, afterIndexShardClosed, afterIndexShardCreated, afterIndexShardDeleted, afterIndexShardStarted, beforeIndexAddedToCluster, beforeIndexCreated, beforeIndexRemoved, beforeIndexShardCreated, beforeIndexShardDeleted, indexShardStateChanged, onShardInactive, onStoreClosed, shardRoutingChanged
-
-
-
-
Constructor Detail
-
PeerRecoveryTargetService
public PeerRecoveryTargetService(Settings settings, ThreadPool threadPool, TransportService transportService, RecoverySettings recoverySettings, ClusterService clusterService)
-
-
Method Detail
-
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
indexShard
- The index shard
-
startRecovery
public void startRecovery(IndexShard indexShard, DiscoveryNode sourceNode, PeerRecoveryTargetService.RecoveryListener listener)
-
retryRecovery
protected void retryRecovery(long recoveryId, java.lang.Throwable reason, TimeValue retryAfter, TimeValue activityTimeout)
-
retryRecovery
protected void retryRecovery(long recoveryId, java.lang.String reason, TimeValue retryAfter, TimeValue activityTimeout)
-
getStartingSeqNo
public static long getStartingSeqNo(org.apache.logging.log4j.Logger logger, RecoveryTarget recoveryTarget)
Get the starting sequence number for a sequence-number-based request.- Parameters:
recoveryTarget
- the target of the recovery- Returns:
- the starting sequence number or
SequenceNumbers.UNASSIGNED_SEQ_NO
if obtaining the starting sequence number failed
-
-