Class BlobSnapshotManager
- java.lang.Object
-
- com.linkedin.davinci.blobtransfer.BlobSnapshotManager
-
public class BlobSnapshotManager extends java.lang.ObjectThis class will manage the snapshot creation, for batch store and hybrid store.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_CONCURRENT_USERS
-
Constructor Summary
Constructors Constructor Description BlobSnapshotManager(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)Constructor for the BlobSnapshotManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateSnapshot(java.lang.String kafkaVersionTopic, int partitionId)Create a snapshot for a particular partitionstatic voidcreateSnapshot(org.rocksdb.RocksDB rocksDB, java.lang.String fullPathForPartitionDBSnapshot)util method to create a snapshot It will check the snapshot directory and delete it if it exists, then generate a new snapshotvoiddecreaseConcurrentUserCount(BlobTransferPayload blobTransferRequest)Decrease the count of hosts using the snapshotprotected longgetConcurrentSnapshotUsers(java.lang.String topicName, int partitionId)BlobTransferPartitionMetadatagetTransferMetadata(BlobTransferPayload payload)Get the transfer metadata for a particular payload 0.BlobTransferPartitionMetadatagetTransferredSnapshotMetadata(java.lang.String topicName, int partitionId)Get the snapshot metadata for a particular topic and partitionbooleanisStoreHybrid(java.lang.String storeName)Check if the store is hybridBlobTransferPartitionMetadataprepareMetadata(BlobTransferPayload blobTransferRequest)Prepare the metadata for a blob transfer request
-
-
-
Field Detail
-
DEFAULT_MAX_CONCURRENT_USERS
public static final int DEFAULT_MAX_CONCURRENT_USERS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BlobSnapshotManager
public BlobSnapshotManager(ReadOnlyStoreRepository readOnlyStoreRepository, StorageEngineRepository storageEngineRepository, StorageMetadataService storageMetadataService, int maxConcurrentUsers, int snapshotRetentionTimeInMin)
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 Detail
-
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
public void decreaseConcurrentUserCount(BlobTransferPayload blobTransferRequest)
Decrease the count of hosts using the snapshot
-
getConcurrentSnapshotUsers
protected long getConcurrentSnapshotUsers(java.lang.String topicName, int partitionId)
-
isStoreHybrid
public boolean isStoreHybrid(java.lang.String storeName)
Check if the store is hybrid- Parameters:
storeName- the name of the store- Returns:
- true if the store is hybrid, false otherwise
-
createSnapshot
public static void createSnapshot(org.rocksdb.RocksDB rocksDB, java.lang.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
public void createSnapshot(java.lang.String kafkaVersionTopic, int partitionId)Create a snapshot for a particular partition
-
getTransferredSnapshotMetadata
public BlobTransferPartitionMetadata getTransferredSnapshotMetadata(java.lang.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
public BlobTransferPartitionMetadata prepareMetadata(BlobTransferPayload blobTransferRequest)
Prepare the metadata for a blob transfer request- Parameters:
blobTransferRequest- the blob transfer request- Returns:
- the metadata for the blob transfer request
-
-