• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

databendlabs / openraft / 20272458143

16 Dec 2025 02:54PM UTC coverage: 92.751% (+0.02%) from 92.736%
20272458143

push

github

drmingdrmer
refactor: add `StreamId` for unique replication stream identification

This change introduces `StreamId` and `SharedIdGenerator` to uniquely identify
replication streams, replacing the previous session-based identification.
Adds `CloseReplicationStreams` command variant for when there are no replication
targets, and adds `leader_vote` field to `RebuildReplicationStreams` and
`ReplicateSnapshot` commands for proper leader identification.

Why:

Before this commit, we used a replication session ID to determine if a
notification message is valid. With this approach, when the membership changes
(e.g., a new membership is appended to the local log), the replication session
ID changes, causing all ongoing replication notifications to be considered
invalid.

This approach is too aggressive - it invalidates notifications that are actually
still valid. For example, if the membership changes from {1,2,3} to {1,2,3,4},
ongoing replication to node 2 or node 3 is still valid because these nodes
remain unchanged in the new membership. But before this commit, these
notifications were simply discarded.

This resulted in fake message loss: valid notification messages were discarded,
causing some tests to fail spuriously.

With this commit, we switch to a new approach: instead of using leader vote and
membership ID to identify notification validity, we assign a unique `StreamId`
to each replication stream. For example, replication to node 2 has a unique
stream ID. As long as this node is present in the membership configuration, the
stream ID remains valid. With this new approach, notification messages won't be
discarded even during membership changes, eliminating the spurious test
failures.

347 of 356 new or added lines in 28 files covered. (97.47%)

10 existing lines in 6 files now uncovered.

14803 of 15960 relevant lines covered (92.75%)

151821.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.57
/openraft/src/engine/command.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc