Class MainIngestionStorageMetadataService
java.lang.Object
com.linkedin.venice.service.AbstractVeniceService
com.linkedin.davinci.ingestion.main.MainIngestionStorageMetadataService
- All Implemented Interfaces:
StorageMetadataService,OffsetManager,Closeable,AutoCloseable
public class MainIngestionStorageMetadataService
extends AbstractVeniceService
implements StorageMetadataService
MainIngestionStorageMetadataService is an in-memory storage metadata service for
IsolatedIngestionBackend.
It keeps storage metadata in the memory so RocksDB metadata partitions can be opened by isolated ingestion process only.
For metadata update generated by hybrid ingestion, it will sync and persist the update to the RocksDB metadata partition
through IPC protocol.-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState -
Field Summary
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState -
Constructor Summary
ConstructorsConstructorDescriptionMainIngestionStorageMetadataService(int targetPort, InternalAvroSpecificSerializer<PartitionState> partitionStateSerializer, MetadataUpdateStats metadataUpdateStats, VeniceConfigLoader configLoader, BiConsumer<String, StoreVersionState> storeVersionStateSyncer) -
Method Summary
Modifier and TypeMethodDescriptionvoidclearOffset(String topicName, int partitionId) voidclearStoreVersionState(String topicName) This will clear all metadata, including store-version state and partition states, tied to .computeStoreVersionState(String topicName, Function<StoreVersionState, StoreVersionState> mapFunction) getLastOffset(String topicName, int partitionId, PubSubContext pubSubContext) Gets the Last Known persisted offset of this consumer.getStoreVersionState(String topicName) Gets the currently-persistedStoreVersionStatefor this topic.voidput(String topicName, int partitionId, OffsetRecord record) Records the offset with underlying/external storage.voidputOffsetRecord(String topicName, int partitionId, OffsetRecord record) putOffsetRecord will only put OffsetRecord into in-memory state, without persisting into metadata RocksDB partition.voidputStoreVersionState(String topicName, StoreVersionState record) putStoreVersionState will only put StoreVersionState into in-memory state, without persisting into metadata RocksDB partition.booleanvoidMethods inherited from class com.linkedin.venice.service.AbstractVeniceService
close, getName, isRunning, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.davinci.storage.StorageMetadataService
getStoreVersionCompressionDictionary
-
Constructor Details
-
MainIngestionStorageMetadataService
public MainIngestionStorageMetadataService(int targetPort, InternalAvroSpecificSerializer<PartitionState> partitionStateSerializer, MetadataUpdateStats metadataUpdateStats, VeniceConfigLoader configLoader, BiConsumer<String, StoreVersionState> storeVersionStateSyncer)
-
-
Method Details
-
startInner
- Specified by:
startInnerin classAbstractVeniceService- Returns:
- true if the service is completely started,
false if it is still starting asynchronously (in this case, it is the implementer's
responsibility to set
AbstractVeniceService.serviceStatetoAbstractVeniceService.ServiceState.STARTEDupon completion of the async work). - Throws:
Exception
-
stopInner
- Specified by:
stopInnerin classAbstractVeniceService- Throws:
Exception
-
computeStoreVersionState
public StoreVersionState computeStoreVersionState(String topicName, Function<StoreVersionState, StoreVersionState> mapFunction) throws VeniceException- Specified by:
computeStoreVersionStatein interfaceStorageMetadataService- Throws:
VeniceException
-
clearStoreVersionState
Description copied from interface:StorageMetadataServiceThis will clear all metadata, including store-version state and partition states, tied to .- Specified by:
clearStoreVersionStatein interfaceStorageMetadataService- Parameters:
topicName- to be cleared
-
getStoreVersionState
Description copied from interface:StorageMetadataServiceGets the currently-persistedStoreVersionStatefor this topic.- Specified by:
getStoreVersionStatein interfaceStorageMetadataService- Parameters:
topicName- kafka topic to which the consumer thread is registered to.- Returns:
- an instance of
StoreVersionStatecorresponding to this topic, or null if there isn't any. - Throws:
VeniceException
-
put
Description copied from interface:OffsetManagerRecords the offset with underlying/external storage. Persistence to disk happens in configurable time interval by a background thread. For example in case of BDB the check pointer thread can be configured to do this.- Specified by:
putin interfaceOffsetManager- Parameters:
topicName- kafka topic to which the consumer thread is registered to.partitionId- kafka partition id for which the consumer thread is registered to.record- OffSetRecord containing last read offset for the topic and partition combination.- Throws:
VeniceException
-
clearOffset
- Specified by:
clearOffsetin interfaceOffsetManager
-
getLastOffset
public OffsetRecord getLastOffset(String topicName, int partitionId, PubSubContext pubSubContext) throws VeniceException Description copied from interface:OffsetManagerGets the Last Known persisted offset of this consumer.- Specified by:
getLastOffsetin interfaceOffsetManager- Parameters:
topicName- kafka topic to which the consumer thread is registered to.partitionId- kafka partition id for which the consumer thread is registered to.pubSubContext- PubSubContext for passing PubSub related dependencies- Returns:
- OffsetRecord - contains offset and time when it was recorded before the consumer thread went down. consumer
- Throws:
VeniceException
-
putOffsetRecord
putOffsetRecord will only put OffsetRecord into in-memory state, without persisting into metadata RocksDB partition. -
putStoreVersionState
putStoreVersionState will only put StoreVersionState into in-memory state, without persisting into metadata RocksDB partition.
-