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

Fix stream writer flushing to be thread safe. #2294

Merged
merged 1 commit into from
Apr 15, 2015
Merged

Fix stream writer flushing to be thread safe. #2294

merged 1 commit into from
Apr 15, 2015

Conversation

benbjohnson
Copy link
Contributor

Overview

This change fixes the raft streams so that Flush() is not called asynchronously while the snapshot is being written. Previously the logWriter would call Flush() while the snapshot was being written. Now it will not call flush until the snapshot is complete.

This change fixes the raft streams so that Flush() is not called
asynchronously while the snapshot is being written.
@toddboom
Copy link
Contributor

:shipit: on green

@@ -231,7 +231,9 @@ func CopyFlush(dst io.Writer, src io.Reader) (written int64, err error) {
}

// Flush after write.
if dst, ok := dst.(http.Flusher); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one wasn't necessary. I mostly just don't like using http.Flusher because Flush() is such a generic concept that tying it to http seems dumb. There is no functional change here. It's just aesthetics.

@otoolep
Copy link
Contributor

otoolep commented Apr 15, 2015

+1, the write will now only take place is snapshotting is not.

toddboom added a commit that referenced this pull request Apr 15, 2015
Fix stream writer flushing to be thread safe.
@toddboom toddboom merged commit b43db19 into master Apr 15, 2015
@toddboom toddboom deleted the flush-fix branch April 16, 2015 03:43
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

Successfully merging this pull request may close these issues.

None yet

3 participants