Repository navigation
Plan analysis: the store readers fill ServerMetadata's cost threshold, max server memory and database settings (#4597) - #4607
Merged
Conversation
Ports PerformanceStudio's AnalyzerConfig/RulesConfig (disabled rules, severity overrides) and the top-level ServerMetadata fields into PerformanceMonitor.PlanAnalysis, adds PlanWarning.RuleNumber, and adds Analyze/Run overloads that take (config, serverMetadata, cancellationToken) and thread both down to the statement and node walks. The existing overloads still forward to AnalyzerConfig.Default and a null metadata, and no rule reads either new parameter yet, so analyzer output is unchanged.
…ng framework as legacy (#4566)
…ing (#4535) Ports erikdarlingdata/PerformanceStudio's severity-override pass: overrides now find a warning's rule via PlanWarning.RuleNumber instead of matching WarningType against a rule-to-name table, and the engine's own warnings (Source == SqlServer) are always skipped. Also ports PlanStatements.EnumerateAllWithContainer, with EnumerateAll delegating to it so the plain and container-carrying walks stay one walk.
…5-analyzer-config
…5-analyzer-config
#4535, #4566) The plumbing step's RuleNumber_DefaultsToNull_UntilLaterStepsStampIt pinned the state partway through the per-rule configuration rollout (only rule 3 stamped). Every step that stamps a rule has landed on this branch, so that pin is wrong by design now. Replaces it with PlanSync4535RuleNumberCensusTests: a code census over every new PlanWarning construction in PlanAnalyzer.cs (each must set RuleNumber, except a SqlServer-sourced initializer), a runtime census over the existing plan fixtures (every analyzer finding carries a non-null RuleNumber), and a cross-step check that disabling every stamped rule number leaves zero analyzer findings.
…into plan-sync/4530-entry-points
Adds three tests the earlier #4530 steps skipped: - a live Postgres pin that seeds collect.server_properties and collect.server_config on a migrated store and asserts DarlingServerMetadataReader.ReadAsync returns the edition and MAXDOP, then runs the same plan XML through the analysis formatter and confirms rule 38 (Standard Edition DOP 2 limitation) gives its Warning, plus a no-rows case that stays on the Info branch; - a drill-down pin: a PLAN_WARNING finding's drill-down surfaces the rule-38 Warning when PgDrillDownCollector runs against a seeded Standard Edition / MAXDOP 8 server; - a Lite.Tests pin (build-only on macOS) for LocalDataService.GetServerMetadataForPlanAnalysisAsync against a seeded DuckDB fixture, plus a Darling.Tests source-census pin that the Lite reader's SQL names the same view and columns Darling's migrated schema and reader use. Ported the reader's column-name RED by temporarily renaming the FROM clause, confirming the new live pin fails, then reverting.
…and seed every required server_properties column in the Lite metadata test
…oints # Conflicts: # PerformanceMonitor.Ui/PlanViewerControl.xaml.cs
…, max server memory and database settings (#4597)
…o plan-sync/4597-server-context-fields
…o plan-sync/4597-server-context-fields # Conflicts: # Darling/PerformanceMonitor.Darling.Storage/DarlingServerMetadataReader.cs
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 #4597. #4601 is merged; this is now against dev. Part of #4511.
What changes
ServerMetadatagains PerformanceStudio'sDatabaseMetadata(name, compatibility level, collation, RCSI, the auto-stats flags, forced parameterization) andScopedConfigItemshapes, plus aDatabaseproperty. Both store readers —DarlingServerMetadataReader(Postgres) and Lite'sLocalDataService.GetServerMetadataForPlanAnalysisAsync(DuckDB) — now also read cost threshold for parallelism and max server memory (MB) from the config history, and, when a database name is given, the newestdatabase_config/v_database_configrow for that database. A missing or absent database row leavesDatabasenull rather than failing the read, the same non-fatal contract the existing edition/MAXDOP read already has.The viewer's plan-opening entry points (
ProcedureHistoryWindow,QueryStatsHistoryWindow,QueryStoreHistoryWindow,WaitDrillDownWindow,ViewerActualPlanFlow,ViewerServerTab.Plans,ViewerDataService) and the drill-down/MCP paths (PgDrillDownCollector.Plans,DarlingMcpPlanTools) now pass the database name through to the reader wherever the call site already has it (a plan opened from a database-scoped history window or drill-down); sites with no database context at hand (a pasted plan, a plan looked up by hash alone) still call the reader with no database name, same as before, and get everything exceptDatabase.PerformanceStudio parity
PM fills every
DatabaseMetadatamember PS's live fetch fills fromsys.databases, sourced from PM's collecteddatabase_config/v_database_configrow instead of a live connection (Darling has no live session at these call sites — same reasoning the existing edition/MAXDOP read already documents).ScopedConfigItem/NonDefaultScopedConfigsis added to the model to keep the shape aligned with PS, but nothing populates it yet in this change; no reader queriesdatabase_scoped_confighere. That's the remaining PS surface with no PM data behind it yet.Test plan
dotnet build Darling/Darling.Tests/Darling.Tests.csproj -c Release -p:EnableWindowsTargeting=true: 0 warnings, 0 errors.PlanSync4597ServerContextFieldsLiveTests,PlanSync4530ReaderLiveTests,PlanSync4530DrillDownLiveTests→ 4/4/… all green, Total: 20 across those plusStorageCommandTimeoutTests, 0 failed.StorageCommandTimeoutTests+LivePostgresCollectionHygieneTests+LiveCleanupConversionRatchetTests+DocCommentHygieneTests+CommentFilterAdoptionTests+McpPayloadContractCensusTests+McpToolsListBudgetTests: Total 204, Failed: 1 —LivePostgresCollectionHygieneTests.EveryClassUsingTheSharedStore_IsSerializedOrDocumentsWhyNotfails on this Mac only, withCould not load file or assembly 'PresentationFramework'; that's a WPF type load unavailable on macOS, not a regression (confirmed unrelated to this change by running it before and after).database_configpredicate todatabase_name = 'red-mutation', rebuilt, reranPlanSync4597ServerContextFieldsLiveTests→Assert.NotNull() Failure: Value is nullat the seeded-database assertion. Reverted, rebuilt, reran → green again (Total: 20, 0 failed).StorageCommandTimeoutTestsinitially caught one real gap: the newdatabase_configread'sNpgsqlCommandhad no explicit deadline. Fixed by settingCommandTimeout = StorageCommandDeadlines.McpReadSeconds(this reader serves the MCP plan tools and drill-downs, the same regime as the file's other MCP-facing reads).dotnet build Lite/PerformanceMonitorLite.csproj,Lite.Tests/Lite.Tests.csproj,Darling/PerformanceMonitor.Darling.Viewer,Darling/PerformanceMonitor.Darling.Service(all-p:EnableWindowsTargeting=true) → 0 warnings, 0 errors on all four.PlanSync4597ServerContextFieldsLiveTestsconfirming Lite'sPlanServerMetadataSqlnames the samev_database_configcolumns Darling'sdatabase_configschema does.Lite.Tests/PlanServerMetadataDatabaseArgTests.cs(a new file, not the siblingPlanServerMetadataReaderTests.cs, which Plan analysis: rule 38 reads the server's edition and MAXDOP at every entry point (#4530) #4601 also edits) with three build-only pins for the database argument, copying that file'sSharedDuckDbFixturesetup pattern and filling every NOT NULL column ofserver_propertiesanddatabase_config. Can't run on macOS (Lite.Testsdiscovery dies on WindowsBase); CI decides them.ProjectReferenceor lock-file changes in this branch, so nodotnet restore --force-evaluatewas needed.CHANGELOG
SECTION: None
ENTRY: None: the fields feed the Server Context card (#4597), a separate PR