Class ReplicationMetadataRocksDBStoragePartition
- java.lang.Object
-
- com.linkedin.davinci.store.AbstractStoragePartition
-
- com.linkedin.davinci.store.rocksdb.RocksDBStoragePartition
-
- com.linkedin.davinci.store.rocksdb.ReplicationMetadataRocksDBStoragePartition
-
public class ReplicationMetadataRocksDBStoragePartition extends RocksDBStoragePartition
ThisReplicationMetadataRocksDBStoragePartition
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
Constructors Constructor Description ReplicationMetadataRocksDBStoragePartition(StoragePartitionConfig storagePartitionConfig, RocksDBStorageEngineFactory factory, java.lang.String dbDir, RocksDBMemoryStats rocksDBMemoryStats, RocksDBThrottler rocksDbThrottler, RocksDBServerConfig rocksDBServerConfig, VeniceStoreVersionConfig storeConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginBatchWrite(java.util.Map<java.lang.String,java.lang.String> checkpointedInfo, java.util.Optional<java.util.function.Supplier<byte[]>> expectedChecksumSupplier)
boolean
checkDatabaseIntegrity(java.util.Map<java.lang.String,java.lang.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
endBatchWrite()
java.lang.String
getFullPathForTempSSTFileDir()
byte[]
getReplicationMetadata(java.nio.ByteBuffer key)
This API retrieves replication metadata from replicationMetadataColumnFamily.long
getRmdByteUsage()
RocksDBSstFileWriter
getRocksDBSstFileWriter()
java.lang.String
getValueFullPathForTempSSTFileDir()
RocksDBSstFileWriter
getValueRocksDBSstFileWriter()
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, java.nio.ByteBuffer value, byte[] metadata)
This API takes in value and metadata as ByteBuffer format and put it into RocksDB.java.util.Map<java.lang.String,java.lang.String>
sync()
Sync current database.boolean
validateBatchIngestion()
-
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 Detail
-
ReplicationMetadataRocksDBStoragePartition
public ReplicationMetadataRocksDBStoragePartition(StoragePartitionConfig storagePartitionConfig, RocksDBStorageEngineFactory factory, java.lang.String dbDir, RocksDBMemoryStats rocksDBMemoryStats, RocksDBThrottler rocksDbThrottler, RocksDBServerConfig rocksDBServerConfig, VeniceStoreVersionConfig storeConfig)
-
-
Method Detail
-
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
public void putWithReplicationMetadata(byte[] key, java.nio.ByteBuffer value, byte[] metadata)
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
public byte[] getReplicationMetadata(java.nio.ByteBuffer key)
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
public boolean checkDatabaseIntegrity(java.util.Map<java.lang.String,java.lang.String> checkpointedInfo)
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(java.util.Map<java.lang.String,java.lang.String> checkpointedInfo, java.util.Optional<java.util.function.Supplier<byte[]>> expectedChecksumSupplier)
- Overrides:
beginBatchWrite
in classRocksDBStoragePartition
-
endBatchWrite
public void endBatchWrite()
- Overrides:
endBatchWrite
in classRocksDBStoragePartition
-
sync
public java.util.Map<java.lang.String,java.lang.String> 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
public java.lang.String getFullPathForTempSSTFileDir()
- Overrides:
getFullPathForTempSSTFileDir
in classRocksDBStoragePartition
-
getRocksDBSstFileWriter
public RocksDBSstFileWriter getRocksDBSstFileWriter()
- Overrides:
getRocksDBSstFileWriter
in classRocksDBStoragePartition
-
getValueFullPathForTempSSTFileDir
public java.lang.String getValueFullPathForTempSSTFileDir()
-
getValueRocksDBSstFileWriter
public RocksDBSstFileWriter getValueRocksDBSstFileWriter()
-
-