Skip to content

refactor: send StreamAppendResult through AppendEntriesTx channel#1665

Merged
xp-trumpet merged 1 commit intodatabendlabs:mainfrom
drmingdrmer:2083-stream-append-result-tx
Feb 27, 2026
Merged

refactor: send StreamAppendResult through AppendEntriesTx channel#1665
xp-trumpet merged 1 commit intodatabendlabs:mainfrom
drmingdrmer:2083-stream-append-result-tx

Conversation

@drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Feb 27, 2026

Changelog

refactor: send StreamAppendResult through AppendEntriesTx channel

The engine now builds StreamAppendResult directly and sends it through
the channel, instead of sending AppendEntriesResponse and converting
at the stream_append pipeline. This eliminates LogIdRange tracking
from the Pending struct in stream_append, since the log_id context is
attached at the source where entries are processed.

Raft::append_entries converts back to AppendEntriesResponse via a
new From<StreamAppendResult> impl for the public API.

Also introduces LogSegment to bundle prev_log_id + entries, and
replaces RejectLeadership with RejectVote in both update_vote()
and RejectAppendEntries, removing the now-dead RejectLeadership type.

Changes:

  • Add LogSegment struct with new() and last() methods
  • Change AppendEntriesTx<C> to send StreamAppendResult<C>
  • Add From<StreamAppendResult> for AppendEntriesResponse
  • Add From<RejectAppendEntries> for StreamAppendError
  • Change update_vote() return type from RejectLeadership to RejectVote
  • Remove RejectLeadership enum (dead code)
  • Simplify Pending in stream_append to a single response_rx field

  • Improvement

This change is Reviewable

@drmingdrmer drmingdrmer force-pushed the 2083-stream-append-result-tx branch 2 times, most recently from 5029e00 to 80892af Compare February 27, 2026 16:56
The engine now builds `StreamAppendResult` directly and sends it through
the channel, instead of sending `AppendEntriesResponse` and converting
at the stream_append pipeline. This eliminates `LogIdRange` tracking
from the `Pending` struct in stream_append, since the log_id context is
attached at the source where entries are processed.

`Raft::append_entries` converts back to `AppendEntriesResponse` via a
new `From<StreamAppendResult>` impl for the public API.

Also introduces `LogSegment` to bundle `prev_log_id` + `entries`, and
replaces `RejectLeadership` with `RejectVote` in both `update_vote()`
and `RejectAppendEntries`, removing the now-dead `RejectLeadership` type.

Changes:
- Add `LogSegment` struct with `new()` and `last()` methods
- Change `AppendEntriesTx<C>` to send `StreamAppendResult<C>`
- Add `From<StreamAppendResult>` for `AppendEntriesResponse`
- Add `From<RejectAppendEntries>` for `StreamAppendError`
- Change `update_vote()` return type from `RejectLeadership` to `RejectVote`
- Remove `RejectLeadership` enum (dead code)
- Simplify `Pending` in stream_append to a single `response_rx` field
@drmingdrmer drmingdrmer force-pushed the 2083-stream-append-result-tx branch from 80892af to 093b473 Compare February 27, 2026 17:07
Copy link
Collaborator

@xp-trumpet xp-trumpet left a comment

Choose a reason for hiding this comment

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

@xp-trumpet reviewed 15 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on drmingdrmer).

@xp-trumpet xp-trumpet added this pull request to the merge queue Feb 27, 2026
Merged via the queue into databendlabs:main with commit d6b833a Feb 27, 2026
38 checks passed
@drmingdrmer drmingdrmer deleted the 2083-stream-append-result-tx branch February 27, 2026 17:38
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.

2 participants