Class OffsetRecord

java.lang.Object
com.linkedin.venice.offsets.OffsetRecord

public class OffsetRecord extends Object
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 Details

  • Constructor Details

  • Method Details

    • getLocalVersionTopicOffset

      public long getLocalVersionTopicOffset()
    • setPreviousStatusesEntry

      public void setPreviousStatusesEntry(String key, String value)
    • getPreviousStatusesEntry

      public String getPreviousStatusesEntry(String key)
    • 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

      public void setProducerPartitionState(GUID producerGuid, ProducerPartitionState state)
    • removeProducerPartitionState

      public void removeProducerPartitionState(GUID producerGuid)
    • getProducerPartitionStateMap

      public Map<CharSequence,ProducerPartitionState> getProducerPartitionStateMap()
    • setRealtimeTopicProducerState

      public void setRealtimeTopicProducerState(String kafkaUrl, GUID producerGuid, ProducerPartitionState state)
    • removeRealTimeTopicProducerState

      public void removeRealTimeTopicProducerState(String kafkaUrl, GUID producerGuid)
    • getRealTimeProducerState

      public ProducerPartitionState getRealTimeProducerState(String kafkaUrl, GUID producerGuid)
    • getProducerPartitionState

      public ProducerPartitionState getProducerPartitionState(GUID producerGuid)
    • setDatabaseInfo

      public void setDatabaseInfo(Map<String,String> databaseInfo)
    • getDatabaseInfo

      public Map<String,String> getDatabaseInfo()
    • setLeaderTopic

      public void setLeaderTopic(PubSubTopic leaderTopic)
    • setLeaderUpstreamOffset

      public void setLeaderUpstreamOffset(String upstreamKafkaURL, long leaderOffset)
    • setLeaderGUID

      public void setLeaderGUID(GUID guid)
    • setLeaderHostId

      public void setLeaderHostId(String leaderHostId)
    • getLeaderTopic

      public String getLeaderTopic()
    • getLeaderTopic

      public PubSubTopic getLeaderTopic(PubSubTopicRepository pubSubTopicRepository)
    • getUpstreamOffset

      public long getUpstreamOffset(String kafkaURL)
      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

      public Long getUpstreamOffsetWithNoDefault(String kafkaURL)
    • cloneUpstreamOffsetMap

      public void cloneUpstreamOffsetMap(@Nonnull Map<String,Long> checkpointUpstreamOffsetMapReceiver)
      Clone the checkpoint upstream offset map to another map provided as the input.
    • resetUpstreamOffsetMap

      public void resetUpstreamOffsetMap(@Nonnull Map<String,Long> checkpointUpstreamOffsetMap)
      Reset the checkpoint upstream offset map to another map provided as the input.
      Parameters:
      checkpointUpstreamOffsetMap -
    • getLeaderGUID

      public GUID getLeaderGUID()
    • getLeaderHostId

      public String getLeaderHostId()
    • getPendingReportIncPushVersionList

      public List<String> getPendingReportIncPushVersionList()
    • setPendingReportIncPushVersionList

      public void setPendingReportIncPushVersionList(List<String> incPushVersionList)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toSimplifiedString

      public String toSimplifiedString()
      This function will print only the critical info inside OffsetRecord, like offset, EOP received; producer DIV info will not be printed.
    • toJsonString

      public String toJsonString()
      PartitionState will be encoded with an in-house JsonEncoder which would transfer all data with "bytes" schema to hexadecimal strings.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toBytes

      public byte[] toBytes()
      serialize to bytes
      Returns:
      byte[]