Skip to content

Space out stored headers so SQL Server search finds ids next to emails and URLs - #6009

Open
warwickschroeder wants to merge 2 commits into
masterfrom
warwick/sqlserver-search-spaced-headers
Open

warwickschroeder wants to merge 2 commits into
masterfrom
warwick/sqlserver-search-spaced-headers

Conversation

@warwickschroeder

Copy link
Copy Markdown
Contributor

What this fixes

Since phrase search, SQL Server could not find a message id followed by an email- or URL-valued header, so ServicePulse could not open that message. Headers are now stored with whitespace between entries on the error and audit persisters. Bodies are unchanged, so search inside a compact JSON body still misses emails and URLs, and rows stored before this keep the old layout.

  • Headers are written one entry per line, as "key": "value".
  • Reading accepts both layouts, so stored rows still load.
  • PostgreSQL is unaffected; its search never had the problem.
  • Stored headers grow by about 2 to 3 percent: one space and one line break per header, about 110 to 160 bytes for 26 headers on SQL Server. Bodies, API responses and the full-text index stay the same size.

How to reproduce

On SQL Server, ingest a message whose id is followed by a header such as NServiceBus.ReplyToAddress: Sales@web01.corp.example.com. Searching the id finds nothing, and opening it by id says it cannot be found.

Tests

  • ServiceControl.Persistence.Tests/EFCore/MessagesViewDataStoreTests: an id followed straight away by an email-like reply-to address is found, on SQL Server and PostgreSQL.
  • ServiceControl.Audit.Persistence.Tests/EFCore/EFQueryTests: the same for audit.

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.

2 participants