Skip to content

sp_QuickieStore tests: fix check counts in the README (MultiDb flake already fixed) - #958

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/admin-qs-harness
Nov 13, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
fix/admin-qs-harness

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

What this changes

Test files only (sp_QuickieStore/tests/README.md, sp_QuickieStore/tests/run_tests.py). No procedure change, no version change.

1. Multi-database flake ("both databases return their queries"): already fixed, no fixture change

Re-check result: the finding no longer holds on dev, and its premise (a Query Store flush race) was never the cause.

I read the job logs of all 11 failed SQL Tests runs from 2026-10-14 to 2026-11-13 (gh api .../jobs/<id>/logs, grepping [FAIL]). The check failed in two runs, both on 2026-10-23, on SQL Server 2022 and 2025 only:

Run Head commit Result
39992604356 3a69179 runtime_stats rows=6 (2025), rows=3 (2022)
39995313858 eace0d1 runtime_stats rows=0 (2022 and 2025)

Both runs are older than ea8cf0c6 (2026-10-23 13:50 EDT, in dev), which fixed it. That commit found the cause: simple parameterization folded md_q1 to md_q3 into one query and dropped the comments, so each database held fewer distinct queries than the check expects. It was not a flush miss.

I confirmed this by replaying the pre-fix harness (eace0d19) against today's procedure on SQL2022 and SQL2025, 3 runs each: rows=6 and a failure every time (6 of 6). The current harness passes the same check every time (below). A flush race would not give the same count on every run.

The fixture already does what the finding asked for:

  • MD_QUERIES_SQL ends with EXECUTE sys.sp_query_store_flush_db; in each fixture database, after the workload and before any read.
  • md_build_database then probes that every marker has a query, a plan and runtime stats, reruns up to 5 times (clearing the plan cache each time), and a captured every marker query check names any miss.

Other checks with the same read-after-workload pattern: every fixture group already flushes after its workload (main fixture lines 256 and 308, MultiDb 664, regression fixture 1371 and 1426, regression window 1872, plan parsing 2905, last values 3453 and 3508). None needs the treatment.

Proof on current dev (origin/dev b7fba0f), python run_tests.py --server <S> --only multidb, 6 runs per server:

  • SQL2022: 6 of 6 runs Total: 20 passed, 0 failed.
  • SQL2025: 6 of 6 runs Total: 20 passed, 0 failed.
  • both databases return their queries returned 11 to 14 runtime_stats rows in all 12 runs (needs 8). No failures.
  • Earlier baseline before my edits: 5 runs per server, no [FAIL] line.

Every failed run from the last month, by cause (none is an open flake):

Runs Failing check Cause and state
4 runs, 2026-10-23 (39988820746, 39988944002, 39989223459, 39989609896) WaitFloor[6001]: LCK_M_IS ... does not surface Failed the same way on every version, then stopped within the same PR. Not a timing flake.
2 runs, 2026-10-23 MultiDb (above) Fixed in ea8cf0c6.
4 runs, 2026-10-27 (40442862926, 40447534772, 40447844332, plus 40600541158) PlanParsing rules 1, 2, 4, 5, 8, 18, and rule 3 (UDF) on 2019 Same on all versions while the @plan_parsing PR was being built, then fixed in that PR (rule 3: 2dcbb025).
1 run, 2026-11-13 (43375069219) none printed; subprocess.TimeoutExpired on 2022 and 2025 The go-sqlcmd stall in the @end_date test, fixed in 2729d75b.

The 5 dev push runs since 2026-11-13 05:59 UTC are all green.

2. README check counts (docs)

The README said 397 in one place and Expect 364 / 365 on 2017 in another. Counts from the last green dev push run (43389980095), Results: line of the sp_QuickieStore step in each job:

Version Checks
SQL Server 2017 396
SQL Server 2019 395
SQL Server 2022 397
SQL Server 2025 397

