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

[RocksDB] Limit write locks to necessary tables #2592

Merged
merged 1 commit into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion nano/node/json_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4100,7 +4100,7 @@ void nano::json_handler::unchecked_clear ()
{
auto rpc_l (shared_from_this ());
node.worker.push_task ([rpc_l]() {
auto transaction (rpc_l->node.store.tx_begin_write ());
auto transaction (rpc_l->node.store.tx_begin_write ({ tables::unchecked }));
rpc_l->node.store.unchecked_clear (transaction);
rpc_l->node.ledger.cache.unchecked_count = 0;
rpc_l->response_l.put ("success", "");
Expand Down
10 changes: 5 additions & 5 deletions nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ startup_time (std::chrono::steady_clock::now ())
if (!is_initialized)
{
release_assert (!flags.read_only);
auto transaction (store.tx_begin_write ());
auto transaction (store.tx_begin_write ({ tables::accounts, tables::cached_counts, tables::confirmation_height, tables::frontiers, tables::open_blocks }));
// Store was empty meaning we just created it, add the genesis block
store.initialize (transaction, genesis, ledger.cache);
}
Expand Down Expand Up @@ -441,7 +441,7 @@ startup_time (std::chrono::steady_clock::now ())
// Drop unchecked blocks if initial bootstrap is completed
if (!flags.disable_unchecked_drop && !use_bootstrap_weight && !flags.read_only)
{
auto transaction (store.tx_begin_write ());
auto transaction (store.tx_begin_write ({ tables::unchecked }));
store.unchecked_clear (transaction);
ledger.cache.unchecked_count = 0;
logger.always_log ("Dropping unchecked blocks");
Expand Down Expand Up @@ -626,7 +626,7 @@ nano::process_return nano::node::process_local (std::shared_ptr<nano::block> blo
// Notify block processor to release write lock
block_processor.wait_write ();
// Process block
auto transaction (store.tx_begin_write ());
auto transaction (store.tx_begin_write ({ tables::accounts, tables::cached_counts, tables::change_blocks, tables::frontiers, tables::open_blocks, tables::pending, tables::receive_blocks, tables::representation, tables::send_blocks, tables::state_blocks }, { tables::confirmation_height }));
return block_processor.process_one (transaction, info, work_watcher_a);
}

Expand Down Expand Up @@ -780,7 +780,7 @@ nano::uint128_t nano::node::minimum_principal_weight (nano::uint128_t const & on
void nano::node::long_inactivity_cleanup ()
{
bool perform_cleanup = false;
auto transaction (store.tx_begin_write ());
auto transaction (store.tx_begin_write ({ tables::online_weight, tables::peers }));
if (store.online_weight_count (transaction) > 0)
{
auto i (store.online_weight_begin (transaction));
Expand Down Expand Up @@ -950,7 +950,7 @@ void nano::node::unchecked_cleanup ()
while (!cleaning_list.empty ())
{
size_t deleted_count (0);
auto transaction (store.tx_begin_write ());
auto transaction (store.tx_begin_write ({ tables::unchecked }));
while (deleted_count++ < 2 * 1024 && !cleaning_list.empty ())
{
auto key (cleaning_list.front ());
Expand Down
2 changes: 1 addition & 1 deletion nano/node/online_reps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void nano::online_reps::observe (nano::account const & rep_a)

void nano::online_reps::sample ()
{
auto transaction (ledger.store.tx_begin_write ());
auto transaction (ledger.store.tx_begin_write ({ tables::online_weight }));
// Discard oldest entries
while (ledger.store.online_weight_count (transaction) >= network_params.node.max_weight_samples)
{
Expand Down