akka-raft
akka-raft copied to clipboard
termAt can return wrong term for first item
The termAt
method will return the wrong term in the case where the first entry in the log actually comes from a term other than term 1 (could happen if multiple elections occur before a request is sent). This is related to the inconsistent use of index numbers - the test should be for an index less than 0, not less than or equal to.
For what it's worth, I have a (non-pull-request-worthy) fix for this issue here:
NetSys/sts2-applications@1840499
Tested by fuzz testing -- I verified that under non-failing scenarios, this behaves correctly at each step of the execution when replicated two client commands.