Class TransportVersion

java.lang.Object
org.elasticsearch.TransportVersion
All Implemented Interfaces:
Comparable<TransportVersion>

public class TransportVersion extends Object implements Comparable<TransportVersion>
Represents the version of the wire protocol used to communicate between ES nodes.

Prior to 8.7.0, the node Version was used everywhere. This class separates the wire protocol version from the running node version. Each node version has a reference to a specific transport version used by that node.

Each transport version constant has an id number, which for versions prior to 8.7.0 is the same as the node version for backwards compatibility. There is also a unique id string. This is not actually used in the protocol, but is there to ensure each protocol version is only added to the source file once. This string needs to be unique (here, a UUID, but can be any other unique nonempty string). If two concurrent PRs added the same protocol version, the unique string causes a git conflict, ensuring the second PR to be merged must be updated with the next free version. Without the unique id string, git will happily merge the two versions together, causing problems when you try to upgrade between those two PRs.

When adding new transport versions, it is recommended to leave a gap in the id number (say, 100) to leave space for any intermediate fixes that may be needed in the future.

The earliest compatible version is hardcoded at MINIMUM_COMPATIBLE. Previously, this was dynamically calculated from the major/minor versions of Version, but TransportVersion does not have separate major/minor version numbers. So the minimum compatible version needs to be hard-coded as the transport version of the minimum compatible node version. That variable should be updated appropriately whenever we do a major version release.