Skip to content

Commit

Permalink
Output the number of entries for each table
Browse files Browse the repository at this point in the history
  • Loading branch information
RickiNano committed Jul 5, 2024
1 parent 69ef7c9 commit 3566c81
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions nano/secure/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,8 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p

if (!rocksdb_store->init_error ())
{
logger.info (nano::log::type::ledger, "Step 1 of 7: Converting blocks table");
auto table_size = store.count (store.tx_begin_read (), tables::blocks);
logger.info (nano::log::type::ledger, "Step 1 of 7: Converting {} million entries from blocks table", table_size / 1000000);
std::atomic<std::size_t> count = 0;
auto refresh_interval = 20ms;
store.block.for_each_par (
Expand All @@ -1272,9 +1273,10 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
}
}
});

logger.info (nano::log::type::ledger, "Finished converting {} blocks", count.load ());
logger.info (nano::log::type::ledger, "Step 2 of 7: Converting pending table");

table_size = store.count (store.tx_begin_read (), tables::pending);
logger.info (nano::log::type::ledger, "Step 2 of 7: Converting {} entries from pending table", table_size);
count = 0;
store.pending.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
Expand All @@ -1289,9 +1291,10 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
}
}
});

logger.info (nano::log::type::ledger, "Finished converting {} entries", count.load ());
logger.info (nano::log::type::ledger, "Step 3 of 7: Converting confirmation_height table");

table_size = store.count (store.tx_begin_read (), tables::confirmation_height);
logger.info (nano::log::type::ledger, "Step 3 of 7: Converting {} entries from confirmation_height table", table_size);
count = 0;
store.confirmation_height.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
Expand All @@ -1306,9 +1309,10 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
}
}
});

logger.info (nano::log::type::ledger, "Finished converting {} entries", count.load ());
logger.info (nano::log::type::ledger, "Step 4 of 7: Converting accounts table");

table_size = store.count (store.tx_begin_read (), tables::confirmation_height);
logger.info (nano::log::type::ledger, "Step 4 of 7: Converting {} entries from confirmation_height table", table_size);
count = 0;
store.account.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
Expand All @@ -1323,9 +1327,10 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
}
}
});

logger.info (nano::log::type::ledger, "Finished converting {} entries", count.load ());
logger.info (nano::log::type::ledger, "Step 5 of 7: Converting rep_weights table");

table_size = store.count (store.tx_begin_read (), tables::rep_weights);
logger.info (nano::log::type::ledger, "Step 5 of 7: Converting {} entries from rep_weights table", table_size);
count = 0;
store.rep_weight.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
Expand All @@ -1340,9 +1345,10 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
}
}
});

logger.info (nano::log::type::ledger, "Finished converting {} entries", count.load ());
logger.info (nano::log::type::ledger, "Step 6 of 7: Converting pruned table");

table_size = store.count (store.tx_begin_read (), tables::pruned);
logger.info (nano::log::type::ledger, "Step 6 of 7: Converting {} entries from pruned table", table_size);
count = 0;
store.pruned.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
Expand All @@ -1357,9 +1363,10 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
}
}
});

logger.info (nano::log::type::ledger, "Finished converting {} entries", count.load ());
logger.info (nano::log::type::ledger, "Step 7 of 7: Converting final_votes table");

table_size = store.count (store.tx_begin_read (), tables::final_votes);
logger.info (nano::log::type::ledger, "Step 7 of 7: Converting {} entries from final_votes table", table_size);
count = 0;
store.final_vote.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
Expand Down

0 comments on commit 3566c81

Please sign in to comment.