Skip to content

Commit e46e3e7

Browse files
committed
Document getMinTransportVersion including exceptions (elastic#124192)
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 2a82161 commit e46e3e7

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

+22
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,28 @@ public boolean hasMixedSystemIndexVersions() {
322322
.anyMatch(e -> e.systemIndexMappingsVersion().equals(minVersions.systemIndexMappingsVersion()) == false);
323323
}
324324

325+
/**
326+
* @return the minimum {@link TransportVersion} that will be used for all future intra-cluster node-to-node communications. This value
327+
* only ever increases, so if {@code v.onOrAfter(cs.getMinTransportVersion())} is true once then it will remain true in the
328+
* future.
329+
* <p>
330+
* There are some subtle exceptions:
331+
* <ul>
332+
* <li>The "only ever increases" property is handled by the master node using the in-memory (ephemeral) part of the
333+
* {@link ClusterState} only, so in theory a full restart of a mixed-version cluster may lose that state and allow some nodes to see
334+
* this value decrease. For this to happen in practice requires some fairly unlucky timing during the initial master election. We
335+
* tell users not to do this: if something breaks during a rolling upgrade then they should upgrade all remaining nodes to continue.
336+
* But we do not enforce it.
337+
* <li>The "used for all node-to-node communications" is false in a disordered upgrade (an upgrade to a semantically-newer but
338+
* chronologically-older version) because for each connection between such nodes we will use {@link
339+
* TransportVersion#bestKnownVersion} to pick a transport version which is known by both endpoints. We tell users not to do
340+
* disordered upgrades too, but do not enforce it.
341+
* </ul>
342+
* <p>
343+
* 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)
344+
* may sometimes use an earlier {@link TransportVersion} than this value. This includes remote-cluster communication, and communication
345+
* with nodes that are just starting up or otherwise are attempting to join this cluster.
346+
*/
325347
public TransportVersion getMinTransportVersion() {
326348
return this.minVersions.transportVersion();
327349
}

0 commit comments

Comments
 (0)