Class VersionSwap

java.lang.Object
org.apache.avro.specific.SpecificRecordBase
com.linkedin.venice.kafka.protocol.VersionSwap
All Implemented Interfaces:
Externalizable, Serializable, Comparable<org.apache.avro.specific.SpecificRecord>, org.apache.avro.generic.GenericContainer, org.apache.avro.generic.GenericRecord, org.apache.avro.generic.IndexedRecord, org.apache.avro.specific.SpecificRecord

public class VersionSwap extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord
This controlMessage is written to the real-time topic by the controller or to the store-version topic by the current version's leader server. It can be used to let current version and future version synchronize on a specific point for all regions' real-time topics, to guarantee there is only one store version producing to change capture topic all the time. It can also be used by the consumer client to switch to another store-version topic and filter messages that have a lower watermark than the one dictated by the leader.
See Also:
  • Field Details

    • SCHEMA$

      public static final org.apache.avro.Schema SCHEMA$
    • oldServingVersionTopic

      public CharSequence oldServingVersionTopic
      Name of the old source topic we are switching from.
    • newServingVersionTopic

      public CharSequence newServingVersionTopic
      Name of the new source topic we are switching to.
    • localHighWatermarks

      public List<Long> localHighWatermarks
      The latest offsets of all real-time topic has been consumed up until now.
    • isRepush

      public boolean isRepush
      Flag to indicate this version swap is triggered by repush or not.
    • isLastVersionSwapMessageFromRealTimeTopic

      public boolean isLastVersionSwapMessageFromRealTimeTopic
      Flag to indicate this version swap message in version topic is triggered by the last version swap in real time topic the leader server has received. With this flag, new leader will be able to recover the full state during leadership handover, when we rely on real-time topics for all regions to achieve version swap synchronization.
  • Constructor Details

    • VersionSwap

      public VersionSwap()
      Default constructor. Note that this does not initialize fields to their default values from the schema. If that is desired then one should use newBuilder().
    • VersionSwap

      public VersionSwap(CharSequence oldServingVersionTopic, CharSequence newServingVersionTopic, List<Long> localHighWatermarks, Boolean isRepush, Boolean isLastVersionSwapMessageFromRealTimeTopic)
      All-args constructor.
      Parameters:
      oldServingVersionTopic - Name of the old source topic we are switching from.
      newServingVersionTopic - Name of the new source topic we are switching to.
      localHighWatermarks - The latest offsets of all real-time topic has been consumed up until now.
      isRepush - Flag to indicate this version swap is triggered by repush or not.
      isLastVersionSwapMessageFromRealTimeTopic - Flag to indicate this version swap message in version topic is triggered by the last version swap in real time topic the leader server has received. With this flag, new leader will be able to recover the full state during leadership handover, when we rely on real-time topics for all regions to achieve version swap synchronization.
  • Method Details

    • getClassSchema

      public static org.apache.avro.Schema getClassSchema()
    • getSpecificData

      public org.apache.avro.specific.SpecificData getSpecificData()
      Overrides:
      getSpecificData in class org.apache.avro.specific.SpecificRecordBase
    • getSchema

      public org.apache.avro.Schema getSchema()
      Specified by:
      getSchema in interface org.apache.avro.generic.GenericContainer
      Specified by:
      getSchema in class org.apache.avro.specific.SpecificRecordBase
    • get

      public Object get(int field$)
      Specified by:
      get in interface org.apache.avro.generic.IndexedRecord
      Specified by:
      get in class org.apache.avro.specific.SpecificRecordBase
    • put

      public void put(int field$, Object value$)
      Specified by:
      put in interface org.apache.avro.generic.IndexedRecord
      Specified by:
      put in class org.apache.avro.specific.SpecificRecordBase
    • getOldServingVersionTopic

      public CharSequence getOldServingVersionTopic()
      Gets the value of the 'oldServingVersionTopic' field.
      Returns:
      Name of the old source topic we are switching from.
    • setOldServingVersionTopic

      public void setOldServingVersionTopic(CharSequence value)
      Sets the value of the 'oldServingVersionTopic' field. Name of the old source topic we are switching from.
      Parameters:
      value - the value to set.
    • getNewServingVersionTopic

      public CharSequence getNewServingVersionTopic()
      Gets the value of the 'newServingVersionTopic' field.
      Returns:
      Name of the new source topic we are switching to.
    • setNewServingVersionTopic

      public void setNewServingVersionTopic(CharSequence value)
      Sets the value of the 'newServingVersionTopic' field. Name of the new source topic we are switching to.
      Parameters:
      value - the value to set.
    • getLocalHighWatermarks

      public List<Long> getLocalHighWatermarks()
      Gets the value of the 'localHighWatermarks' field.
      Returns:
      The latest offsets of all real-time topic has been consumed up until now.
    • setLocalHighWatermarks

      public void setLocalHighWatermarks(List<Long> value)
      Sets the value of the 'localHighWatermarks' field. The latest offsets of all real-time topic has been consumed up until now.
      Parameters:
      value - the value to set.
    • getIsRepush

      public boolean getIsRepush()
      Gets the value of the 'isRepush' field.
      Returns:
      Flag to indicate this version swap is triggered by repush or not.
    • setIsRepush

      public void setIsRepush(boolean value)
      Sets the value of the 'isRepush' field. Flag to indicate this version swap is triggered by repush or not.
      Parameters:
      value - the value to set.
    • getIsLastVersionSwapMessageFromRealTimeTopic

      public boolean getIsLastVersionSwapMessageFromRealTimeTopic()
      Gets the value of the 'isLastVersionSwapMessageFromRealTimeTopic' field.
      Returns:
      Flag to indicate this version swap message in version topic is triggered by the last version swap in real time topic the leader server has received. With this flag, new leader will be able to recover the full state during leadership handover, when we rely on real-time topics for all regions to achieve version swap synchronization.
    • setIsLastVersionSwapMessageFromRealTimeTopic

      public void setIsLastVersionSwapMessageFromRealTimeTopic(boolean value)
      Sets the value of the 'isLastVersionSwapMessageFromRealTimeTopic' field. Flag to indicate this version swap message in version topic is triggered by the last version swap in real time topic the leader server has received. With this flag, new leader will be able to recover the full state during leadership handover, when we rely on real-time topics for all regions to achieve version swap synchronization.
      Parameters:
      value - the value to set.
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Overrides:
      writeExternal in class org.apache.avro.specific.SpecificRecordBase
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException
      Specified by:
      readExternal in interface Externalizable
      Overrides:
      readExternal in class org.apache.avro.specific.SpecificRecordBase
      Throws:
      IOException