Skip to content

Remove ringbuffer dependency from independent periodic tasks - #8445

Open
Eddy Ashton (eddyashton) wants to merge 4 commits into
agents/ledger-ringbuffer-removal-implementationfrom
agents/periodic-task-implementation-ccf
Open

Eddy Ashton (eddyashton) wants to merge 4 commits into
agents/ledger-ringbuffer-removal-implementationfrom
agents/periodic-task-implementation-ccf

Conversation

@eddyashton

Copy link
Copy Markdown
Member

Motivation

Stacked on #8405 as the next step of the ringbuffer-removal plan. Delayed and periodic tasks, historical-state cache maintenance, and frontend endpoint maintenance currently depend on the aggregate AdminMessage::tick ringbuffer message even though they do not need the node/consensus tick's serialization.

Consensus, node-to-node channel maintenance, indexing, and the aggregate tick message remain in place for the later ordering-sensitive work.

Implementation summary

  • Add a host-side libuv timer which advances the existing task clock at tick_interval. Its callback only makes due tasks runnable; task bodies still execute on task workers.
  • Add PeriodicTaskOwner for weak-owner lifetime, cancellation, elapsed-time accounting, and serialization of repeated executions.
  • Move historical state-cache and RPC frontend ticks to owner-managed periodic tasks. Unopened frontends continue to ignore ticks.
  • Remove the unused periodic_end()/tick_end() hook.
  • Preserve the existing ccf::tasks::tick() API, recurrence behavior, cancellation behavior, configured period, and deterministic fake-time tests.

Safety and compatibility

  • No consensus, node-message, indexing, or ledger ordering changes. Those operations remain on the aggregate tick path.
  • The historical cache already protects tick state with requests_lock; frontend ticking retains its atomic open check. Periodic callbacks hold owners weakly and are cancelled on destruction.
  • The old public-recovery frontend guard protected signature emission which moved to TxHistory in 2020. History already starts its signature timer only after public recovery; current production endpoint ticks are no-ops.
  • No public API, data-format, configuration, recovery, or mixed-version change.

Validation: task_system_test, historical_queries_test, frontend_test; fully linked js_generic; C++/CMake formatting, ASCII, copyright, TODO, and include-policy checks.

Drive the task clock from a host-side libuv timer while retaining the existing tick semantics and configured interval. Let historical state caches and RPC frontends own their periodic task lifetimes, and remove the unused consensus periodic_end hook.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the StubLedgerReader introduced by the ledger ringbuffer removal base instead of the removed ringbuffer StubWriter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eddyashton
Eddy Ashton (eddyashton) requested a review from a team as a code owner September 24, 2026 15:32
Satisfy the clang-tidy named-parameter check for the default no-op RPC handler implementation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Satisfy clang-tidy's member-initialization check in the shared periodic task owner.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant