Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#23771] YSQL, ASH: Fix prepared statements not being tracked in ASH
Summary: pg_stat_statements doesn't track the execution of PREPARE, EXECUTE and DEALLOCATE, so it doesn't set a query id for these statements, however it sets the query id for the underlying query of EXECUTE, the one which is actually executed by the executor hooks. Previously, the execution of prepared statements using PREPARE and EXECUTE were not being tracked by default after D34773 because the execution happens after the utility node of EXECUTE, which made it a nested statement, and unless pg_stat_statements.track='all' is set, these are not tracked. As a result, the underlying query of EXECUTE were not being tracked by default (with pg_stat_statements.track='top') in ASH but they were in pg_stat_statements. This diff fixes the issue by skipping the nested level when the node being processed is PREPARE, EXECUTE or DEALLOCATE, which is the same behaviour as pg_stat_statements, and this means that either the underlying query of EXECUTE will always be tracked by ASH when it's also being tracked by pg_stat_statements This diff also enables the ASH java tests in TSAN mode after D37049 fixed the test failures with ASH in TSAN mode Jira: DB-12675 Test Plan: ./yb_build.sh --java-test TestYbAsh#testPreparedStatements Reviewers: jason Reviewed By: jason Subscribers: amitanand, hbhanawat, yql Differential Revision: https://phorge.dev.yugabyte.com/D37737
- Loading branch information