Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: proprely record stmt stats for client-specified app names
The initialization of `(*connExecutor).appStats` in `newConnExecutor` was based off a temporary local variable (`sd`) unrelated to the object actually holding the application name (`ex.sessionData`). This caused the initial appStats to always be wrong when the initial application name was not empty. Meanwhile, the changes in cockroachdb#30702 have ensured that `appStats` is initialized via `resetSessionVars` for normal client connections. The extra initialization in `newConnExecutor` was not just wrong; it was not needed any more except for internal executors. This patch corrects/simplifies the situation. Release note (bug fix): CockroachDB now properly records statistics for sessions where the value of `application_name` is given by the client during initialization instead of `SET`.
- Loading branch information