Rename remaining blockprocessor usages to block_processor
This commit is contained in:
parent
23fc8972b6
commit
8ea3b2b619
9 changed files with 40 additions and 40 deletions
|
|
@ -5854,7 +5854,7 @@ TEST (ledger_transaction, write_wait_order)
|
||||||
WAIT (250ms); // Allow thread to start
|
WAIT (250ms); // Allow thread to start
|
||||||
|
|
||||||
auto fut2 = std::async (std::launch::async, [&ctx, &acquired2, &latch2] {
|
auto fut2 = std::async (std::launch::async, [&ctx, &acquired2, &latch2] {
|
||||||
auto tx = ctx.ledger ().tx_begin_write (nano::store::writer::blockprocessor);
|
auto tx = ctx.ledger ().tx_begin_write (nano::store::writer::block_processor);
|
||||||
acquired2 = true;
|
acquired2 = true;
|
||||||
latch2.wait (); // Wait for the signal to drop tx
|
latch2.wait (); // Wait for the signal to drop tx
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2404,7 +2404,7 @@ TEST (node, block_processor_reject_state)
|
||||||
send1->signature.bytes[0] ^= 1;
|
send1->signature.bytes[0] ^= 1;
|
||||||
ASSERT_FALSE (node.block_or_pruned_exists (send1->hash ()));
|
ASSERT_FALSE (node.block_or_pruned_exists (send1->hash ()));
|
||||||
node.process_active (send1);
|
node.process_active (send1);
|
||||||
ASSERT_TIMELY_EQ (5s, 1, node.stats.count (nano::stat::type::blockprocessor_result, nano::stat::detail::bad_signature));
|
ASSERT_TIMELY_EQ (5s, 1, node.stats.count (nano::stat::type::block_processor_result, nano::stat::detail::bad_signature));
|
||||||
ASSERT_FALSE (node.block_or_pruned_exists (send1->hash ()));
|
ASSERT_FALSE (node.block_or_pruned_exists (send1->hash ()));
|
||||||
auto send2 = builder.make_block ()
|
auto send2 = builder.make_block ()
|
||||||
.account (nano::dev::genesis_key.pub)
|
.account (nano::dev::genesis_key.pub)
|
||||||
|
|
|
||||||
|
|
@ -1045,7 +1045,7 @@ TEST (toml_config, log_config_no_defaults)
|
||||||
|
|
||||||
[log.levels]
|
[log.levels]
|
||||||
active_elections = "trace"
|
active_elections = "trace"
|
||||||
blockprocessor = "trace"
|
block_processor = "trace"
|
||||||
)toml";
|
)toml";
|
||||||
|
|
||||||
nano::tomlconfig toml;
|
nano::tomlconfig toml;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ enum class type
|
||||||
tls,
|
tls,
|
||||||
active_elections,
|
active_elections,
|
||||||
election,
|
election,
|
||||||
blockprocessor,
|
block_processor,
|
||||||
network,
|
network,
|
||||||
message,
|
message,
|
||||||
channel,
|
channel,
|
||||||
|
|
@ -122,7 +122,7 @@ enum class detail
|
||||||
election_expired,
|
election_expired,
|
||||||
broadcast_vote,
|
broadcast_vote,
|
||||||
|
|
||||||
// blockprocessor
|
// block_processor
|
||||||
block_processed,
|
block_processed,
|
||||||
|
|
||||||
// vote_processor
|
// vote_processor
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ enum class type
|
||||||
vote_cache,
|
vote_cache,
|
||||||
vote_cache_processor,
|
vote_cache_processor,
|
||||||
hinting,
|
hinting,
|
||||||
blockprocessor,
|
block_processor,
|
||||||
blockprocessor_source,
|
block_processor_source,
|
||||||
blockprocessor_result,
|
block_processor_result,
|
||||||
blockprocessor_overfill,
|
block_processor_overfill,
|
||||||
bootstrap,
|
bootstrap,
|
||||||
bootstrap_verify,
|
bootstrap_verify,
|
||||||
bootstrap_verify_blocks,
|
bootstrap_verify_blocks,
|
||||||
|
|
@ -206,7 +206,7 @@ enum class detail
|
||||||
representative_mismatch,
|
representative_mismatch,
|
||||||
block_position,
|
block_position,
|
||||||
|
|
||||||
// blockprocessor
|
// block_processor
|
||||||
process_blocking,
|
process_blocking,
|
||||||
process_blocking_timeout,
|
process_blocking_timeout,
|
||||||
force,
|
force,
|
||||||
|
|
|
||||||
|
|
@ -111,12 +111,12 @@ bool nano::block_processor::add (std::shared_ptr<nano::block> const & block, blo
|
||||||
{
|
{
|
||||||
if (network_params.work.validate_entry (*block)) // true => error
|
if (network_params.work.validate_entry (*block)) // true => error
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::insufficient_work);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::insufficient_work);
|
||||||
return false; // Not added
|
return false; // Not added
|
||||||
}
|
}
|
||||||
|
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::process);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::process);
|
||||||
logger.debug (nano::log::type::blockprocessor, "Processing block (async): {} (source: {} {})",
|
logger.debug (nano::log::type::block_processor, "Processing block (async): {} (source: {} {})",
|
||||||
block->hash ().to_string (),
|
block->hash ().to_string (),
|
||||||
to_string (source),
|
to_string (source),
|
||||||
channel ? channel->to_string () : "<unknown>"); // TODO: Lazy eval
|
channel ? channel->to_string () : "<unknown>"); // TODO: Lazy eval
|
||||||
|
|
@ -126,8 +126,8 @@ bool nano::block_processor::add (std::shared_ptr<nano::block> const & block, blo
|
||||||
|
|
||||||
std::optional<nano::block_status> nano::block_processor::add_blocking (std::shared_ptr<nano::block> const & block, block_source const source)
|
std::optional<nano::block_status> nano::block_processor::add_blocking (std::shared_ptr<nano::block> const & block, block_source const source)
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::process_blocking);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::process_blocking);
|
||||||
logger.debug (nano::log::type::blockprocessor, "Processing block (blocking): {} (source: {})", block->hash ().to_string (), to_string (source));
|
logger.debug (nano::log::type::block_processor, "Processing block (blocking): {} (source: {})", block->hash ().to_string (), to_string (source));
|
||||||
|
|
||||||
context ctx{ block, source };
|
context ctx{ block, source };
|
||||||
auto future = ctx.get_future ();
|
auto future = ctx.get_future ();
|
||||||
|
|
@ -140,8 +140,8 @@ std::optional<nano::block_status> nano::block_processor::add_blocking (std::shar
|
||||||
}
|
}
|
||||||
catch (std::future_error const &)
|
catch (std::future_error const &)
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::process_blocking_timeout);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::process_blocking_timeout);
|
||||||
logger.error (nano::log::type::blockprocessor, "Block dropped when processing: {}", block->hash ().to_string ());
|
logger.error (nano::log::type::block_processor, "Block dropped when processing: {}", block->hash ().to_string ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
@ -149,8 +149,8 @@ std::optional<nano::block_status> nano::block_processor::add_blocking (std::shar
|
||||||
|
|
||||||
void nano::block_processor::force (std::shared_ptr<nano::block> const & block_a)
|
void nano::block_processor::force (std::shared_ptr<nano::block> const & block_a)
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::force);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::force);
|
||||||
logger.debug (nano::log::type::blockprocessor, "Forcing block: {}", block_a->hash ().to_string ());
|
logger.debug (nano::log::type::block_processor, "Forcing block: {}", block_a->hash ().to_string ());
|
||||||
|
|
||||||
add_impl (context{ block_a, block_source::forced });
|
add_impl (context{ block_a, block_source::forced });
|
||||||
}
|
}
|
||||||
|
|
@ -169,8 +169,8 @@ bool nano::block_processor::add_impl (context ctx, std::shared_ptr<nano::transpo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::overfill);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::overfill);
|
||||||
stats.inc (nano::stat::type::blockprocessor_overfill, to_stat_detail (source));
|
stats.inc (nano::stat::type::block_processor_overfill, to_stat_detail (source));
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
@ -183,18 +183,18 @@ void nano::block_processor::rollback_competitor (secure::write_transaction const
|
||||||
if (successor != nullptr && successor->hash () != hash)
|
if (successor != nullptr && successor->hash () != hash)
|
||||||
{
|
{
|
||||||
// Replace our block with the winner and roll back any dependent blocks
|
// Replace our block with the winner and roll back any dependent blocks
|
||||||
logger.debug (nano::log::type::blockprocessor, "Rolling back: {} and replacing with: {}", successor->hash ().to_string (), hash.to_string ());
|
logger.debug (nano::log::type::block_processor, "Rolling back: {} and replacing with: {}", successor->hash ().to_string (), hash.to_string ());
|
||||||
|
|
||||||
std::deque<std::shared_ptr<nano::block>> rollback_list;
|
std::deque<std::shared_ptr<nano::block>> rollback_list;
|
||||||
if (ledger.rollback (transaction, successor->hash (), rollback_list))
|
if (ledger.rollback (transaction, successor->hash (), rollback_list))
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::ledger, nano::stat::detail::rollback_failed);
|
stats.inc (nano::stat::type::ledger, nano::stat::detail::rollback_failed);
|
||||||
logger.error (nano::log::type::blockprocessor, "Failed to roll back: {} because it or a successor was confirmed", successor->hash ().to_string ());
|
logger.error (nano::log::type::block_processor, "Failed to roll back: {} because it or a successor was confirmed", successor->hash ().to_string ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::ledger, nano::stat::detail::rollback);
|
stats.inc (nano::stat::type::ledger, nano::stat::detail::rollback);
|
||||||
logger.debug (nano::log::type::blockprocessor, "Blocks rolled back: {}", rollback_list.size ());
|
logger.debug (nano::log::type::block_processor, "Blocks rolled back: {}", rollback_list.size ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify observers of the rolled back blocks on a background thread while not holding the ledger write lock
|
// Notify observers of the rolled back blocks on a background thread while not holding the ledger write lock
|
||||||
|
|
@ -215,7 +215,7 @@ void nano::block_processor::run ()
|
||||||
// It's possible that ledger processing happens faster than the notifications can be processed by other components, cooldown here
|
// It's possible that ledger processing happens faster than the notifications can be processed by other components, cooldown here
|
||||||
while (workers.queued_tasks () >= config.max_queued_notifications)
|
while (workers.queued_tasks () >= config.max_queued_notifications)
|
||||||
{
|
{
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::cooldown);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::cooldown);
|
||||||
condition.wait_for (lock, 100ms, [this] { return stopped; });
|
condition.wait_for (lock, 100ms, [this] { return stopped; });
|
||||||
if (stopped)
|
if (stopped)
|
||||||
{
|
{
|
||||||
|
|
@ -225,7 +225,7 @@ void nano::block_processor::run ()
|
||||||
|
|
||||||
if (log_interval.elapsed (15s))
|
if (log_interval.elapsed (15s))
|
||||||
{
|
{
|
||||||
logger.info (nano::log::type::blockprocessor, "{} blocks (+ {} forced) in processing queue",
|
logger.info (nano::log::type::block_processor, "{} blocks (+ {} forced) in processing queue",
|
||||||
queue.size (),
|
queue.size (),
|
||||||
queue.size ({ nano::block_source::forced }));
|
queue.size ({ nano::block_source::forced }));
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +236,7 @@ void nano::block_processor::run ()
|
||||||
|
|
||||||
// Queue notifications to be dispatched in the background
|
// Queue notifications to be dispatched in the background
|
||||||
workers.post ([this, processed = std::move (processed)] () mutable {
|
workers.post ([this, processed = std::move (processed)] () mutable {
|
||||||
stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::notify);
|
stats.inc (nano::stat::type::block_processor, nano::stat::detail::notify);
|
||||||
// Set results for futures when not holding the lock
|
// Set results for futures when not holding the lock
|
||||||
for (auto & [result, context] : processed)
|
for (auto & [result, context] : processed)
|
||||||
{
|
{
|
||||||
|
|
@ -298,7 +298,7 @@ auto nano::block_processor::process_batch (nano::unique_lock<nano::mutex> & lock
|
||||||
|
|
||||||
lock.unlock ();
|
lock.unlock ();
|
||||||
|
|
||||||
auto transaction = ledger.tx_begin_write (nano::store::writer::blockprocessor);
|
auto transaction = ledger.tx_begin_write (nano::store::writer::block_processor);
|
||||||
|
|
||||||
nano::timer<std::chrono::milliseconds> timer;
|
nano::timer<std::chrono::milliseconds> timer;
|
||||||
timer.start ();
|
timer.start ();
|
||||||
|
|
@ -329,7 +329,7 @@ auto nano::block_processor::process_batch (nano::unique_lock<nano::mutex> & lock
|
||||||
|
|
||||||
if (number_of_blocks_processed != 0 && timer.stop () > std::chrono::milliseconds (100))
|
if (number_of_blocks_processed != 0 && timer.stop () > std::chrono::milliseconds (100))
|
||||||
{
|
{
|
||||||
logger.debug (nano::log::type::blockprocessor, "Processed {} blocks ({} forced) in {} {}", number_of_blocks_processed, number_of_forced_processed, timer.value ().count (), timer.unit ());
|
logger.debug (nano::log::type::block_processor, "Processed {} blocks ({} forced) in {} {}", number_of_blocks_processed, number_of_forced_processed, timer.value ().count (), timer.unit ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return processed;
|
return processed;
|
||||||
|
|
@ -341,10 +341,10 @@ nano::block_status nano::block_processor::process_one (secure::write_transaction
|
||||||
auto const hash = block->hash ();
|
auto const hash = block->hash ();
|
||||||
nano::block_status result = ledger.process (transaction_a, block);
|
nano::block_status result = ledger.process (transaction_a, block);
|
||||||
|
|
||||||
stats.inc (nano::stat::type::blockprocessor_result, to_stat_detail (result));
|
stats.inc (nano::stat::type::block_processor_result, to_stat_detail (result));
|
||||||
stats.inc (nano::stat::type::blockprocessor_source, to_stat_detail (context.source));
|
stats.inc (nano::stat::type::block_processor_source, to_stat_detail (context.source));
|
||||||
|
|
||||||
logger.trace (nano::log::type::blockprocessor, nano::log::detail::block_processed,
|
logger.trace (nano::log::type::block_processor, nano::log::detail::block_processed,
|
||||||
nano::log::arg{ "result", result },
|
nano::log::arg{ "result", result },
|
||||||
nano::log::arg{ "source", context.source },
|
nano::log::arg{ "source", context.source },
|
||||||
nano::log::arg{ "arrival", nano::log::microseconds (context.arrival) },
|
nano::log::arg{ "arrival", nano::log::microseconds (context.arrival) },
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ void nano::bootstrap_service::wait (std::function<bool ()> const & predicate) co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nano::bootstrap_service::wait_blockprocessor () const
|
void nano::bootstrap_service::wait_block_processor () const
|
||||||
{
|
{
|
||||||
wait ([this] () {
|
wait ([this] () {
|
||||||
return block_processor.size (nano::block_source::bootstrap) < config.block_processor_threshold;
|
return block_processor.size (nano::block_source::bootstrap) < config.block_processor_threshold;
|
||||||
|
|
@ -569,7 +569,7 @@ bool nano::bootstrap_service::request_frontiers (nano::account start, std::share
|
||||||
|
|
||||||
void nano::bootstrap_service::run_one_priority ()
|
void nano::bootstrap_service::run_one_priority ()
|
||||||
{
|
{
|
||||||
wait_blockprocessor ();
|
wait_block_processor ();
|
||||||
auto channel = wait_channel ();
|
auto channel = wait_channel ();
|
||||||
if (!channel)
|
if (!channel)
|
||||||
{
|
{
|
||||||
|
|
@ -611,7 +611,7 @@ void nano::bootstrap_service::run_priorities ()
|
||||||
|
|
||||||
void nano::bootstrap_service::run_one_database (bool should_throttle)
|
void nano::bootstrap_service::run_one_database (bool should_throttle)
|
||||||
{
|
{
|
||||||
wait_blockprocessor ();
|
wait_block_processor ();
|
||||||
auto channel = wait_channel ();
|
auto channel = wait_channel ();
|
||||||
if (!channel)
|
if (!channel)
|
||||||
{
|
{
|
||||||
|
|
@ -641,7 +641,7 @@ void nano::bootstrap_service::run_database ()
|
||||||
|
|
||||||
void nano::bootstrap_service::run_one_dependency ()
|
void nano::bootstrap_service::run_one_dependency ()
|
||||||
{
|
{
|
||||||
// No need to wait for blockprocessor, as we are not processing blocks
|
// No need to wait for block_processor, as we are not processing blocks
|
||||||
auto channel = wait_channel ();
|
auto channel = wait_channel ();
|
||||||
if (!channel)
|
if (!channel)
|
||||||
{
|
{
|
||||||
|
|
@ -669,7 +669,7 @@ void nano::bootstrap_service::run_dependencies ()
|
||||||
|
|
||||||
void nano::bootstrap_service::run_one_frontier ()
|
void nano::bootstrap_service::run_one_frontier ()
|
||||||
{
|
{
|
||||||
// No need to wait for blockprocessor, as we are not processing blocks
|
// No need to wait for block_processor, as we are not processing blocks
|
||||||
wait ([this] () {
|
wait ([this] () {
|
||||||
return !accounts.priority_half_full ();
|
return !accounts.priority_half_full ();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,8 @@ private:
|
||||||
/* Waits for a condition to be satisfied with incremental backoff */
|
/* Waits for a condition to be satisfied with incremental backoff */
|
||||||
void wait (std::function<bool ()> const & predicate) const;
|
void wait (std::function<bool ()> const & predicate) const;
|
||||||
|
|
||||||
/* Ensure there is enough space in blockprocessor for queuing new blocks */
|
/* Ensure there is enough space in block_processor for queuing new blocks */
|
||||||
void wait_blockprocessor () const;
|
void wait_block_processor () const;
|
||||||
/* Waits for a channel that is not full */
|
/* Waits for a channel that is not full */
|
||||||
std::shared_ptr<nano::transport::channel> wait_channel ();
|
std::shared_ptr<nano::transport::channel> wait_channel ();
|
||||||
/* Waits until a suitable account outside of cooldown period is available */
|
/* Waits until a suitable account outside of cooldown period is available */
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ enum class writer
|
||||||
{
|
{
|
||||||
generic,
|
generic,
|
||||||
node,
|
node,
|
||||||
blockprocessor,
|
block_processor,
|
||||||
confirmation_height,
|
confirmation_height,
|
||||||
pruning,
|
pruning,
|
||||||
voting_final,
|
voting_final,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue