Skip to content

Commit

Permalink
Fixed double count
Browse files Browse the repository at this point in the history
  • Loading branch information
RickiNano committed Jun 26, 2024
1 parent de69185 commit cdfaa6a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions nano/secure/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,9 +1263,9 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
rocksdb_store->block.raw_put (rocksdb_transaction, vector, i->first);

count++;
if (count % 5000000 == 0)
if (count % 500000 == 0)
{
logger.info (nano::log::type::ledger, "{} million blocks converted", count / 1000000);
logger.info (nano::log::type::ledger, "{} million blocks converted", count);
}
}
});
Expand All @@ -1275,7 +1275,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
count = 0;
store.pending.for_each_par (
[&rocksdb_store, &count, &logger] (store::read_transaction const & /*unused*/, auto i, auto n) {
for (; i != n; ++i, ++count)
for (; i != n; ++i)
{
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::pending }));
rocksdb_store->pending.put (rocksdb_transaction, i->first, i->second);
Expand All @@ -1292,7 +1292,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
count = 0;
store.confirmation_height.for_each_par (
[&rocksdb_store, &count, &logger] (store::read_transaction const & /*unused*/, auto i, auto n) {
for (; i != n; ++i, ++count)
for (; i != n; ++i)
{
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::confirmation_height }));
rocksdb_store->confirmation_height.put (rocksdb_transaction, i->first, i->second);
Expand All @@ -1305,11 +1305,11 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
});

logger.info (nano::log::type::ledger, "Finished converting {} entries", count);
logger.info (nano::log::type::ledger, "Step 4 of 7: Converting accounts height table");
logger.info (nano::log::type::ledger, "Step 4 of 7: Converting accounts table");
count = 0;
store.account.for_each_par (
[&rocksdb_store, &count, &logger] (store::read_transaction const & /*unused*/, auto i, auto n) {
for (; i != n; ++i, ++count)
for (; i != n; ++i)
{
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::accounts }));
rocksdb_store->account.put (rocksdb_transaction, i->first, i->second);
Expand All @@ -1326,7 +1326,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
count = 0;
store.rep_weight.for_each_par (
[&rocksdb_store, &count, &logger] (store::read_transaction const & /*unused*/, auto i, auto n) {
for (; i != n; ++i, ++count)
for (; i != n; ++i)
{
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::rep_weights }));
rocksdb_store->rep_weight.put (rocksdb_transaction, i->first, i->second.number ());
Expand All @@ -1343,7 +1343,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
count = 0;
store.pruned.for_each_par (
[&rocksdb_store, &count, &logger] (store::read_transaction const & /*unused*/, auto i, auto n) {
for (; i != n; ++i, ++count)
for (; i != n; ++i)
{
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::pruned }));
rocksdb_store->pruned.put (rocksdb_transaction, i->first);
Expand All @@ -1360,7 +1360,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
count = 0;
store.final_vote.for_each_par (
[&rocksdb_store, &count, &logger] (store::read_transaction const & /*unused*/, auto i, auto n) {
for (; i != n; ++i, ++count)
for (; i != n; ++i)
{
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::final_votes }));
rocksdb_store->final_vote.put (rocksdb_transaction, i->first, i->second);
Expand Down

0 comments on commit cdfaa6a

Please sign in to comment.