feat(consensus): add loopback queue for primary self-addressed messages#2825
Open
feat(consensus): add loopback queue for primary self-addressed messages#2825
Conversation
e47bde6 to
4d969b8
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2825 +/- ##
============================================
+ Coverage 67.53% 67.88% +0.35%
Complexity 739 739
============================================
Files 1048 1048
Lines 84103 84247 +144
Branches 60704 60857 +153
============================================
+ Hits 56795 57195 +400
+ Misses 24950 24678 -272
- Partials 2358 2374 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
krishvishal
reviewed
Feb 27, 2026
krishvishal
reviewed
Feb 27, 2026
The primary was sending PrepareOk to itself through the message bus, requiring a network round-trip and an unwrap() on bus errors. Replace with an in-process VecDeque that the simulator drains after each dispatch. Cleared on view change reset and on DVC quorum completion. Includes defensive debug_assert guards on push_loopback overflow, process_loopback buf precondition, and simulator drain idempotency. Adds test verifying loopback is cleared when complete_view_change_as_primary fires.
4d969b8 to
33610e6
Compare
krishvishal
approved these changes
Feb 27, 2026
numinnex
requested changes
Mar 2, 2026
| } | ||
|
|
||
| /// Enqueue a self-addressed PrepareOk for the primary to process in the next loopback drain. | ||
| pub(crate) fn push_loopback(&self, message: Message<PrepareOkHeader>) { |
Contributor
There was a problem hiding this comment.
We don't send only PrepareOk to our selves, other messages such as DoViewChange and StartViewChange.
Contributor
There was a problem hiding this comment.
Also use that method inside of the send_message_to_replica or however it's called method, when the replica_id == self.replica_id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The primary was sending PrepareOk to itself through the message
bus, requiring a network round-trip and an unwrap() on bus
errors. Replace with an in-process VecDeque that the simulator
drains after each dispatch. Cleared on view change reset and
on DVC quorum completion.
Includes defensive debug_assert guards on push_loopback
overflow, process_loopback buf precondition, and simulator
drain idempotency. Adds test verifying loopback is cleared
when complete_view_change_as_primary fires.