Skip to content

Commit b72bfb4

Browse files
committed
Document getMinTransportVersion including exceptions
The cluster's min transport version has some useful properties but also some subtle exceptions that are today not documented in the code. This commit adds some Javadocs in this area.
1 parent c702eb9 commit b72bfb4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

server/src/main/java/org/elasticsearch/cluster/ClusterState.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,28 @@ public boolean hasMixedSystemIndexVersions() {
350350
.anyMatch(e -> e.systemIndexMappingsVersion().equals(minVersions.systemIndexMappingsVersion()) == false);
351351
}
352352

353+
/**
354+
* @return the minimum {@link TransportVersion} that will be used for all future intra-cluster node-to-node communications. This value
355+
* only ever increases, so if {@code v.onOrAfter(cs.getMinTransportVersion())} is true once then it will remain true in the
356+
* future.
357+
* <p>
358+
* There are some subtle exceptions:
359+
* <ul>
360+
* <li>The "only ever increases" property is handled by the master node using the in-memory (ephemeral) part of the
361+
* {@link ClusterState} only, so in theory a full restart of a mixed-version cluster may lose that state and allow some nodes to see
362+
* this value decrease. For this to happen in practice requires some fairly unlucky timing during the initial master election. We
363+
* tell users not to do this: if something breaks during a rolling upgrade then they should upgrade all remaining nodes to continue.
364+
* But we do not enforce it.
365+
* <li>The "used for all node-to-node communications" is false in a disordered upgrade (an upgrade to a semantically-newer but
366+
* chronologically-older version) because for each connection between such nodes we will use {@link
367+
* TransportVersion#bestKnownVersion} to pick a transport version which is known by both endpoints. We tell users not to do
368+
* disordered upgrades too, but do not enforce it.
369+
* </ul>
370+
* <p>
371+
* Note also that node-to-node communications which are not <i>intra-cluster</i> (i.e. they are not between nodes in the same cluster)
372+
* may sometimes use an earlier {@link TransportVersion} than this value. This includes remote-cluster communication, and communication
373+
* with nodes that are just starting up or otherwise are attempting to join this cluster.
374+
*/
353375
public TransportVersion getMinTransportVersion() {
354376
return this.minVersions.transportVersion();
355377
}

0 commit comments

Comments
 (0)