Skip to content

raftcore: a wake restarts the idle minute, so a write's learner deliveries are not discarded - #2224

Merged
santoshkumarradha merged 4 commits into
app/v3from
fix/c41-learner-wake
Nov 3, 2026
Merged

santoshkumarradha merged 4 commits into
app/v3from
fix/c41-learner-wake

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

A second computer could miss a committed change until something next woke the group. This showed up as R9 learner did not reach its applied state in TestR26R27C30OpenLearnerIdleAndStateWake.

Cause. wakeScheduling set s.active = s.now, and s.now is the time of the last Schedule call. After a long sleep that time is old, so a group woken by a write looked idle at once. It then prepared its sleep marker on the next maintenance turn. At that sleep boundary Router.Quiesce discards deliveries queued for learners, including the write's own, and a learner that had not drained its queue stayed behind.

Evidence. In a failing run the learner stood at commit 17 and its peer at 18. Advancing the clock 40 more times (20 virtual seconds) did not help. In a run of 96 under load, all 5 failures had Quiesce drops to the learners after the idle window, and none of the 91 passes did.

Change. The idle minute now restarts at the first Schedule after a wake. IdleRead keeps its existing exemption, so it cannot hold a group awake.

Validation

  • Red first: TestWakeRestartsTheIdleWindowFromTheNextLook got Barrier:true straight after a write. It also checks that the group prepares to sleep again after a full idle minute.
  • raftcore scheduler tests and the raftdirectory quiescence and idle tests pass. The full gate is left to the merge batch.

Limits

  • The integration test still failed once in 96 under the same load (5–7 in 96 before). I am still working on that remaining failure, so this PR does not close the flake.
  • A learner slower than the full idle minute still has its deliveries discarded at the sleep boundary. That is the documented Quiesce behaviour and this PR does not change it.
  • I did not reproduce this on real relays with a real clock.

🤖 Generated with Claude Code

wakeScheduling set s.active to s.now, the time of the last Schedule. A group
that slept for an hour therefore looked idle as soon as a write woke it, prepared
its sleep marker on the next turn, and at that sleep boundary Router.Quiesce
discarded the write's deliveries to learners. The other computer stayed behind
until something woke the group again.

Red: TestWakeRestartsTheIdleWindowFromTheNextLook (Barrier:true after a write).
IdleRead keeps its existing exemption, so it cannot hold the group awake.
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 3, 2026 08:43
@santoshkumarradha
santoshkumarradha merged commit 26efa2a into app/v3 Nov 3, 2026
@santoshkumarradha
santoshkumarradha deleted the fix/c41-learner-wake branch November 3, 2026 08:43
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.

1 participant