Search code examples
aeron

For Aeron cluster, is there a max value for the term number?


I am reading some material of how clustered Aeron. It says Aeron use the Raft Consensus Algorithm to synchronize between nodes, where the leader is determined by checking if the node has the latest term number (and the logs as well).

My understanding is the term number is an incremental sequence number on the growth of the message size. If my understanding is correct, will there be a limit on the term number and what if the term number has reached the limit?


Solution

  • Aeron uses a 64-bit signed integer for the leadership term id which is incremented on each change of leadership in a cluster. Leaderships tends to change on restart, failed leader, or during upgrades - so relatively infrequently.

    The leadership term id will go negative after 2^63. How likely is this to happen? Let's assume a very extreme and unlikely case in that leadership changes in the cluster 1 billion times per second, i.e. once per nanosecond. If that was to happen then in 292.2 years the the leadership term id would go negative. This is not something I lose sleep over.