Skip to content

Kill AOF BulkConsume When Connection is Dead#1656

Open
vazois wants to merge 7 commits intomainfrom
vazois/consume-stop
Open

Kill AOF BulkConsume When Connection is Dead#1656
vazois wants to merge 7 commits intomainfrom
vazois/consume-stop

Conversation

@vazois
Copy link
Copy Markdown
Contributor

@vazois vazois commented Mar 31, 2026

This PR introduces a stopConsume callback that checks the health of the client connection when streaming the AOF.
I used a callback here to avoid maintaining a second background task that monitors the connection and kills the AOF BulkConsume loop.

Copilot AI review requested due to automatic review settings March 31, 2026 19:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to stop the AOF streaming BulkConsumeAllAsync loop when the replica client connection is no longer healthy, by introducing a stopConsume callback that can terminate consumption without running a separate monitoring task.

Changes:

  • Added an optional stopConsume callback parameter to TsavoriteLogScanIterator.BulkConsumeAllAsync.
  • Wired stopConsume into the primary-side AOF sync task to stop streaming when GarnetClientSession disconnects.
  • Updated the replica replay task call site to accommodate the new method signature.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
libs/storage/Tsavorite/cs/src/core/TsavoriteLog/TsavoriteLogIterator.cs Adds stopConsume callback support to the bulk consume loop.
libs/cluster/Server/Replication/PrimaryOps/AofSyncTaskInfo.cs Uses stopConsume to exit AOF streaming when the client disconnects.
libs/cluster/Server/Replication/ReplicaOps/ReplicaReplayTask.cs Updates BulkConsumeAllAsync invocation to match the new signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vazois vazois force-pushed the vazois/consume-stop branch from 0799aaf to 190dd34 Compare April 1, 2026 17:32
@vazois vazois force-pushed the vazois/consume-stop branch from f7985c6 to 0335ff2 Compare April 2, 2026 22:37
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.

3 participants