Repository navigation
Darling builds a background index so get_query_store_top no longer reads every entry a server holds (#4952) #4969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e991ff4
Darling builds its Query Store read indexes through one shared backgr…
erikdarlingdata f51ac1d
Live tests pin the two Query Store indexes: valid per chunk, identica…
erikdarlingdata f75d7f9
Live test comment: name the test roles, not the environment (#4952)
erikdarlingdata 89a4079
Tests for deferring the Query Store partial index while the newest ch…
erikdarlingdata aafeab2
The Query Store partial index builds only while the newest chunk is s…
erikdarlingdata 7c402a9
The same-results pin also covers the web viewer's table read and the …
erikdarlingdata 20defc1
Comment: the collector's live and backfill writes both land in the ne…
erikdarlingdata cd14850
The Query Store partial index retries a deferred build every 5 minute…
erikdarlingdata 193d48f
The Query Store background indexes are the BRIN and the wide btree on…
erikdarlingdata 00e7f50
Drop the duplicate version-floor assertions from the background index…
erikdarlingdata 5a51f62
Tests for the Query Store background index review: the shutdown lines…
erikdarlingdata 2e92fa2
The per-server table floor test vacuums the table before it plans, so…
erikdarlingdata a9b554f
The Query Store background index run names the index in every shutdow…
erikdarlingdata ebcfba8
Merge origin/dev
erikdarlingdata dcefab6
Pin the SQLSTATE in the Query Store background index failure warning:…
erikdarlingdata 56ebce3
The Query Store background index failure warning builds its SQLSTATE …
erikdarlingdata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
463 changes: 463 additions & 0 deletions
463
Darling/Darling.Tests/QueryStoreBackgroundIndexesLiveTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
377 changes: 377 additions & 0 deletions
377
Darling/Darling.Tests/QueryStoreBackgroundIndexesTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Anchored here because it is the nearest changed line; the finding is about
:60-61and:233in this same file.)The one data-independent guard on this table's HOT safety still builds the BRIN alone, so it cannot see
QueryStoreBackgroundIndexes.All— the trap from.github/REVIEW-TRAPS.mdapplies here.NoNonBrinIndex_CoversAColumnTheUpsertSets_SoTheUpsertStaysHotForItsWholeSetList(:216) is the strongest guard this table has: it is a catalog scan, not a seeded update, so it fires on any index covering anyDO UPDATE SETcolumn — including a column only anINCLUDElist or a partial predicate mentions (:247-252). Its roster is one line:EnsureAsync(connection, ct)at:233, which resolves to this file's local helper at:60-61— the BRIN's ensure, and nothing else.Before this PR that roster was complete: the BRIN was the only index built outside a migration rung. After it,
All(QueryStoreBackgroundIndexes.cs:122-126) has two members and is built to grow, and this census sees one of them.Today's btree happens to be safe —
server_idandfirst_execution_timeare both inIdentityColumns(QueryStoreIntervalWide.cs:77-78) and neither appears in theDO UPDATE SETlist (:344-394), andTheUpsertsWholeSetList_StaysHotWithTheWideBtreePresent_AndNotWithABtreeOnASetColumnproves it behaviourally with a control that can fail. But the guard that would catch the next member is now blind to it, and nothing else in the tree records that.One-line fix: point
:60-61at a loop overQueryStoreBackgroundIndexes.All— the sameEnsureAllAsyncthe new live file already has (QueryStoreBackgroundIndexesLiveTests.cs:64-70). That restores the census to "every index this product builds on this table" and weakens nothing it asserts today.