Skip to content
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 include/bitcoin/node/chasers/chaser_validate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class BCN_API chaser_validate
std::atomic_bool disk_recovering_{};
std::atomic_bool window_archived_{};
std::atomic_bool maximum_posted_{};
std::atomic_bool verifying_{};
////std::atomic_bool verifying_{};
std::atomic_bool draining_{};
atomic_counter writers_{};
counters counters_{};
Expand Down
21 changes: 16 additions & 5 deletions src/chasers/chaser_validate_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ void chaser_validate::process_batch(bool residual) NOEXCEPT
}

// Divert paused/new arrivals to inline for the verify duration.
verifying_.store(true);
////verifying_.store(true);

// Batch tables are now quiescent (no writers admitted, none in flight).
// ========================================================================

// Retest under the claim, another drain may have just emptied the tables.
if (!is_mature(residual))
{
verifying_.store(false);
////verifying_.store(false);
draining_.store(false);
return;
}

const auto ec = do_process_batch(false);
verifying_.store(false);
////verifying_.store(false);
draining_.store(false);
if (ec == network::error::operation_canceled)
return;
Expand Down Expand Up @@ -269,8 +269,8 @@ std::string chaser_validate::log_rate(const std::string& name,

bool chaser_validate::enter_capture() NOEXCEPT
{
// Wait out a pending batch cutoff (brief, bounded by in-flight captures),
// then capture. Divert to inline only during verify.
#if defined(DISABLED)
// Blocked by batch (also requires other verifying_ enabled).
while (true)
{
++writers_;
Expand All @@ -283,6 +283,17 @@ bool chaser_validate::enter_capture() NOEXCEPT

std::this_thread::yield();
}
#else
// Bypassed by batch (faster overall, but high bypass).
++writers_;
if (draining_.load())
{
--writers_;
return false;
}

return true;
#endif
}

void chaser_validate::exit_capture() NOEXCEPT
Expand Down
Loading