Skip to content

Use %I64d for bigint args in collector RAISERROR debug output (#987)#988

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/987-raiserror-bigint
May 22, 2026
Merged

Use %I64d for bigint args in collector RAISERROR debug output (#987)#988
erikdarlingdata merged 1 commit into
devfrom
feature/987-raiserror-bigint

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Fixes #987. RAISERROR's %d substitution accepts only int — passing a bigint silently produces no message. Collector @rows_collected is declared bigint and set from ROWCOUNT_BIG(), so every collector's @debug=1 row-count line (N'Collected %d ... rows') rendered nothing — the user saw only "Commands completed successfully".

This is a diagnostic-output bug only. The Agent jobs never pass @debug=1, so actual data collection was never affected — the messages were just invisible when a collector was run by hand.

Changes

  • 35 %d%I64d substitutions across 31 install files, for every RAISERROR argument whose variable is bigint (@rows_collected, @rows_updated, @rows_parsed, @events_from_file, @total_deleted, @duration_threshold_ms).
  • Multi-argument calls fixed positionally — %d kept for genuine int arguments (@table_count, @trace_id, @property_count, CPU-scheduler warning counters, etc.).
  • %I64d was already used correctly in a few places (23, 25, 43); this brings the rest in line.

Test plan

  • Full installer run against SQL2022 — 54 files, 0 failures, 45 collectors ran (all 31 changed files compile).
  • EXEC collect.cpu_utilization_stats_collector @debug=1Collected 1 CPU utilization stats rows (reporter's expected output).
  • EXEC collect.wait_stats_collector @debug=1Collected 84 wait stats rows.

🤖 Generated with Claude Code

RAISERROR's %d substitution accepts only int — passing a bigint silently
produces no message, so every collector's @debug=1 row-count line printed
nothing ("Commands completed successfully" with no output).

@rows_collected is declared bigint and set from ROWCOUNT_BIG(), so the
N'Collected %d ... rows' messages never rendered. Switched %d to %I64d for
every RAISERROR argument whose variable is bigint (@rows_collected,
@rows_updated, @rows_parsed, @events_from_file, @total_deleted,
@duration_threshold_ms) across 31 install files — 35 substitutions.

Multi-arg calls were fixed positionally: %d kept for genuine int arguments
(@table_count, @trace_id, @property_count, etc.).

Verified: full installer run against SQL2022 (54 files, 0 failures) and
EXEC collect.cpu_utilization_stats_collector @debug=1 now prints
"Collected 1 CPU utilization stats rows"; wait_stats prints its count too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 6e0c3b1 into dev May 22, 2026
6 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/987-raiserror-bigint branch May 22, 2026 14:04
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