Why does ClusterState class need need a data member named stateUUID?

https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/cluster/ClusterState.java#L139

This class ClusterState has two data member, named stateUUID and version. The stateUUID is supported for cluster state diffs. My question is since there is a version member, why do need a stateUUID data member? The version data member can also support the cluster state diffs.

@Igor_Motov Thanks.

Version is monotonically increasing on (and therefore uniquely identifies) committed states, while stateUUID uniquely identifies a state, even if the state is not committed. Typically, stateUUID is used to identify changed state when it received by non-master nodes before the state is committed, you can think of it as non-commited version. During normal operation of cluster each new stateUUID will have a corresponding version change, but when something unordinary happens such as master disconnects, nodes go down or timeout, etc, there could be multiple different states with different stateUUIDs before one of them is finally accepted by the quorum of master-eligible nodes and the version increments. You can find more information about this process and parameters that control it in our documentation.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.