Commit c460316
Honor @pending_task_threshold in sp_HealthParser scheduler shreds
@pending_task_threshold documents the minimum pending-task count the
caller wants to see, but two shreds silently ignored it:
1. #scheduler_details WHERE clause (line ~2954):
AND (... pendingTasks[.>= sql:variable("@pending_task_threshold")] ...
OR @warnings_only = 0)
The `OR @warnings_only = 0` short-circuit meant that whenever the
user ran in the default @warnings_only = 0 mode, the threshold
predicate evaluated to TRUE regardless of the pending-task value.
Setting @pending_task_threshold = 100 returned rows with 2 pending
tasks just the same.
2. #pending_task_details CROSS APPLY (line ~3179):
... queryProcessing[@pendingTasks > 1] ...
Hardcoded literal 1, again with no reference to the parameter.
Both now use sql:variable("@pending_task_threshold") unconditionally.
@warnings_only still independently controls the WARNING-state filter.
Verified the sproc installs clean and @what_to_check = 'scheduler'
with @pending_task_threshold = 100 runs without errors against the
system_health session on SQL Server 2022.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7a9919f commit c460316
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2951 | 2951 | | |
2952 | 2952 | | |
2953 | 2953 | | |
2954 | | - | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
2955 | 2959 | | |
2956 | 2960 | | |
2957 | 2961 | | |
| |||
3176 | 3180 | | |
3177 | 3181 | | |
3178 | 3182 | | |
3179 | | - | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
3180 | 3187 | | |
3181 | 3188 | | |
3182 | 3189 | | |
| |||
0 commit comments