Revert "Prevent dropping of unchecked on restart if high unchecked (#1965)"
This reverts commit ecc571ca6d.
This commit is contained in:
parent
a691823d98
commit
2174fd737b
2 changed files with 7 additions and 15 deletions
|
|
@ -832,7 +832,6 @@ txn_tracking_enabled (txn_tracking_config_a.enable)
|
|||
if (!error_a)
|
||||
{
|
||||
auto is_fully_upgraded (false);
|
||||
bool is_unchecked_drop_required (false);
|
||||
{
|
||||
auto transaction (tx_begin_read ());
|
||||
auto err = mdb_dbi_open (env.tx (transaction), "meta", 0, &meta);
|
||||
|
|
@ -854,17 +853,14 @@ txn_tracking_enabled (txn_tracking_config_a.enable)
|
|||
{
|
||||
error_a |= do_upgrades (transaction, batch_size);
|
||||
}
|
||||
is_unchecked_drop_required = (block_count (transaction).sum () / 10) > unchecked_count (transaction) && unchecked_count (transaction) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto transaction (tx_begin_read ());
|
||||
open_databases (error_a, transaction, 0);
|
||||
is_unchecked_drop_required = (block_count (transaction).sum () / 10) > unchecked_count (transaction) && unchecked_count (transaction) != 0;
|
||||
}
|
||||
|
||||
// Delete unchecked blocks at node start (if node initial synchronization is mostly completed)
|
||||
if (!error_a && drop_unchecked && is_unchecked_drop_required)
|
||||
if (!error_a && drop_unchecked)
|
||||
{
|
||||
auto transaction (tx_begin_write ());
|
||||
unchecked_clear (transaction);
|
||||
|
|
|
|||
|
|
@ -1847,18 +1847,14 @@ void nano::node::unchecked_cleanup ()
|
|||
{
|
||||
auto now (nano::seconds_since_epoch ());
|
||||
auto transaction (store.tx_begin_read ());
|
||||
// Don't start cleanup if unchecked count > 10% of total blocks count
|
||||
if ((store.block_count (transaction).sum () / 10) + 1 >= store.unchecked_count (transaction))
|
||||
// Max 128k records to clean, max 2 minutes reading to prevent slow i/o systems start issues
|
||||
for (auto i (store.unchecked_begin (transaction)), n (store.unchecked_end ()); i != n && cleaning_list.size () < 128 * 1024 && nano::seconds_since_epoch () - now < 120; ++i)
|
||||
{
|
||||
// Max 128k records to clean, max 2 minutes reading to prevent slow i/o systems start issues
|
||||
for (auto i (store.unchecked_begin (transaction)), n (store.unchecked_end ()); i != n && cleaning_list.size () < 128 * 1024 && nano::seconds_since_epoch () - now < 120; ++i)
|
||||
nano::unchecked_key key (i->first);
|
||||
nano::unchecked_info info (i->second);
|
||||
if ((now - info.modified) > static_cast<uint64_t> (config.unchecked_cutoff_time.count ()))
|
||||
{
|
||||
nano::unchecked_key key (i->first);
|
||||
nano::unchecked_info info (i->second);
|
||||
if ((now - info.modified) > static_cast<uint64_t> (config.unchecked_cutoff_time.count ()))
|
||||
{
|
||||
cleaning_list.push_back (key);
|
||||
}
|
||||
cleaning_list.push_back (key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue