Class TopicSwitch

java.lang.Object
org.apache.avro.specific.SpecificRecordBase
com.linkedin.venice.kafka.protocol.TopicSwitch
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 TopicSwitch extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord
This ControlMessage is sent by the Controller, once per partition; it will only be used in leader/follower state transition model; this control message will indicate the leader to switch to a new source topic and start consuming from offset with a specific timestamp.
See Also:
  • Field Details

    • SCHEMA$

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

      public List<CharSequence> sourceKafkaServers
      A list of Kafka bootstrap servers URLs where the new source topic exists; currently there will be only one URL in the list, but the list opens up the possibility for leader to consume from different fabrics in active-active replication mode.
    • sourceTopicName

      public CharSequence sourceTopicName
      Name of new the source topic.
    • rewindStartTimestamp

      public long rewindStartTimestamp
      The creation time of this control message in parent controller minus the rewind time of the corresponding store; leaders in different fabrics will get the offset of the source topic by the same start timestamp and start consuming from there; if timestamp is 0, leader will start consuming from the beginning of the source topic. if timestmap is -2 then leader will calculate the timestamp itself based on SOP/EOP's producer timestamp
  • Constructor Details

    • TopicSwitch

      public TopicSwitch()
      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().
    • TopicSwitch

      public TopicSwitch(List<CharSequence> sourceKafkaServers, CharSequence sourceTopicName, Long rewindStartTimestamp)
      All-args constructor.
      Parameters:
      sourceKafkaServers - A list of Kafka bootstrap servers URLs where the new source topic exists; currently there will be only one URL in the list, but the list opens up the possibility for leader to consume from different fabrics in active-active replication mode.
      sourceTopicName - Name of new the source topic.
      rewindStartTimestamp - The creation time of this control message in parent controller minus the rewind time of the corresponding store; leaders in different fabrics will get the offset of the source topic by the same start timestamp and start consuming from there; if timestamp is 0, leader will start consuming from the beginning of the source topic. if timestmap is -2 then leader will calculate the timestamp itself based on SOP/EOP's producer timestamp
  • 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
    • getSourceKafkaServers

      public List<CharSequence> getSourceKafkaServers()
      Gets the value of the 'sourceKafkaServers' field.
      Returns:
      A list of Kafka bootstrap servers URLs where the new source topic exists; currently there will be only one URL in the list, but the list opens up the possibility for leader to consume from different fabrics in active-active replication mode.
    • setSourceKafkaServers

      public void setSourceKafkaServers(List<CharSequence> value)
      Sets the value of the 'sourceKafkaServers' field. A list of Kafka bootstrap servers URLs where the new source topic exists; currently there will be only one URL in the list, but the list opens up the possibility for leader to consume from different fabrics in active-active replication mode.
      Parameters:
      value - the value to set.
    • getSourceTopicName

      public CharSequence getSourceTopicName()
      Gets the value of the 'sourceTopicName' field.
      Returns:
      Name of new the source topic.
    • setSourceTopicName

      public void setSourceTopicName(CharSequence value)
      Sets the value of the 'sourceTopicName' field. Name of new the source topic.
      Parameters:
      value - the value to set.
    • getRewindStartTimestamp

      public long getRewindStartTimestamp()
      Gets the value of the 'rewindStartTimestamp' field.
      Returns:
      The creation time of this control message in parent controller minus the rewind time of the corresponding store; leaders in different fabrics will get the offset of the source topic by the same start timestamp and start consuming from there; if timestamp is 0, leader will start consuming from the beginning of the source topic. if timestmap is -2 then leader will calculate the timestamp itself based on SOP/EOP's producer timestamp
    • setRewindStartTimestamp

      public void setRewindStartTimestamp(long value)
      Sets the value of the 'rewindStartTimestamp' field. The creation time of this control message in parent controller minus the rewind time of the corresponding store; leaders in different fabrics will get the offset of the source topic by the same start timestamp and start consuming from there; if timestamp is 0, leader will start consuming from the beginning of the source topic. if timestmap is -2 then leader will calculate the timestamp itself based on SOP/EOP's producer timestamp
      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