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

    • setPreviousStatusesEntry

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

      public String getPreviousStatusesEntry(String key)
    • getCheckpointedLocalVtPosition

      public PubSubPosition getCheckpointedLocalVtPosition()
    • checkpointLocalVtPosition

      public void checkpointLocalVtPosition(PubSubPosition vtPosition)
    • getCheckpointedRemoteVtPosition

      public PubSubPosition getCheckpointedRemoteVtPosition()
    • checkpointRemoteVtPosition

      public void checkpointRemoteVtPosition(PubSubPosition remoteVtPosition)
    • getOffsetLag

      public long getOffsetLag()
    • setOffsetLag

      public void setOffsetLag(long offsetLag)
    • getHeartbeatTimestamp

      public long getHeartbeatTimestamp()
    • setHeartbeatTimestamp

      public void setHeartbeatTimestamp(long heartbeatTimestamp)
    • getLastCheckpointTimestamp

      public long getLastCheckpointTimestamp()
    • setLastCheckpointTimestamp

      public void setLastCheckpointTimestamp(long timestamp)
    • 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()
    • 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)
    • setLeaderGUID

      public void setLeaderGUID(GUID guid)
    • setLeaderHostId

      public void setLeaderHostId(String leaderHostId)
    • getLeaderTopic

      public String getLeaderTopic()
    • getLeaderTopic

      public PubSubTopic getLeaderTopic(PubSubTopicRepository pubSubTopicRepository)
    • getCheckpointedRtPosition

      public PubSubPosition getCheckpointedRtPosition(String pubSubBrokerAddress)
      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.
    • checkpointRtPosition

      public void checkpointRtPosition(String pubSubBrokerAddress, PubSubPosition leaderPosition)
    • checkpointRtPositions

      public void checkpointRtPositions(@Nonnull Map<String,PubSubPosition> newRtPositions)
      Update the checkpoint upstream positions map with new values from another map provided as the input.
      Parameters:
      newRtPositions -
    • cloneRtPositionCheckpoints

      public void cloneRtPositionCheckpoints(@Nonnull Map<String,PubSubPosition> checkpointUpstreamPositionsReceiver)
      Clone the checkpoint upstream positions map to another map provided as the input.
    • getLeaderGUID

      public GUID getLeaderGUID()
    • getLeaderHostId

      public String getLeaderHostId()
    • getPendingReportIncPushVersionList

      public List<String> getPendingReportIncPushVersionList()
    • setPendingReportIncPushVersionList

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

      public Integer getRecordTransformerClassHash()
    • setRecordTransformerClassHash

      public void setRecordTransformerClassHash(int classHash)
    • setLatestConsumedVtPosition

      public void setLatestConsumedVtPosition(PubSubPosition latestConsumedVtPosition)
    • getLatestConsumedVtPosition

      public PubSubPosition getLatestConsumedVtPosition()
    • 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[]