Skip to content

Commit

Permalink
Asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Aug 27, 2024
1 parent b2108b7 commit 9762eeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nano/store/lmdb/lmdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ void nano::store::lmdb::component::upgrade_v22_to_v23 (store::write_transaction
logger.info (nano::log::type::lmdb, "Upgrading database from v22 to v23...");

drop (transaction, tables::rep_weights);
transaction.refresh ();

release_assert (rep_weight.begin (tx_begin_read ()) == rep_weight.end (), "rep weights table must be empty before upgrading to v23");

const size_t batch_size = 1000 * 10;

Expand Down
4 changes: 4 additions & 0 deletions nano/store/rocksdb/rocksdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transacti
{
logger.info (nano::log::type::rocksdb, "Dropping existing rep_weights table");
drop (transaction, tables::rep_weights);
transaction.refresh ();
}

{
Expand All @@ -301,8 +302,11 @@ void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transacti
::rocksdb::ColumnFamilyHandle * new_cf_handle;
::rocksdb::Status status = db->CreateColumnFamily (new_cf_options, "rep_weights", &new_cf_handle);
handles.emplace_back (new_cf_handle);
transaction.refresh ();
}

release_assert (rep_weight.begin (tx_begin_read ()) == rep_weight.end (), "rep weights table must be empty before upgrading to v23");

const size_t batch_size = 1000 * 10;

nano::account next = 0;
Expand Down

0 comments on commit 9762eeb

Please sign in to comment.