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 rocksdb migration #4645

Merged
merged 2 commits into from
Jun 18, 2024
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
13 changes: 11 additions & 2 deletions nano/store/rocksdb/rocksdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ void nano::store::rocksdb::component::upgrade_v21_to_v22 (store::write_transacti
void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transaction const & transaction_a)
{
logger.info (nano::log::type::rocksdb, "Upgrading database from v22 to v23...");

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);
}
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 All @@ -309,10 +318,10 @@ void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transacti
processed_accounts++;
if (processed_accounts % 250000 == 0)
{
logger.info (nano::log::type::lmdb, "Processed {} accounts", processed_accounts);
logger.info (nano::log::type::rocksdb, "Processed {} accounts", processed_accounts);
}
}
logger.info (nano::log::type::lmdb, "Processed {} accounts", processed_accounts);
logger.info (nano::log::type::rocksdb, "Processed {} accounts", processed_accounts);
version.put (transaction_a, 23);
logger.info (nano::log::type::rocksdb, "Upgrading database from v22 to v23 completed");
}
Expand Down
Loading