Skip to content

Commit

Permalink
pd(upgrade): use upgrade_path flag (#3101)
Browse files Browse the repository at this point in the history
* pd(upgrade): use  flag

* pd(upgrade): use  instead of data path
  • Loading branch information
erwanor authored Sep 26, 2023
1 parent 8c6de29 commit 6a538dd
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions crates/bin/pd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,21 +629,17 @@ async fn main() -> anyhow::Result<()> {
t.write_configs()?;
}
RootCommand::Export {
mut data_path,
mut home,
mut export_path,
prune,
} => {
use fs_extra;

tracing::info!("exporting state to {}", export_path.display());
let copy_opts = fs_extra::dir::CopyOptions::new();
data_path.push("rocksdb");
let from = [data_path.as_path()];
tracing::info!(
?data_path,
?export_path,
"copying from data dir to export dir",
);
home.push("rocksdb");
let from = [home.as_path()];
tracing::info!(?home, ?export_path, "copying from data dir to export dir",);
std::fs::create_dir_all(&export_path)?;
fs_extra::copy_items(&from, export_path.as_path(), &copy_opts)?;

Expand All @@ -662,9 +658,9 @@ async fn main() -> anyhow::Result<()> {
// - apply checks: root hash, size, etc.
todo!()
}
RootCommand::Upgrade { export_path } => {
tracing::info!("upgrading state from {}", export_path.display());
let _ = upgrade::migrate(export_path.clone(), Upgrade::Testnet60)
RootCommand::Upgrade { upgrade_path } => {
tracing::info!("upgrading state from {}", upgrade_path.display());
let _ = upgrade::migrate(upgrade_path.clone(), Upgrade::Testnet60)
.await
.context("failed to upgrade state")?;
}
Expand Down

0 comments on commit 6a538dd

Please sign in to comment.