Record Class TransformConfigVersion
- All Implemented Interfaces:
Comparable<TransformConfigVersion>,VersionId<TransformConfigVersion>,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentFragment
Version class so that
in mixed version clusters during upgrades the old nodes won't throw exceptions when parsing these new versions.
Prior to 8.10.0, the release Version was used everywhere. This class separates the Transform config format version
from the running node version.
Each Transform config version constant has an id number, which for versions prior to 8.10.0 is the same as the release version for backwards compatibility. In 8.10.0 this is changed to an incrementing number, disconnected from the release version, starting at 10000099. This format is chosen for best compatibility with old node versions. *
Each version constant has a unique id string. This is not actually used in the binary protocol, but is there to ensure each protocol version is only added to the source file once. This string needs to be unique (normally a UUID, but can be any other unique nonempty string). If two concurrent PRs add the same Transform config version, the different unique ids cause a git conflict, ensuring the second PR to be merged must be updated with the next free version first. Without the unique id string, git will happily merge the two versions together, resulting in the same Transform config version being used across multiple commits, causing problems when you try to upgrade between those two merged commits.
Version compatibility
The earliest version is hardcoded in theFIRST_TRANSFORM_VERSION field. This cannot be dynamically calculated
from the major/minor versions of Version, because TransformConfigVersion does not have separate major/minor version
numbers.
So the minimum version is simply hard-coded as the earliest version where Transform existed (7.2.0).
Adding a new version
A new Transform config version should be added every time a change is made to the serialization format of one or more Transform config or state classes. Each Transform config version should only be used in a single merged commit (apart from BwC versions copied fromVersion).
To add a new Transform config version, add a new constant at the bottom of the list that is one million greater than the current highest
version, ensure it has a unique id, and update the CURRENT constant to point to the new version.
Reverting a Transform config version
If you revert a commit with a Transform config version change, you must ensure there is a new Transform config version representing the reverted change. Do not let the Transform config version go backwards, it must always be incremented.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransformConfigVersionReference to the most recent Transform config version.static final TransformConfigVersionReference to the earliest compatible Transform config version to this version of the codebase.static final TransformConfigVersionReference to the first TransformConfigVersion that is detached from the stack (product) version.static final Stringstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionstatic final TransformConfigVersionFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionTransformConfigVersion(int id) Creates an instance of aTransformConfigVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static TransformConfigVersionfromId(int id) static TransformConfigVersionfromNode(DiscoveryNode node) static TransformConfigVersionfromString(String str) getAllVersionIds(Class<?> cls) Obtain a selection of (nearly) all registered versions.static TransformConfigVersionstatic org.elasticsearch.core.Tuple<TransformConfigVersion, TransformConfigVersion> static TransformConfigVersionstatic TransformConfigVersionfinal inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.static TransformConfigVersionmax(TransformConfigVersion version1, TransformConfigVersion version2) Returns the maximum version ofversion1andversion2New, single number representations are treated as being after all legacy, semantic style representations.static TransformConfigVersionmin(TransformConfigVersion version1, TransformConfigVersion version2) Returns the minimum version ofversion1andversion2Legacy, semantic style representations are treated as being before all new, single number representationsstatic TransformConfigVersiontoString()Returns a string representation of this record class.org.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) static voidwriteVersion(TransformConfigVersion version, StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
TRANSFORM_CONFIG_VERSION_NODE_ATTR
- See Also:
-
ZERO
-
V_7_2_0
-
V_7_2_1
-
V_7_3_0
-
V_7_3_2
-
V_7_4_0
-
V_7_5_0
-
V_7_6_0
-
V_7_6_2
-
V_7_7_0
-
V_7_8_0
-
V_7_8_1
-
V_7_9_0
-
V_7_9_1
-
V_7_9_2
-
V_7_9_3
-
V_7_10_0
-
V_7_10_1
-
V_7_11_0
-
V_7_12_0
-
V_7_13_0
-
V_7_14_0
-
V_7_15_0
-
V_7_15_1
-
V_7_16_0
-
V_7_17_0
-
V_7_17_1
-
V_7_17_8
-
V_8_0_0
-
V_8_1_0
-
V_8_2_0
-
V_8_3_0
-
V_8_4_0
-
V_8_5_0
-
V_8_6_0
-
V_8_6_1
-
V_8_7_0
-
V_8_7_1
-
V_8_8_0
-
V_8_8_1
-
V_8_9_0
-
V_10
-
CURRENT
Reference to the most recent Transform config version. This should be the Transform config version with the highest id. -
MINIMUM_DETACHED_TRANSFORM_CONFIG_VERSION
Reference to the first TransformConfigVersion that is detached from the stack (product) version. -
FIRST_TRANSFORM_VERSION
Reference to the earliest compatible Transform config version to this version of the codebase. This is hard-coded as the first version that included the Transform plugin.
-
-
Constructor Details
-
TransformConfigVersion
public TransformConfigVersion(int id) Creates an instance of aTransformConfigVersionrecord class.- Parameters:
id- the value for theidrecord component
-
-
Method Details
-
getAllVersionIds
Obtain a selection of (nearly) all registered versions. This method should only ever be used internally - to initialize VERSION_IDS, and in unit tests. It should never be called directly in production code. -
readVersion
- Throws:
IOException
-
fromId
-
fromNode
-
writeVersion
public static void writeVersion(TransformConfigVersion version, StreamOutput out) throws IOException - Throws:
IOException
-
min
public static TransformConfigVersion min(TransformConfigVersion version1, TransformConfigVersion version2) Returns the minimum version ofversion1andversion2Legacy, semantic style representations are treated as being before all new, single number representations -
max
public static TransformConfigVersion max(TransformConfigVersion version1, TransformConfigVersion version2) Returns the maximum version ofversion1andversion2New, single number representations are treated as being after all legacy, semantic style representations. -
getMinTransformConfigVersion
-
getMaxTransformConfigVersion
-
getMinMaxTransformConfigVersion
public static org.elasticsearch.core.Tuple<TransformConfigVersion,TransformConfigVersion> getMinMaxTransformConfigVersion(DiscoveryNodes nodes) -
getTransformConfigVersionForNode
-
fromString
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
id
public int id()Returns the value of theidrecord component.- Specified by:
idin interfaceVersionId<TransformConfigVersion>- Returns:
- the value of the
idrecord component
-