Repository navigation
Lite reads wait history stored with a trailing space as the clean wait name - #4939
Merged
Merged
Conversation
…t name Wait rows stored before the collectors trimmed wait names keep the DMV's trailing space, for example "SQP_STATS_REPORTING ", until retention removes them. Lite compared the stored name exactly, so the ignore list never hid the spaced spelling, and a wait stored both ways came back as two rows. Every Lite read that filters, groups or looks up by wait name now compares rtrim(wait_type): the ignore list hides both spellings, the two spellings sum into one row under the clean name, and a lookup by the clean name finds the spaced history. This covers the Wait Stats grid, picker and trends, the overview total wait line, Current Waits, the wait drill-down, the MCP wait tools, the daily summary's top wait, the FinOps wait categories, and the analysis wait facts and anomaly contributors.
erikdarlingdata
marked this pull request as ready for review
October 2, 2026 07:58
erikdarlingdata
added a commit
that referenced
this pull request
Oct 2, 2026
The 3.9.0 entry for the wait-name fix (#4884) now covers #4939 and #4941, which completed it after the release was cut: its references gain both PRs in the index and the archive, rows stored with the trailing space before the upgrade are described as reading as the clean name in both apps, and the entry says Lite's wait views hide the two newly ignored waits in history from before the upgrade while Darling shows that history until retention removes it. The archive census carries the new 3.9.0 prose hash; the entry count is unchanged.
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.
What changed
Since #4884, the collectors trim wait names before they store them. Rows stored before that keep the DMV's trailing space, for example
SQP_STATS_REPORTING, until retention removes them. Lite compared the stored name exactly, so:SQP_STATS_REPORTING, yetSQP_STATS_REPORTINGstill showed as one of the biggest waits in history from before the upgrade.Every Lite read that filters, groups or looks up by wait name now uses
rtrim(wait_type):IgnoredWaitTypes.BuildExclusionClauseemitsAND rtrim(wait_type) NOT IN (...), so the ignore list hides both spellings.rtrim(wait_type)and return the clean name, so the two spellings sum into one row.rtrim(wait_type) = rtrim($n).The fix is on the read side only. There is no schema change, and no stored row is rewritten.
Reads checked: 32
Changed (13)
GetWaitStatsAsyncget_wait_statsGetDistinctWaitTypesAsync,GetDistinctWaitTypesForPickerAsyncget_wait_types, the hint inget_wait_trendGetTotalWaitTrendAsyncGetWaitingTasksAsyncget_waiting_tasksGetWaitingTaskTrendAsyncGetWaitStatsTrendAsyncWaitTrendsSql(GetWaitStatsTrendsByTypesAsync)GetWaitBucketsAsyncget_wait_trendGetQuerySnapshotsByWaitTypeAsyncDailySummaryRangeSqlGetWaitCategorySummaryAsyncDuckDbFactCollectorwait factsAnomalyDetectortop contributorsANOMALY_WAIT_PROFILEmetadataNo change needed (19)
PoisonWaitAccumulationSql(poison-wait alerts). It namesTHREADPOOL,RESOURCE_SEMAPHOREandRESOURCE_SEMAPHORE_QUERY_COMPILEonly. None of the three ever had the trailing space. The four names that did areEXTERNAL_GOVERNANCE_ATTR_SYNC_BACKGROUND,EDC_DOPP_LOCK,EDC_DOPP_BACKGROUNDandSQP_STATS_REPORTING(seeWaitTypeName).AnomalyDetectoryoung-baseline bar filter, and the C# check beside it. Both nameREMOTE_BLOCK_IOonly.GetLockWaitTrendAsync,GetLockWaitFamilyTrendAsync,GetLockWaitTypesAsync(get_lock_wait_trend) and the analysis drill-down's lock waits. They readLCK%names only.HasAnyWaitStatAsyncandHasAnyWaitingTaskSampleAsync(2). They only check that a row exists.GetSignificantWaitsWithCaptureAsync(system_health significant waits). It parses the name from the stored XML on every read, andSystemHealthParseralready trims it there (Wait names lose their trailing space, and two Hyperscale timer waits are ignored #4884).GetCurrentBlockingWaitAsync(blocking alert). It reads blocking snapshots and no wait name.wait_typebut never filter or group on it (5). A trailing space changes nothing there. They areGetLatestQuerySnapshotsAsync, the blocking-chain query-snapshot read, the analysis query drill-down,PileupSnapshotReaderand the session tool.WAITFOR,BACKUPTHREAD,BACKUPIO,XE_LIVE_TARGET_TVFandSP_SERVER_DIAGNOSTICS. That is T-SQL run on SQL Server, where a trailing space compares equal.DeltaCalculator.WaitStatsSeedSql. This is the collector's baseline seed. Wait names lose their trailing space, and two Hyperscale timer waits are ignored #4884 pins that the first sample under the trimmed name is a baseline.DuckDbMuteRuleStore,get_mute_rules). These store rules only. Matching uses the finding's wait name, which now comes from the facts under the clean name.App,MainWindow,ConfigSeeder, the collector's ignore-list load,Schema,DuckDbSchemaGenerator, the project file). None of them reads wait rows.Notes
SQP_STATS_REPORTINGas its top wait, now once and under its clean name. This change does not alter what those reads count.wait_stats,waiting_tasksorquery_snapshots, and the reads go through thev_archive views. Sortrimcosts no index plan.Tests
WaitNameSpacedHistoryReadTestsadds 15 tests against a real DuckDB through the real reads, with the bundled default ignore list. 14 of them failed against the reads before the fix, each on its assertion. The 15th checks that the default list namesSQP_STATS_REPORTING, and passes either way.Failures before the fix:
WaitStats_TheDefaultIgnoreList_HidesTheSpacedSpelling:Assert.DoesNotContain() Failure: Filter matched in collectionPicker_TheDefaultIgnoreList_HidesTheSpacedSpelling:Assert.DoesNotContain() Failure: Filter matched in collection, collection["SQP_STATS_REPORTING ", "CXPACKET"]TotalWaitTrend_TheDefaultIgnoreList_LeavesTheSpacedSpellingOut:Assert.Equal() Failure: Values are not within 6 decimal places, expected 10WaitStats_ANameStoredBothWays_IsOneRowWithTheSummedValues:Assert.Single() Failure: The collection contained 2 matching itemsPicker_ANameStoredBothWays_IsOneCleanName:Assert.Equal() Failure: Collections differ at index 0WaitTrend_ByTheCleanName_IncludesTheSpacedHistory:Assert.Equal() Failure: Collections differWaitTrends_ByTheCleanName_AreOneSeriesThatIncludesTheSpacedHistory:Assert.Equal() Failure: Collections differWaitingTasks_TheDefaultIgnoreList_HidesTheSpacedSpelling:Assert.DoesNotContain() Failure: Filter matched in collectionWaitingTaskTrend_ANameStoredBothWays_IsOneSeriesUnderTheCleanName:Assert.Equal() Failure: Collections differ at index 1QueryDrillDown_ByTheCleanName_FindsASnapshotStoredWithTheSpace:Assert.Single() Failure: The collection was emptyWaitBuckets_ByTheCleanName_IncludeTheSpacedHistory:Assert.Equal() Failure: Values differ, expected 2DailySummary_TopWait_SumsBothSpellingsUnderTheCleanName:Assert.Equal() Failure: Strings differ, expectedEDC_DOPP_LOCKWaitCategorySummary_TopWait_SumsBothSpellingsUnderTheCleanName:Assert.Equal() Failure: Strings differ, expectedEDC_DOPP_LOCKAnalysisWaitFacts_ANameStoredBothWays_IsOneFactUnderTheCleanName:Assert.Single() Failure: The collection contained 2 matching itemsAll 15 pass with the fix. The two clause-text assertions in
IgnoredWaitTypesTestsnow expect thertrimform. TheAnomalyDetectorcontributor change has no test of its own. It runs only when anANOMALY_WAIT_PROFILEanomaly fires, and it uses the same group key as the wait-facts test.Full suites at faddc40:
CHANGELOG
No new entry: this amends the [3.9.0] #4884 line, and the release owner applies it.
Proposed sentence: