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

Way to ensure checkpoint is completed? #888

Closed
kidcooky opened this issue May 16, 2024 · 1 comment
Closed

Way to ensure checkpoint is completed? #888

kidcooky opened this issue May 16, 2024 · 1 comment

Comments

@kidcooky
Copy link

kidcooky commented May 16, 2024

Hey, I have a periodic job to create checkpoint to a local directory, and serve this checkpoint to other machine with another thread, I wonder what I can do to ensure the checkpoint is successfully done and all data is checkpointed before sending it out? i.e. How do I know the checkpoint has been fully done to file system so I can compress and send it out?

fn create_and_save_checkpoint(db: Arc<DB>, snapshot_dir: &Path) -> Result<(), error::Error> {
    if snapshot_dir.exists() {
        fs::remove_dir_all(snapshot_dir)?;
    }
    let checkpoint = Checkpoint::new(&db)?;
    checkpoint.create_checkpoint(snapshot_dir)?;
    Ok(())
}
@zaidoon1
Copy link
Contributor

checkpoint creation is a blocking call so once checkpoint.create_checkpoint(snapshot_dir)?; returns, the checkpoint would have already be completed/done

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

No branches or pull requests

2 participants