MySQL 5.6.14 Source Code Document
|
#include "dict0dict.h"
#include "fts0fts.h"
#include "fil0fil.h"
#include "buf0buf.h"
#include "data0type.h"
#include "mach0data.h"
#include "dict0boot.h"
#include "dict0mem.h"
#include "dict0crea.h"
#include "dict0stats.h"
#include "trx0undo.h"
#include "btr0btr.h"
#include "btr0cur.h"
#include "btr0sea.h"
#include "page0zip.h"
#include "page0page.h"
#include "pars0pars.h"
#include "pars0sym.h"
#include "que0que.h"
#include "rem0cmp.h"
#include "fts0types.h"
#include "m_ctype.h"
#include "ha_prototypes.h"
#include "srv0mon.h"
#include "srv0start.h"
#include "lock0lock.h"
#include "dict0priv.h"
#include "row0upd.h"
#include "row0mysql.h"
#include "row0merge.h"
#include "row0log.h"
#include "ut0ut.h"
#include "m_string.h"
#include "my_sys.h"
#include "mysqld.h"
#include "strfunc.h"
#include <ctype.h>
Go to the source code of this file.
Macros | |
#define | DICT_HEAP_SIZE 100 |
#define | DICT_POOL_PER_TABLE_HASH 512 |
#define | DICT_POOL_PER_VARYING 4 |
#define | DICT_TABLE_STATS_LATCHES_SIZE 64 |
#define | GET_TABLE_STATS_LATCH(table) |
#define | BIG_ROW_SIZE 1024 |
Functions | |
UNIV_INTERN void | dict_casedn_str (char *a) |
UNIV_INTERN ibool | dict_tables_have_same_db (const char *name1, const char *name2) |
UNIV_INTERN const char * | dict_remove_db_name (const char *name) |
UNIV_INTERN ulint | dict_get_db_name_len (const char *name) |
UNIV_INTERN void | dict_mutex_enter_for_mysql (void) |
UNIV_INTERN void | dict_mutex_exit_for_mysql (void) |
UNIV_INTERN void | dict_table_stats_lock (const dict_table_t *table, ulint latch_mode) |
UNIV_INTERN void | dict_table_stats_unlock (const dict_table_t *table, ulint latch_mode) |
UNIV_INTERN void | dict_table_close (dict_table_t *table, ibool dict_locked, ibool try_drop) |
UNIV_INTERN const char * | dict_table_get_col_name (const dict_table_t *table, ulint col_nr) |
UNIV_INTERN void | dict_table_autoinc_lock (dict_table_t *table) |
UNIV_INTERN void | dict_table_autoinc_initialize (dict_table_t *table, ib_uint64_t value) |
UNIV_INTERN ulint | dict_table_get_all_fts_indexes (dict_table_t *table, ib_vector_t *indexes) |
UNIV_INTERN ib_uint64_t | dict_table_autoinc_read (const dict_table_t *table) |
UNIV_INTERN void | dict_table_autoinc_update_if_greater (dict_table_t *table, ib_uint64_t value) |
UNIV_INTERN void | dict_table_autoinc_unlock (dict_table_t *table) |
UNIV_INTERN ulint | dict_index_get_nth_col_or_prefix_pos (const dict_index_t *index, ulint n, ibool inc_prefix) |
UNIV_INTERN ibool | dict_index_contains_col_or_prefix (const dict_index_t *index, ulint n) |
UNIV_INTERN ulint | dict_index_get_nth_field_pos (const dict_index_t *index, const dict_index_t *index2, ulint n) |
UNIV_INTERN dict_table_t * | dict_table_open_on_id (table_id_t table_id, ibool dict_locked, dict_table_op_t table_op) |
UNIV_INTERN ulint | dict_table_get_nth_col_pos (const dict_table_t *table, ulint n) |
UNIV_INTERN ibool | dict_table_col_in_clustered_key (const dict_table_t *table, ulint n) |
UNIV_INTERN void | dict_init (void) |
UNIV_INTERN void | dict_move_to_mru (dict_table_t *table) |
UNIV_INTERN dict_table_t * | dict_table_open_on_name (const char *table_name, ibool dict_locked, ibool try_drop, dict_err_ignore_t ignore_err) |
UNIV_INTERN void | dict_table_add_system_columns (dict_table_t *table, mem_heap_t *heap) |
UNIV_INTERN void | dict_table_add_to_cache (dict_table_t *table, ibool can_be_evicted, mem_heap_t *heap) |
UNIV_INTERN ulint | dict_make_room_in_cache (ulint max_tables, ulint pct_check) |
UNIV_INTERN void | dict_table_move_from_lru_to_non_lru (dict_table_t *table) |
UNIV_INTERN void | dict_table_move_from_non_lru_to_lru (dict_table_t *table) |
UNIV_INTERN dict_index_t * | dict_index_find_on_id_low (index_id_t id) |
UNIV_INTERN dberr_t | dict_table_rename_in_cache (dict_table_t *table, const char *new_name, ibool rename_also_foreigns) |
UNIV_INTERN void | dict_table_change_id_in_cache (dict_table_t *table, table_id_t new_id) |
UNIV_INTERN void | dict_table_remove_from_cache (dict_table_t *table) |
UNIV_INTERN ibool | dict_col_name_is_reserved (const char *name) |
UNIV_INTERN dberr_t | dict_index_add_to_cache (dict_table_t *table, dict_index_t *index, ulint page_no, ibool strict) |
UNIV_INTERN void | dict_index_remove_from_cache (dict_table_t *table, dict_index_t *index) |
UNIV_INTERN void | dict_index_add_col (dict_index_t *index, const dict_table_t *table, dict_col_t *col, ulint prefix_len) |
UNIV_INTERN void | dict_index_copy_types (dtuple_t *tuple, const dict_index_t *index, ulint n_fields) |
UNIV_INTERN void | dict_table_copy_types (dtuple_t *tuple, const dict_table_t *table) |
UNIV_INTERN void | dict_table_wait_for_bg_threads_to_exit (dict_table_t *table, ulint delay) |
UNIV_INTERN ibool | dict_table_is_referenced_by_foreign_key (const dict_table_t *table) |
UNIV_INTERN dict_foreign_t * | dict_table_get_referenced_constraint (dict_table_t *table, dict_index_t *index) |
UNIV_INTERN dict_foreign_t * | dict_table_get_foreign_constraint (dict_table_t *table, dict_index_t *index) |
UNIV_INTERN void | dict_foreign_free (dict_foreign_t *foreign) |
UNIV_INTERN void | dict_foreign_remove_from_cache (dict_foreign_t *foreign) |
UNIV_INTERN dict_index_t * | dict_foreign_find_index (const dict_table_t *table, const char **col_names, const char **columns, ulint n_cols, const dict_index_t *types_idx, bool check_charsets, ulint check_null) |
UNIV_INTERN dberr_t | dict_foreign_add_to_cache (dict_foreign_t *foreign, const char **col_names, bool check_charsets, dict_err_ignore_t ignore_err) |
UNIV_INTERN char * | dict_get_referenced_table (const char *name, const char *database_name, ulint database_name_len, const char *table_name, ulint table_name_len, dict_table_t **table, mem_heap_t *heap) |
UNIV_INTERN ulint | dict_table_get_highest_foreign_id (dict_table_t *table) |
UNIV_INTERN ibool | dict_str_starts_with_keyword (THD *thd, const char *str, const char *keyword) |
UNIV_INTERN dberr_t | dict_create_foreign_constraints (trx_t *trx, const char *sql_string, size_t sql_length, const char *name, ibool reject_fks) |
UNIV_INTERN dberr_t | dict_foreign_parse_drop_constraints (mem_heap_t *heap, trx_t *trx, dict_table_t *table, ulint *n, const char ***constraints_to_drop) |
UNIV_INTERN dict_index_t * | dict_index_get_if_in_cache_low (index_id_t index_id) |
UNIV_INTERN dtuple_t * | dict_index_build_node_ptr (const dict_index_t *index, const rec_t *rec, ulint page_no, mem_heap_t *heap, ulint level) |
UNIV_INTERN rec_t * | dict_index_copy_rec_order_prefix (const dict_index_t *index, const rec_t *rec, ulint *n_fields, byte **buf, ulint *buf_size) |
UNIV_INTERN dtuple_t * | dict_index_build_data_tuple (dict_index_t *index, rec_t *rec, ulint n_fields, mem_heap_t *heap) |
UNIV_INTERN ulint | dict_index_calc_min_rec_len (const dict_index_t *index) |
UNIV_INTERN void | dict_table_print (dict_table_t *table) |
UNIV_INTERN void | dict_print_info_on_foreign_key_in_create_format (FILE *file, trx_t *trx, dict_foreign_t *foreign, ibool add_newline) |
UNIV_INTERN void | dict_print_info_on_foreign_keys (ibool create_table_format, FILE *file, trx_t *trx, dict_table_t *table) |
UNIV_INTERN void | dict_index_name_print (FILE *file, const trx_t *trx, const dict_index_t *index) |
UNIV_INTERN ibool | dict_set_corrupted_by_space (ulint space_id) |
UNIV_INTERN void | dict_set_corrupted (dict_index_t *index, trx_t *trx, const char *ctx) |
UNIV_INTERN void | dict_set_corrupted_index_cache_only (dict_index_t *index, dict_table_t *table) |
UNIV_INTERN void | dict_ind_init (void) |
UNIV_INTERN dict_index_t * | dict_table_get_index_on_name (dict_table_t *table, const char *name) |
UNIV_INTERN bool | dict_foreign_replace_index (dict_table_t *table, const char **col_names, const dict_index_t *index) |
UNIV_INTERN dict_index_t * | dict_table_get_index_on_name_and_min_id (dict_table_t *table, const char *name) |
UNIV_INTERN void | dict_fs2utf8 (const char *db_and_table, char *db_utf8, size_t db_utf8_size, char *table_utf8, size_t table_utf8_size) |
UNIV_INTERN void | dict_close (void) |
UNIV_INTERN bool | dict_foreign_qualify_index (const dict_table_t *table, const char **col_names, const char **columns, ulint n_cols, const dict_index_t *index, const dict_index_t *types_idx, bool check_charsets, ulint check_null) |
UNIV_INTERN void | dict_index_zip_success (dict_index_t *index) |
UNIV_INTERN void | dict_index_zip_failure (dict_index_t *index) |
UNIV_INTERN ulint | dict_index_zip_pad_optimal_page_size (dict_index_t *index) |
UNIV_INTERN const char * | dict_tf_to_row_format_string (ulint table_flag) |
UNIV_INTERN dberr_t | dict_table_schema_check (dict_table_schema_t *req_schema, char *errstr, size_t errstr_sz) |
Variables | |
UNIV_INTERN dict_index_t * | dict_ind_redundant |
UNIV_INTERN dict_index_t * | dict_ind_compact |
UNIV_INTERN dict_sys_t * | dict_sys = NULL |
UNIV_INTERN rw_lock_t | dict_operation_lock |
the data dictionary rw-latch protecting dict_sys | |
UNIV_INTERN ulong | zip_failure_threshold_pct = 5 |
UNIV_INTERN ulong | zip_pad_max = 50 |
UNIV_INTERN FILE * | dict_foreign_err_file = NULL |
UNIV_INTERN ib_mutex_t | dict_foreign_err_mutex |
#define DICT_HEAP_SIZE 100 |
initial memory heap size when creating a table or index object
Definition at line 114 of file dict0dict.cc.
#define DICT_POOL_PER_TABLE_HASH 512 |
buffer pool max size per table hash table fixed size in bytes
Definition at line 116 of file dict0dict.cc.
#define DICT_POOL_PER_VARYING 4 |
buffer pool max size per data dictionary varying size in bytes
Definition at line 118 of file dict0dict.cc.
#define DICT_TABLE_STATS_LATCHES_SIZE 64 |
array of rw locks protecting
dict_table_t::stat_initialized dict_table_t::stat_n_rows (*) dict_table_t::stat_clustered_index_size dict_table_t::stat_sum_of_other_index_sizes dict_table_t::stat_modified_counter (*) dict_table_t::indexes*::stat_n_diff_key_vals[] dict_table_t::indexes*::stat_index_size dict_table_t::indexes*::stat_n_leaf_pages (*) those are not always protected for performance reasons
Definition at line 134 of file dict0dict.cc.
#define GET_TABLE_STATS_LATCH | ( | table | ) |
Get the latch that protects the stats of a given table
Definition at line 336 of file dict0dict.cc.
UNIV_INTERN void dict_casedn_str | ( | char * | a | ) |
Makes all characters in a NUL-terminated UTF-8 string lower case.
a | in/out: string to put in lower case |
Definition at line 255 of file dict0dict.cc.
UNIV_INTERN void dict_close | ( | void | ) |
Closes the data dictionary module.
Definition at line 6200 of file dict0dict.cc.
UNIV_INTERN ibool dict_col_name_is_reserved | ( | const char * | name | ) |
If the given column name is reserved for InnoDB system columns, return TRUE.
name | in: column name |
Definition at line 1928 of file dict0dict.cc.
UNIV_INTERN dberr_t dict_create_foreign_constraints | ( | trx_t * | trx, |
const char * | sql_string, | ||
size_t | sql_length, | ||
const char * | name, | ||
ibool | reject_fks | ||
) |
Scans a table create SQL string and adds to the data dictionary the foreign key constraints declared in the string. This function should be called after the indexes for a table have been created. Each foreign key constraint must be accompanied with indexes in both participating tables. The indexes are allowed to contain more fields than mentioned in the constraint.
trx | in: transaction |
sql_string | in: table create statement where foreign keys are declared like: FOREIGN KEY (a, b) REFERENCES table2(c, d), table2 can be written also with the database name before it: test.table2; the default database id the database of parameter name |
sql_length | in: length of sql_string |
name | in: table full name in the normalized form database_name/table_name |
reject_fks | in: if TRUE, fail with error code DB_CANNOT_ADD_CONSTRAINT if any foreign keys are found. |
Definition at line 4665 of file dict0dict.cc.
UNIV_INTERN dberr_t dict_foreign_add_to_cache | ( | dict_foreign_t * | foreign, |
const char ** | col_names, | ||
bool | check_charsets, | ||
dict_err_ignore_t | ignore_err | ||
) |
Adds a foreign key constraint object to the dictionary cache. May free the object if there already is an object with the same identifier in. At least one of the foreign table and the referenced table must already be in the dictionary cache!
foreign | in, own: foreign key constraint |
col_names | in: column names, or NULL to use foreign->foreign_table->col_names |
check_charsets | in: whether to check charset compatibility |
ignore_err | in: error to be ignored |
Definition at line 3304 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_foreign_find_index | ( | const dict_table_t * | table, |
const char ** | col_names, | ||
const char ** | columns, | ||
ulint | n_cols, | ||
const dict_index_t * | types_idx, | ||
bool | check_charsets, | ||
ulint | check_null | ||
) |
Tries to find an index whose first fields are the columns in the array, in the same order and is not marked for deletion and is not the same as types_idx.
table | in: table |
col_names | in: column names, or NULL to use table->col_names |
columns | in: array of column names |
n_cols | in: number of columns |
types_idx | in: NULL or an index whose types the column types must match |
check_charsets | in: whether to check charsets. only has an effect if types_idx != NULL |
check_null | in: nonzero if none of the columns must be declared NOT NULL |
Definition at line 3210 of file dict0dict.cc.
UNIV_INTERN void dict_foreign_free | ( | dict_foreign_t * | foreign | ) |
Frees a foreign key struct.
foreign | in, own: foreign key struct |
Definition at line 3129 of file dict0dict.cc.
UNIV_INTERN dberr_t dict_foreign_parse_drop_constraints | ( | mem_heap_t * | heap, |
trx_t * | trx, | ||
dict_table_t * | table, | ||
ulint * | n, | ||
const char *** | constraints_to_drop | ||
) |
Parses the CONSTRAINT id's to be dropped in an ALTER TABLE statement.
heap | in: heap from which we can allocate memory |
trx | in: transaction |
table | in: table |
n | out: number of constraints to drop |
constraints_to_drop | out: id's of the constraints to drop |
Definition at line 4710 of file dict0dict.cc.
UNIV_INTERN bool dict_foreign_qualify_index | ( | const dict_table_t * | table, |
const char ** | col_names, | ||
const char ** | columns, | ||
ulint | n_cols, | ||
const dict_index_t * | index, | ||
const dict_index_t * | types_idx, | ||
bool | check_charsets, | ||
ulint | check_null | ||
) |
Check an index to see whether its first fields are the columns in the array, in the same order and is not marked for deletion and is not the same as types_idx.
table | in: table |
col_names | in: column names, or NULL to use table->col_names |
columns | in: array of column names |
n_cols | in: number of columns |
index | in: index to check |
types_idx | in: NULL or an index whose types the column types must match |
check_charsets | in: whether to check charsets. only has an effect if types_idx != NULL |
check_null | in: nonzero if none of the columns must be declared NOT NULL |
Definition at line 6348 of file dict0dict.cc.
UNIV_INTERN void dict_foreign_remove_from_cache | ( | dict_foreign_t * | foreign | ) |
Removes a foreign constraint struct from the dictionary cache.
foreign | in, own: foreign constraint |
Definition at line 3140 of file dict0dict.cc.
UNIV_INTERN bool dict_foreign_replace_index | ( | dict_table_t * | table, |
const char ** | col_names, | ||
const dict_index_t * | index | ||
) |
Replace the index passed in with another equivalent index in the foreign key lists of the table.
table | in/out: table |
col_names | in: column names, or NULL to use table->col_names |
index | in: index to be replaced |
Definition at line 5777 of file dict0dict.cc.
UNIV_INTERN void dict_fs2utf8 | ( | const char * | db_and_table, |
char * | db_utf8, | ||
size_t | db_utf8_size, | ||
char * | table_utf8, | ||
size_t | table_utf8_size | ||
) |
Converts a database and table name from filesystem encoding (e.g. d/a@1Kc, same format as used in dict_table_t::name) in two strings in UTF8 encoding (e.g. dцb and aюbØc). The output buffers must be at least MAX_DB_UTF8_LEN and MAX_TABLE_UTF8_LEN bytes.
db_and_table | in: database and table names, e.g. d/a@1Kc |
db_utf8 | out: database name, e.g. dцb |
db_utf8_size | in: dbname_utf8 size |
table_utf8 | out: table name, e.g. aюbØc |
table_utf8_size | in: table_utf8 size |
Definition at line 6138 of file dict0dict.cc.
UNIV_INTERN ulint dict_get_db_name_len | ( | const char * | name | ) |
Get the database name length in a table name.
name | in: table name in the form dbname '/' tablename |
Definition at line 304 of file dict0dict.cc.
UNIV_INTERN char* dict_get_referenced_table | ( | const char * | name, |
const char * | database_name, | ||
ulint | database_name_len, | ||
const char * | table_name, | ||
ulint | table_name_len, | ||
dict_table_t ** | table, | ||
mem_heap_t * | heap | ||
) |
Open a table from its database and table name, this is currently used by foreign constraint parser to get the referenced table.
name | in: foreign key table name |
database_name | in: table db name |
database_name_len | in: db name length |
table_name | in: table name |
table_name_len | in: table name length |
table | out: table object or NULL |
heap | in/out: heap memory |
Definition at line 3715 of file dict0dict.cc.
UNIV_INTERN void dict_ind_init | ( | void | ) |
Inits dict_ind_redundant and dict_ind_compact.
Definition at line 5687 of file dict0dict.cc.
UNIV_INTERN void dict_index_add_col | ( | dict_index_t * | index, |
const dict_table_t * | table, | ||
dict_col_t * | col, | ||
ulint | prefix_len | ||
) |
Adds a column to index.
index | in/out: index |
table | in: table |
col | in: column |
prefix_len | in: column prefix length |
Definition at line 2595 of file dict0dict.cc.
UNIV_INTERN dberr_t dict_index_add_to_cache | ( | dict_table_t * | table, |
dict_index_t * | index, | ||
ulint | page_no, | ||
ibool | strict | ||
) |
Adds an index to the dictionary cache.
table | in: table on which the index is |
index | in, own: index; NOTE! The index memory object is freed in this function! |
page_no | in: root page number of the index |
strict | in: TRUE=refuse to create the index if records could be too big to fit in an B-tree page |
Definition at line 2262 of file dict0dict.cc.
UNIV_INTERN dtuple_t* dict_index_build_data_tuple | ( | dict_index_t * | index, |
rec_t * | rec, | ||
ulint | n_fields, | ||
mem_heap_t * | heap | ||
) |
Builds a typed data tuple out of a physical record.
index | in: index tree |
rec | in: record for which to build data tuple |
n_fields | in: number of data fields |
heap | in: memory heap where tuple created |
Definition at line 5019 of file dict0dict.cc.
UNIV_INTERN dtuple_t* dict_index_build_node_ptr | ( | const dict_index_t * | index, |
const rec_t * | rec, | ||
ulint | page_no, | ||
mem_heap_t * | heap, | ||
ulint | level | ||
) |
Builds a node pointer out of a physical record and a page number.
index | in: index |
rec | in: record for which to build node pointer |
page_no | in: page number to put in node pointer |
heap | in: memory heap where pointer created |
level | in: level of rec in tree: 0 means leaf level |
Definition at line 4919 of file dict0dict.cc.
UNIV_INTERN ulint dict_index_calc_min_rec_len | ( | const dict_index_t * | index | ) |
Calculates the minimum record length in an index.
index | in: index |
Definition at line 5046 of file dict0dict.cc.
UNIV_INTERN ibool dict_index_contains_col_or_prefix | ( | const dict_index_t * | index, |
ulint | n | ||
) |
Returns TRUE if the index contains a column or a prefix of that column.
index | in: index |
n | in: column number |
Definition at line 705 of file dict0dict.cc.
UNIV_INTERN rec_t* dict_index_copy_rec_order_prefix | ( | const dict_index_t * | index, |
const rec_t * | rec, | ||
ulint * | n_fields, | ||
byte ** | buf, | ||
ulint * | buf_size | ||
) |
Copies an initial segment of a physical record, long enough to specify an index entry uniquely.
index | in: index |
rec | in: record for which to copy prefix |
n_fields | out: number of fields copied |
buf | in/out: memory buffer for the copied prefix, or NULL |
buf_size | in/out: buffer size |
Definition at line 4989 of file dict0dict.cc.
UNIV_INTERN void dict_index_copy_types | ( | dtuple_t * | tuple, |
const dict_index_t * | index, | ||
ulint | n_fields | ||
) |
Copies types of fields contained in index to tuple.
tuple | in/out: data tuple |
index | in: index |
n_fields | in: number of field types to copy |
Definition at line 2668 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_index_find_on_id_low | ( | index_id_t | id | ) |
Looks for an index with the given id. NOTE that we do not reserve the dictionary mutex: this function is for emergency purposes like printing info of a corrupt database page!
id | in: index id |
Definition at line 1359 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_index_get_if_in_cache_low | ( | index_id_t | index_id | ) |
Returns an index object if it is found in the dictionary cache. Assumes that dict_sys->mutex is already being held.
index_id | in: index id |
Definition at line 4860 of file dict0dict.cc.
UNIV_INTERN ulint dict_index_get_nth_col_or_prefix_pos | ( | const dict_index_t * | index, |
ulint | n, | ||
ibool | inc_prefix | ||
) |
Looks for column n in an index.
index | in: index |
n | in: column number |
inc_prefix | in: TRUE=consider column prefixes too |
Definition at line 662 of file dict0dict.cc.
UNIV_INTERN ulint dict_index_get_nth_field_pos | ( | const dict_index_t * | index, |
const dict_index_t * | index2, | ||
ulint | n | ||
) |
Looks for a matching field in an index. The column has to be the same. The column in index must be complete, or must contain a prefix longer than the column in index2. That is, we must be able to construct the prefix in index2 from the prefix in index.
index | in: index from which to search |
index2 | in: index |
n | in: field number in index2 |
Definition at line 748 of file dict0dict.cc.
UNIV_INTERN void dict_index_name_print | ( | FILE * | file, |
const trx_t * | trx, | ||
const dict_index_t * | index | ||
) |
Displays the names of the index and the table.
file | in: output stream |
trx | in: transaction |
index | in: index to print |
Definition at line 5469 of file dict0dict.cc.
UNIV_INTERN void dict_index_remove_from_cache | ( | dict_table_t * | table, |
dict_index_t * | index | ||
) |
Removes an index from the dictionary cache.
Removes an index from the cache
table | in/out: table |
index | in, own: index |
Definition at line 2535 of file dict0dict.cc.
UNIV_INTERN void dict_index_zip_failure | ( | dict_index_t * | index | ) |
This function should be called whenever a page compression attempt fails. Updates the compression padding information.
index | in/out: index to be updated. |
Definition at line 6530 of file dict0dict.cc.
UNIV_INTERN ulint dict_index_zip_pad_optimal_page_size | ( | dict_index_t * | index | ) |
Return the optimal page size, for which page will likely compress.
index | in: index for which page size is requested |
Definition at line 6554 of file dict0dict.cc.
UNIV_INTERN void dict_index_zip_success | ( | dict_index_t * | index | ) |
This function should be called whenever a page is successfully compressed. Updates the compression padding information.
index | in/out: index to be updated. |
Definition at line 6507 of file dict0dict.cc.
UNIV_INTERN void dict_init | ( | void | ) |
Inits the data dictionary module.
Definition at line 880 of file dict0dict.cc.
UNIV_INTERN ulint dict_make_room_in_cache | ( | ulint | max_tables, |
ulint | pct_check | ||
) |
Make room in the table cache by evicting an unused table. The unused table should not be part of FK relationship and currently not used in any user transaction. There is no guarantee that it will remove a table.
max_tables | in: max tables allowed in cache |
pct_check | in: max percent to check |
Definition at line 1230 of file dict0dict.cc.
UNIV_INTERN void dict_move_to_mru | ( | dict_table_t * | table | ) |
Move to the most recently used segment of the LRU list.
table | in: table to move to MRU |
Definition at line 916 of file dict0dict.cc.
UNIV_INTERN void dict_mutex_enter_for_mysql | ( | void | ) |
Reserves the dictionary system mutex for MySQL.
Definition at line 319 of file dict0dict.cc.
UNIV_INTERN void dict_mutex_exit_for_mysql | ( | void | ) |
Releases the dictionary system mutex for MySQL.
Definition at line 329 of file dict0dict.cc.
UNIV_INTERN void dict_print_info_on_foreign_key_in_create_format | ( | FILE * | file, |
trx_t * | trx, | ||
dict_foreign_t * | foreign, | ||
ibool | add_newline | ||
) |
Outputs info on a foreign key of a table in a format suitable for CREATE TABLE.
file | in: file where to print |
trx | in: transaction |
foreign | in: foreign key constraint |
add_newline | in: whether to add a newline |
Definition at line 5282 of file dict0dict.cc.
UNIV_INTERN void dict_print_info_on_foreign_keys | ( | ibool | create_table_format, |
FILE * | file, | ||
trx_t * | trx, | ||
dict_table_t * | table | ||
) |
Outputs info on foreign keys of a table.
create_table_format | in: if TRUE then print in a format suitable to be inserted into a CREATE TABLE, otherwise in the format of SHOW TABLE STATUS |
file | in: file where to print |
trx | in: transaction |
table | in: table |
Definition at line 5379 of file dict0dict.cc.
UNIV_INTERN const char* dict_remove_db_name | ( | const char * | name | ) |
Return the end of table name where we have removed dbname and '/'.
name | in: table name in the form dbname '/' tablename |
Definition at line 288 of file dict0dict.cc.
UNIV_INTERN void dict_set_corrupted | ( | dict_index_t * | index, |
trx_t * | trx, | ||
const char * | ctx | ||
) |
Flags an index corrupted both in the data dictionary cache and in the SYS_INDEXES
index | in/out: index |
trx | in/out: transaction |
ctx | in: context |
Definition at line 5545 of file dict0dict.cc.
UNIV_INTERN ibool dict_set_corrupted_by_space | ( | ulint | space_id | ) |
Flags a table with specified space_id corrupted in the data dictionary cache
space_id | in: space ID |
Definition at line 5521 of file dict0dict.cc.
UNIV_INTERN void dict_set_corrupted_index_cache_only | ( | dict_index_t * | index, |
dict_table_t * | table | ||
) |
Flags an index corrupted in the data dictionary cache only. This is used mostly to mark a corrupted index when index's own dictionary is corrupted, and we force to load such index for repair purpose
index | in/out: index |
table | in/out: table |
Definition at line 5656 of file dict0dict.cc.
UNIV_INTERN ibool dict_str_starts_with_keyword | ( | THD * | thd, |
const char * | str, | ||
const char * | keyword | ||
) |
thd | in: MySQL thread handle |
str | in: string to scan for keyword |
keyword | in: keyword to look for |
Definition at line 4643 of file dict0dict.cc.
UNIV_INTERN void dict_table_add_system_columns | ( | dict_table_t * | table, |
mem_heap_t * | heap | ||
) |
Adds system columns to a table object.
table | in/out: table |
heap | in: temporary heap |
Definition at line 1017 of file dict0dict.cc.
UNIV_INTERN void dict_table_add_to_cache | ( | dict_table_t * | table, |
ibool | can_be_evicted, | ||
mem_heap_t * | heap | ||
) |
Adds a table object to the dictionary cache.
table | in: table |
can_be_evicted | in: TRUE if can be evicted |
heap | in: temporary heap |
Definition at line 1064 of file dict0dict.cc.
UNIV_INTERN void dict_table_autoinc_initialize | ( | dict_table_t * | table, |
ib_uint64_t | value | ||
) |
Unconditionally set the autoinc counter.
table | in/out: table |
value | in: next value to assign to a row |
Definition at line 573 of file dict0dict.cc.
UNIV_INTERN void dict_table_autoinc_lock | ( | dict_table_t * | table | ) |
Acquire the autoinc lock.
table | in/out: table |
Definition at line 562 of file dict0dict.cc.
UNIV_INTERN ib_uint64_t dict_table_autoinc_read | ( | const dict_table_t * | table | ) |
Reads the next autoinc value (== autoinc counter value), 0 if not yet initialized.
table | in: table |
Definition at line 616 of file dict0dict.cc.
UNIV_INTERN void dict_table_autoinc_unlock | ( | dict_table_t * | table | ) |
Release the autoinc lock.
table | in/out: table |
Definition at line 648 of file dict0dict.cc.
UNIV_INTERN void dict_table_autoinc_update_if_greater | ( | dict_table_t * | table, |
ib_uint64_t | value | ||
) |
Updates the autoinc counter if the value supplied is greater than the current value.
table | in/out: table |
value | in: value which was assigned to a row |
Definition at line 630 of file dict0dict.cc.
UNIV_INTERN void dict_table_change_id_in_cache | ( | dict_table_t * | table, |
table_id_t | new_id | ||
) |
Change the id of a table object in the dictionary cache. This is used in DISCARD TABLESPACE.
table | in/out: table object already in cache |
new_id | in: new id to set |
Definition at line 1784 of file dict0dict.cc.
UNIV_INTERN void dict_table_close | ( | dict_table_t * | table, |
ibool | dict_locked, | ||
ibool | try_drop | ||
) |
Decrements the count of open handles to a table.
table | in/out: table |
dict_locked | in: TRUE=data dictionary locked |
try_drop | in: TRUE=try to drop any orphan indexes after an aborted online index creation |
Definition at line 470 of file dict0dict.cc.
UNIV_INTERN ibool dict_table_col_in_clustered_key | ( | const dict_table_t * | table, |
ulint | n | ||
) |
Checks if a column is in the ordering columns of the clustered index of a table. Column prefixes are treated like whole columns.
table | in: table |
n | in: column number |
Definition at line 845 of file dict0dict.cc.
UNIV_INTERN void dict_table_copy_types | ( | dtuple_t * | tuple, |
const dict_table_t * | table | ||
) |
Copies types of columns contained in table to tuple and sets all fields of the tuple to the SQL NULL value. This function should be called right after dtuple_create().
tuple | in/out: data tuple |
table | in: table |
Definition at line 2699 of file dict0dict.cc.
UNIV_INTERN ulint dict_table_get_all_fts_indexes | ( | dict_table_t * | table, |
ib_vector_t * | indexes | ||
) |
table | in: table |
indexes | out: all FTS indexes on this table |
Definition at line 588 of file dict0dict.cc.
UNIV_INTERN const char* dict_table_get_col_name | ( | const dict_table_t * | table, |
ulint | col_nr | ||
) |
Returns a column's name.
table | in: table |
col_nr | in: column number |
Definition at line 535 of file dict0dict.cc.
UNIV_INTERN dict_foreign_t* dict_table_get_foreign_constraint | ( | dict_table_t * | table, |
dict_index_t * | index | ||
) |
Checks if a index is defined for a foreign key constraint. Index is a part of a foreign key constraint if the index is referenced by foreign key or index is a foreign key index.
table | in: InnoDB table |
index | in: InnoDB index |
Definition at line 3102 of file dict0dict.cc.
UNIV_INTERN ulint dict_table_get_highest_foreign_id | ( | dict_table_t * | table | ) |
Finds the highest [number] for foreign key constraints of the table. Looks only at the >= 4.0.18-format id's, which are of the form databasename/tablename_ibfk_[number].
table | in: table in the dictionary memory cache |
Definition at line 3987 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_table_get_index_on_name | ( | dict_table_t * | table, |
const char * | name | ||
) |
Get index by name
table | in: table |
name | in: name of the index to find |
Definition at line 5745 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_table_get_index_on_name_and_min_id | ( | dict_table_t * | table, |
const char * | name | ||
) |
In case there is more than one index with the same name return the index with the min(id).
table | in: table |
name | in: name of the index to find |
Definition at line 5848 of file dict0dict.cc.
UNIV_INTERN ulint dict_table_get_nth_col_pos | ( | const dict_table_t * | table, |
ulint | n | ||
) |
Looks for column n position in the clustered index.
table | in: table |
n | in: column number |
Definition at line 830 of file dict0dict.cc.
UNIV_INTERN dict_foreign_t* dict_table_get_referenced_constraint | ( | dict_table_t * | table, |
dict_index_t * | index | ||
) |
Check if the index is referenced by a foreign key, if TRUE return foreign else return NULL
table | in: InnoDB table |
index | in: InnoDB index |
Definition at line 3071 of file dict0dict.cc.
UNIV_INTERN ibool dict_table_is_referenced_by_foreign_key | ( | const dict_table_t * | table | ) |
Checks if a table is referenced by foreign keys.
table | in: InnoDB table |
Definition at line 3057 of file dict0dict.cc.
UNIV_INTERN void dict_table_move_from_lru_to_non_lru | ( | dict_table_t * | table | ) |
Move a table to the non-LRU list from the LRU list.
table | in: table to move from LRU to non-LRU |
Definition at line 1290 of file dict0dict.cc.
UNIV_INTERN void dict_table_move_from_non_lru_to_lru | ( | dict_table_t * | table | ) |
Move a table to the LRU list from the non-LRU list.
table | in: table to move from non-LRU to LRU |
Definition at line 1310 of file dict0dict.cc.
UNIV_INTERN dict_table_t* dict_table_open_on_id | ( | table_id_t | table_id, |
ibool | dict_locked, | ||
dict_table_op_t | table_op | ||
) |
Returns a table object based on table id.
table_id | in: table id |
dict_locked | in: TRUE=data dictionary locked |
table_op | in: operation to perform |
Definition at line 786 of file dict0dict.cc.
UNIV_INTERN dict_table_t* dict_table_open_on_name | ( | const char * | table_name, |
ibool | dict_locked, | ||
ibool | try_drop, | ||
dict_err_ignore_t | ignore_err | ||
) |
Returns a table object and increment its open handle count. NOTE! This is a high-level function to be used mainly from outside the 'dict' module. Inside this directory dict_table_get_low is usually the appropriate function.
table_name | in: table name |
dict_locked | in: TRUE=data dictionary locked |
try_drop | in: TRUE=try to drop any orphan indexes after an aborted online index creation |
ignore_err | in: error to be ignored when loading a table definition |
Definition at line 941 of file dict0dict.cc.
UNIV_INTERN void dict_table_print | ( | dict_table_t * | table | ) |
Prints a table data.
table | in: table |
Definition at line 5127 of file dict0dict.cc.
UNIV_INTERN void dict_table_remove_from_cache | ( | dict_table_t * | table | ) |
Removes a table object from the dictionary cache.
table | in, own: table |
Definition at line 1915 of file dict0dict.cc.
UNIV_INTERN dberr_t dict_table_rename_in_cache | ( | dict_table_t * | table, |
const char * | new_name, | ||
ibool | rename_also_foreigns | ||
) |
Renames a table object.
table | in/out: table |
new_name | in: new name |
rename_also_foreigns | in: in ALTER TABLE we want to preserve the original table name in constraints which reference it |
Definition at line 1400 of file dict0dict.cc.
UNIV_INTERN dberr_t dict_table_schema_check | ( | dict_table_schema_t * | req_schema, |
char * | errstr, | ||
size_t | errstr_sz | ||
) |
Checks whether a table exists and whether it has the given structure. The table must have the same number of columns with the same names and types. The order of the columns does not matter. The caller must own the dictionary mutex. dict_table_schema_check()
req_schema | in/out: required table schema |
errstr | out: human readable error message if != DB_SUCCESS is returned |
errstr_sz | in: errstr size |
Definition at line 5942 of file dict0dict.cc.
UNIV_INTERN void dict_table_stats_lock | ( | const dict_table_t * | table, |
ulint | latch_mode | ||
) |
Lock the appropriate latch to protect a given table's statistics. table->id is used to pick the corresponding latch from a global array of latches.
table | in: table |
latch_mode | in: RW_S_LATCH or RW_X_LATCH |
Definition at line 346 of file dict0dict.cc.
UNIV_INTERN void dict_table_stats_unlock | ( | const dict_table_t * | table, |
ulint | latch_mode | ||
) |
Unlock the latch that has been locked by dict_table_stats_lock()
table | in: table |
latch_mode | in: RW_S_LATCH or RW_X_LATCH |
Definition at line 373 of file dict0dict.cc.
UNIV_INTERN ibool dict_tables_have_same_db | ( | const char * | name1, |
const char * | name2 | ||
) |
Checks if the database name in two table names is the same.
name1 | in: table name in the form dbname '/' tablename |
name2 | in: table name in the form dbname '/' tablename |
Definition at line 267 of file dict0dict.cc.
UNIV_INTERN const char* dict_tf_to_row_format_string | ( | ulint | table_flag | ) |
Convert table flag to row format string.
table_flag | in: row format setting |
Definition at line 6597 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_ind_compact |
dummy index for ROW_FORMAT=COMPACT supremum and infimum records
Definition at line 39 of file dict0dict.cc.
UNIV_INTERN dict_index_t* dict_ind_redundant |
dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records
Definition at line 37 of file dict0dict.cc.
UNIV_INTERN rw_lock_t dict_operation_lock |
the data dictionary rw-latch protecting dict_sys
table create, drop, etc. reserve this in X-mode; implicit or backround operations purge, rollback, foreign key checks reserve this in S-mode; we cannot trust that MySQL protects implicit or background operations a table drop since MySQL does not know of them; therefore we need this; NOTE: a transaction which reserves this must keep book on the mode in trx_t::dict_operation_lock_mode
Definition at line 90 of file dict0dict.cc.
UNIV_INTERN dict_sys_t* dict_sys = NULL |
the dictionary system
Definition at line 80 of file dict0dict.cc.
UNIV_INTERN ulong zip_failure_threshold_pct = 5 |
Percentage of compression failures that are allowed in a single
round
Definition at line 94 of file dict0dict.cc.
UNIV_INTERN ulong zip_pad_max = 50 |
Maximum percentage of a page that can be allowed as a pad to avoid
compression failures
Definition at line 98 of file dict0dict.cc.