Skip to content

Fix transaction heartbeat watchdog correlation#5573

Closed
mikaelweave wants to merge 1 commit into
mainfrom
mikaelweave/fix-transaction-heartbeat-watchdog
Closed

Fix transaction heartbeat watchdog correlation#5573
mikaelweave wants to merge 1 commit into
mainfrom
mikaelweave/fix-transaction-heartbeat-watchdog

Conversation

@mikaelweave
Copy link
Copy Markdown
Contributor

ADO 192126.

Why

SQL merge transaction heartbeat bookkeeping was tied to the inbound request cancellation token. If the client canceled after a transaction row was created, heartbeat updates could stop while the server-side row still needed cleanup, leaving watchdog activity harder to correlate back to the originating batch or transaction request.

Approach

  • Use a non-request cancellation token for merge transaction heartbeat updates after transaction creation.
  • Store bounded request context in dbo.Transactions.Definition for schema V114+ and gate the SQL parameter for rolling upgrade compatibility.
  • Return the stored context from timed-out transaction lookup and include it in watchdog cleanup telemetry when available.
  • Add schema migration 114.diff.sql, update base sprocs, and bump SQL latest schema version to 114.

Notes

The stored context is intentionally bounded to the existing varchar(2000) column and excludes the full URI and query string. Older schemas do not receive @Definition, and the timeout read path tolerates missing definition columns.

Validation

  • dotnet test src\Microsoft.Health.Fhir.SqlServer.UnitTests\Microsoft.Health.Fhir.SqlServer.UnitTests.csproj --no-restore --filter "FullyQualifiedName~SqlServerFhirDataStoreUnitTests|FullyQualifiedName~SqlStoreClientTests|FullyQualifiedName~TransactionWatchdogTests" --logger "console;verbosity=minimal"
  • git diff --check

Use a non-request cancellation token for SQL transaction heartbeat bookkeeping after merge transaction rows are created. Persist bounded request context on transaction rows for schema V114+ and include it in watchdog cleanup telemetry when available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mikaelweave mikaelweave requested a review from a team as a code owner May 15, 2026 16:12
@github-actions github-actions Bot added the SQL Scripts If SQL scripts are added to the PR label May 15, 2026
@mikaelweave mikaelweave deleted the mikaelweave/fix-transaction-heartbeat-watchdog branch May 15, 2026 16:27
@mikaelweave mikaelweave restored the mikaelweave/fix-transaction-heartbeat-watchdog branch May 15, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SQL Scripts If SQL scripts are added to the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant