Class VersionSwap

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.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:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      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.
      boolean isRepush
      Flag to indicate this version swap is triggered by repush or not.
      java.util.List<java.lang.Long> localHighWatermarks
      The latest offsets of all real-time topic has been consumed up until now.
      java.lang.CharSequence newServingVersionTopic
      Name of the new source topic we are switching to.
      java.lang.CharSequence oldServingVersionTopic
      Name of the old source topic we are switching from.
      static org.apache.avro.Schema SCHEMA$  
    • Constructor Summary

      Constructors 
      Constructor Description
      VersionSwap()
      Default constructor.
      VersionSwap​(java.lang.CharSequence oldServingVersionTopic, java.lang.CharSequence newServingVersionTopic, java.util.List<java.lang.Long> localHighWatermarks, java.lang.Boolean isRepush, java.lang.Boolean isLastVersionSwapMessageFromRealTimeTopic)
      All-args constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(int field$)  
      static org.apache.avro.Schema getClassSchema()  
      boolean getIsLastVersionSwapMessageFromRealTimeTopic()
      Gets the value of the 'isLastVersionSwapMessageFromRealTimeTopic' field.
      boolean getIsRepush()
      Gets the value of the 'isRepush' field.
      java.util.List<java.lang.Long> getLocalHighWatermarks()
      Gets the value of the 'localHighWatermarks' field.
      java.lang.CharSequence getNewServingVersionTopic()
      Gets the value of the 'newServingVersionTopic' field.
      java.lang.CharSequence getOldServingVersionTopic()
      Gets the value of the 'oldServingVersionTopic' field.
      org.apache.avro.Schema getSchema()  
      org.apache.avro.specific.SpecificData getSpecificData()  
      void put​(int field$, java.lang.Object value$)  
      void readExternal​(java.io.ObjectInput in)  
      void setIsLastVersionSwapMessageFromRealTimeTopic​(boolean value)
      Sets the value of the 'isLastVersionSwapMessageFromRealTimeTopic' field.
      void setIsRepush​(boolean value)
      Sets the value of the 'isRepush' field.
      void setLocalHighWatermarks​(java.util.List<java.lang.Long> value)
      Sets the value of the 'localHighWatermarks' field.
      void setNewServingVersionTopic​(java.lang.CharSequence value)
      Sets the value of the 'newServingVersionTopic' field.
      void setOldServingVersionTopic​(java.lang.CharSequence value)
      Sets the value of the 'oldServingVersionTopic' field.
      void writeExternal​(java.io.ObjectOutput out)  
      • Methods inherited from class org.apache.avro.specific.SpecificRecordBase

        compareTo, customDecode, customEncode, equals, get, getConversion, getConversion, hasCustomCoders, hashCode, put, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.avro.generic.GenericRecord

        hasField
    • Field Detail

      • SCHEMA$

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

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

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

        public java.util.List<java.lang.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 Detail

      • 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​(java.lang.CharSequence oldServingVersionTopic,
                           java.lang.CharSequence newServingVersionTopic,
                           java.util.List<java.lang.Long> localHighWatermarks,
                           java.lang.Boolean isRepush,
                           java.lang.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 Detail

      • 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 java.lang.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$,
                        java.lang.Object value$)
        Specified by:
        put in interface org.apache.avro.generic.IndexedRecord
        Specified by:
        put in class org.apache.avro.specific.SpecificRecordBase
      • getOldServingVersionTopic

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

        public void setOldServingVersionTopic​(java.lang.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 java.lang.CharSequence getNewServingVersionTopic()
        Gets the value of the 'newServingVersionTopic' field.
        Returns:
        Name of the new source topic we are switching to.
      • setNewServingVersionTopic

        public void setNewServingVersionTopic​(java.lang.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 java.util.List<java.lang.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​(java.util.List<java.lang.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​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Overrides:
        writeExternal in class org.apache.avro.specific.SpecificRecordBase
        Throws:
        java.io.IOException
      • readExternal

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