Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

server loads old snapshots #235

@bcwaldon

Description

@bcwaldon

I have the following snapshot files:

1007_79443860.ss
101073_272975458.ss
103852_275330228.ss
11166_165394546.ss
1136_85946380.ss
12466_171438525.ss
1336_94077876.ss
22734_195564716.ss
3111_127284971.ss
3276_130008173.ss
3440_132650609.ss
579_44459558.ss
59456_237259277.ss
651_50350829.ss
68876_245043430.ss
8128_151960757.ss
88589_262075601.ss
9787_159118266.ss

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

snapshotPath := path.Join(s.path, "snapshot", filenames[len(filenames)-1])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions