MySQL 9.1.0
Source Code Documentation
Opt_trace_context::Opt_trace_context_impl Class Reference

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_stmtcurrent_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...
 
UnstructuredTracem_unstructured_trace {nullptr}
 Trace in plain text, as used by Hypergraph. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Opt_trace_context_impl()

Opt_trace_context::Opt_trace_context_impl::Opt_trace_context_impl ( )
inline

Member Function Documentation

◆ disable_I_S_for_this_and_children()

void Opt_trace_context::Opt_trace_context_impl::disable_I_S_for_this_and_children ( )

◆ restore_I_S()

void Opt_trace_context::Opt_trace_context_impl::restore_I_S ( )

Member Data Documentation

◆ all_stmts_for_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:

  • to output traces "oldest first" in OPTIMIZER_TRACE
  • to preserve traces "newest first" when @@optimizer_trace_offset<0
  • to delete a trace in the middle of the list when it is permanently out of the offset/limit showable window.

◆ all_stmts_to_del

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.

◆ current_stmt_in_gen

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.

◆ end_marker

bool Opt_trace_context::Opt_trace_context_impl::end_marker

copy of parameter of Opt_trace_context::start

◆ features

feature_value Opt_trace_context::Opt_trace_context_impl::features

◆ limit

long Opt_trace_context::Opt_trace_context_impl::limit

◆ m_unstructured_trace

UnstructuredTrace* Opt_trace_context::Opt_trace_context_impl::m_unstructured_trace {nullptr}

Trace in plain text, as used by Hypergraph.

◆ max_mem_size

size_t Opt_trace_context::Opt_trace_context_impl::max_mem_size

◆ offset

long Opt_trace_context::Opt_trace_context_impl::offset

◆ one_line

bool Opt_trace_context::Opt_trace_context_impl::one_line

◆ since_offset_0

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.

◆ stack_of_current_stmts

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.


The documentation for this class was generated from the following files: