Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does this library call Sink.Close() during Snapshotting? #616

Open
otoolep opened this issue Sep 21, 2024 · 2 comments
Open

Why does this library call Sink.Close() during Snapshotting? #616

otoolep opened this issue Sep 21, 2024 · 2 comments

Comments

@otoolep
Copy link
Contributor

otoolep commented Sep 21, 2024

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/[email protected]#FSMSnapshot

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?

@otoolep otoolep changed the title Why does this library call Sink.Close() during Snapshotting Why does this library call Sink.Close() during Snapshotting? Sep 21, 2024
@otoolep
Copy link
Contributor Author

otoolep commented Sep 21, 2024

Same question for Cancel() too.

@otoolep
Copy link
Contributor Author

otoolep commented Sep 21, 2024

(Made some corrections to text of report)

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

No branches or pull requests

1 participant