MySQL 9.0.0
Source Code Documentation
|
Loads to the memory cache database object definitions from dictionary tables. More...
#include "btr0types.h"
#include "dict0types.h"
#include "fil0fil.h"
#include "mem0mem.h"
#include "trx0types.h"
#include "univ.i"
#include "ut0byte.h"
#include "ut0new.h"
#include <deque>
Go to the source code of this file.
Classes | |
struct | space_compare |
Typedefs | |
typedef std::deque< const char *, ut::allocator< const char * > > | dict_names_t |
A stack of table names related through foreign key constraints. More... | |
using | missing_sys_tblsp_t = std::set< fil_space_t *, space_compare > |
Enumerations | |
enum | dict_system_id_t { SYS_TABLES = 0 , SYS_INDEXES , SYS_COLUMNS , SYS_FIELDS , SYS_FOREIGN , SYS_FOREIGN_COLS , SYS_TABLESPACES , SYS_DATAFILES , SYS_VIRTUAL , SYS_NUM_SYSTEM_TABLES } |
enum that defines all system table IDs. More... | |
enum | dict_table_info_t { DICT_TABLE_LOAD_FROM_RECORD = 0 , DICT_TABLE_LOAD_FROM_CACHE = 1 } |
Status bit for dict_process_sys_tables_rec_and_mtr_commit() More... | |
Functions | |
char * | dict_get_first_table_name_in_db (const char *name) |
Finds the first table name in the given database. More... | |
char * | dict_get_first_path (ulint space_id) |
Get the first filepath from SYS_DATAFILES for a given space_id. More... | |
void | dict_get_and_save_data_dir_path (dict_table_t *table, bool dict_mutex_own) |
Make sure the data_dir_path is saved in dict_table_t if DATA DIRECTORY was used. More... | |
void | dict_get_and_save_space_name (dict_table_t *table) |
Make sure the tablespace name is saved in dict_table_t if the table uses a general tablespace. More... | |
dict_table_t * | dict_load_table (const char *name, bool cached, dict_err_ignore_t ignore_err, const std::string *prev_table=nullptr) |
Loads a table definition and also all its index definitions, and also the cluster definition if the table is a member in a cluster. More... | |
void | dict_load_sys_table (dict_table_t *table) |
This function is called when the database is booted. More... | |
dberr_t | dict_load_foreigns (const char *table_name, const char **col_names, bool check_recursive, bool check_charsets, dict_err_ignore_t ignore_err, dict_names_t &fk_tables) |
Loads foreign key constraints where the table is either the foreign key holder or where the table is referenced by a foreign key. More... | |
const rec_t * | dict_startscan_system (btr_pcur_t *pcur, mtr_t *mtr, dict_system_id_t system_id) |
This function opens a system table, and return the first record. More... | |
const rec_t * | dict_getnext_system (btr_pcur_t *pcur, mtr_t *mtr) |
This function get the next system table record as we scan the table. More... | |
const char * | dict_process_sys_tablespaces (mem_heap_t *heap, const rec_t *rec, space_id_t *space, const char **name, uint32_t *flags) |
This function parses a SYS_TABLESPACES record, extracts necessary information from the record and returns to caller. More... | |
void | dict_load_tablespace (dict_table_t *table, dict_err_ignore_t ignore_err) |
Opens a tablespace for dict_load_table_one() More... | |
void | dict_save_data_dir_path (dict_table_t *table, char *filepath) |
Using the table->heap, copy the null-terminated filepath into table->data_dir_path. More... | |
Variables | |
const char * | SYSTEM_TABLE_NAME [] |
Following are the InnoDB system tables. More... | |
missing_sys_tblsp_t | missing_spaces |
bool | has_discarded_tablespaces |
This bool denotes if we found a Table or Partition with discarded Tablespace during load of SYS_TABLES (in dict_check_sys_tables). More... | |
Loads to the memory cache database object definitions from dictionary tables.
Created 4/24/1996 Heikki Tuuri
typedef std::deque<const char *, ut::allocator<const char *> > dict_names_t |
A stack of table names related through foreign key constraints.
using missing_sys_tblsp_t = std::set<fil_space_t *, space_compare> |
enum dict_system_id_t |
enum dict_table_info_t |
void dict_get_and_save_data_dir_path | ( | dict_table_t * | table, |
bool | dict_mutex_own | ||
) |
Make sure the data_dir_path is saved in dict_table_t if DATA DIRECTORY was used.
Try to read it from the fil_system first, then from SYS_DATAFILES.
[in] | table | Table object |
[in] | dict_mutex_own | true if dict_sys->mutex is owned already |
void dict_get_and_save_space_name | ( | dict_table_t * | table | ) |
Make sure the tablespace name is saved in dict_table_t if the table uses a general tablespace.
Try to read it from the fil_system_t first, then from SYS_TABLESPACES.
[in] | table | Table object |
char * dict_get_first_path | ( | ulint | space_id | ) |
Get the first filepath from SYS_DATAFILES for a given space_id.
[in] | space_id | Tablespace ID |
NULL | if no SYS_DATAFILES entry was found. |
char * dict_get_first_table_name_in_db | ( | const char * | name | ) |
Finds the first table name in the given database.
name | in: database name which ends in '/' |
const rec_t * dict_getnext_system | ( | btr_pcur_t * | pcur, |
mtr_t * | mtr | ||
) |
This function get the next system table record as we scan the table.
This function get the next system table record as we scan the table.
pcur | in/out: persistent cursor to the record |
mtr | in: the mini-transaction |
dberr_t dict_load_foreigns | ( | const char * | table_name, |
const char ** | col_names, | ||
bool | check_recursive, | ||
bool | check_charsets, | ||
dict_err_ignore_t | ignore_err, | ||
dict_names_t & | fk_tables | ||
) |
Loads foreign key constraints where the table is either the foreign key holder or where the table is referenced by a foreign key.
Adds these constraints to the data dictionary.
The foreign key constraint is loaded only if the referenced table is also in the dictionary cache. If the referenced table is not in dictionary cache, then it is added to the output parameter (fk_tables).
Adds these constraints to the data dictionary.
The foreign key constraint is loaded only if the referenced table is also in the dictionary cache. If the referenced table is not in dictionary cache, then it is added to the output parameter (fk_tables).
table_name | in: table name |
col_names | in: column names, or NULL to use table->col_names |
check_recursive | in: Whether to check recursive load of tables chained by FK |
check_charsets | in: whether to check charset compatibility |
ignore_err | in: error to be ignored |
fk_tables | out: stack of table names which must be loaded subsequently to load all the foreign key constraints. |
void dict_load_sys_table | ( | dict_table_t * | table | ) |
This function is called when the database is booted.
Loads system table index definitions except for the clustered index which is added to the dictionary cache at booting before calling this function. in: system table
Loads system table index definitions except for the clustered index which is added to the dictionary cache at booting before calling this function.
table | in: system table |
dict_table_t * dict_load_table | ( | const char * | name, |
bool | cached, | ||
dict_err_ignore_t | ignore_err, | ||
const std::string * | prev_table = nullptr |
||
) |
Loads a table definition and also all its index definitions, and also the cluster definition if the table is a member in a cluster.
Also loads all foreign key constraints where the foreign key is in the table or where a foreign key references columns in this table.
[in] | name | Table name in the dbname/tablename format |
[in] | cached | true=add to cache, false=do not |
[in] | ignore_err | Error to be ignored when loading table and its index definition |
[in] | prev_table | previous table name. The current table load is happening because of the load of the previous table name. This parameter is used to check for cyclic calls. |
void dict_load_tablespace | ( | dict_table_t * | table, |
dict_err_ignore_t | ignore_err | ||
) |
Opens a tablespace for dict_load_table_one()
[in,out] | table | A table that refers to the tablespace to open |
[in] | ignore_err | Whether to ignore an error. |
const char * dict_process_sys_tablespaces | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
space_id_t * | space, | ||
const char ** | name, | ||
uint32_t * | flags | ||
) |
This function parses a SYS_TABLESPACES record, extracts necessary information from the record and returns to caller.
heap | in/out: heap memory |
rec | in: current SYS_TABLESPACES rec |
space | out: space id |
name | out: tablespace name |
flags | out: tablespace flags |
void dict_save_data_dir_path | ( | dict_table_t * | table, |
char * | filepath | ||
) |
Using the table->heap, copy the null-terminated filepath into table->data_dir_path.
The data directory path is derived from the filepath by stripping the the table->name.m_name component suffix. If the filepath is not of the correct form (".../db/table.ibd"), then table->data_dir_path will remain nullptr.
[in,out] | table | table instance |
[in] | filepath | filepath of tablespace |
const rec_t * dict_startscan_system | ( | btr_pcur_t * | pcur, |
mtr_t * | mtr, | ||
dict_system_id_t | system_id | ||
) |
This function opens a system table, and return the first record.
This function opens a system table, and return the first record.
pcur | out: persistent cursor to the record |
mtr | in: the mini-transaction |
system_id | in: which system table to open |
|
extern |
This bool denotes if we found a Table or Partition with discarded Tablespace during load of SYS_TABLES (in dict_check_sys_tables).
TODO To be removed in WL#16210
|
extern |
|
extern |
Following are the InnoDB system tables.
The positions in this array are referenced by enum dict_system_table_id.