Package com.linkedin.davinci.store.view
Class MaterializedViewWriter
java.lang.Object
com.linkedin.venice.views.VeniceView
com.linkedin.davinci.store.view.VeniceViewWriter
com.linkedin.davinci.store.view.MaterializedViewWriter
Materialized view writer is responsible for processing input records from the version topic and write them to the
materialized view topic based on parameters defined in
MaterializedViewParameters
.
This writer has its own VeniceWriter
.-
Field Summary
Fields inherited from class com.linkedin.davinci.store.view.VeniceViewWriter
isNearlineProducerCompressionEnabled, nearlineProducerCountPerWriter, version, versionNumber
Fields inherited from class com.linkedin.venice.views.VeniceView
props, storeName, VIEW_TOPIC_SEPARATOR, viewParameters
-
Constructor Summary
ConstructorDescriptionMaterializedViewWriter
(VeniceConfigLoader props, Version version, org.apache.avro.Schema keySchema, Map<String, String> extraViewParameters) -
Method Summary
Modifier and TypeMethodDescriptionImplementations should return the fully specified class name for the component VeniceViewWriter implementation.void
processControlMessage
(KafkaKey kafkaKey, KafkaMessageEnvelope kafkaMessageEnvelope, ControlMessage controlMessage, int partition, PartitionConsumptionState partitionConsumptionState) Called when the server encounters a control message.processRecord
(ByteBuffer newValue, byte[] key, int newValueSchemaId) To be called as a given ingestion task consumes each record.processRecord
(ByteBuffer newValue, ByteBuffer oldValue, byte[] key, int newValueSchemaId, int oldValueSchemaId, org.apache.avro.generic.GenericRecord replicationMetadataRecord) To be called as a given ingestion task consumes each record.Methods inherited from class com.linkedin.davinci.store.view.VeniceViewWriter
setProducerOptimizations
Methods inherited from class com.linkedin.venice.views.VeniceView
close, getTopicNamesAndConfigsForVersion, getWriterOptionsBuilder, isViewTopic, parseStoreFromViewTopic, parseVersionFromViewTopic, validateConfigs
-
Constructor Details
-
MaterializedViewWriter
public MaterializedViewWriter(VeniceConfigLoader props, Version version, org.apache.avro.Schema keySchema, Map<String, String> extraViewParameters)
-
-
Method Details
-
processRecord
public CompletableFuture<PubSubProduceResult> processRecord(ByteBuffer newValue, ByteBuffer oldValue, byte[] key, int newValueSchemaId, int oldValueSchemaId, org.apache.avro.generic.GenericRecord replicationMetadataRecord) Description copied from class:VeniceViewWriter
To be called as a given ingestion task consumes each record. This is called prior to writing to a VT or to persistent storage.- Specified by:
processRecord
in classVeniceViewWriter
- Parameters:
newValue
- the incoming fully specified value which hasn't yet been committed to VeniceoldValue
- the previous value which has already been locally committed to Venice for the given keykey
- the key of the record that designates newValue and oldValuenewValueSchemaId
- the schemaId of the incoming recordoldValueSchemaId
- the schemaId of the old recordreplicationMetadataRecord
- the associated RMD for the incoming record.
-
processRecord
public CompletableFuture<PubSubProduceResult> processRecord(ByteBuffer newValue, byte[] key, int newValueSchemaId) Description copied from class:VeniceViewWriter
To be called as a given ingestion task consumes each record. This is called prior to writing to a VT or to persistent storage.- Specified by:
processRecord
in classVeniceViewWriter
- Parameters:
newValue
- the incoming fully specified value which hasn't yet been committed to Venicekey
- the key of the record that designates newValue and oldValuenewValueSchemaId
- the schemaId of the incoming record
-
processControlMessage
public void processControlMessage(KafkaKey kafkaKey, KafkaMessageEnvelope kafkaMessageEnvelope, ControlMessage controlMessage, int partition, PartitionConsumptionState partitionConsumptionState) Description copied from class:VeniceViewWriter
Called when the server encounters a control message. There isn't (today) a strict ordering on if the rest of the server alters it's state completely or not based on the incoming control message relative to the given view. Different view types may be interested in different control messages and act differently. The corresponding view writer should implement this method accordingly.- Overrides:
processControlMessage
in classVeniceViewWriter
- Parameters:
kafkaKey
- the corresponding kafka key of this control messagekafkaMessageEnvelope
- the corresponding kafka message envelope of this control messagecontrolMessage
- the control message we're processingpartition
- the partition this control message was delivered topartitionConsumptionState
- the pcs of the consuming node
-
getWriterClassName
Description copied from class:VeniceView
Implementations should return the fully specified class name for the component VeniceViewWriter implementation.- Overrides:
getWriterClassName
in classVeniceView
- Returns:
- returns the className of the writer which should be instantiated.
-