Why does this library call Sink.Close() during Snapshotting?
- Dominant language
- Go
- Stars
- 9.1k
- Forks
- 1.1k
- Avg merge
- 3h 27m
- Merged PRs (30d)
- 2
Description
This library closes a Sink to which a snapshot is written, after the snapshot has been written to the Sink:
https://github.com/hashicorp/raft/blob/v1.7.1/snapshot.go#L197
Yet the Godocs imply that the FSM should call Close:
https://pkg.go.dev/github.com/hashicorp/raft@v1.7.1#FSMSnapshot
```Go
type FSMSnapshot interface {
// Persist should dump all necessary state to the WriteCloser 'sink',
// and call sink.Close() when finished or call sink.Cancel() on error.
Persist(sink SnapshotSink)
// Release is invoked when we are finished with the snapshot.
Release()
}
```
Granted, it's easy enough to code a Sink to make close idempotent, but is this simply a bug?
Contributor guide
Research direction
Read snapshot.go around line 197 and compare its Sink.Close handling with the FSMSnapshot interface documentation on pkg.go.dev. Determine which lifecycle contract is intended and trace any related snapshot behavior before proposing a focused consistency fix; done means the implementation and documentation agree, with coverage for the clarified behavior if an appropriate test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100