-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[FIXED] Fix install stream snapshots on graceful shutdown #5809
Merged
derekcollison
merged 2 commits into
main
from
fix/stream-snapshots-not-installed-on-shutdown
Aug 20, 2024
Merged
[FIXED] Fix install stream snapshots on graceful shutdown #5809
derekcollison
merged 2 commits into
main
from
fix/stream-snapshots-not-installed-on-shutdown
Aug 20, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Need to fix this one:
|
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
MauriceVanVeen
force-pushed
the
fix/stream-snapshots-not-installed-on-shutdown
branch
from
August 20, 2024 20:34
2007a25
to
420a121
Compare
derekcollison
approved these changes
Aug 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
derekcollison
deleted the
fix/stream-snapshots-not-installed-on-shutdown
branch
August 20, 2024 21:04
wallyqs
pushed a commit
that referenced
this pull request
Aug 23, 2024
Upon graceful shutdown, stream snapshots aren't installed: stream.go ```go } else { // Always attempt snapshot on clean exit. n.InstallSnapshot(mset.stateSnapshotLocked()) n.Stop() } ``` But raft.go exits immediately since it's in Closed state ```go if n.State() == Closed { return errNodeClosed } ``` This turns out to be because of calling either of `close(mset.mqch)` or `close(mset.qch)`. Which then calls the following upon leaving `monitorStream`: ```go // Make sure to stop the raft group on exit to prevent accidental memory bloat. // This should be below the checkInMonitor call though to avoid stopping it out // from underneath the one that is running since it will be the same raft node. defer n.Stop() ``` This PR proposes to skip running `n.Stop()` from `monitorStream` when we know we're closing / have called `mset.stop()`. Which will already take care of calling either `n.Stop()` or `n.Delete()` so there's no need in stopping from `monitorStream` in that case. TLDR; this ensures stream snapshots are installed upon shutdown. Signed-off-by: Maurice van Veen <github@mauricevanveen.com> --------- Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
wallyqs
pushed a commit
that referenced
this pull request
Aug 23, 2024
Upon graceful shutdown, stream snapshots aren't installed: stream.go ```go } else { // Always attempt snapshot on clean exit. n.InstallSnapshot(mset.stateSnapshotLocked()) n.Stop() } ``` But raft.go exits immediately since it's in Closed state ```go if n.State() == Closed { return errNodeClosed } ``` This turns out to be because of calling either of `close(mset.mqch)` or `close(mset.qch)`. Which then calls the following upon leaving `monitorStream`: ```go // Make sure to stop the raft group on exit to prevent accidental memory bloat. // This should be below the checkInMonitor call though to avoid stopping it out // from underneath the one that is running since it will be the same raft node. defer n.Stop() ``` This PR proposes to skip running `n.Stop()` from `monitorStream` when we know we're closing / have called `mset.stop()`. Which will already take care of calling either `n.Stop()` or `n.Delete()` so there's no need in stopping from `monitorStream` in that case. TLDR; this ensures stream snapshots are installed upon shutdown. Signed-off-by: Maurice van Veen <github@mauricevanveen.com> --------- Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
wallyqs
changed the title
Fix install stream snapshots on graceful shutdown
[FIXED] Fix install stream snapshots on graceful shutdown
Aug 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upon graceful shutdown, stream snapshots aren't installed:
stream.go
But raft.go exits immediately since it's in Closed state
This turns out to be because of calling either of
close(mset.mqch)
orclose(mset.qch)
. Which then calls the following upon leavingmonitorStream
:This PR proposes to skip running
n.Stop()
frommonitorStream
when we know we're closing / have calledmset.stop()
. Which will already take care of calling eithern.Stop()
orn.Delete()
so there's no need in stopping frommonitorStream
in that case.TLDR; this ensures stream snapshots are installed upon shutdown.
Signed-off-by: Maurice van Veen github@mauricevanveen.com