Skip to content

Fix Azure SQL DB server_id collision (#677)#679

Closed
erikdarlingdata wants to merge 1 commit intodevfrom
fix/azure-db-server-id-677
Closed

Fix Azure SQL DB server_id collision (#677)#679
erikdarlingdata wants to merge 1 commit intodevfrom
fix/azure-db-server-id-677

Conversation

@erikdarlingdata
Copy link
Owner

@erikdarlingdata erikdarlingdata commented Mar 24, 2026

Fixes #677 — Azure SQL DB connections to different databases on the same logical server shared the same server_id, causing CPU and other database-scoped DMV data to interleave.

GetServerNameForStorage() now appends /DatabaseName when set, so myserver.database.windows.net/Db1 and myserver.database.windows.net/Db2 hash to different server_ids.

Existing data under the old hash becomes orphaned (acceptable — it was mixed/incorrect anyway).

Test plan

  • Builds clean (no new warnings)
  • On-prem connections without DatabaseName unaffected (empty/null check)
  • ReadOnlyIntent suffix still appended correctly after database name
  • MCP ServerResolver still resolves by ServerName/DisplayName (unaffected)

GetServerNameForStorage() only used ServerName for hashing, so two
Azure SQL DB connections on the same logical server with different
databases got the same server_id. Database-scoped DMVs like
dm_db_resource_stats then had their data interleaved.

Now appends "/DatabaseName" to the storage key when DatabaseName is
set, giving each database its own server_id and clean data separation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata
Copy link
Owner Author

Closing in favor of #680 — community contributor landed the same fix with real Azure SQL DB testing. Thanks @tnguyen7s!

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