Skip to content

Conversation

the-mikedavis
Copy link
Collaborator

A leader might've taken a snapshot at the last index before a partition takes place. It can then write commands after the partition is in effect and the commands will not be committed. Then another leader can be elected and ask the deposed leader to reset its log down to the snapshot index. Previously this crashed since ra_log:set_last_index/2 did not consider the snapshot state.

Fixes #557

A leader might've taken a snapshot at the last index before a partition
takes place. It can then write commands after the partition is in effect
and the commands will not be committed. Then another leader can be
elected and ask the deposed leader to reset its log down to the snapshot
index. Previously this crashed since `ra_log:set_last_index/2` did not
consider the snapshot state.
@the-mikedavis
Copy link
Collaborator Author

This is a bit tricky to test since ra_log is mocked in ra_server_SUITE. The fix itself is small though and I've applied it equally to ra_log_memory and ra_log - ra_log_memory previously failed in the same scenario as #557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reseting a log doesn't take the snapshotted index into account

1 participant