MySQL 5.6.14 Source Code Document
|
#include "dict0load.h"
#include "mysql_version.h"
#include "btr0pcur.h"
#include "btr0btr.h"
#include "page0page.h"
#include "mach0data.h"
#include "dict0dict.h"
#include "dict0boot.h"
#include "dict0stats.h"
#include "rem0cmp.h"
#include "srv0start.h"
#include "srv0srv.h"
#include "dict0crea.h"
#include "dict0priv.h"
#include "ha_prototypes.h"
#include "fts0priv.h"
Go to the source code of this file.
Functions | |
UNIV_INTERN char * | dict_get_first_table_name_in_db (const char *name) |
UNIV_INTERN void | dict_print (void) |
UNIV_INTERN const rec_t * | dict_startscan_system (btr_pcur_t *pcur, mtr_t *mtr, dict_system_id_t system_id) |
UNIV_INTERN const rec_t * | dict_getnext_system (btr_pcur_t *pcur, mtr_t *mtr) |
UNIV_INTERN const char * | dict_process_sys_tables_rec_and_mtr_commit (mem_heap_t *heap, const rec_t *rec, dict_table_t **table, dict_table_info_t status, mtr_t *mtr) |
UNIV_INTERN const char * | dict_process_sys_indexes_rec (mem_heap_t *heap, const rec_t *rec, dict_index_t *index, table_id_t *table_id) |
UNIV_INTERN const char * | dict_process_sys_columns_rec (mem_heap_t *heap, const rec_t *rec, dict_col_t *column, table_id_t *table_id, const char **col_name) |
UNIV_INTERN const char * | dict_process_sys_fields_rec (mem_heap_t *heap, const rec_t *rec, dict_field_t *sys_field, ulint *pos, index_id_t *index_id, index_id_t last_id) |
UNIV_INTERN const char * | dict_process_sys_foreign_rec (mem_heap_t *heap, const rec_t *rec, dict_foreign_t *foreign) |
UNIV_INTERN const char * | dict_process_sys_foreign_col_rec (mem_heap_t *heap, const rec_t *rec, const char **name, const char **for_col_name, const char **ref_col_name, ulint *pos) |
UNIV_INTERN const char * | dict_process_sys_tablespaces (mem_heap_t *heap, const rec_t *rec, ulint *space, const char **name, ulint *flags) |
UNIV_INTERN const char * | dict_process_sys_datafiles (mem_heap_t *heap, const rec_t *rec, ulint *space, const char **path) |
UNIV_INTERN char * | dict_get_first_path (ulint space, const char *name) |
UNIV_INTERN dberr_t | dict_update_filepath (ulint space_id, const char *filepath) |
UNIV_INTERN dberr_t | dict_insert_tablespace_and_filepath (ulint space, const char *name, const char *filepath, ulint fsp_flags) |
UNIV_INTERN void | dict_check_tablespaces_and_store_max_id (dict_check_t dict_check) |
UNIV_INTERN const char * | dict_load_column_low (dict_table_t *table, mem_heap_t *heap, dict_col_t *column, table_id_t *table_id, const char **col_name, const rec_t *rec) |
UNIV_INTERN const char * | dict_load_field_low (byte *index_id, dict_index_t *index, dict_field_t *sys_field, ulint *pos, byte *last_index_id, mem_heap_t *heap, const rec_t *rec) |
UNIV_INTERN const char * | dict_load_index_low (byte *table_id, const char *table_name, mem_heap_t *heap, const rec_t *rec, ibool allocate, dict_index_t **index) |
Variables | |
UNIV_INTERN my_bool | srv_load_corrupted = FALSE |
static mem_heap_t * | heap |
Loads to the memory cache database object definitions from dictionary tables
Created 4/24/1996 Heikki Tuuri
Definition in file dict0load.cc.
UNIV_INTERN void dict_check_tablespaces_and_store_max_id | ( | dict_check_t | dict_check | ) |
This function looks at each table defined in SYS_TABLES. It checks the tablespace for any table with a space_id > 0. It looks up the tablespace in SYS_DATAFILES to ensure the correct path.
In a crash recovery we already have all the tablespace objects created. This function compares the space id information in the InnoDB data dictionary to what we already read with fil_load_single_table_tablespaces().
In a normal startup, we create the tablespace objects for every table in InnoDB's data dictionary, if the corresponding .ibd file exists. We also scan the biggest space id, and store it to fil_system.
dict_check | in: how to check |
Definition at line 961 of file dict0load.cc.
UNIV_INTERN char* dict_get_first_path | ( | ulint | space, |
const char * | name | ||
) |
Gets the filepath for a spaceid from SYS_DATAFILES and checks it against the contents of a link file. This function is called when there is no fil_node_t entry for this space ID so both durable locations on disk must be checked and compared. We use a temporary heap here for the table lookup, but not for the path returned which the caller must free. This function can return NULL if the space ID is not found in SYS_DATAFILES, then the caller will assume that the ibd file is in the normal datadir.
space | in: space id |
name | in: tablespace name |
Definition at line 786 of file dict0load.cc.
UNIV_INTERN 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 '/' |
Definition at line 93 of file dict0load.cc.
UNIV_INTERN const rec_t* dict_getnext_system | ( | btr_pcur_t * | pcur, |
mtr_t * | mtr | ||
) |
This function gets the next system table record as it scans the table.
pcur | in/out: persistent cursor to the record |
mtr | in: the mini-transaction |
Definition at line 298 of file dict0load.cc.
UNIV_INTERN dberr_t dict_insert_tablespace_and_filepath | ( | ulint | space, |
const char * | name, | ||
const char * | filepath, | ||
ulint | fsp_flags | ||
) |
Insert records into SYS_TABLESPACES and SYS_DATAFILES.
space | in: space id |
name | in: talespace name |
filepath | in: filepath |
fsp_flags | in: tablespace flags |
Definition at line 913 of file dict0load.cc.
UNIV_INTERN const char* dict_load_column_low | ( | dict_table_t * | table, |
mem_heap_t * | heap, | ||
dict_col_t * | column, | ||
table_id_t * | table_id, | ||
const char ** | col_name, | ||
const rec_t * | rec | ||
) |
Loads a table column definition from a SYS_COLUMNS record to dict_table_t.
table | in/out: table, could be NULL if we just populate a dict_column_t struct with information from a SYS_COLUMNS record |
heap | in/out: memory heap for temporary storage |
column | out: dict_column_t to fill, or NULL if table != NULL |
table_id | out: table id |
col_name | out: column name |
rec | in: SYS_COLUMNS record |
Definition at line 1175 of file dict0load.cc.
UNIV_INTERN const char* dict_load_field_low | ( | byte * | index_id, |
dict_index_t * | index, | ||
dict_field_t * | sys_field, | ||
ulint * | pos, | ||
byte * | last_index_id, | ||
mem_heap_t * | heap, | ||
const rec_t * | rec | ||
) |
Loads an index field definition from a SYS_FIELDS record to dict_index_t.
index_id | in/out: index id (8 bytes) an "in" value if index != NULL and "out" if index == NULL |
index | in/out: index, could be NULL if we just populate a dict_field_t struct with information from a SYS_FIELDS record |
sys_field | out: dict_field_t to be filled |
pos | out: Field position |
last_index_id | in: last index id |
heap | in/out: memory heap for temporary storage |
rec | in: SYS_FIELDS record |
Definition at line 1425 of file dict0load.cc.
UNIV_INTERN const char* dict_load_index_low | ( | byte * | table_id, |
const char * | table_name, | ||
mem_heap_t * | heap, | ||
const rec_t * | rec, | ||
ibool | allocate, | ||
dict_index_t ** | index | ||
) |
Loads an index definition from a SYS_INDEXES record to dict_index_t. If allocate=TRUE, we will create a dict_index_t structure and fill it accordingly. If allocated=FALSE, the dict_index_t will be supplied by the caller and filled with information read from the record.
table_id | in/out: table id (8 bytes), an "in" value if allocate=TRUE and "out" when allocate=FALSE |
table_name | in: table name |
heap | in/out: temporary memory heap |
rec | in: SYS_INDEXES record |
allocate | in: TRUE=allocate *index, FALSE=fill in a pre-allocated *index |
index | out,own: index, or NULL |
Definition at line 1629 of file dict0load.cc.
UNIV_INTERN void dict_print | ( | void | ) |
Prints to the standard output information on all tables found in the data dictionary system table.
Definition at line 176 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_columns_rec | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
dict_col_t * | column, | ||
table_id_t * | table_id, | ||
const char ** | col_name | ||
) |
This function parses a SYS_COLUMNS record and populate a dict_column_t structure with the information from the record.
heap | in/out: heap memory |
rec | in: current SYS_COLUMNS rec |
column | out: dict_col_t to be filled |
table_id | out: table id |
col_name | out: column name |
Definition at line 407 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_datafiles | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
ulint * | space, | ||
const char ** | path | ||
) |
This function parses a SYS_DATAFILES record, extracts necessary information from the record and returns it to the caller.
heap | in/out: heap memory |
rec | in: current SYS_DATAFILES rec |
space | out: space id |
path | out: datafile paths |
Definition at line 683 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_fields_rec | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
dict_field_t * | sys_field, | ||
ulint * | pos, | ||
index_id_t * | index_id, | ||
index_id_t | last_id | ||
) |
This function parses a SYS_FIELDS record and populates a dict_field_t structure with the information from the record.
heap | in/out: heap memory |
rec | in: current SYS_FIELDS rec |
sys_field | out: dict_field_t to be filled |
pos | out: Field position |
index_id | out: current index id |
last_id | in: previous index id |
Definition at line 430 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_foreign_col_rec | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
const char ** | name, | ||
const char ** | for_col_name, | ||
const char ** | ref_col_name, | ||
ulint * | pos | ||
) |
This function parses a SYS_FOREIGN_COLS record and extract necessary information from the record and return to caller.
heap | in/out: heap memory |
rec | in: current SYS_FOREIGN_COLS rec |
name | out: foreign key constraint name |
for_col_name | out: referencing column name |
ref_col_name | out: referenced column name in referenced table |
pos | out: column position |
Definition at line 546 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_foreign_rec | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
dict_foreign_t * | foreign | ||
) |
This function parses a SYS_FOREIGN record and populate a dict_foreign_t structure with the information from the record. For detail information about SYS_FOREIGN fields, please refer to dict_load_foreign() function.
heap | in/out: heap memory |
rec | in: current SYS_FOREIGN rec |
foreign | out: dict_foreign_t struct to be filled |
Definition at line 465 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_indexes_rec | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
dict_index_t * | index, | ||
table_id_t * | table_id | ||
) |
This function parses a SYS_INDEXES record and populate a dict_index_t structure with the information from the record. For detail information about SYS_INDEXES fields, please refer to dict_boot() function.
heap | in/out: heap memory |
rec | in: current SYS_INDEXES rec |
index | out: index to be filled |
table_id | out: index table id |
Definition at line 380 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_tables_rec_and_mtr_commit | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
dict_table_t ** | table, | ||
dict_table_info_t | status, | ||
mtr_t * | mtr | ||
) |
This function processes one SYS_TABLES record and populate the dict_table_t struct for the table. Extracted out of dict_print() to be used by both monitor table output and information schema innodb_sys_tables output.
heap | in/out: temporary memory heap |
rec | in: SYS_TABLES record |
table | out: dict_table_t to fill |
status | in: status bit controls options such as whether we shall look for dict_table_t from cache first |
mtr | in/out: mini-transaction, will be committed |
Definition at line 322 of file dict0load.cc.
UNIV_INTERN const char* dict_process_sys_tablespaces | ( | mem_heap_t * | heap, |
const rec_t * | rec, | ||
ulint * | space, | ||
const char ** | name, | ||
ulint * | 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 |
Definition at line 616 of file dict0load.cc.
UNIV_INTERN 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 returns the first record.
pcur | out: persistent cursor to the record |
mtr | in: the mini-transaction |
system_id | in: which system table to open |
Definition at line 268 of file dict0load.cc.
UNIV_INTERN dberr_t dict_update_filepath | ( | ulint | space_id, |
const char * | filepath | ||
) |
Update the record for space_id in SYS_TABLESPACES to this filepath.
space_id | in: space id |
filepath | in: filepath |
Definition at line 856 of file dict0load.cc.
mem_heap_t* heap |
< in/out: table in: memory heap for temporary storage
Definition at line 1766 of file dict0load.cc.