Skip to content

Fix SQL schema/job/validation defects from Fable code review (chunk 7)#1108

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/code-review-sql-schema
Jun 11, 2026
Merged

Fix SQL schema/job/validation defects from Fable code review (chunk 7)#1108
erikdarlingdata merged 1 commit into
devfrom
feature/code-review-sql-schema

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

SQL schema/job/validation fixes from the Fable code review (chunk 7 of 7, final). Minimal, verifiably-correct changes; full install needs your version testing across 2016–2025.

Fixes

[HIGH] Fresh installs missing TRANSACTION_MUTEX in the ignored-wait seedinstall/01
config.ignored_wait_types is seeded by 01 first (non-empty), and install/03's seed (which does include TRANSACTION_MUTEX) only fires when the table is empty — so it never runs on a fresh install. Net: fresh 2.12.0 installs collect TRANSACTION_MUTEX and can resurface the exact ANOMALY_WAIT_TRANSACTION_MUTEX noise the 2.11→2.12 upgrade shipped to kill. Added it alphabetically to 01's seed.

[MEDIUM] Agent-job recreation orphans msdb schedulesinstall/45
The three sp_delete_job calls omitted @delete_unused_schedule = 1 (defaults to 0), so each reinstall/upgrade left the job's schedule orphaned in msdb.sysschedules and created a fresh one — 3 orphans per upgrade, forever. Added the parameter to all three (00_uninstall.sql already does this).

[LOW] Validation points users at non-existent filesinstall/98
Remediation messages referenced 34a_hung_job_monitor.sql / 35_create_agent_jobs.sql / 98_test_hung_monitor.sql — none exist. Corrected to 44_hung_job_monitor.sql / 45_create_agent_jobs.sql / 97_test_procedures.sql.

Remaining schema/upgrade findings — flagged for follow-up (deeper/riskier)

  • [HIGH] 03 ensure_config_tables self-heal creates stale/divergent schemas on a live recovery path (the master collector calls it every cycle): collection_schedule without collect_query/collect_plan (breaks collectors 08/09/10), and an installation_history of an entirely different shape (breaks version detection).
  • [MEDIUM] 41 apply_collection_preset blanket re-enables every collector, re-enabling the ones 04 deliberately disabled as platform-incompatible on Azure MI / AWS RDS → a permanent ERROR stream.
  • [HIGH] upgrades/2.1.0-to-2.2.0 compress migrations: batch-scoped RETURN before GO is a no-op, so a re-run double-compresses LOBs and can strand collect.query_stats empty; the CATCH only PRINTs (no THROW), so the installer logs SUCCESS.
  • [LOW] upgrades/README example teaches the fresh-install-bug pattern; 01 misplaced ELSE in the blocked-process-threshold messaging.

These touch the live self-heal / upgrade paths and warrant your review + real version testing, so I left them rather than guess.

🤖 Generated with Claude Code

- 01 fresh-install seed of config.ignored_wait_types was missing TRANSACTION_MUTEX,
  so fresh 2.12.0 installs collect it and can resurface the ANOMALY_WAIT_
  TRANSACTION_MUTEX noise the 2.11->2.12 upgrade shipped to kill (install/03's
  seed has it but only fires when the table is empty, which never happens after
  01 seeds it first). Added it alphabetically.
- 45 agent-job recreation used sp_delete_job without @delete_unused_schedule = 1
  (defaults to 0), so each reinstall/upgrade orphaned the job's schedule in
  msdb.sysschedules and created a fresh one — 3 orphans per upgrade, forever.
  Added @delete_unused_schedule = 1 to all three (00_uninstall already does this).
- 98 validation remediation messages pointed at install/34a_hung_job_monitor.sql,
  install/35_create_agent_jobs.sql, and install/98_test_hung_monitor.sql — none
  exist. Corrected to 44_hung_job_monitor.sql / 45_create_agent_jobs.sql /
  97_test_procedures.sql.

Changes are syntactically trivial (a VALUES-list entry, a standard sp_delete_job
parameter already used in 00_uninstall, and PRINT text). Full install needs your
version testing across 2016-2025.

Remaining schema/upgrade findings flagged for follow-up (deeper/riskier): 03
ensure_config_tables self-heal creates stale/divergent schemas (collection_schedule
missing collect_query/collect_plan; installation_history wrong shape) on a live
recovery path; 41 apply_collection_preset re-enables platform-incompatible
collectors on MI/RDS; upgrades 2.1.0-to-2.2.0 compress-migration batch-scoped
RETURN + PRINT-not-THROW; upgrades README example teaches the fresh-install-bug
pattern; 01 misplaced ELSE in the blocked-process-threshold messaging.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit b9ed1e6 into dev Jun 11, 2026
@erikdarlingdata erikdarlingdata deleted the feature/code-review-sql-schema branch June 11, 2026 07:24
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