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 | Description |
---|---|---|
protected org.apache.logging.log4j.Logger |
logger |
|
protected org.elasticsearch.indices.recovery.RecoveryResponse |
response |
Constructor | Description |
---|---|
RecoverySourceHandler(IndexShard shard,
RecoveryTargetHandler recoveryTarget,
StartRecoveryRequest request,
int fileChunkSizeInBytes,
Settings nodeSettings) |
Modifier and Type | Method | Description |
---|---|---|
void |
cancel(java.lang.String reason) |
Cancels the recovery and interrupts all eligible threads.
|
protected void |
failEngine(java.io.IOException cause) |
|
void |
finalizeRecovery(long targetLocalCheckpoint) |
|
StartRecoveryRequest |
getRequest() |
|
void |
phase1(org.apache.lucene.index.IndexCommit snapshot,
java.util.function.Supplier<java.lang.Integer> translogOps) |
Perform phase1 of the recovery operations.
|
org.elasticsearch.indices.recovery.RecoveryResponse |
recoverToTarget() |
performs the recovery from the local engine to the target
|
protected org.elasticsearch.indices.recovery.RecoverySourceHandler.SendSnapshotResult |
sendSnapshot(long startingSeqNo,
long requiredSeqNoRangeStart,
long endingSeqNo,
Translog.Snapshot snapshot) |
Send the given snapshot's operations with a sequence number greater than the specified staring sequence number 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, int fileChunkSizeInBytes, Settings nodeSettings)
public StartRecoveryRequest getRequest()
public org.elasticsearch.indices.recovery.RecoveryResponse recoverToTarget() throws java.io.IOException
java.io.IOException
public void phase1(org.apache.lucene.index.IndexCommit snapshot, java.util.function.Supplier<java.lang.Integer> translogOps)
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
public void finalizeRecovery(long targetLocalCheckpoint) throws java.io.IOException
java.io.IOException
protected org.elasticsearch.indices.recovery.RecoverySourceHandler.SendSnapshotResult sendSnapshot(long startingSeqNo, long requiredSeqNoRangeStart, long endingSeqNo, Translog.Snapshot snapshot) throws java.io.IOException
Operations are bulked into a single request depending on an operation count limit or size-in-bytes limit.
startingSeqNo
- the sequence number for which only operations with a sequence number greater than this will be sentrequiredSeqNoRangeStart
- the lower sequence number of the required rangeendingSeqNo
- the upper bound of the sequence number range to be sent (inclusive)snapshot
- the translog snapshot to replay operations from @return the local checkpoint on the target and the
total number of operations sentjava.io.IOException
- if an I/O exception occurred reading the translog snapshotpublic void cancel(java.lang.String reason)
public java.lang.String toString()
toString
in class java.lang.Object
protected void failEngine(java.io.IOException cause)