Class BlobSnapshotManager


  • public class BlobSnapshotManager
    extends java.lang.Object
    This class will manage the snapshot creation, for batch store and hybrid store.
    • Field Detail

      • DEFAULT_MAX_CONCURRENT_USERS

        public static final int DEFAULT_MAX_CONCURRENT_USERS
        See Also:
        Constant Field Values
    • 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 name
        partitionId - 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