mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Changing the state of whether we're recording profiling information
halfway through a query (as happens in "SET SESSION PROFILING = ...") has a few side-effects, the worst of which is a memory leak for prepared statements, which poke directly from the parser into the profiling code (we don't have the query text when we need it) and that overwrites a pointer to heap-allocated memory when the previous statement turns on profiling. Instead, now set a flag when we begin a new statement that tracks whether profiling is on _at the start_ of the query. Use that to track whether we gather info. Additionally, use that AND use the state of the profiling variable after the end of a query to know whether to store information about the query that just finished.
This commit is contained in:
@ -277,6 +277,7 @@ private:
|
||||
query_id_t profile_id_counter;
|
||||
THD *thd;
|
||||
bool keeping;
|
||||
bool enabled;
|
||||
|
||||
QUERY_PROFILE *current;
|
||||
QUERY_PROFILE *last;
|
||||
|
Reference in New Issue
Block a user