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

NRG: Don't delete on-disk state if failing to create internal subs #5687

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

neilalexander
Copy link
Member

If we failed to start the Raft group subscriptions then we were calling shutdown with the shouldDelete flag set, which would nuke the state on disk, blowing away the WAL, the term and vote etc.

However, this could happen if a Raft group tried to be started while the server was shutting down. When this happened, we would see a log entry saying Error creating raft group: system account not setup and then the Raft state would get deleted, so after a restart, all state was lost.

This PR changes shouldDelete to false so that we preserve the state on disk for the next startup.

Signed-off-by: Neil Twigg neil@nats.io

If we failed to start the Raft group subscriptions then we were calling
`shutdown` with the `shouldDelete` flag set, which would nuke the state
on disk, blowing away the WAL, the term and vote etc.

However, this could happen if a Raft group tried to be started while the
server was shutting down. When this happened, we would see a log entry
saying `Error creating raft group: system account not setup` and then the
Raft state would get deleted, so after a restart, all state was lost.

This PR changes `shouldDelete` to false so that we preserve the state on
disk for the next startup.

Signed-off-by: Neil Twigg <neil@nats.io>
@neilalexander neilalexander requested a review from a team as a code owner July 23, 2024 13:45
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit af257ec into main Jul 23, 2024
5 checks passed
@derekcollison derekcollison deleted the neil/nrgshutdown branch July 23, 2024 14:54
bruth added a commit that referenced this pull request Jul 30, 2024
Includes the following:

* #5602
* #5672
* #5668
* #5607
* #5687
* #5695
* #5697
* #5704
* #5706
* #5709
* #5710
* #5713
* #5719

Some PRs specifically excluded:

* #5707 — based on a 2.11 NRG
PR
* #5690 — continue to allow
Go 1.20 for 2.10.x
* Various other NRG PRs which are higher risk and destined for 2.11
instead
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.

2 participants