My own full runs agree for 2022 and 2025 (397 total each). The README now gives these four numbers and the reasons they differ: two permission checks run only on 2022 and later, the rule 14 check at compatibility level 150 and up does not run on 2017, and 2017 runs two more rule 1 checks. (2019 = 395; 2022 = 395 + 2; 2017 = 395 - 1 + 2.) The plain-English checker shows no hits on the lines I changed.

3. Small addition: --only multidb prints a Total line

--only plan_parsing ends with Total: N passed, M failed; --only multidb printed nothing, so repeated runs could not be counted from the output. It now prints the same line.

Full harness runs (once, at the end, on the final harness)

  • SQL2025: Results: 397 passed, 0 failed, 397 total, run twice.
  • SQL2022 (lab): 396 passed, 1 failed, 397 total, run twice, same single failure: WaitWindow: resource_stats has one row per query (query_id values: ['7', '9']). A third run with a debug driver also failed the matching Regression check.

The SQL2022 failure is the lab server, not this change or CI. resource_stats is read from sys.dm_exec_query_stats, so a fixture query's plan has to still be in the plan cache. The lab SQL2022 instance sees 1 GB of physical memory (target 625 MB, plan cache about 26 MB), so the likely cause is plan cache eviction: rm_q3 had no cached plan at the read, and a query of the cache right after the run held only rm_q1. SQL2025 here and the CI containers keep the plans. Check 43389980095 is green on 2022.

Dropped, and considered, not added

  • Dropped: the flush fix for MultiDb. Already in dev (above); adding a second flush or a poll would address no failure.
  • Considered, not added: making resource_stats has one row per query independent of the plan cache. The only failure is a memory-starved lab instance; CI has never failed on it. If that instance becomes a target, the fix is to run each fixture procedure once just before the read.
  • Considered, not added: a retry around the MultiDb read. No failure since ea8cf0c6 (3 weeks, 12 of 12 local runs).
  • Seen but left alone: in --only multidb and --only plan_parsing the PASS lines print their detail text (for example (skipped list missing from the footer) next to a PASS). It is only noise.

Lab cleanup: no quickiestore_test* databases or logins remain on SQL2022 or SQL2025. sp_QuickieStore in master on both servers is the origin/dev copy.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M98owc3zzZNEpij3p49Bbe

…line for --only multidb

The README said 397 checks in one place and "Expect 364 / 365 on 2017" in
another. The real counts from a green CI run on dev (b7fba0f) are 397 on SQL
Server 2022 and 2025, 396 on 2017 and 395 on 2019; the README now says so and
explains why the count changes with the version.

--only multidb now prints a "Total: N passed, M failed" line, like --only
plan_parsing, so repeated runs of the group can be counted.

The MultiDb "both databases return their queries" flake from 2026-10-23 is
already fixed on dev by ea8cf0c (markers folded by simple parameterization,
not a Query Store flush race), and every fixture already flushes, so no
fixture change is made here.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M98owc3zzZNEpij3p49Bbe
@erikdarlingdata
erikdarlingdata marked this pull request as ready for review November 13, 2026 09:01
@claude

claude Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Claude finished @erikdarlingdata's task in 10s —— View job


Review

The change is small and looks good. It touches test files only, with no procedure, version, or Install-All edits.

  • run_tests.py: the new Total: N passed, M failed line for --only multidb uses R.passed and R.failed, and it sits before sys.exit. This matches the plan_parsing output.
  • README.md: the four per-version counts and the reasons they differ are consistent with the arithmetic in the PR body (2019 = 395, 2022 = 395 + 2, 2017 = 395 - 1 + 2). The old 364/365 text is gone, and I found no leftover references.

I didn't re-run the harness. I only read the diff, and the CI-run numbers come from the PR description.

No issues to flag.

@erikdarlingdata
erikdarlingdata merged commit b1b6117 into dev Nov 13, 2026
8 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/admin-qs-harness branch November 13, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant