RecoveryTargetHandler
public class RemoteRecoveryTargetHandler extends java.lang.Object implements RecoveryTargetHandler
Constructor | Description |
---|---|
RemoteRecoveryTargetHandler(long recoveryId,
ShardId shardId,
TransportService transportService,
DiscoveryNode targetNode,
RecoverySettings recoverySettings,
java.util.function.Consumer<java.lang.Long> onSourceThrottle) |
Modifier and Type | Method | Description |
---|---|---|
void |
cleanFiles(int totalTranslogOps,
Store.MetadataSnapshot sourceMetaData) |
After all source files has been sent over, this command is sent to the target so it can clean any local
files that are not part of the source store
|
void |
ensureClusterStateVersion(long clusterStateVersion) |
Blockingly waits for cluster state with at least clusterStateVersion to be available
|
void |
finalizeRecovery(long globalCheckpoint) |
The finalize request refreshes the engine now that new segments are available, enables garbage collection of tombstone files, and
updates the global checkpoint.
|
void |
handoffPrimaryContext(GlobalCheckpointTracker.PrimaryContext primaryContext) |
Handoff the primary context between the relocation source and the relocation target.
|
long |
indexTranslogOperations(java.util.List<Translog.Operation> operations,
int totalTranslogOps) |
Index a set of translog operations on the target
|
void |
prepareForTranslogOperations(boolean createNewTranslog,
int totalTranslogOps) |
Prepares the target to receive translog operations, after all file have been copied
|
void |
receiveFileInfo(java.util.List<java.lang.String> phase1FileNames,
java.util.List<java.lang.Long> phase1FileSizes,
java.util.List<java.lang.String> phase1ExistingFileNames,
java.util.List<java.lang.Long> phase1ExistingFileSizes,
int totalTranslogOps) |
Notifies the target of the files it is going to receive
|
void |
writeFileChunk(StoreFileMetaData fileMetaData,
long position,
BytesReference content,
boolean lastChunk,
int totalTranslogOps) |
writes a partial file chunk to the target store
|
public RemoteRecoveryTargetHandler(long recoveryId, ShardId shardId, TransportService transportService, DiscoveryNode targetNode, RecoverySettings recoverySettings, java.util.function.Consumer<java.lang.Long> onSourceThrottle)
public void prepareForTranslogOperations(boolean createNewTranslog, int totalTranslogOps) throws java.io.IOException
RecoveryTargetHandler
prepareForTranslogOperations
in interface RecoveryTargetHandler
createNewTranslog
- whether or not to delete the local translog on the targettotalTranslogOps
- total translog operations expected to be sentjava.io.IOException
public void finalizeRecovery(long globalCheckpoint)
RecoveryTargetHandler
finalizeRecovery
in interface RecoveryTargetHandler
globalCheckpoint
- the global checkpoint on the recovery sourcepublic void ensureClusterStateVersion(long clusterStateVersion)
RecoveryTargetHandler
ensureClusterStateVersion
in interface RecoveryTargetHandler
public void handoffPrimaryContext(GlobalCheckpointTracker.PrimaryContext primaryContext)
RecoveryTargetHandler
handoffPrimaryContext
in interface RecoveryTargetHandler
primaryContext
- the primary context from the relocation sourcepublic long indexTranslogOperations(java.util.List<Translog.Operation> operations, int totalTranslogOps)
RecoveryTargetHandler
indexTranslogOperations
in interface RecoveryTargetHandler
operations
- operations to indextotalTranslogOps
- current number of total operations expected to be indexedpublic void receiveFileInfo(java.util.List<java.lang.String> phase1FileNames, java.util.List<java.lang.Long> phase1FileSizes, java.util.List<java.lang.String> phase1ExistingFileNames, java.util.List<java.lang.Long> phase1ExistingFileSizes, int totalTranslogOps)
RecoveryTargetHandler
receiveFileInfo
in interface RecoveryTargetHandler
public void cleanFiles(int totalTranslogOps, Store.MetadataSnapshot sourceMetaData) throws java.io.IOException
RecoveryTargetHandler
cleanFiles
in interface RecoveryTargetHandler
totalTranslogOps
- an update number of translog operations that will be replayed later onsourceMetaData
- meta data of the source storejava.io.IOException
public void writeFileChunk(StoreFileMetaData fileMetaData, long position, BytesReference content, boolean lastChunk, int totalTranslogOps) throws java.io.IOException
RecoveryTargetHandler
writeFileChunk
in interface RecoveryTargetHandler
java.io.IOException