|
25 | 25 | import java.util.TreeMap;
|
26 | 26 |
|
27 | 27 | /**
|
28 |
| - * Represents the version of the wire protocol used to communicate between ES nodes. |
| 28 | + * Represents the version of the wire protocol used to communicate between a pair of ES nodes. |
29 | 29 | * <p>
|
30 |
| - * Prior to 8.8.0, the release {@link Version} was used everywhere. This class separates the wire protocol version |
31 |
| - * from the release version. |
| 30 | + * Prior to 8.8.0, the release {@link Version} was used everywhere. This class separates the wire protocol version from the release version. |
32 | 31 | * <p>
|
33 |
| - * Each transport version constant has an id number, which for versions prior to 8.9.0 is the same as the release version |
34 |
| - * for backwards compatibility. In 8.9.0 this is changed to an incrementing number, disconnected from the release version. |
| 32 | + * Each transport version constant has an id number, which for versions prior to 8.9.0 is the same as the release version for backwards |
| 33 | + * compatibility. In 8.9.0 this is changed to an incrementing number, disconnected from the release version. |
35 | 34 | * <p>
|
36 |
| - * Each version constant has a unique id string. This is not actually used in the binary protocol, but is there to ensure |
37 |
| - * each protocol version is only added to the source file once. This string needs to be unique (normally a UUID, |
38 |
| - * but can be any other unique nonempty string). |
39 |
| - * If two concurrent PRs add the same transport version, the different unique ids cause a git conflict, ensuring the second PR to be merged |
40 |
| - * must be updated with the next free version first. Without the unique id string, git will happily merge the two versions together, |
41 |
| - * resulting in the same transport version being used across multiple commits, |
42 |
| - * causing problems when you try to upgrade between those two merged commits. |
| 35 | + * Each version constant has a unique id string. This is not actually used in the binary protocol, but is there to ensure each protocol |
| 36 | + * 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 |
| 37 | + * string). If two concurrent PRs add the same transport version, the different unique ids cause a git conflict, ensuring that the second PR |
| 38 | + * to be merged must be updated with the next free version first. Without the unique id string, git will happily merge the two versions |
| 39 | + * together, resulting in the same transport version being used across multiple commits, causing problems when you try to upgrade between |
| 40 | + * those two merged commits. |
43 | 41 | * <h2>Version compatibility</h2>
|
44 |
| - * The earliest compatible version is hardcoded in the {@link #MINIMUM_COMPATIBLE} field. Previously, this was dynamically calculated |
45 |
| - * from the major/minor versions of {@link Version}, but {@code TransportVersion} does not have separate major/minor version numbers. |
46 |
| - * So the minimum compatible version is hard-coded as the transport version used by the highest minor release of the previous major version. |
47 |
| - * {@link #MINIMUM_COMPATIBLE} should be updated appropriately whenever a major release happens. |
| 42 | + * The earliest compatible version is hardcoded in the {@link #MINIMUM_COMPATIBLE} field. Previously, this was dynamically calculated from |
| 43 | + * the major/minor versions of {@link Version}, but {@code TransportVersion} does not have separate major/minor version numbers. So the |
| 44 | + * minimum compatible version is hard-coded as the transport version used by the highest minor release of the previous major version. {@link |
| 45 | + * #MINIMUM_COMPATIBLE} should be updated appropriately whenever a major release happens. |
48 | 46 | * <p>
|
49 |
| - * The earliest CCS compatible version is hardcoded at {@link #MINIMUM_CCS_VERSION}, as the transport version used by the |
50 |
| - * previous minor release. This should be updated appropriately whenever a minor release happens. |
| 47 | + * The earliest CCS compatible version is hardcoded at {@link #MINIMUM_CCS_VERSION}, as the transport version used by the previous minor |
| 48 | + * release. This should be updated appropriately whenever a minor release happens. |
51 | 49 | * <h2>Adding a new version</h2>
|
52 |
| - * A new transport version should be added <em>every time</em> a change is made to the serialization protocol of one or more classes. |
53 |
| - * Each transport version should only be used in a single merged commit (apart from BwC versions copied from {@link Version}). |
| 50 | + * A new transport version should be added <em>every time</em> a change is made to the serialization protocol of one or more classes. Each |
| 51 | + * transport version should only be used in a single merged commit (apart from BwC versions copied from {@link Version}). |
54 | 52 | * <p>
|
55 |
| - * To add a new transport version, add a new constant at the bottom of the list that is one greater than the current highest version, |
56 |
| - * ensure it has a unique id, and update the {@link CurrentHolder#CURRENT} constant to point to the new version. |
| 53 | + * To add a new transport version, add a new constant at the bottom of the list that is one greater than the current highest version, ensure |
| 54 | + * it has a unique id, and update the {@link CurrentHolder#CURRENT} constant to point to the new version. |
57 | 55 | * <h2>Reverting a transport version</h2>
|
58 |
| - * If you revert a commit with a transport version change, you <em>must</em> ensure there is a <em>new</em> transport version |
59 |
| - * representing the reverted change. <em>Do not</em> let the transport version go backwards, it must <em>always</em> be incremented. |
| 56 | + * If you revert a commit with a transport version change, you <em>must</em> ensure there is a <em>new</em> transport version representing |
| 57 | + * the reverted change. <em>Do not</em> let the transport version go backwards, it must <em>always</em> be incremented. |
| 58 | + * <h2>Scope of usefulness of {@link TransportVersion}</h2> |
| 59 | + * {@link TransportVersion} is a property of the transport connection between a pair of nodes, and should not be used as an indication of |
| 60 | + * the version of any single node. The {@link TransportVersion} of a connection is negotiated between the nodes via some logic that is not |
| 61 | + * totally trivial, and may change in future. Any other places that might make decisions based on this version effectively have to reproduce |
| 62 | + * this negotiation logic, which would be fragile. If you need to make decisions based on the version of a single node, do so using a |
| 63 | + * different version value. If you need to know whether the cluster as a whole speaks a new enough {@link TransportVersion} to understand a |
| 64 | + * newly-added feature, use {@link org.elasticsearch.cluster.ClusterState#getMinTransportVersion}. |
60 | 65 | */
|
61 | 66 | public record TransportVersion(int id) implements Comparable<TransportVersion> {
|
62 | 67 |
|
|
0 commit comments