public class RecoverySourceHandler
extends java.lang.Object
RateLimiter
passed via RecoverySettings
is shared across recoveries
originating from this nodes to throttle the number bytes send during file transfer. The transaction log
phase bypasses the rate limiter entirely.Modifier and Type | Field and Description |
---|---|
protected org.apache.logging.log4j.Logger |
logger |
protected org.elasticsearch.indices.recovery.RecoveryResponse |
response |
Constructor and Description |
---|
RecoverySourceHandler(IndexShard shard,
RecoveryTargetHandler recoveryTarget,
StartRecoveryRequest request,
java.util.function.Supplier<java.lang.Long> currentClusterStateVersionSupplier,
java.util.function.Function<java.lang.String,Releasable> delayNewRecoveries,
int fileChunkSizeInBytes,
org.apache.logging.log4j.Logger logger) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(java.lang.String reason)
Cancels the recovery and interrupts all eligible threads.
|
protected void |
failEngine(java.io.IOException cause) |
void |
finalizeRecovery()
finalizes the recovery process
|
void |
phase1(org.apache.lucene.index.IndexCommit snapshot,
Translog.View translogView)
Perform phase1 of the recovery operations.
|
void |
phase2(Translog.Snapshot snapshot)
Perform phase2 of the recovery process
|
protected void |
prepareTargetForTranslog(int totalTranslogOps,
long maxUnsafeAutoIdTimestamp) |
org.elasticsearch.indices.recovery.RecoveryResponse |
recoverToTarget()
performs the recovery from the local engine to the target
|
protected int |
sendSnapshot(Translog.Snapshot snapshot)
Send the given snapshot's operations to this handler's target node.
|
java.lang.String |
toString() |
protected final org.apache.logging.log4j.Logger logger
protected final org.elasticsearch.indices.recovery.RecoveryResponse response
public RecoverySourceHandler(IndexShard shard, RecoveryTargetHandler recoveryTarget, StartRecoveryRequest request, java.util.function.Supplier<java.lang.Long> currentClusterStateVersionSupplier, java.util.function.Function<java.lang.String,Releasable> delayNewRecoveries, int fileChunkSizeInBytes, org.apache.logging.log4j.Logger logger)
public org.elasticsearch.indices.recovery.RecoveryResponse recoverToTarget() throws java.io.IOException
java.io.IOException
public void phase1(org.apache.lucene.index.IndexCommit snapshot, Translog.View translogView)
IndexCommit
snapshot has been performed no commit operations (files being fsync'd)
are effectively allowed on this index until all recovery phases are done
Phase1 examines the segment files on the target node and copies over the segments that are missing. Only segments that have the same size and checksum can be reused
protected void prepareTargetForTranslog(int totalTranslogOps, long maxUnsafeAutoIdTimestamp) throws java.io.IOException
java.io.IOException
public void phase2(Translog.Snapshot snapshot)
Phase2 takes a snapshot of the current translog *without* acquiring the write lock (however, the translog snapshot is a point-in-time view of the translog). It then sends each translog operation to the target node so it can be replayed into the new shard.
public void finalizeRecovery()
protected int sendSnapshot(Translog.Snapshot snapshot)
Operations are bulked into a single request depending on an operation count limit or size-in-bytes limit
public void cancel(java.lang.String reason)
public java.lang.String toString()
toString
in class java.lang.Object
protected void failEngine(java.io.IOException cause)