Class TranslogTransferManager
java.lang.Object
org.opensearch.index.translog.transfer.TranslogTransferManager
The class responsible for orchestrating the transfer of a
TransferSnapshot
via a TransferService
- Opensearch.internal:
-
Constructor Summary
ConstructorsConstructorDescriptionTranslogTransferManager
(org.opensearch.core.index.shard.ShardId shardId, TransferService transferService, BlobPath remoteDataTransferPath, BlobPath remoteMetadataTransferPath, FileTransferTracker fileTransferTracker, RemoteTranslogTransferTracker remoteTranslogTransferTracker, RemoteStoreSettings remoteStoreSettings) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Deletes all the translog content related to the underlying shard.void
deleteGenerationAsync
(long primaryTerm, Set<Long> generations, Runnable onCompletion) This method handles deletion of multiple generations for a single primary term.void
deletePrimaryTermsAsync
(long minPrimaryTermToKeep) Deletes all primary terms from remote store that are more than the givenminPrimaryTermToKeep
.void
deleteStaleTranslogMetadataFilesAsync
(Runnable onCompletion) void
boolean
downloadTranslog
(String primaryTerm, String generation, Path location) int
byte[]
getMetadataBytes
(TranslogTransferMetadata metadata) Get the metadata bytes for aTranslogTransferMetadata
objectorg.opensearch.core.index.shard.ShardId
boolean
transferSnapshot
(TransferSnapshot transferSnapshot, TranslogTransferListener translogTransferListener)
-
Constructor Details
-
TranslogTransferManager
public TranslogTransferManager(org.opensearch.core.index.shard.ShardId shardId, TransferService transferService, BlobPath remoteDataTransferPath, BlobPath remoteMetadataTransferPath, FileTransferTracker fileTransferTracker, RemoteTranslogTransferTracker remoteTranslogTransferTracker, RemoteStoreSettings remoteStoreSettings)
-
-
Method Details
-
getRemoteTranslogTransferTracker
-
getShardId
public org.opensearch.core.index.shard.ShardId getShardId() -
transferSnapshot
public boolean transferSnapshot(TransferSnapshot transferSnapshot, TranslogTransferListener translogTransferListener) throws IOException - Throws:
IOException
-
downloadTranslog
public boolean downloadTranslog(String primaryTerm, String generation, Path location) throws IOException - Throws:
IOException
-
readMetadata
- Throws:
IOException
-
getMetadataBytes
Get the metadata bytes for aTranslogTransferMetadata
object- Parameters:
metadata
- The object to be parsed- Returns:
- Byte representation for the given metadata
- Throws:
IOException
-
deleteGenerationAsync
This method handles deletion of multiple generations for a single primary term. The deletion happens for translog and metadata files.- Parameters:
primaryTerm
- primary term where the generations will be deleted.generations
- set of generation to delete.onCompletion
- runnable to run on completion of deletion regardless of success/failure.
-
deletePrimaryTermsAsync
public void deletePrimaryTermsAsync(long minPrimaryTermToKeep) Deletes all primary terms from remote store that are more than the givenminPrimaryTermToKeep
. The caller of the method must ensure that the value is lesser than equal to the minimum primary term referenced by the remote translog metadata.- Parameters:
minPrimaryTermToKeep
- all primary terms below this primary term are deleted.
-
delete
public void delete()Deletes all the translog content related to the underlying shard. -
deleteStaleTranslogMetadataFilesAsync
-
deleteTranslogFiles
- Throws:
IOException
-
getMaxRemoteTranslogReadersSettings
public int getMaxRemoteTranslogReadersSettings()
-