Skip to content

Add RocksDB checkpoint generation command and rebase onto main#3756

Closed
Copilot wants to merge 1 commit into
generating_checkpointfrom
copilot/sub-pr-3743
Closed

Add RocksDB checkpoint generation command and rebase onto main#3756
Copilot wants to merge 1 commit into
generating_checkpointfrom
copilot/sub-pr-3743

Conversation

Copilot AI commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Summary

Rebased PR onto latest main and added checkpoint generation capability for RocksDB databases.

Changes

  • Added GenerateDBCheckPointCommand to create RocksDB checkpoints for backup/snapshot purposes
  • Integrated command into CLI with rooch db generate-db-checkpoint -o <output_dir> subcommand
  • Fixed readonly RocksDB initialization to set error_if_exists(false), preventing spurious errors when opening existing databases in readonly mode

Implementation Details

The checkpoint command uses RocksDB's native checkpoint API to create consistent snapshots without blocking writes:

pub async fn execute(self) -> RoochResult<()> {
    let (_root, rooch_db, _start_time) =
        open_rooch_db_readonly(self.base_data_dir.clone(), self.chain_id.clone());
    let rocks_db = rooch_db.moveos_store.node_store.get_store().store().db()
        .expect("Failed to open RocksDB instance")
        .inner();

    let check_point = Checkpoint::new(rocks_db)
        .expect("failed to create Checkpoint object from RocksDB instance.");
    check_point.create_checkpoint(self.output_dir.as_path())
        .map_err(|e| RoochError::from(anyhow::anyhow!(
            "failed to create checkpoint directory at {:?}: {}", self.output_dir, e
        )))?;
    
    Ok(())
}

Opens database in readonly mode to avoid interfering with running nodes.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Nov 18, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rooch-portal-v2.1 Ready Ready Preview Comment Nov 18, 2025 7:50am
test-portal Ready Ready Preview Comment Nov 18, 2025 7:50am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rooch Ignored Ignored Preview Nov 18, 2025 7:50am

Copilot AI changed the title [WIP] Add functionality to generate checkpoints for RocksDB Add RocksDB checkpoint generation command and rebase onto main Nov 18, 2025
Copilot AI requested a review from jolestar November 18, 2025 08:03
@jolestar jolestar marked this pull request as ready for review November 18, 2025 08:07
@jolestar jolestar closed this Nov 18, 2025
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