MySQL 8.4.2
Source Code Documentation
|
To have the smallest impact on THD's size, most of the implementation is moved to a separate class Opt_trace_context_impl which is instantiated on the heap when really needed. More...
Public Member Functions | |
Opt_trace_context_impl () | |
void | disable_I_S_for_this_and_children () |
void | restore_I_S () |
Public Attributes | |
Opt_trace_stmt * | current_stmt_in_gen |
Opt_trace_stmt_array | stack_of_current_stmts |
To keep track of what is the current statement, as execution goes into a sub-statement, and back to the upper statement, we have a stack of successive values of current_stmt_in_gen: when in a statement we enter a substatement (a new trace), we push the statement's trace on the stack and change current_stmt_in_gen to the substatement's trace; when leaving the substatement we pop from the stack and set current_stmt_in_gen to the popped value. More... | |
Opt_trace_stmt_array | all_stmts_for_I_S |
List of remembered traces for putting into the OPTIMIZER_TRACE table. More... | |
Opt_trace_stmt_array | all_stmts_to_del |
List of traces which are unneeded because of OFFSET/LIMIT, and scheduled for deletion from memory. More... | |
bool | end_marker |
copy of parameter of Opt_trace_context::start More... | |
bool | one_line |
feature_value | features |
long | offset |
long | limit |
size_t | max_mem_size |
long | since_offset_0 |
Number of statements traced so far since "offset 0", for comparison with OFFSET and LIMIT, when OFFSET >= 0. More... | |
UnstructuredTrace * | m_unstructured_trace {nullptr} |
Trace in plain text, as used by Hypergraph. More... | |
To have the smallest impact on THD's size, most of the implementation is moved to a separate class Opt_trace_context_impl which is instantiated on the heap when really needed.
So if a connection never sets @@optimizer_trace to "enabled=on" and does not use –debug, this heap allocation never happens. This class is declared here so that frequently called functions like Opt_trace_context::is_started() can be inlined.
|
inline |
void Opt_trace_context::Opt_trace_context_impl::disable_I_S_for_this_and_children | ( | ) |
void Opt_trace_context::Opt_trace_context_impl::restore_I_S | ( | ) |
Opt_trace_stmt_array Opt_trace_context::Opt_trace_context_impl::all_stmts_for_I_S |
List of remembered traces for putting into the OPTIMIZER_TRACE table.
Element 0 is the one created first, will be first row of OPTIMIZER_TRACE table. The array structure fulfills those needs:
Opt_trace_stmt_array Opt_trace_context::Opt_trace_context_impl::all_stmts_to_del |
List of traces which are unneeded because of OFFSET/LIMIT, and scheduled for deletion from memory.
Opt_trace_stmt* Opt_trace_context::Opt_trace_context_impl::current_stmt_in_gen |
Trace which is currently being generated, where structures are being added. "in_gen" stands for "in generation", being-generated. In simple cases it is equal to the last element of array all_stmts_for_I_S. But it can be prior to it, for example when calling a stored routine:
CALL statement starts executing create trace of CALL (call it "trace #1") add structure to trace #1 add structure to trace #1 First sub-statement executing create trace of sub-statement (call it "trace #2") add structure to trace #2 add structure to trace #2 First sub-statement ends add structure to trace #1
In the beginning, the CALL statement's trace is the newest and current; when the first sub-statement is executing, that sub-statement's trace is the newest and current; when the first sub-statement ends, it is still the newest but it's not the current anymore: the current is then again the CALL's one, where structures will be added, until a second sub-statement is executed. Another case is when the current statement sends only to DBUG: all_stmts_for_I_S lists only traces shown in OPTIMIZER_TRACE.
bool Opt_trace_context::Opt_trace_context_impl::end_marker |
copy of parameter of Opt_trace_context::start
feature_value Opt_trace_context::Opt_trace_context_impl::features |
long Opt_trace_context::Opt_trace_context_impl::limit |
UnstructuredTrace* Opt_trace_context::Opt_trace_context_impl::m_unstructured_trace {nullptr} |
Trace in plain text, as used by Hypergraph.
size_t Opt_trace_context::Opt_trace_context_impl::max_mem_size |
long Opt_trace_context::Opt_trace_context_impl::offset |
bool Opt_trace_context::Opt_trace_context_impl::one_line |
long Opt_trace_context::Opt_trace_context_impl::since_offset_0 |
Number of statements traced so far since "offset 0", for comparison with OFFSET and LIMIT, when OFFSET >= 0.
Opt_trace_stmt_array Opt_trace_context::Opt_trace_context_impl::stack_of_current_stmts |
To keep track of what is the current statement, as execution goes into a sub-statement, and back to the upper statement, we have a stack of successive values of current_stmt_in_gen: when in a statement we enter a substatement (a new trace), we push the statement's trace on the stack and change current_stmt_in_gen to the substatement's trace; when leaving the substatement we pop from the stack and set current_stmt_in_gen to the popped value.