Class MergeConflictResolver
- java.lang.Object
-
- com.linkedin.davinci.replication.merge.MergeConflictResolver
-
public class MergeConflictResolver extends java.lang.Object
The workflow is Query old replication metadata. If it's null (and running in first batch push merge policy), then write the new value directly. If the old replication metadata exists, then deserialize it and run Merge. If the incoming TS is higher than the entirety of the old replication metadata, then write the new value directly. If the incoming TS is lower than the entirety of the old replication metadata, then drop the new value. If the incoming TS is partially higher, partially lower, than the old replication metadata, then query the old value, deserialize it, and pass it to Merge , Merge
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.avro.generic.GenericRecord
createPerFieldTimestampRecord(org.apache.avro.Schema rmdSchema, long fieldTimestamp, org.apache.avro.generic.GenericRecord oldValueRecord)
MergeConflictResult
delete(Lazy<java.nio.ByteBuffer> oldValueBytesProvider, RmdWithValueSchemaId rmdWithValueSchemaID, long deleteOperationTimestamp, long deleteOperationSourceOffset, int deleteOperationSourceBrokerID, int deleteOperationColoID)
Perform conflict resolution when the incoming operation is a DELETE operation.MergeConflictResult
put(Lazy<java.nio.ByteBuffer> oldValueBytesProvider, RmdWithValueSchemaId rmdWithValueSchemaID, java.nio.ByteBuffer newValueBytes, long putOperationTimestamp, int newValueSchemaID, long newValueSourceOffset, int newValueSourceBrokerID, int newValueColoID)
Perform conflict resolution when the incoming operation is a PUT operation.MergeConflictResult
update(Lazy<java.nio.ByteBuffer> oldValueBytes, RmdWithValueSchemaId rmdWithValueSchemaId, java.nio.ByteBuffer updateBytes, int incomingValueSchemaId, int incomingUpdateProtocolVersion, long updateOperationTimestamp, long newValueSourceOffset, int newValueSourceBrokerID, int newValueColoID, ChunkedValueManifestContainer oldValueManifest)
-
-
-
Method Detail
-
put
public MergeConflictResult put(Lazy<java.nio.ByteBuffer> oldValueBytesProvider, RmdWithValueSchemaId rmdWithValueSchemaID, java.nio.ByteBuffer newValueBytes, long putOperationTimestamp, int newValueSchemaID, long newValueSourceOffset, int newValueSourceBrokerID, int newValueColoID)
Perform conflict resolution when the incoming operation is a PUT operation.- Parameters:
oldValueBytesProvider
- A Lazy supplier of currently persisted value bytes.rmdWithValueSchemaID
- The replication metadata of the currently persisted value and the value schema ID (or null)newValueBytes
- The value in the incoming record.putOperationTimestamp
- The logical timestamp of the incoming record.newValueSchemaID
- The schema id of the value in the incoming record.newValueSourceOffset
- The offset from which the new value originates in the realtime stream. Used to build the ReplicationMetadata for the newly inserted record.newValueSourceBrokerID
- The ID of the broker from which the new value originates. ID's should correspond to the kafkaClusterUrlIdMap configured in the LeaderFollowerIngestionTask. Used to build the ReplicationMetadata for the newly inserted record.newValueColoID
- ID of the colo/fabric where this new Put request came from.- Returns:
- A MergeConflictResult which denotes what update should be applied or if the operation should be ignored.
-
delete
public MergeConflictResult delete(Lazy<java.nio.ByteBuffer> oldValueBytesProvider, RmdWithValueSchemaId rmdWithValueSchemaID, long deleteOperationTimestamp, long deleteOperationSourceOffset, int deleteOperationSourceBrokerID, int deleteOperationColoID)
Perform conflict resolution when the incoming operation is a DELETE operation.- Parameters:
rmdWithValueSchemaID
- The replication metadata of the currently persisted value and the value schema ID.deleteOperationTimestamp
- The logical timestamp of the incoming record.deleteOperationSourceOffset
- The offset from which the delete operation originates in the realtime stream. Used to build the ReplicationMetadata for the newly inserted record.deleteOperationSourceBrokerID
- The ID of the broker from which the new value originates. ID's should correspond to the kafkaClusterUrlIdMap configured in the LeaderFollowerIngestionTask. Used to build the ReplicationMetadata for the newly inserted record.deleteOperationColoID
- ID of the colo/fabric where this new Delete request came from.- Returns:
- A MergeConflictResult which denotes what update should be applied or if the operation should be ignored.
-
update
public MergeConflictResult update(Lazy<java.nio.ByteBuffer> oldValueBytes, RmdWithValueSchemaId rmdWithValueSchemaId, java.nio.ByteBuffer updateBytes, int incomingValueSchemaId, int incomingUpdateProtocolVersion, long updateOperationTimestamp, long newValueSourceOffset, int newValueSourceBrokerID, int newValueColoID, ChunkedValueManifestContainer oldValueManifest)
-
createPerFieldTimestampRecord
protected org.apache.avro.generic.GenericRecord createPerFieldTimestampRecord(org.apache.avro.Schema rmdSchema, long fieldTimestamp, org.apache.avro.generic.GenericRecord oldValueRecord)
-
-