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

databendlabs / openraft / 25491647501
87%

Build:
DEFAULT BRANCH: main
Ran 07 May 2026 11:01AM UTC
Jobs 1
Files 264
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

07 May 2026 10:57AM UTC coverage: 86.679% (+0.05%) from 86.626%
25491647501

push

github

drmingdrmer
fix: client_api: ensure_linearizable_read must respect transfer_to

# Summary

Replace `try_leader_handler` with `ensure_writable_leader_handler` at
the top of `handle_ensure_linearizable_read`. The read path now returns
`ForwardToLeader(target)` when `transfer_to` is set, mirroring the
write path. Fixes #1747.

# Details

Before this change, the only gate on the read path was "am I a
leader?". The write path had a stricter "am I a *writable* leader?"
gate that also checks `transfer_to`. The asymmetry caused two bugs:

- `ReadIndex` on the source emits AppendEntries that bump follower
  `last_update` regardless of lease state. Under sustained reads, the
  cluster could not recover from a transfer if the target was
  unreachable -- followers never election-time-out, so no new leader
  was established.
- `LeaseRead` short-circuits on `last_quorum_acked + leader_lease`,
  which `transfer_leader` does not clear. The source kept serving
  cached reads while a new leader could already be committing fresh
  entries -- a stale read.

Both paths now go through the same gate. `ensure_writable_leader_handler`
returns `ForwardToLeader(target)` when transfer is in progress; the
existing `tx.send(Err(forward.into()))` path propagates that to the
client unchanged.

The two reproducer tests added in the previous commit now pass:

- `transfer_leader_with_dead_target_does_not_block_election` --
  the cluster recovers (n2 elects) within `5 * election_timeout_max`,
  because n0 stops emitting AppendEntries for reads.
- `transfer_leader_blocks_lease_read` -- LeaseRead returns
  `ForwardToLeader(target)` immediately; no stale-read window.

- Fix: #1747

16332 of 18842 relevant lines covered (86.68%)

145287.39 hits per line

Coverage Regressions

Lines Coverage ∆ File
2
92.59
3.7% openraft/src/core/sm/handle.rs
Jobs
ID Job ID Ran Files Coverage
1 25491647501.1 07 May 2026 11:01AM UTC 264
86.68
GitHub Action Run
Source Files on build 25491647501
  • Tree
  • List 264
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #25491647501
  • 1ef3e574 on github
  • Prev Build on main (#25206429598)
  • Delete
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