- All Implemented Interfaces:
Comparable<IndexVersion>
Prior to 8.8.0, the node Version
was used everywhere. This class separates the index format version
from the running node version.
Each index version constant has an id number, which for versions prior to 8.9.0 is the same as the release version for backwards compatibility. In 8.9.0 this is changed to an incrementing number, disconnected from the release version.
Each version constant has a unique id string. This is not actually stored in the index, but is there to ensure each index 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 index 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 index version being used across multiple commits, causing problems when you try to upgrade between those two merged commits.
Version compatibility
The earliest compatible version is hardcoded in theMINIMUM_COMPATIBLE
field. Previously, this was dynamically calculated
from the major/minor versions of Version
, but IndexVersion
does not have separate major/minor version numbers.
So the minimum compatible version is hard-coded as the index version used by the first version of the previous major release.
MINIMUM_COMPATIBLE
should be updated appropriately whenever a major release happens.
Adding a new version
A new index version should be added every time a change is made to the serialization protocol of one or more classes. Each index version should only be used in a single merged commit (apart from BwC versions copied fromVersion
).
To add a new index version, add a new constant at the bottom of the list that is one greater than the current highest version,
ensure it has a unique id, and update the CURRENT
constant to point to the new version.
Reverting an index version
If you revert a commit with an index version change, you must ensure there is a new index version representing the reverted change. Do not let the index version go backwards, it must always be incremented.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IndexVersion
Reference to the most recent index version.static final IndexVersion
Reference to the earliest compatible index version to this version of the codebase.static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
static final IndexVersion
-
Constructor Summary
ConstructorsConstructorDescriptionIndexVersion
(int id, org.apache.lucene.util.Version luceneVersion) Creates an instance of aIndexVersion
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
after
(IndexVersion version) boolean
before
(IndexVersion version) boolean
between
(IndexVersion lowerInclusive, IndexVersion upperExclusive) int
compareTo
(IndexVersion other) boolean
Indicates whether some other object is "equal to" this one.static IndexVersion
fromId
(int id) int
hashCode()
Returns a hash code value for this object.int
id()
Returns the value of theid
record component.boolean
org.apache.lucene.util.Version
Returns the value of theluceneVersion
record component.static IndexVersion
max
(IndexVersion version1, IndexVersion version2) Returns the maximum version ofversion1
andversion2
static IndexVersion
min
(IndexVersion version1, IndexVersion version2) Returns the minimum version ofversion1
andversion2
boolean
onOrAfter
(IndexVersion version) boolean
onOrBefore
(IndexVersion version) toString()
Returns a string representation of this record class.Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
ZERO
-
V_7_0_0
-
V_7_0_1
-
V_7_1_0
-
V_7_1_1
-
V_7_2_0
-
V_7_2_1
-
V_7_3_0
-
V_7_3_1
-
V_7_3_2
-
V_7_4_0
-
V_7_4_1
-
V_7_4_2
-
V_7_5_0
-
V_7_5_1
-
V_7_5_2
-
V_7_6_0
-
V_7_6_1
-
V_7_6_2
-
V_7_7_0
-
V_7_7_1
-
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_10_2
-
V_7_11_0
-
V_7_11_1
-
V_7_11_2
-
V_7_12_0
-
V_7_12_1
-
V_7_13_0
-
V_7_13_1
-
V_7_13_2
-
V_7_13_3
-
V_7_13_4
-
V_7_14_0
-
V_7_14_1
-
V_7_14_2
-
V_7_15_0
-
V_7_15_1
-
V_7_15_2
-
V_7_16_0
-
V_7_16_1
-
V_7_16_2
-
V_7_16_3
-
V_7_17_0
-
V_7_17_1
-
V_7_17_2
-
V_7_17_3
-
V_7_17_4
-
V_7_17_5
-
V_7_17_6
-
V_7_17_7
-
V_7_17_8
-
V_7_17_9
-
V_7_17_10
-
V_7_17_11
-
V_7_17_12
-
V_8_0_0
-
V_8_0_1
-
V_8_1_0
-
V_8_1_1
-
V_8_1_2
-
V_8_1_3
-
V_8_2_0
-
V_8_2_1
-
V_8_2_2
-
V_8_2_3
-
V_8_3_0
-
V_8_3_1
-
V_8_3_2
-
V_8_3_3
-
V_8_4_0
-
V_8_4_1
-
V_8_4_2
-
V_8_4_3
-
V_8_5_0
-
V_8_5_1
-
V_8_5_2
-
V_8_5_3
-
V_8_6_0
-
V_8_6_1
-
V_8_6_2
-
V_8_7_0
-
V_8_7_1
-
V_8_8_0
-
V_8_8_1
-
V_8_8_2
-
V_8_8_3
-
V_8_9_0
-
CURRENT
Reference to the most recent index version. This should be the index version with the highest id. -
MINIMUM_COMPATIBLE
Reference to the earliest compatible index version to this version of the codebase. This should be the index version used by the first release of the previous major version.
-
-
Constructor Details
-
IndexVersion
public IndexVersion(int id, org.apache.lucene.util.Version luceneVersion) Creates an instance of aIndexVersion
record class.- Parameters:
id
- the value for theid
record componentluceneVersion
- the value for theluceneVersion
record component
-
-
Method Details
-
fromId
-
toVersion
Deprecated, for removal: This API element is subject to removal in a future version. -
min
Returns the minimum version ofversion1
andversion2
-
max
Returns the maximum version ofversion1
andversion2
-
after
-
onOrAfter
-
before
-
onOrBefore
-
between
-
isLegacyIndexVersion
public boolean isLegacyIndexVersion() -
compareTo
- Specified by:
compareTo
in interfaceComparable<IndexVersion>
-
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. -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
id
public int id()Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
luceneVersion
public org.apache.lucene.util.Version luceneVersion()Returns the value of theluceneVersion
record component.- Returns:
- the value of the
luceneVersion
record component
-