Class ReplicationMetadataRocksDBStoragePartition
java.lang.Object
com.linkedin.davinci.store.AbstractStoragePartition
com.linkedin.davinci.store.rocksdb.RocksDBStoragePartition
com.linkedin.davinci.store.rocksdb.ReplicationMetadataRocksDBStoragePartition
This
ReplicationMetadataRocksDBStoragePartition
is built to store key value pair along with the timestamp
metadata. It is designed for active/active replication mode, which uses putWithReplicationMetadata and getReplicationMetadata
to insert and retrieve replication metadata associated with a key. The implementation relies on different column family
in RocksDB to isolate the value and replication metadata of a key.-
Field Summary
Fields inherited from class com.linkedin.davinci.store.rocksdb.RocksDBStoragePartition
blobTransferEnabled, columnFamilyDescriptors, columnFamilyHandleList, deferredWrite, partitionId, READ_OPTIONS_DEFAULT, readCloseRWLock, readOnly, readWriteLeaderForDefaultCF, readWriteLeaderForRMDCF, replicaId, rocksDB, storeName, storeNameAndVersion, writeOnly, writeOptions
-
Constructor Summary
ConstructorDescriptionReplicationMetadataRocksDBStoragePartition
(StoragePartitionConfig storagePartitionConfig, RocksDBStorageEngineFactory factory, String dbDir, RocksDBMemoryStats rocksDBMemoryStats, RocksDBThrottler rocksDbThrottler, RocksDBServerConfig rocksDBServerConfig, VeniceStoreVersionConfig storeConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
beginBatchWrite
(Map<String, String> checkpointedInfo, Optional<Supplier<byte[]>> expectedChecksumSupplier) boolean
checkDatabaseIntegrity
(Map<String, String> checkpointedInfo) checks whether the current state of the database is valid during the start of ingestion.void
close()
Close the specific partitionvoid
deleteWithReplicationMetadata
(byte[] key, byte[] replicationMetadata) This API deletes a record from RocksDB but updates the metadata in ByteBuffer format and puts it into RocksDB.void
drop()
Drop when it is not required anymore.void
byte[]
This API retrieves replication metadata from replicationMetadataColumnFamily.long
void
putReplicationMetadata
(byte[] key, byte[] metadata) void
putWithReplicationMetadata
(byte[] key, byte[] value, byte[] metadata) This API takes in value and metadata as byte array format and put it into RocksDB.void
putWithReplicationMetadata
(byte[] key, ByteBuffer value, byte[] metadata) This API takes in value and metadata as ByteBuffer format and put it into RocksDB.sync()
Sync current database.boolean
Methods inherited from class com.linkedin.davinci.store.rocksdb.RocksDBStoragePartition
createSnapshot, delete, deleteFilesInDirectory, get, get, get, get, getApproximateMemoryUsageByType, getBlobTransferEnabled, getByKeyPrefix, getColumnFamilyHandleList, getEnvOptions, getIterator, getOptions, getPartitionSizeInBytes, getRocksDBStatValue, getStoreOptions, makeSureRocksDBIsStillOpen, multiGet, multiGet, put, put, put, reopen, verifyConfig
Methods inherited from class com.linkedin.davinci.store.AbstractStoragePartition
getPartitionId
-
Constructor Details
-
ReplicationMetadataRocksDBStoragePartition
public ReplicationMetadataRocksDBStoragePartition(StoragePartitionConfig storagePartitionConfig, RocksDBStorageEngineFactory factory, String dbDir, RocksDBMemoryStats rocksDBMemoryStats, RocksDBThrottler rocksDbThrottler, RocksDBServerConfig rocksDBServerConfig, VeniceStoreVersionConfig storeConfig)
-
-
Method Details
-
putWithReplicationMetadata
public void putWithReplicationMetadata(byte[] key, byte[] value, byte[] metadata) Description copied from class:AbstractStoragePartition
This API takes in value and metadata as byte array format and put it into RocksDB. OnlyReplicationMetadataRocksDBStoragePartition
will execute this method, other storage partition implementation will VeniceUnsupportedOperationException.- Overrides:
putWithReplicationMetadata
in classAbstractStoragePartition
-
putReplicationMetadata
public void putReplicationMetadata(byte[] key, byte[] metadata) - Overrides:
putReplicationMetadata
in classAbstractStoragePartition
-
getRmdByteUsage
public long getRmdByteUsage()- Overrides:
getRmdByteUsage
in classRocksDBStoragePartition
-
putWithReplicationMetadata
This API takes in value and metadata as ByteBuffer format and put it into RocksDB. Note that it is not an efficient implementation as it copies the content to perform the ByteBuffer -> byte[] conversion. TODO: Rewrite this implementation after we adopt the thread-local direct bytebuffer approach.- Overrides:
putWithReplicationMetadata
in classAbstractStoragePartition
-
getReplicationMetadata
Description copied from class:AbstractStoragePartition
This API retrieves replication metadata from replicationMetadataColumnFamily. OnlyReplicationMetadataRocksDBStoragePartition
will execute this method, other storage partition implementation will VeniceUnsupportedOperationException.- Overrides:
getReplicationMetadata
in classAbstractStoragePartition
-
deleteWithReplicationMetadata
public void deleteWithReplicationMetadata(byte[] key, byte[] replicationMetadata) This API deletes a record from RocksDB but updates the metadata in ByteBuffer format and puts it into RocksDB.- Overrides:
deleteWithReplicationMetadata
in classAbstractStoragePartition
-
checkDatabaseIntegrity
Description copied from class:AbstractStoragePartition
checks whether the current state of the database is valid during the start of ingestion.- Overrides:
checkDatabaseIntegrity
in classRocksDBStoragePartition
-
beginBatchWrite
public void beginBatchWrite(Map<String, String> checkpointedInfo, Optional<Supplier<byte[]>> expectedChecksumSupplier) - Overrides:
beginBatchWrite
in classRocksDBStoragePartition
-
endBatchWrite
public void endBatchWrite()- Overrides:
endBatchWrite
in classRocksDBStoragePartition
-
sync
Description copied from class:AbstractStoragePartition
Sync current database.- Overrides:
sync
in classRocksDBStoragePartition
- Returns:
- Database related info, which is required to be checkpointed.
-
close
public void close()Description copied from class:AbstractStoragePartition
Close the specific partition- Overrides:
close
in classRocksDBStoragePartition
-
validateBatchIngestion
public boolean validateBatchIngestion()- Overrides:
validateBatchIngestion
in classRocksDBStoragePartition
-
drop
public void drop()Description copied from class:AbstractStoragePartition
Drop when it is not required anymore.- Overrides:
drop
in classRocksDBStoragePartition
-
getFullPathForTempSSTFileDir
- Overrides:
getFullPathForTempSSTFileDir
in classRocksDBStoragePartition
-
getRocksDBSstFileWriter
- Overrides:
getRocksDBSstFileWriter
in classRocksDBStoragePartition
-
getValueFullPathForTempSSTFileDir
-
getValueRocksDBSstFileWriter
-