Class BlobSnapshotManager
java.lang.Object
com.linkedin.davinci.blobtransfer.BlobSnapshotManager
This class will manage the snapshot creation, for batch store and hybrid store.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBlobSnapshotManager
(ReadOnlyStoreRepository readOnlyStoreRepository, StorageEngineRepository storageEngineRepository, StorageMetadataService storageMetadataService) The constructor for the BlobSnapshotManager, with default max concurrent users and snapshot retention timeBlobSnapshotManager
(ReadOnlyStoreRepository readOnlyStoreRepository, StorageEngineRepository storageEngineRepository, StorageMetadataService storageMetadataService, int maxConcurrentUsers, int snapshotRetentionTimeInMin, BlobTransferUtils.BlobTransferTableFormat transferTableFormat) Constructor for the BlobSnapshotManager -
Method Summary
Modifier and TypeMethodDescriptionvoid
createSnapshot
(String kafkaVersionTopic, int partitionId) Create a snapshot for a particular partitionstatic void
createSnapshot
(org.rocksdb.RocksDB rocksDB, String fullPathForPartitionDBSnapshot) util method to create a snapshot It will check the snapshot directory and delete it if it exists, then generate a new snapshotvoid
decreaseConcurrentUserCount
(BlobTransferPayload blobTransferRequest) Decrease the count of hosts using the snapshotGet the current snapshot format, which is a config value.protected int
getConcurrentSnapshotUsers
(String topicName, int partitionId) getTransferMetadata
(BlobTransferPayload payload) Get the transfer metadata for a particular payload 0.getTransferredSnapshotMetadata
(String topicName, int partitionId) Get the snapshot metadata for a particular topic and partitionboolean
isStoreHybrid
(String storeName, int versionNum) Check if the store is hybridprepareMetadata
(BlobTransferPayload blobTransferRequest) Prepare the metadata for a blob transfer request
-
Field Details
-
DEFAULT_MAX_CONCURRENT_USERS
public static final int DEFAULT_MAX_CONCURRENT_USERS- See Also:
-
-
Constructor Details
-
BlobSnapshotManager
public BlobSnapshotManager(ReadOnlyStoreRepository readOnlyStoreRepository, StorageEngineRepository storageEngineRepository, StorageMetadataService storageMetadataService, int maxConcurrentUsers, int snapshotRetentionTimeInMin, BlobTransferUtils.BlobTransferTableFormat transferTableFormat) Constructor for the BlobSnapshotManager -
BlobSnapshotManager
public BlobSnapshotManager(ReadOnlyStoreRepository readOnlyStoreRepository, StorageEngineRepository storageEngineRepository, StorageMetadataService storageMetadataService) The constructor for the BlobSnapshotManager, with default max concurrent users and snapshot retention time
-
-
Method Details
-
getTransferMetadata
public BlobTransferPartitionMetadata getTransferMetadata(BlobTransferPayload payload) throws VeniceException Get the transfer metadata for a particular payload 0. pre-check: throttle the request if many concurrent users. 1. the store is not hybrid, it will prepare the metadata and return it. 2. the store is hybrid: 2. 1. check snapshot staleness 2. 1. 1. if stale, recreate the snapshot and metadata, then return the metadata 2. 1. 2. if not stale, directly return the metadata- Parameters:
payload
- the blob transfer payload- Returns:
- the need transfer metadata to client
- Throws:
VeniceException
-
decreaseConcurrentUserCount
Decrease the count of hosts using the snapshot -
getConcurrentSnapshotUsers
-
isStoreHybrid
Check if the store is hybrid- Parameters:
storeName
- the name of the storeversionNum
- the version number- Returns:
- true if the store is hybrid, false otherwise
-
createSnapshot
public static void createSnapshot(org.rocksdb.RocksDB rocksDB, String fullPathForPartitionDBSnapshot) util method to create a snapshot It will check the snapshot directory and delete it if it exists, then generate a new snapshot -
createSnapshot
Create a snapshot for a particular partition -
getTransferredSnapshotMetadata
public BlobTransferPartitionMetadata getTransferredSnapshotMetadata(String topicName, int partitionId) Get the snapshot metadata for a particular topic and partition- Parameters:
topicName
- the topic namepartitionId
- the partition id- Returns:
- the snapshot metadata
-
prepareMetadata
Prepare the metadata for a blob transfer request- Parameters:
blobTransferRequest
- the blob transfer request- Returns:
- the metadata for the blob transfer request
-
getBlobTransferTableFormat
Get the current snapshot format, which is a config value.- Returns:
- the transfer table format, BLOCK_BASED_TABLE or PLAIN_TABLE.
-