Package com.linkedin.venice.offsets
Class OffsetRecord
java.lang.Object
com.linkedin.venice.offsets.OffsetRecord
If OffsetRecord is initialized with a serializer that contains SchemaReader, old version of server codes
will be able to deserialize OffsetRecord that is serialized with a newer protocol version, which can happen
after rolling back a server release with new protocol version to an old server release with old protocol version.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
static final long
static final long
static final String
-
Constructor Summary
ConstructorDescriptionOffsetRecord
(byte[] bytes, InternalAvroSpecificSerializer<PartitionState> serializer) OffsetRecord
(PartitionState partitionState, InternalAvroSpecificSerializer<PartitionState> serializer) OffsetRecord
(InternalAvroSpecificSerializer<PartitionState> serializer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cloneUpstreamOffsetMap
(Map<String, Long> checkpointUpstreamOffsetMapReceiver) Clone the checkpoint upstream offset map to another map provided as the input.void
endOfPushReceived
(long endOfPushOffset) boolean
long
long
getLeaderTopic
(PubSubTopicRepository pubSubTopicRepository) long
long
long
getProducerPartitionState
(GUID producerGuid) getRealTimeProducerState
(String kafkaUrl, GUID producerGuid) long
getUpstreamOffset
(String kafkaURL) The caller of this API should be interested in the largest known upstream offset.getUpstreamOffsetWithNoDefault
(String kafkaURL) int
hashCode()
boolean
void
removeProducerPartitionState
(GUID producerGuid) void
removeRealTimeTopicProducerState
(String kafkaUrl, GUID producerGuid) void
resetUpstreamOffsetMap
(Map<String, Long> checkpointUpstreamOffsetMap) Reset the checkpoint upstream offset map to another map provided as the input.void
setCheckpointLocalVersionTopicOffset
(long offset) void
setCheckpointUpstreamVersionTopicOffset
(long upstreamVersionTopicOffset) void
setDatabaseInfo
(Map<String, String> databaseInfo) void
setLatestProducerProcessingTimeInMs
(long updateTimeInMs) void
setLeaderGUID
(GUID guid) void
setLeaderHostId
(String leaderHostId) void
setLeaderTopic
(PubSubTopic leaderTopic) void
setLeaderUpstreamOffset
(String upstreamKafkaURL, long leaderOffset) void
setOffsetLag
(long offsetLag) void
setPendingReportIncPushVersionList
(List<String> incPushVersionList) void
setPreviousStatusesEntry
(String key, String value) void
setProducerPartitionState
(GUID producerGuid, ProducerPartitionState state) void
setRealtimeTopicProducerState
(String kafkaUrl, GUID producerGuid, ProducerPartitionState state) byte[]
toBytes()
serialize to bytesPartitionState will be encoded with an in-house JsonEncoder which would transfer all data with "bytes" schema to hexadecimal strings.This function will print only the critical info inside OffsetRecord, like offset, EOP received; producer DIV info will not be printed.toString()
-
Field Details
-
LOWEST_OFFSET
public static final long LOWEST_OFFSET- See Also:
-
LOWEST_OFFSET_LAG
public static final long LOWEST_OFFSET_LAG- See Also:
-
DEFAULT_OFFSET_LAG
public static final long DEFAULT_OFFSET_LAG- See Also:
-
NON_AA_REPLICATION_UPSTREAM_OFFSET_MAP_KEY
- See Also:
-
-
Constructor Details
-
OffsetRecord
public OffsetRecord(PartitionState partitionState, InternalAvroSpecificSerializer<PartitionState> serializer) -
OffsetRecord
-
OffsetRecord
- Parameters:
bytes
- to deserialize from
-
-
Method Details
-
getLocalVersionTopicOffset
public long getLocalVersionTopicOffset() -
setPreviousStatusesEntry
-
getPreviousStatusesEntry
-
setCheckpointLocalVersionTopicOffset
public void setCheckpointLocalVersionTopicOffset(long offset) -
getCheckpointUpstreamVersionTopicOffset
public long getCheckpointUpstreamVersionTopicOffset() -
setCheckpointUpstreamVersionTopicOffset
public void setCheckpointUpstreamVersionTopicOffset(long upstreamVersionTopicOffset) -
getOffsetLag
public long getOffsetLag() -
setOffsetLag
public void setOffsetLag(long offsetLag) -
getMaxMessageTimeInMs
public long getMaxMessageTimeInMs()- Returns:
- the last messageTimeStamp across all producers tracked by this OffsetRecord
-
getLatestProducerProcessingTimeInMs
public long getLatestProducerProcessingTimeInMs() -
setLatestProducerProcessingTimeInMs
public void setLatestProducerProcessingTimeInMs(long updateTimeInMs) -
endOfPushReceived
public void endOfPushReceived(long endOfPushOffset) -
isEndOfPushReceived
public boolean isEndOfPushReceived() -
setProducerPartitionState
-
removeProducerPartitionState
-
getProducerPartitionStateMap
-
setRealtimeTopicProducerState
public void setRealtimeTopicProducerState(String kafkaUrl, GUID producerGuid, ProducerPartitionState state) -
removeRealTimeTopicProducerState
-
getRealTimeProducerState
-
getProducerPartitionState
-
setDatabaseInfo
-
getDatabaseInfo
-
setLeaderTopic
-
setLeaderUpstreamOffset
-
setLeaderGUID
-
setLeaderHostId
-
getLeaderTopic
-
getLeaderTopic
-
getUpstreamOffset
The caller of this API should be interested in the largest known upstream offset. For example, during re-balance, a new leader is elected to consume a partition from scratch; the partition in VT looks like this: SOP, data messages from batch..., EOP, TS, some data messages from RT... Leader shouldn't act on the TS message the moment it consumes TS, but instead, it should consume all the messages in the VT including all the existing real-time messages in VT, in order to resume consumption from RT at the largest known upstream offset to avoid duplicate work. In this case, leader is still consuming VT, so it would return VT offset; users should call this API to get the latest upstream offset. -
getUpstreamOffsetWithNoDefault
-
cloneUpstreamOffsetMap
Clone the checkpoint upstream offset map to another map provided as the input. -
resetUpstreamOffsetMap
Reset the checkpoint upstream offset map to another map provided as the input.- Parameters:
checkpointUpstreamOffsetMap
-
-
getLeaderGUID
-
getLeaderHostId
-
getPendingReportIncPushVersionList
-
setPendingReportIncPushVersionList
-
toString
-
toSimplifiedString
This function will print only the critical info inside OffsetRecord, like offset, EOP received; producer DIV info will not be printed. -
toJsonString
PartitionState will be encoded with an in-house JsonEncoder which would transfer all data with "bytes" schema to hexadecimal strings. -
equals
-
hashCode
public int hashCode() -
toBytes
public byte[] toBytes()serialize to bytes- Returns:
- byte[]
-