-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: consistent aggregated timestamp when flushing sql stats
Previously, when SQL Stats are flushed to system table, the aggregatedTs column for SQL Stats is calculated for each stats entry individually. This means that if a flush starts near the end of each hour, it is possible that different stats rows will be assigned two different aggregated timestamp. Currently, flusher flushes statement statistics first, and only when statement statistics are flushed, transaction statistics will be flushed into system table. This means that it is likely the transaction statistics will get assigned a different aggregatedTs than the statement statistics. Consequentially, when the frontend fetches SQL Stats through the CombinedStmtStats handler, the frontend default performs range scan at 1 hour interval. This triggers a range scan on the system table for that 1 hour range. This causes the statement statisitcs that got assigned a different aggregatedTs to be omitted from the result. This commit changed the flusher to only compute aggregatedTs once before the flush actually happen, and assign that aggregatedTs too *all* stmt/txn stats rows. Statements executed in the same aggregation interval can be looked up by the corresponding statement fingerprint ID stored in transaction stats metadata. Release note: None
- Loading branch information
Showing
4 changed files
with
323 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.