Repository navigation
Add IsSystemMessage to the audit TimeSent indexes - #6241
Open
warwickschroeder wants to merge 2 commits into
Open
warwickschroeder wants to merge 2 commits into
warwickschroeder wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Part of #6240 (queries 2, 3 and 4). All Messages and an endpoint's message list hide system messages by default, and no index held
IsSystemMessage, so their cappedTotal-Countread every candidate row. The per-day audit count had the same gap. On an IO-limited database with a few hundred thousand rows, these counts reached the 60-second query limit, and ServicePulse showed the page without the audit messages. On 200,000 seeded rows, all three counts now read only an index, and the totals stay the same.IX_AuditMessages_TimeSentincludesIsSystemMessage. All Messages count: 152,977 reads down to about 440.IX_AuditMessages_ReceivingEndpointName_TimeSentincludesIsSystemMessageandProcessedAt. One endpoint's count and its per-day audit count: 42,601 reads down to 83 each.Tests
ServiceControl.Audit.Persistence.Tests.SqlServer(newSystemMessageCountReadsTests): the All Messages and endpoint counts stay under 1,000 reads, and a quiet endpoint's message and per-day counts stay under 10, each with the right total. Each test failed when the include it pins was removed.SlowMigrationOperationApprovalsfor SQL Server and PostgreSQL: approve the drop and recreate of both indexes.