Repository navigation
test(ingestor): seed tx_last_seen backfill fixtures in one transaction - #1021
Merged
Merged
Conversation
seedTxWithObs inserted the transmission and each observation as separate autocommit statements. If the tx_last_seen_backfill_v1 goroutine that OpenStore schedules ran between them, it stamped last_seen from a partial set of observations (100 instead of 300), and the test's own backfill call then skipped the row because it only selects last_seen = 0. newTestStore and WaitForAsyncMigrations already drain that goroutine before seeding, so current master is not exposed. The failures on #1012 came from a merge commit (5072050, base 4af4177) whose test code predates those waits. Seeding in one transaction closes the window regardless: a backfill running at any point sees the row with none or all of its observations. seedTxNoObs now reuses the same helper. Relates to #1012 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Review — CS-Minimax PR#1021 — head cceb357Dom: APPROVE med nits (Review written in English; verdict wording above kept to the agreed vocabulary: approve, with nits.) Findings
No blocking findings. Answers to the review points
TestsRun on the merged tree (
Mutants (own, on production backfill in
|
| Mutant | Result |
|---|---|
MAX(timestamp) → MIN(timestamp) |
killed: ResolvesFromMaxObservationTimestamp fails [T] |
Drop the EXISTS (…observations…) filter |
killed: OrphanNeverLoopsForever fails after 5 s [T] |
Drop last_seen = 0 from the batch filter |
killed by hang only: the run did not finish within the 400 s limit and I stopped it. Not a clean assertion failure. [T] |
Not verified
- [A] The "red before" state: I did not reproduce the original race on the stale base
4af4177c. I rely on the author's stress-run numbers. On master the race cannot occur because of the existing wait, so a red-before/green-after pair does not exist for master. - [A] The author's 2000-run stress under CPU load (4177 s). Not repeated.
- E2E/browser: not applicable, no UI or server change.
sh test-all.sh,node test-frontend-helpers.js, and the Go server suites were not re-run by me. The change is one ingestor test file, and CI passed these.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #1012
Summary
TestBackfillTxLastSeen_ResolvesFromMaxObservationTimestampfailed on all three "Go Build & Test" runs for #1012 (run 46132323901) withlast_seen = 100, want 300.Root cause
5072050d(feat(info): /guider page with click-to-play video guides #1012 headcb99a342merged into4af4177c, the tip ofcodex/meshview-info-pagesfrom before feat(info): /guider page with click-to-play video guides #1012 was retargeted to master). That base forked from master before14789759and3bbd5507, which addedWaitForAsyncMigrations()before seeding and madenewTestStoredrainbackfillWg. Re-runs reuse the same merge SHA, so every attempt tested the code without the wait.OpenStoreschedulestx_last_seen_backfill_v1in a goroutine.seedTxWithObsinserted the transmission and each observation as separate autocommit statements. If the goroutine ran between them, it stampedlast_seenfrom the first observation only (100), and the test's ownbackfillTxLastSeencall then skipped the row because it only selectslast_seen = 0. The CI log shows exactly this: the async run reports1 rows updatedand"tx_last_seen_backfill_v1" doneafter the test's direct backfill started.Is the wait on master sufficient?
Yes.
RunAsyncMigrationcallsbackfillWg.Add(1)synchronously beforeOpenStorereturns, andbackfillTxLastSeendoes all its chunks inside that one goroutine, so no chunk is rescheduled outside the WaitGroup. No trigger writestransmissions.last_seen. The only other writer isInsertTransmission, which these seeds don't use.This change (test only)
seedTxWithObsnow inserts the transmission and all of its observations in one transaction. A backfill running at any point (withSetMaxOpenConns(1)it blocks on the pool until commit) sees the row with none or all of its observations, so the result is MAX = 300 either way.seedTxNoObsreuses the same helper. A comment onseedTxWithObsexplains the race. No production code changes.Action for #1012
Its current failures go away once CI runs on a fresh merge ref against master: push a commit, or merge master into the branch. Re-running the old run won't help.
Tests
4af4177c, the samecmd/ingestorcode as the failing merge commit) withgo test -race -count=200 -cpu 1,2 -run TestBackfillTxLastSeenand 12 busy-loop CPU hogs. The run gave 15 failures in the same class: an async backfill stamped rows the test did not expect (IgnoresRowsInsertedAfterSnapshot×11,OrphanNeverLoopsForever×3,ChunksAcrossMultipleBatches×1), then hit the 10 m default timeout.-timeout 0, 2000 test runs under the same load):ok(4177 s).cd cmd/ingestor && go test ./...:ok.No frontend or browser-visible change, so no browser validation is needed. No config or customizer implications.
🤖 Generated with Claude Code