MySQL 9.1.0
Source Code Documentation
sql_handler.cc File Reference
#include "sql/sql_handler.h"
#include <limits.h>
#include <string.h>
#include <sys/types.h>
#include <memory>
#include <new>
#include <unordered_map>
#include <utility>
#include "lex_string.h"
#include "m_string.h"
#include "map_helpers.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_pointer_arithmetic.h"
#include "my_sys.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/my_loglevel.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld_error.h"
#include "nulls.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/dd/types/abstract_table.h"
#include "sql/error_handler.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/key.h"
#include "sql/lock.h"
#include "sql/mdl.h"
#include "sql/protocol.h"
#include "sql/psi_memory_key.h"
#include "sql/sql_audit.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thd_raii.h"
#include "sql/transaction.h"
#include "sql/transaction_info.h"
#include "sql/xa.h"
#include "sql_string.h"
#include "typelib.h"

Macros

#define HANDLER_TABLES_HASH_SIZE   120
 

Functions

static bool mysql_ha_open_table (THD *thd, Table_ref *hash_tables)
 Auxiliary function which opens or re-opens table for HANDLER statements. More...
 
static void mysql_ha_close_table (THD *thd, Table_ref *tables)
 Close a HANDLER table. More...
 
static Table_refmysql_ha_find (THD *thd, Table_ref *tables)
 Scan the handler tables hash for matching tables. More...
 
void mysql_ha_rm_tables (THD *thd, Table_ref *tables)
 Remove matching tables from the HANDLER's hash table. More...
 
void mysql_ha_flush_tables (THD *thd, Table_ref *all_tables)
 Close cursors of matching tables from the HANDLER's hash table. More...
 
void mysql_ha_flush_table (THD *thd, const char *db_name, const char *table_name)
 Close cursors on the table from the HANDLER's hash. More...
 
void mysql_ha_flush (THD *thd)
 Flush (close and mark for re-open) all tables that should be should be reopen. More...
 
void mysql_ha_rm_temporary_tables (THD *thd)
 Remove temporary tables from the HANDLER's hash table. More...
 
void mysql_ha_cleanup (THD *thd)
 Close all HANDLER's tables. More...
 
void mysql_ha_set_explicit_lock_duration (THD *thd)
 Set explicit duration for metadata locks corresponding to open HANDLERs to protect them from being released at the end of transaction. More...
 

Variables

static enum_ha_read_modes rkey_to_rnext []
 

Macro Definition Documentation

◆ HANDLER_TABLES_HASH_SIZE

#define HANDLER_TABLES_HASH_SIZE   120

Function Documentation

◆ mysql_ha_cleanup()

void mysql_ha_cleanup ( THD thd)

Close all HANDLER's tables.

Parameters
thdThread identifier.
Note
Broadcasts refresh if it closed a table with old version.

◆ mysql_ha_close_table()

static void mysql_ha_close_table ( THD thd,
Table_ref tables 
)
static

Close a HANDLER table.

Parameters
thdThread identifier.
tablesA list of tables with the first entry to close.
Note
Though this function takes a list of tables, only the first list entry will be closed.
Broadcasts refresh if it closed a table with old version.

◆ mysql_ha_find()

static Table_ref * mysql_ha_find ( THD thd,
Table_ref tables 
)
static

Scan the handler tables hash for matching tables.

Parameters
thdThread identifier.
tablesThe list of tables to remove.
Returns
Pointer to head of linked list (Table_ref::next_local) of matching Table_ref elements from handler_tables_hash. Otherwise, NULL if no table was matched.

◆ mysql_ha_flush()

void mysql_ha_flush ( THD thd)

Flush (close and mark for re-open) all tables that should be should be reopen.

Parameters
thdThread identifier.
Note
Broadcasts refresh if it closed a table with old version.

◆ mysql_ha_flush_table()

void mysql_ha_flush_table ( THD thd,
const char *  db_name,
const char *  table_name 
)

Close cursors on the table from the HANDLER's hash.

Parameters
thdThread context.
db_nameDatabase name for the table.
table_nameTable name.

◆ mysql_ha_flush_tables()

void mysql_ha_flush_tables ( THD thd,
Table_ref all_tables 
)

Close cursors of matching tables from the HANDLER's hash table.

Parameters
thdThread identifier.
all_tablesThe list of tables to flush.

◆ mysql_ha_open_table()

static bool mysql_ha_open_table ( THD thd,
Table_ref hash_tables 
)
static

Auxiliary function which opens or re-opens table for HANDLER statements.

Parameters
thdThread context..
hash_tablesTable list element for table to open.
Return values
false- Success.
true- Failure.

◆ mysql_ha_rm_tables()

void mysql_ha_rm_tables ( THD thd,
Table_ref tables 
)

Remove matching tables from the HANDLER's hash table.

Parameters
thdThread identifier.
tablesThe list of tables to remove.
Note
Broadcasts refresh if it closed a table with old version.

◆ mysql_ha_rm_temporary_tables()

void mysql_ha_rm_temporary_tables ( THD thd)

Remove temporary tables from the HANDLER's hash table.

The reason for having a separate function, rather than calling mysql_ha_rm_tables() is that it is not always feasible (e.g. in close_temporary_tables) to obtain a Table_ref containing the temporary tables.

See also
close_temporary_tables
Parameters
thdThread identifier.

◆ mysql_ha_set_explicit_lock_duration()

void mysql_ha_set_explicit_lock_duration ( THD thd)

Set explicit duration for metadata locks corresponding to open HANDLERs to protect them from being released at the end of transaction.

Parameters
thdThread identifier.

Variable Documentation

◆ rkey_to_rnext