Class CollectionRmdTimestamp<DELETED_ELEMENT_TYPE>
java.lang.Object
com.linkedin.venice.schema.rmd.v1.CollectionRmdTimestamp<DELETED_ELEMENT_TYPE>
This class centralizes the logic of creating a collection replication metadata schema and providing a POJO representation
upon a collection replication metadata generic record. Its purpose is to abstract details of collection replication
metadata schema and its generic record away for users.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final int
Client readable elements that haven't been deleted yet.static final org.apache.avro.Schema
static final String
static final int
static final String
static final int
static final String
static final int
static final String
static final int
static final String
static final int
-
Constructor Summary
ConstructorDescriptionCollectionRmdTimestamp
(org.apache.avro.generic.GenericRecord collectionRmdRecord) -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.avro.Schema
createCollectionTimeStampSchema
(String metadataRecordName, String namespace, org.apache.avro.Schema elemSchema) Create a RECORD that keeps track of collection field's update metadata.boolean
int
int
long
int
hashCode()
boolean
int
removeActiveTimestampsLowerOrEqualTo
(long minTimestamp) void
removeDeletionInfoWithTimestampsLowerOrEqualTo
(long minTimestamp) void
setActiveElementTimestamps
(List<Long> collectionActiveTimestamps) void
setDeletedElementsAndTimestamps
(List<DELETED_ELEMENT_TYPE> deletedElements, List<Long> deletedTimestamps) void
setPutOnlyPartLength
(int putOnlyPartLength) void
setTopLevelColoID
(int topLevelColoID) void
setTopLevelFieldTimestamp
(long topLevelFieldTimestamp) toString()
-
Field Details
-
TOP_LEVEL_TS_FIELD_POS
public static final int TOP_LEVEL_TS_FIELD_POS- See Also:
-
TOP_LEVEL_TS_FIELD_NAME
- See Also:
-
TOP_LEVEL_COLO_ID_FIELD_POS
public static final int TOP_LEVEL_COLO_ID_FIELD_POS- See Also:
-
TOP_LEVEL_COLO_ID_FIELD_NAME
- See Also:
-
PUT_ONLY_PART_LENGTH_FIELD_POS
public static final int PUT_ONLY_PART_LENGTH_FIELD_POS- See Also:
-
PUT_ONLY_PART_LENGTH_FIELD_NAME
- See Also:
-
ACTIVE_ELEM_TS_FIELD_POS
public static final int ACTIVE_ELEM_TS_FIELD_POSClient readable elements that haven't been deleted yet.- See Also:
-
ACTIVE_ELEM_TS_FIELD_NAME
- See Also:
-
DELETED_ELEM_FIELD_POS
public static final int DELETED_ELEM_FIELD_POS- See Also:
-
DELETED_ELEM_FIELD_NAME
- See Also:
-
DELETED_ELEM_TS_FIELD_POS
public static final int DELETED_ELEM_TS_FIELD_POS- See Also:
-
DELETED_ELEM_TS_FIELD_NAME
- See Also:
-
COLLECTION_TS_ARRAY_SCHEMA
public static final org.apache.avro.Schema COLLECTION_TS_ARRAY_SCHEMA
-
-
Constructor Details
-
CollectionRmdTimestamp
-
CollectionRmdTimestamp
public CollectionRmdTimestamp(org.apache.avro.generic.GenericRecord collectionRmdRecord)
-
-
Method Details
-
getTopLevelFieldTimestamp
public long getTopLevelFieldTimestamp() -
getTopLevelColoID
public int getTopLevelColoID() -
getPutOnlyPartLength
public int getPutOnlyPartLength() -
isInPutOnlyState
public boolean isInPutOnlyState() -
getActiveElementTimestamps
-
removeActiveTimestampsLowerOrEqualTo
public int removeActiveTimestampsLowerOrEqualTo(long minTimestamp) - Parameters:
minTimestamp
- Remove all active timestamps that are smaller or equal tominTimestamp
.- Returns:
- number of active timestamps removed from the beginning (index 0).
-
removeDeletionInfoWithTimestampsLowerOrEqualTo
public void removeDeletionInfoWithTimestampsLowerOrEqualTo(long minTimestamp) -
getDeletedElementTimestamps
-
getDeletedElements
-
setTopLevelFieldTimestamp
public void setTopLevelFieldTimestamp(long topLevelFieldTimestamp) -
setTopLevelColoID
public void setTopLevelColoID(int topLevelColoID) -
setPutOnlyPartLength
public void setPutOnlyPartLength(int putOnlyPartLength) -
setActiveElementTimestamps
-
setDeletedElementsAndTimestamps
public void setDeletedElementsAndTimestamps(List<DELETED_ELEMENT_TYPE> deletedElements, List<Long> deletedTimestamps) -
equals
-
hashCode
public int hashCode() -
toString
-
createCollectionTimeStampSchema
public static org.apache.avro.Schema createCollectionTimeStampSchema(String metadataRecordName, String namespace, org.apache.avro.Schema elemSchema) Create a RECORD that keeps track of collection field's update metadata. There are 4 sub-fields here.TOP_LEVEL_TS_FIELD_NAME
The top level timestamp. This field is updated when the whole collections is replaced/removed (via partial update)ACTIVE_ELEM_TS_FIELD_NAME
A timestamp array that holds the timestamps for each elements in the collection.DELETED_ELEM_FIELD_NAME
A tombstone array that holds deleted elements. If this collection is an ARRAY, the array will hold elements the same type as the original array. If this collection is a MAP, the array will hold string elements (keys in the original map).DELETED_ELEM_TS_FIELD_NAME
A timestamp array that holds the timestamps for each deleted element in the tombstone arrayExample value schema: { "type" : "record", "name" : "testRecord", "namespace" : "avro.example", "fields" : [ { "name" : "intArray", "type" : { "type" : "array", "items" : "int" }, "default" : [ ] } ] } Corresponding TS schema { "type" : "record", "name" : "ARRAY_CollectionTimestampMetadata_1", "doc" : "structure that maintains all of the necessary metadata to perform deterministic conflict resolution on collection fields.", "fields" : [ { "name" : "topLevelFieldTimestamp", "type" : "long", "doc" : "Timestamp of the last partial update attempting to set every element of this collection.", "default" : 0 },{ "name" : "topLevelColoID", "type" : "int", "doc" : "ID of the colo from which the last successfully applied partial update was sent.", "default" : -1 },{ "name" : "putOnlyPartLength", "type" : "int", "doc" : "Length of the put-only part of the collection which starts from index 0.", "default" : 0 }, { "name" : "activeElementsTimestamps", "type" : { "type" : "array", "items" : "long" }, "doc" : "Timestamps of each active element in the user's collection. This is a parallel array with the user's collection.", "default" : [ ] }, { "name" : "deletedElementsIdentities", "type" : { "type" : "array", "items" : "int" }, "doc" : "The tomestone array of deleted elements. This is a parallel array with deletedElementsTimestamps", "default" : [ ] }, { "name" : "deletedElementsTimestamps", "type" : { "type" : "array", "items" : "long" }, "doc" : "Timestamps of each deleted element. This is a parallel array with deletedElementsIdentity.", "default" : [ ] } }
-