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

Drop existing rep_weights table before migrating #4712

Closed
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions nano/store/lmdb/lmdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ void nano::store::lmdb::component::upgrade_v21_to_v22 (store::write_transaction
void nano::store::lmdb::component::upgrade_v22_to_v23 (store::write_transaction const & transaction_a)
{
logger.info (nano::log::type::lmdb, "Upgrading database from v22 to v23...");
drop (transaction_a, tables::rep_weights);
auto i{ make_iterator<nano::account, nano::account_info_v22> (transaction_a, tables::accounts) };
auto end{ store::iterator<nano::account, nano::account_info_v22> (nullptr) };
uint64_t processed_accounts = 0;
Expand Down
16 changes: 10 additions & 6 deletions nano/store/rocksdb/rocksdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,18 @@ void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transacti
{
logger.info (nano::log::type::rocksdb, "Upgrading database from v22 to v23...");

if (!column_family_exists ("rep_weights"))
if (column_family_exists ("rep_weights"))
{
logger.info (nano::log::type::rocksdb, "Creating table rep_weights");
::rocksdb::ColumnFamilyOptions new_cf_options;
::rocksdb::ColumnFamilyHandle * new_cf_handle;
::rocksdb::Status status = db->CreateColumnFamily (new_cf_options, "rep_weights", &new_cf_handle);
handles.emplace_back (new_cf_handle);
logger.info (nano::log::type::rocksdb, "Dropping existing rep_weights table");
drop (transaction_a, tables::rep_weights);
}

logger.info (nano::log::type::rocksdb, "Creating table rep_weights");
::rocksdb::ColumnFamilyOptions new_cf_options;
::rocksdb::ColumnFamilyHandle * new_cf_handle;
::rocksdb::Status status = db->CreateColumnFamily (new_cf_options, "rep_weights", &new_cf_handle);
handles.emplace_back (new_cf_handle);

auto i{ make_iterator<nano::account, nano::account_info_v22> (transaction_a, tables::accounts) };
auto end{ store::iterator<nano::account, nano::account_info_v22> (nullptr) };
uint64_t processed_accounts = 0;
Expand Down
Loading