-
Notifications
You must be signed in to change notification settings - Fork 340
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
Stops ABS in wen_restart when generating a snapshot #4896
base: master
Are you sure you want to change the base?
Conversation
9dea61e
to
3967cd3
Compare
@wen-coding: requesting your review as an expert on the wen_restart code |
let mut last_snapshot_end_time = None; | ||
|
||
loop { | ||
if exit.load(Ordering::Relaxed) || stop.load(Ordering::Relaxed) { |
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.
This looks pretty good to me. My only question is: if we stop in the middle, would this leave anything broken on disk so that we can't really generate snapshot later?
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.
Nothing is stopped in the middle, so we're safe.
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.
The wen_restart part looks good to me.
@wen-coding Does this need to be backported to v2.2? |
Nah, I think we can just wait for the normal release cycle. |
/// Query and manage the status of AccountsBackgroundService | ||
#[derive(Debug, Clone)] | ||
pub struct AbsStatus { | ||
/// Flag to query if ABS is running |
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.
nit: we could optimized this into just one AtomicU8.
0 - running
1 - stopping
2 - stopped.
Problem
When wen_restart generates a snapshot, AccountsBackgroundService is still running. The accounts-db background tasks (flush/clean/shrink) cannot run concurrent with each other, but since ABS is still running (and generating a snapshot calls flush & clean), this invariant is broken. We observe asserts on larger tests indicating as such.
Summary of Changes
Stop ABS before wen-restart generates a snapshot.
Note to reviewers: I recommend ignoring whitespace in the diff view.