Skip to content

test(mem_wal): make snapshot freeze coverage deterministic - #10549

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/repair-memwal-freeze-evidence-20261101
Nov 1, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/repair-memwal-freeze-evidence-20261101

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Problem

test_memory_snapshot_never_drifts_from_writer_state::case_2_zero_grace_evicts_on_commit can fail at its coverage precondition even when a memtable freeze occurred. The test used the current frozen_bytes or frozen_count as evidence of a past freeze. With zero grace, a successful flush retires the frozen handle immediately, so both values can legitimately be zero after the freeze.

This was observed in the main linux-build job (run 41262655601). The drift and unflushed_bytes assertions did not fail; this change does not claim that production snapshot drift or memory corruption occurred.

Fix

Capture the initial active memtable generation and assert that it advanced after the existing 24 puts. Generation only advances when the active memtable is rotated, so it proves the freeze path ran without depending on a transient frozen handle.

After the existing flush drain:

  • zero grace must report frozen_count == 0;
  • a long grace must keep frozen_count > 0;
  • existing frozen_bytes == 0 accounting and every assert_no_drift / unflushed_bytes invariant remain unchanged.

The change is test-only.

Validation

  • Final two-case CI-profile regression: 2 passed.
  • Existing test_memtable_stats_frozen_count_outlives_frozen_bytes, test_frozen_retained_during_grace_then_swept, and test_frozen_evicted_immediately_with_zero_grace: passed.
  • CI-profile clippy for all targets with the workflow feature set and the Arrow ordering fixture: passed.
  • Applicable pre-commit hooks (fmt, typos): passed.
  • A clearly separated diagnostic experiment, which changed timing by draining before evaluating the old predicate, observed frozen_bytes=0, frozen_count=0, and generation 1 -> 3. This demonstrates the false event inference but is not an unchanged-timing reproduction and is not part of the patch.
  • Hosted CI passed on this head: linux-build passed all 18,764 tests, including both cases of test_memory_snapshot_never_drifts_from_writer_state. All applicable workflows completed successfully; the path-filtered Arrow ordering compatibility job was skipped as expected.

@claude claude Bot 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions github-actions Bot added the chore label Nov 1, 2026
@Xuanwo
Xuanwo requested a review from jackye1995 November 1, 2026 03:16

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Gate recommendation: approve.

The generation check removes the timing-dependent freeze precondition while preserving the memory-accounting invariants. No blocking issues found.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Nov 1, 2026
@Xuanwo
Xuanwo merged commit ee4fc8a into main Nov 1, 2026
53 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/repair-memwal-freeze-evidence-20261101 branch November 1, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants