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 Summary
Modifier and TypeFieldDescriptionboolean
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
Flag to indicate this version swap is triggered by repush or not.The latest offsets of all real-time topic has been consumed up until now.Name of the new source topic we are switching to.Name of the old source topic we are switching from.static final org.apache.avro.Schema
-
Constructor Summary
ConstructorDescriptionDefault constructor.VersionSwap
(CharSequence oldServingVersionTopic, CharSequence newServingVersionTopic, List<Long> localHighWatermarks, Boolean isRepush, Boolean isLastVersionSwapMessageFromRealTimeTopic) All-args constructor. -
Method Summary
Modifier and TypeMethodDescriptionget
(int field$) static org.apache.avro.Schema
boolean
Gets the value of the 'isLastVersionSwapMessageFromRealTimeTopic' field.boolean
Gets the value of the 'isRepush' field.Gets the value of the 'localHighWatermarks' field.Gets the value of the 'newServingVersionTopic' field.Gets the value of the 'oldServingVersionTopic' field.org.apache.avro.Schema
org.apache.avro.specific.SpecificData
void
void
void
setIsLastVersionSwapMessageFromRealTimeTopic
(boolean value) Sets the value of the 'isLastVersionSwapMessageFromRealTimeTopic' field.void
setIsRepush
(boolean value) Sets the value of the 'isRepush' field.void
setLocalHighWatermarks
(List<Long> value) Sets the value of the 'localHighWatermarks' field.void
Sets the value of the 'newServingVersionTopic' field.void
Sets the value of the 'oldServingVersionTopic' field.void
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 Details
-
SCHEMA$
public static final org.apache.avro.Schema SCHEMA$ -
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
public boolean isRepushFlag to indicate this version swap is triggered by repush or not. -
isLastVersionSwapMessageFromRealTimeTopic
public boolean isLastVersionSwapMessageFromRealTimeTopicFlag 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 usenewBuilder()
. -
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 classorg.apache.avro.specific.SpecificRecordBase
-
getSchema
public org.apache.avro.Schema getSchema()- Specified by:
getSchema
in interfaceorg.apache.avro.generic.GenericContainer
- Specified by:
getSchema
in classorg.apache.avro.specific.SpecificRecordBase
-
get
- Specified by:
get
in interfaceorg.apache.avro.generic.IndexedRecord
- Specified by:
get
in classorg.apache.avro.specific.SpecificRecordBase
-
put
- Specified by:
put
in interfaceorg.apache.avro.generic.IndexedRecord
- Specified by:
put
in classorg.apache.avro.specific.SpecificRecordBase
-
getOldServingVersionTopic
Gets the value of the 'oldServingVersionTopic' field.- Returns:
- Name of the old source topic we are switching from.
-
setOldServingVersionTopic
Sets the value of the 'oldServingVersionTopic' field. Name of the old source topic we are switching from.- Parameters:
value
- the value to set.
-
getNewServingVersionTopic
Gets the value of the 'newServingVersionTopic' field.- Returns:
- Name of the new source topic we are switching to.
-
setNewServingVersionTopic
Sets the value of the 'newServingVersionTopic' field. Name of the new source topic we are switching to.- Parameters:
value
- the value to set.
-
getLocalHighWatermarks
Gets the value of the 'localHighWatermarks' field.- Returns:
- The latest offsets of all real-time topic has been consumed up until now.
-
setLocalHighWatermarks
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
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classorg.apache.avro.specific.SpecificRecordBase
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classorg.apache.avro.specific.SpecificRecordBase
- Throws:
IOException
-