Skip to content

Catch up with the tree at start even while a 0.6.4 server is still stopping - #263

Merged
devmaxxx merged 2 commits into
mainfrom
fix/serve-start-catch-up
Oct 19, 2026
Merged

devmaxxx merged 2 commits into
mainfrom
fix/serve-start-catch-up

Conversation

@devmaxxx

Copy link
Copy Markdown
Owner

Summary

  • serve no longer skips its start-up catch-up when a 0.6.4 server is still being stopped. The catch-up waits until the old server is gone, then runs on the next loop turn (within WAKE, 250 ms), before any answer. Before this change, a --stale ask under --every 3600 kept answering from the tree as it was before start. That is the windows-latest flake in a_server_catches_up_with_the_tree_at_start_rather_than_at_its_first_poll.
  • I picked deferring the catch-up over a bounded wait. A busy 0.6.4 server can take up to RERANK_TIMEOUT plus STOP_WAIT to leave, and a bounded wait would either hold start-up that long or still skip the catch-up when it timed out.
  • New test a_server_catches_up_with_the_tree_once_a_slow_0_6_4_server_has_stopped. A stand-in 0.6.4 server holds its stop confirmation until the new server has answered once, so the race happens on every OS. The test then releases the stop and expects the document written before start to appear in a --stale answer.

Closes #261

Test plan

  • Without the src/serve.rs change, the new test fails: it never catches up within 20 s.
  • With the change, the new test passes.
  • cargo test: all suites pass.
  • cargo clippy --all-targets -- -D warnings: clean.
  • cargo test --test serve passed 20 times in a row (20/20) on macOS.
  • windows-latest CI is green.

The start-up catch-up was skipped outright when the thread stopping a
0.6.4 server had not finished yet. With a long --every no poll made up
for it, so a --stale ask kept answering from the tree as it stood before
start. The catch-up is now held until the old server is gone and runs
on the first loop turn after that, ahead of any answer.

The new test holds a stand-in 0.6.4 server's stop confirmation until the
server has answered once, so the race reproduces on every platform
rather than only under windows-latest timing.

Closes #261
The loop looked at the 0.6.4 stop before handing a question over, and
answer looked again. A stop that finished between the two looks let a
--stale question through without being forced stale, and before the
catch-up had run, so the reply came from the tree as it was before
start. The catch-up now runs inside answer, on the same reading that
decides staleness, and a question is forced stale only while the
catch-up is still owed.

The test no longer retries. It waits for the server to log that the old
server stopped, then asserts that the very next --stale answer already
has the document written before start.

Refs #261
@devmaxxx
devmaxxx merged commit 9965e80 into main Oct 19, 2026
4 checks passed
@devmaxxx
devmaxxx deleted the fix/serve-start-catch-up branch October 19, 2026 11:58
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.

serve skips its start-up catch-up while a 0.6.4 server is still stopping

1 participant