This PR makes three complementary fixes to the way how catchup and truncating is handled.
Specifically:
when doing n.loadEntry(index) we need to pass where the AppendEntry is in terms of stream sequence, this is equal to ae.pindex+1 since the ae.pindex is the value before it's stored in the stream.
start catchup from n.commit, we could have messages past our commit that have been invalidated and need to be truncated since there was a switch between leaders
because we catchup from n.commit, we check if our local AppendEntry matches terms with the incoming AppendEntry, we only need to truncate if the terms don't match
This PR makes three complementary fixes to the way how catchup and truncating is handled. Specifically:
n.loadEntry(index)
we need to pass where the AppendEntry is in terms of stream sequence, this is equal toae.pindex+1
since theae.pindex
is the value before it's stored in the stream.n.commit
, we could have messages past our commit that have been invalidated and need to be truncated since there was a switch between leadersn.commit
, we check if our local AppendEntry matches terms with the incoming AppendEntry, we only need to truncate if the terms don't matchSigned-off-by: Maurice van Veen github@mauricevanveen.com