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

fix(core): only resize db if migration is required #4792

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2618,7 +2618,7 @@ fn run_migrations(db: &LMDBDatabase) -> Result<(), ChainStorageError> {
Ok(())
}

// TODO: remove
// TODO: this is a temporary fix, remove
mod tari_script_execution_stack_bug_migration {
use serde::{Deserialize, Serialize};
use tari_common_types::types::{ComSignature, PublicKey};
Expand All @@ -2632,6 +2632,13 @@ mod tari_script_execution_stack_bug_migration {
};

pub fn migrate(db: &LMDBDatabase) -> Result<(), ChainStorageError> {
{
let txn = db.read_transaction()?;
// Only perform migration if necessary
if lmdb_len(&txn, &db.inputs_db)? == 0 {
return Ok(());
}
}
unsafe {
LMDBStore::resize(&db.env, &LMDBConfig::new(0, 1024 * 1024 * 1024, 0))?;
}
Expand Down