Skip to content

rpcv2: wait for the hot DB destroys before the lifecycle e2e shuts down - #1008

Merged
tamirms merged 1 commit into
feature/full-historyfrom
lifecycle-e2e-wait-for-destroy
Sep 14, 2026
Merged

tamirms merged 1 commit into
feature/full-historyfrom
lifecycle-e2e-wait-for-destroy

Conversation

@tamirms

@tamirms tamirms commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

TestE2E_DaemonLifecycle_FirstStartIngestFreezeLookupRestartPrune fails now and then under -race on e2e_test.go:374, "chunk 00000001 hot key is discarded". It passed on rerun on #968 and fails about one run in four locally on the base branch with the race detector, so it is a timing race in the test, not a regression.

The race. The test waits for the discard counter to reach two and then cancels the daemon. That counter rises when the lifecycle demotes a hot chunk. The hot key it then asserts on is removed by the deferred destroy at the end of the same tick, after the grace wait, and a cancellation during that wait skips the destroy by design and leaves the demoted key for the next run. The test's cancel lands at a random point up to 50 ms after the counter moved, so when it falls inside the prune scan or the grace wait, the assertion sees the key still there.

The fix. Before shutting down, the test also waits for both chunks' hot DB directories to be removed, which is what the destroy does. This is the same proof the test's prune step already uses for its index file. No production code changes.

Checked. Six consecutive -race runs of the test pass on this branch; on the base branch the same loop fails about one run in four.

🤖 Generated with Claude Code

TestE2E_DaemonLifecycle_FirstStartIngestFreezeLookupRestartPrune waited for
the discard counter, which rises when a chunk is demoted, and then cancelled
the daemon and asserted that the chunks' hot keys were gone. The key goes
with the deferred destroy at the end of the run, after the grace wait, and a
shutdown during that wait skips the destroy by design, so the assertion
raced the tick and failed once in a while under -race. The test now also
waits for both hot DB directories to be removed before shutting down, the
proof the prune step already uses for its index file.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M23ZvEkyrFjyUUbm7zLwob
Copilot AI balanced review requested due to automatic review settings September 12, 2026 06:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a timing race in the lifecycle E2E test by waiting for deferred hot-chunk destruction before shutdown.

Changes:

  • Waits for both hot DB directories to be removed.
  • Prevents cancellation during deferred destruction.

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tamirms
tamirms merged commit 06c39b8 into feature/full-history Sep 14, 2026
15 checks passed
@tamirms
tamirms deleted the lifecycle-e2e-wait-for-destroy branch September 14, 2026 13:03
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.

3 participants