Open schuster opened 9 years ago
For what it's worth, I have a (non-pull-request-worthy) fix for this issue here:
NetSys/sts2-applications@1840499 https://github.com/NetSys/sts2-applications/commit/6f15bcf436c3bc4f58c21a64ab6cf5265d5d19cf
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.
The index numbers used in the code are confusing and seem to be inconsistent. The indices in the log will start at 0. However, an
AppendEntries
with an empty list of entries to send will indicate its last index as 1, which would actually be the second index in the log (I would expect this to be 0). I seem to recall similar issues, but can't seem to find them now.The code should be consistent on what the start index of the log is, and what number indicates "this is before the start of the log". The tech report uses 0 as a special index value to indicate a point before the beginning of the log and starts the log at index 1, but -1 and 0 could be used equally well. Whichever way is used should be documented somewhere in the code.