-
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.
sqlstats: reuse the temporary statement stats container
This commit cleans up the confusing swapping and usages of 2 fields on the StatsCollector, `ApplicationStats` and `flushTarget`. Originally the field `flushTarget`was only used for explicit transactions. In order to provide each statement with the correct txn fingerprint id, statements for explicit txns were stored in a temp stats container and flushed to the app container at the end of transaction execution. The assumption for implicit transactions was that they only had 1 statement and so such statements could be written directly to the parent `ApplicationStats` container rather than waiting for the entire transaction to finish. Now that we create temporary containers for both explicit and implicit txns we should reuse the temporary container between transactions instead of discarding and allocating a new one for each. Summary: - `ApplicationStats` field is on sslocal.StatsCollector is renamed to `currentTransactionStatementStats` - `FlushTarget` is always defined for a stats collector. It represents the current application's sql stats - Instead of allocating a new container for each new txn, we'll clear and reuse `currentTxnStatementStats` between transactions - StatsCollector no longer implementats the `sqlstats.ApplicationStats` interface. There isn't a need for StatsCollector to be used as an interface and doing so makes working with the various containers within StatsCollector more difficult. An exception is made for stats collectors belonging to an internal executor for an outer transaction. Such executors do not start or end the transaction, and so no temporary containers will be used in this case. Fixes: #94650 Release note: None
- Loading branch information
Showing
6 changed files
with
88 additions
and
84 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
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
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