Skip to content

Commit

Permalink
fix(migration): release storage locks
Browse files Browse the repository at this point in the history
Closes #4344. Hat tip to @erwanor for spotting the omission.
  • Loading branch information
conorsch committed May 7, 2024
1 parent 15f347c commit ea5a523
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions crates/bin/pd/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ impl Migration {
storage.release().await;
let storage = Storage::load(rocksdb_dir, SUBSTORE_PREFIXES.to_vec()).await?;
let migrated_state = storage.latest_snapshot();
storage.release().await;

// The migration is complete, now we need to generate a genesis file. To do this, we need
// to lookup a validator view from the chain, and specify the post-upgrade app hash and
Expand Down Expand Up @@ -254,6 +255,7 @@ pub async fn last_block_timestamp(home: PathBuf) -> anyhow::Result<tendermint::T
.get_block_timestamp()
.await
.context("error reading latest block timestamp")?;
storage.release().await;
Ok(last_block_time)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bin/pd/src/migrate/testnet74.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ pub async fn migrate(

(start_time.elapsed().unwrap(), post_upgrade_root_hash)
};

storage.release().await;
tracing::info!(?post_upgrade_root_hash, "post-upgrade root hash");

storage.release().await;
let storage = Storage::load(rocksdb_dir, SUBSTORE_PREFIXES.to_vec()).await?;
let migrated_state = storage.latest_snapshot();
storage.release().await;

// The migration is complete, now we need to generate a genesis file. To do this, we need
// to lookup a validator view from the chain, and specify the post-upgrade app hash and
Expand Down

0 comments on commit ea5a523

Please sign in to comment.