Repository navigation
Harden the legacy-row partial-index plan test: fixed anchor, size guard, plan in the failure message - #5061
Merged
erikdarlingdata merged 1 commit intoOct 4, 2026
Conversation
Seed the three days to 23:50 UTC on a fixed past day instead of the wall clock, so the uncompressed newest chunk always holds a full day of rows. Guard its size, and print the plan when the plan asserts fail.
erikdarlingdata
marked this pull request as ready for review
October 4, 2026 00:45
erikdarlingdata
deleted the
test/query-store-legacy-index-plan-time-of-day
branch
October 4, 2026 00:46
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.
Summary
TheShippedCheck_PlansOnThePartialIndex_AndAnswersExactlyfailed once on a dev push's Build run on 2026-10-04 at about 00:08Z, atAssert.NotEmpty(indexReads): a scan ofquery_store_statswas found, but none read the partial index. It passed on re-run, and the assert printed no plan. It failed the same way on another PR's Build run about 15 minutes later, a PR that changes only web JavaScript. Both failures fell in the first half hour after 00:00 UTC, after a day of green runs.The test seeded to the wall clock, so the one uncompressed chunk was "today since 00:00 UTC". Just after midnight that is one pass, about 60 rows on one heap page.
I could not reproduce the failure. With the old shape (only the time of day varied), anchors 00:01, 00:03, 00:08 (14 runs), 00:31, 00:38, 01:08, 01:38, 02:08, 03:00, 06:00, 12:00 and 23:55 all passed. At 00:08 the planner picked an Index Only Scan on the partial index for the one-pass chunk:
With index and bitmap scans disabled, the competing Seq Scan on that chunk costs
0.00..2.05. So the near-empty chunk is a close call (1.73 vs 2.05), which is a plausible way for a small difference in statistics, visibility-map state or the platform to flip the plan on CI. That is an inference, not something I reproduced. The partial index is empty in this test (no row has a NULL start), so its cost stays about constant as the chunk grows, while the Seq Scan's cost grows with the chunk's pages. A full-day chunk therefore widens the gap instead of sitting on it. The earliest time of day at which the old shape passes is therefore not a meaningful number: it passed at every time I tried.What changes
Tests only, in
QueryStoreLegacyRowIndexLiveTests.cs:DateTime.UtcNow. The newest, uncompressed chunk always holds a full day of passes (about 2,880 rows), whatever time the test runs. Nothing else in the test compared against the real "now".Assert.NotEmpty(scans)andAssert.NotEmpty(indexReads)becameAssert.True(..., message + "\n" + plan), so the next failure shows the plan.enable_seqscan = off, no forced plans, no VACUUM. The test still asserts that the shipped check plans on the partial index and never heap-filters the NULL test. I did not try VACUUM, since there was no failure to stabilise.Test plan
TuningHourlyCreateLiveTests: 5 of 5 pass.LivePostgresCollectionHygieneTestscannot load WPF assemblies on this machine.DARLING_TEST_PG: 22046 total, 476 failed, and every failing test name is already on the known local-failure list for dev (thecomm -23difference is empty).--no-incrementalbuild: 0 warnings.Limits
CHANGELOG
SECTION: None
ENTRY: None: tests only