This repository has been archived by the owner on Sep 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 478
server loads old snapshots #235
Comments
This is a somewhat dangerous bug if people have been using rsync or something to backup their snapshot directory. But, in the common case there is only ever one snapshot file on disk and this is managed by go-raft. |
Wow. Something as simple as this should fix it. |
@otoolep You actually need to pad both fields, as you need to be able to sort by the last index in the event that the term appears more than once. |
...and we need to deal with snapshots that are already out there. |
Check the PR -- it pads both fields. |
Ah, I didn't realize there was a PR. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have the following snapshot files:
On startup, the server picks the "latest" snapshot as a starting point. The "latest" snapshot is determined by first sorting all the snapshot files in alphabetical order (as they are above), then choosing the last one [0] . The format of these file names is
<lastTerm>_<lastIndex>.ss
. The intention here is to grab the snapshot from the highest term, falling back to the highest index in case two snapshots were created within the same term. Looking at the sort order above, the last one is clearly not the one with the highest term or highest index.[0]
raft/server.go
Line 1339 in 510993e
The text was updated successfully, but these errors were encountered: