Class WriteComputeProcessor


  • @ThreadSafe
    public class WriteComputeProcessor
    extends java.lang.Object
    This class is able to read write-computed value and apply it to original value. Notice: though it's possible, we only support GenericRecord updating at this point. That's being said, both original and write compute object need to be GenericRecord. Currently, Venice supports 3 kinds of updates. 1. Record partial update. 2. Collection merging. 3. Value deletion. This class has the knowledge of different versions of write compute so that it can dispatch method calls to their corresponding write compute logic. Note that write-compute is only available for the root level field. Parsing nested fields are not supported at this point. TODO: since this class is very performance sensitive, we should add metrics to measure the TODO: time it spends and keep optimizing the operations
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.avro.generic.GenericRecord updateRecord​(org.apache.avro.Schema valueSchema, org.apache.avro.generic.GenericRecord currRecord, org.apache.avro.generic.GenericRecord writeComputeRecord)
      Apply write-compute operations on the given record.
      ValueAndRmd<org.apache.avro.generic.GenericRecord> updateRecordWithRmd​(org.apache.avro.Schema currValueSchema, ValueAndRmd<org.apache.avro.generic.GenericRecord> oldRecordAndRmd, org.apache.avro.generic.GenericRecord writeComputeRecord, long updateOperationTimestamp, int updateOperationColoID)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WriteComputeProcessor

        public WriteComputeProcessor​(MergeRecordHelper mergeRecordHelper)
    • Method Detail

      • updateRecord

        public org.apache.avro.generic.GenericRecord updateRecord​(org.apache.avro.Schema valueSchema,
                                                                  org.apache.avro.generic.GenericRecord currRecord,
                                                                  org.apache.avro.generic.GenericRecord writeComputeRecord)
        Apply write-compute operations on the given record.
        Parameters:
        valueSchema - the original value schema that write compute schema is derived from
        Returns:
        write-compute updated record
      • updateRecordWithRmd

        public ValueAndRmd<org.apache.avro.generic.GenericRecord> updateRecordWithRmd​(org.apache.avro.Schema currValueSchema,
                                                                                      ValueAndRmd<org.apache.avro.generic.GenericRecord> oldRecordAndRmd,
                                                                                      org.apache.avro.generic.GenericRecord writeComputeRecord,
                                                                                      long updateOperationTimestamp,
                                                                                      int updateOperationColoID)