Add rule 38 for standard edition limitation on batch mode when dop=2#275
Conversation
Code Review — Rule 38: Standard Edition DOP 2 limitationOverviewAdds a new analyzer rule that flags plans with DOP=2 + batch mode where the SQL Server Standard Edition cap is the likely cause. Threads Issues1. Other call sites not updated (most important)
The optional parameter means it compiles, but the CLI Query Store path and the MCP path do connect to a live server and could plumb 2. No tests
3.
|
1. Fix Rule 38 edge case (PlanAnalyzer.cs) • Introduced editionKnown variable: !string.IsNullOrEmpty(serverMetadata?.Edition) • If ServerMetadata is non-null but Edition is null/empty (collection failure), the Info branch now fires instead of silently skipping 2. Wire RunLiveAsync(FileInfo?, string, string?, string?, DirectoryInfo?, bool, string?, bool, int, string, bool, bool, ICredentialService?, string?, string?, AnalyzerConfig) (AnalyzeCommand.cs) • Fetches ServerMetadata via FetchServerMetadataAsync(string, bool, CancellationToken) after connection is established • Passes it to PlanAnalyzer.Analyze(plan, analyzerConfig, serverMetadata) • Non-fatal try/catch so analysis continues if metadata collection fails 3. Wire RunAsync(FileInfo?, bool, string, bool, bool, AnalyzerConfig) (QueryStoreCommand.cs) • Same pattern: fetches metadata once before the plan analysis loop • Reuses it for all plans in the batch (same server) 4. Wire McpQueryStoreTools (McpQueryStoreTools.cs) • Fetches metadata before the LINQ Select that parses plans • Passes via named parameter serverMetadata: serverMetadata 5. PlanTestHelper overload (PlanTestHelper.cs) • Added LoadAndAnalyze(string planFileName, ServerMetadata? serverMetadata) overload • Original overload delegates to the new one with null 6. Unit tests (PlanAnalyzerTests.cs) — 4 tests: • Standard + DOP=2 + batch + MAXDOP>2 → Warning ✅ • Standard + DOP=2 + batch + MAXDOP=2 → no warning ✅ • No metadata + DOP=2 + batch → Info ✅ • Metadata with null Edition + DOP=2 + batch → Info ✅ (edge case fix)
What does this PR do?
Add Rule 38: Standard Edition DOP 2 Limitation
• With server context (repro/query session): When Edition="Standard", batch mode nodes exist, DOP=2, and MAXDOP>2 → emits a Warning confirming the Standard Edition limitation and noting that Developer/Enterprise Edition would allow higher DOP
• Without server context (.sqlplan file): When batch mode nodes exist and DOP=2 → emits an Info suggesting the limitation may apply
Which component(s) does this affect?
How was this tested?
Describe the testing you've done. Include:
Checklist
dotnet build -c Debug)dotnet test)