Skip to content

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

Open
@otoolep

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/[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?

Activity

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

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