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

Stops ABS in wen_restart when generating a snapshot #4896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brooksprumo
Copy link

@brooksprumo brooksprumo commented Feb 10, 2025

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.

@brooksprumo brooksprumo self-assigned this Feb 10, 2025
@brooksprumo brooksprumo marked this pull request as ready for review February 10, 2025 22:08
@brooksprumo
Copy link
Author

@wen-coding: requesting your review as an expert on the wen_restart code
@HaoranYi: requesting your review as an expert on the accounts-db/ABS code

let mut last_snapshot_end_time = None;

loop {
if exit.load(Ordering::Relaxed) || stop.load(Ordering::Relaxed) {

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?

Copy link
Author

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.

Copy link

@wen-coding wen-coding left a 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.

@brooksprumo
Copy link
Author

@wen-coding Does this need to be backported to v2.2?

@wen-coding
Copy link

@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

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.

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.

3 participants