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_NAME_SEPARATOR, VIEW_STORE_PREFIX, viewParameters
-
Constructor Summary
ConstructorsConstructorDescriptionMaterializedViewWriter
(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.boolean
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, boolean isChunkedKey, Lazy<org.apache.avro.generic.GenericRecord> newValueProvider) Before we have proper chunking support for view writers we assume that even when chunking is enabled the actual k/v will not be chunked.processRecord
(ByteBuffer newValue, ByteBuffer oldValue, byte[] key, int newValueSchemaId, int oldValueSchemaId, org.apache.avro.generic.GenericRecord replicationMetadataRecord, Lazy<org.apache.avro.generic.GenericRecord> valueProvider) 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, composeTopicName, getStoreName, getStoreNameFromViewStoreName, getTopicNamesAndConfigsForVersion, getViewNameFromViewStoreName, getViewStoreName, getWriterOptionsBuilder, isViewStore, isViewTopic, parseStoreAndViewFromViewTopic, 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<Void> processRecord(ByteBuffer newValue, ByteBuffer oldValue, byte[] key, int newValueSchemaId, int oldValueSchemaId, org.apache.avro.generic.GenericRecord replicationMetadataRecord, Lazy<org.apache.avro.generic.GenericRecord> valueProvider) 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.valueProvider
- to provide the corresponding deserialized newValue for PUT and UPDATE or the old value for the given key for DELETE.
-
processRecord
public CompletableFuture<Void> processRecord(ByteBuffer newValue, byte[] key, int newValueSchemaId, boolean isChunkedKey, Lazy<org.apache.avro.generic.GenericRecord> newValueProvider) Before we have proper chunking support for view writers we assume that even when chunking is enabled the actual k/v will not be chunked. This way we don't need to worry about how to ensure all the chunks are forwarded to the same view partition during NR's pass-through mode. Proper chunking support can leverage message footer populated by the CompositeVeniceWriter in VPJ (write to views first and then VT) to figure out which view partition to forward the chunks to. Another alternative is trigger the view writer write upon receiving the manifest, and we will assemble and re-chunk.- 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 recordisChunkedKey
- is the key already serialized withKeyWithChunkingSuffixSerializer
newValueProvider
- to provide the deserialized new value
-
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.
-
isComplexVenicePartitioner
public boolean isComplexVenicePartitioner()
-