MySQL 9.0.0
Source Code Documentation
Open_tables_state Class Reference

Class that holds information about tables which were opened and locked by the thread. More...

#include <sql_class.h>

Inheritance diagram for Open_tables_state:
[legend]

Public Types

enum  enum_flags { BACKUPS_AVAIL = (1U << 0) , SYSTEM_TABLES = (1U << 1) }
 

Public Member Functions

Reprepare_observerget_reprepare_observer () const
 
void push_reprepare_observer (Reprepare_observer *o)
 
Reprepare_observerpop_reprepare_observer ()
 
void reset_reprepare_observers ()
 
 Open_tables_state ()
 This constructor initializes Open_tables_state instance which can only be used as backup storage. More...
 
void set_open_tables_state (Open_tables_state *state)
 
void reset_open_tables_state ()
 

Public Attributes

TABLEopen_tables
 List of regular tables in use by this thread. More...
 
TABLEtemporary_tables
 List of temporary tables used by this thread. More...
 
MYSQL_LOCKlock
 
MYSQL_LOCKextra_lock
 
enum enum_locked_tables_mode locked_tables_mode
 
uint state_flags
 

Private Attributes

Prealloced_array< Reprepare_observer *, 4 > m_reprepare_observers
 A stack of Reprepare_observer-instances. More...
 

Detailed Description

Class that holds information about tables which were opened and locked by the thread.

It is also used to save/restore this information in push_open_tables_state()/pop_open_tables_state().

Member Enumeration Documentation

◆ enum_flags

Enumerator
BACKUPS_AVAIL 
SYSTEM_TABLES 

Constructor & Destructor Documentation

◆ Open_tables_state()

Open_tables_state::Open_tables_state ( )
inline

This constructor initializes Open_tables_state instance which can only be used as backup storage.

To prepare Open_tables_state instance for operations which open/lock/close tables (e.g. open_table()) one has to call init_open_tables_state().

Member Function Documentation

◆ get_reprepare_observer()

Reprepare_observer * Open_tables_state::get_reprepare_observer ( ) const
inline

◆ pop_reprepare_observer()

Reprepare_observer * Open_tables_state::pop_reprepare_observer ( )
inline

◆ push_reprepare_observer()

void Open_tables_state::push_reprepare_observer ( Reprepare_observer o)
inline

◆ reset_open_tables_state()

void Open_tables_state::reset_open_tables_state ( )

◆ reset_reprepare_observers()

void Open_tables_state::reset_reprepare_observers ( )
inline

◆ set_open_tables_state()

void Open_tables_state::set_open_tables_state ( Open_tables_state state)

Member Data Documentation

◆ extra_lock

MYSQL_LOCK* Open_tables_state::extra_lock

◆ lock

MYSQL_LOCK* Open_tables_state::lock

◆ locked_tables_mode

enum enum_locked_tables_mode Open_tables_state::locked_tables_mode

◆ m_reprepare_observers

Prealloced_array<Reprepare_observer *, 4> Open_tables_state::m_reprepare_observers
private

A stack of Reprepare_observer-instances.

The top most instance is the currently active one. This stack is used during execution of prepared statements and stored programs in order to detect metadata changes. The locking subsystem reports a metadata change if the top-most item is not NULL.

When Open_tables_state part of THD is reset to open a system or INFORMATION_SCHEMA table, NULL is temporarily pushed to avoid spurious ER_NEED_REPREPARE errors – system and INFORMATION_SCHEMA tables are not subject to metadata version tracking.

A stack is used here for the convenience – in some cases we need to temporarily override/disable current Reprepare_observer-instance.

NOTE: This is not a list of observers, only the top-most element will be notified in case of a metadata change.

See also
check_and_update_table_version()

◆ open_tables

TABLE* Open_tables_state::open_tables

List of regular tables in use by this thread.

Contains persistent base tables that were opened with

See also
open_tables().

◆ state_flags

uint Open_tables_state::state_flags

◆ temporary_tables

TABLE* Open_tables_state::temporary_tables

List of temporary tables used by this thread.

Contains user-level temporary tables, created with CREATE TEMPORARY TABLE, and intermediate tables used in ALTER TABLE implementation.


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