Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ra_server: Add a comment explaining the promotion target index
The worry here about `ra_log:next_index/1` is that the peer joining might be 'stuck' if this were off-by-one: if the cluster weren't handling any other new commands other than the `$ra_join`, the peer would be able to catch up to `ra_log`'s `LastIndex` but not this target, so the peer wouldn't be promotable until the cluster handled some other command. This isn't the case though because the next index is immediately used for a cluster change command which updates this peer's promotion target. So it should be possible for the peer to reach its promotion target even if the cluster doesn't handle any other commands by the time the candidate catches up to the target. This change just documents why the next index is ok to use.
- Loading branch information