Lite: an upgraded install merges new default ignored waits into the user's list once - #4931
Merged
Merged
Conversation
…ce and keeps the user's edits
…ser's list once, keeping the user's edits
… list, and a refused file says why
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.
Refs #4884
What was wrong
#4884 added
RBIO_COMM_RETRYandSQP_STATS_REPORTINGto the default ignored waits. Lite readsconfig/ignored_wait_types.jsonfrom the per-user data folder first, andConfigSeeder.SeedMissingcopies the bundled file only when the per-user one is missing. An install upgraded from an earlier release already has the file, so it never received the two names. Those installs kept collecting, showing and analysing the two waits. Only fresh installs got the fix.The fix
At startup, right after
SeedMissingand before anything callsIgnoredWaitTypes.Load(), Lite runsIgnoredWaitTypes.MergeNewDefaults(bundled, user).seen_defaultsarray besideignored_waits. It records the bundled defaults the file has already been offered.seen_defaultswas written by v3.8.0 or earlier. The bundled list is identical, 124 names, in every release from v1.0.0 through v3.8.0, so such a file has seen exactlyIgnoredWaitTypes.V380Defaults(that list, compiled in). Any default added later, in 3.9.0 or a future release, differs from it, so an install that skips releases still gains every new default.bundled - seenis appended toignored_waits(case-insensitive, skipping names already there), andseen_defaultsbecomesseen + bundled.TryMergeNewDefaults(JsonObject, IReadOnlyCollection<string>, out JsonObject, out string?);MergeNewDefaultsis the file wrapper.What stays the user's
seen_defaults).JsonObject, not a typed model)..tmpfile andFile.Move(..., overwrite: true), keeping the file's line endings and trailing newline. The rewrite is indented two spaces, one name per line, and drops a UTF-8 byte-order mark;Loadreads either form. A second start is a no-op: same bytes, same last-write time.seen_defaults.ignored_waitsorseen_defaultsis not a list of strings is left alone with a warning naming which. A malformed file is never overwritten.seen_defaults. If that user then removed one of the two, it is added back once.Darling needs no change
Darling's collectors use the compiled-in
IgnoredWaitDefaults.All(DarlingCollectorRunner.cs, both collector option sites). There is no per-store or per-user override and no migration that stores an ignored list, so an upgraded Darling store gets the new names with the new binary.Lite analysis
The wait-profile fact read in
DuckDbFactCollector.Waits.csdoes not apply the ignored list at read time; it reads whatever was stored. The merge stops new rows for the two waits on upgraded installs (collection) and hides old rows in the wait-stats tab at once (display usesIgnoredWaitTypes.Load()). Rows already stored age out of the analysis window.Pins
Lite.Tests/IgnoredWaitTypesUpgradeTests.cs, over the pure function and the file wrapper in a temp directory:V380Defaultsequals v3.8.0's bundled list name for name, and the current bundle carries all of it plus the two;seen_defaults;seen_defaults, against a bundle carrying a future name too, gains all three;CHECKPOINT_QUEUE) stays removed while the two are added;seen_defaultsexists;.tmpis left;ignored_waits, are byte-identical afterwards;seen_defaults), then not again.The tests commit does not compile on dev (
MergeNewDefaultsandTryMergeNewDefaultsdo not exist yet).Tests run
IgnoredWaitTypesUpgradeTests,ConfigSeederTests,SharedCollectorDefaultsPinTestsandDataRootMigrationTests, 38 passing at the first fix commit; CI's Lite shards run the whole suite.CHANGELOG
None: this amends #4884's Fixed entry to cover upgraded installs.