Skip to content

Commit

Permalink
Use default refresh interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Jul 9, 2024
1 parent 59e874b commit 1cbf85f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions nano/secure/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,21 +1265,19 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
// Open rocksdb database
nano::rocksdb_config rocksdb_config;
rocksdb_config.enable = true;
//rocksdb_config.memory_multiplier = 4;
auto rocksdb_store = nano::make_store (logger, data_path_a, nano::dev::constants, false, true, rocksdb_config);

if (!rocksdb_store->init_error ())
{
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 = 100ms;
store.block.for_each_par (
[&] (store::read_transaction const & /*unused*/, auto i, auto n) {
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::blocks }));
for (; i != n; ++i)
{
rocksdb_transaction.refresh_if_needed (refresh_interval);
rocksdb_transaction.refresh_if_needed ();
std::vector<uint8_t> vector;
{
nano::vectorstream stream (vector);
Expand All @@ -1304,7 +1302,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::pending }));
for (; i != n; ++i)
{
rocksdb_transaction.refresh_if_needed (refresh_interval);
rocksdb_transaction.refresh_if_needed ();
rocksdb_store->pending.put (rocksdb_transaction, i->first, i->second);
if (auto count_l = ++count; count_l % 500000 == 0)
{
Expand All @@ -1322,7 +1320,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::confirmation_height }));
for (; i != n; ++i)
{
rocksdb_transaction.refresh_if_needed (refresh_interval);
rocksdb_transaction.refresh_if_needed ();
rocksdb_store->confirmation_height.put (rocksdb_transaction, i->first, i->second);
if (auto count_l = ++count; count_l % 500000 == 0)
{
Expand All @@ -1340,7 +1338,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::accounts }));
for (; i != n; ++i)
{
rocksdb_transaction.refresh_if_needed (refresh_interval);
rocksdb_transaction.refresh_if_needed ();
rocksdb_store->account.put (rocksdb_transaction, i->first, i->second);
if (auto count_l = ++count; count_l % 500000 == 0)
{
Expand All @@ -1358,7 +1356,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::rep_weights }));
for (; i != n; ++i)
{
rocksdb_transaction.refresh_if_needed (refresh_interval);
rocksdb_transaction.refresh_if_needed ();
rocksdb_store->rep_weight.put (rocksdb_transaction, i->first, i->second.number ());
if (auto count_l = ++count; count_l % 500000 == 0)
{
Expand All @@ -1376,7 +1374,7 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::pruned }));
for (; i != n; ++i)
{
rocksdb_transaction.refresh_if_needed (refresh_interval);
rocksdb_transaction.refresh_if_needed ();
rocksdb_store->pruned.put (rocksdb_transaction, i->first);
if (auto count_l = ++count; count_l % 500000 == 0)
{
Expand Down

0 comments on commit 1cbf85f

Please sign in to comment.