MySQL 8.0.40
Source Code Documentation
dict0dd.ic File Reference

Data dictionary access. More...

#include "sql_table.h"
#include "dict0crea.h"
#include "dict0priv.h"
#include "field.h"
#include "sql/table.h"
#include "sql_base.h"

Functions

dd::Object_id dd_get_space_id (const dd::Partition &partition)
 Get the explicit dd::Tablespace::id of a partition. More...
 
const dd::Columndd_find_column (const dd::Table *dd_table, const char *name)
 Look up a column in a table using the system_charset_info collation. More...
 
dd::Columndd_add_hidden_column (dd::Table *dd_table, const char *name, uint length, dd::enum_column_types type)
 Add a hidden column when creating a table. More...
 
bool dd_drop_hidden_column (dd::Table *dd_table, const char *name)
 
void dd_add_hidden_element (dd::Index *index, const dd::Column *column)
 Add a hidden index element at the end. More...
 
dd::Indexdd_set_hidden_unique_index (dd::Index *index, const char *name, const dd::Column *column)
 Initialize a hidden unique B-tree index. More...
 
dict_table_tdd_table_open_on_id_in_mem (table_id_t table_id, bool dict_locked)
 Returns a cached table object based on table id. More...
 
dict_table_tdd_table_open_on_name_in_mem (const char *name, bool dict_locked)
 Returns a cached table object based on table name. More...
 
bool create_table_check_doc_id_col (THD *thd, const TABLE *form, ulint *doc_id_col)
 Check whether there exist a column named as "FTS_DOC_ID", which is reserved for InnoDB FTS Doc ID. More...
 
const char * get_row_format_name (enum row_type row_format)
 Return a display name for the row format. More...
 
static bool dd_mdl_acquire (THD *thd, MDL_ticket **mdl, const char *db, const char *table)
 Acquire a shared metadata lock. More...
 
uint64_t dd_get_version (const dd::Table *dd_table)
 Get the version attribute. More...
 

Detailed Description

Data dictionary access.

Created 10/2016 Jimmy Yamg

Function Documentation

◆ create_table_check_doc_id_col()

bool create_table_check_doc_id_col ( THD thd,
const TABLE form,
ulint doc_id_col 
)
inline

Check whether there exist a column named as "FTS_DOC_ID", which is reserved for InnoDB FTS Doc ID.

Parameters
[in]thdMySQL thread handle
[in]forminformation on table columns and indexes
[out]doc_id_colDoc ID column number if there exist a FTS_DOC_ID column, ULINT_UNDEFINED if column is of the wrong type/name/size
Returns
true if there exist a "FTS_DOC_ID" column

◆ dd_add_hidden_column()

dd::Column * dd_add_hidden_column ( dd::Table dd_table,
const char *  name,
uint  length,
dd::enum_column_types  type 
)
inline

Add a hidden column when creating a table.

Parameters
[in,out]dd_tabletable containing user columns and indexes
[in]namehidden column name
[in]lengthlength of the column, in bytes
[in]typecolumn type
Returns
the added column, or NULL if there already was a column by that name

◆ dd_add_hidden_element()

void dd_add_hidden_element ( dd::Index index,
const dd::Column column 
)
inline

Add a hidden index element at the end.

Parameters
[in,out]indexcreated index metadata
[in]columncolumn of the index

◆ dd_drop_hidden_column()

bool dd_drop_hidden_column ( dd::Table dd_table,
const char *  name 
)
inline

◆ dd_find_column()

const dd::Column * dd_find_column ( const dd::Table dd_table,
const char *  name 
)
inline

Look up a column in a table using the system_charset_info collation.

Parameters
[in]dd_tabledata dictionary table
[in]namecolumn name
Returns
the column
Return values
nullptrif not found

◆ dd_get_space_id()

dd::Object_id dd_get_space_id ( const dd::Partition partition)
inline

Get the explicit dd::Tablespace::id of a partition.

Parameters
[in]partitionpartition or subpartition
Returns
the explicit dd::Tablespace::id
Return values
dd::INVALID_OBJECT_IDif there is no explicit tablespace

◆ dd_get_version()

uint64_t dd_get_version ( const dd::Table dd_table)
inline

Get the version attribute.

Parameters
[in]dd_tabledd::Table
Returns
table dynamic metadata version if exists, otherwise 0

◆ dd_mdl_acquire()

static bool dd_mdl_acquire ( THD thd,
MDL_ticket **  mdl,
const char *  db,
const char *  table 
)
inlinestatic

Acquire a shared metadata lock.

Parameters
[in,out]thdcurrent thread
[out]mdlmetadata lock
[in]dbschema name
[in]tabletable name
Return values
falseif acquired
trueif failed (my_error() will have been called)

◆ dd_set_hidden_unique_index()

dd::Index * dd_set_hidden_unique_index ( dd::Index index,
const char *  name,
const dd::Column column 
)
inline

Initialize a hidden unique B-tree index.

Parameters
[in,out]indexcreated index metadata
[in]namename of the index
[in]columncolumn of the index
Returns
the initialized index

◆ dd_table_open_on_id_in_mem()

dict_table_t * dd_table_open_on_id_in_mem ( table_id_t  table_id,
bool  dict_locked 
)
inline

Returns a cached table object based on table id.

This function does NOT move the table to the front of MRU, because currently it is called in contexts where we don't really mean to "use" the table, and believe that it would actually hurt performance if we moved it to the front, such as:

  1. The table would be evicted soon anyway.
  2. A batch of FTS tables would be opened from background thread, and it is not proper to move these tables to mru.
  3. All tables in memory will be accessed sequentially, so it is useless to move.
    Parameters
    [in]table_idtable id
    [in]dict_lockedtrue=data dictionary locked
    Returns
    table, NULL if does not exist

◆ dd_table_open_on_name_in_mem()

dict_table_t * dd_table_open_on_name_in_mem ( const char *  name,
bool  dict_locked 
)
inline

Returns a cached table object based on table name.

Parameters
[in]nametable name
[in]dict_lockedtrue=data dictionary locked
Returns
table, NULL if does not exist

◆ get_row_format_name()

const char * get_row_format_name ( enum row_type  row_format)
inline

Return a display name for the row format.

Parameters
[in]row_formatRow Format
Returns
row format name