#include "univ.i"
#include "dict0types.h"
#include "dict0mem.h"
#include "data0type.h"
#include "data0data.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "ut0mem.h"
#include "ut0lst.h"
#include "hash0hash.h"
#include "ut0rnd.h"
#include "ut0byte.h"
#include "trx0types.h"
#include "sync0sync.h"
#include "sync0rw.h"
Go to the source code of this file.
Classes | |
struct | dict_sys_struct |
Defines | |
#define | dict_table_get_first_index(table) UT_LIST_GET_FIRST((table)->indexes) |
#define | dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index) |
#define | dict_table_get_nth_col(table, pos) ((table)->cols + (pos)) |
#define | dict_table_get_sys_col(table, sys) ((table)->cols + (table)->n_cols + (sys) - DATA_N_SYS_COLS) |
#define | dict_index_get_nth_field(index, pos) ((index)->fields + (pos)) |
Functions | |
UNIV_INTERN void | dict_casedn_str (char *a) |
UNIV_INTERN ulint | dict_get_db_name_len (const char *name) |
const char * | dict_remove_db_name (const char *name) |
UNIV_INTERN dict_table_t * | dict_table_get_on_id (table_id_t table_id, trx_t *trx) |
UNIV_INTERN void | dict_table_decrement_handle_count (dict_table_t *table, ibool dict_locked) |
UNIV_INTERN void | dict_init (void) |
UNIV_INTERN void | dict_load_space_id_list (void) |
UNIV_INLINE ulint | dict_col_get_mbminlen (const dict_col_t *col) |
UNIV_INLINE ulint | dict_col_get_mbmaxlen (const dict_col_t *col) |
UNIV_INLINE void | dict_col_set_mbminmaxlen (dict_col_t *col, ulint mbminlen, ulint mbmaxlen) |
UNIV_INLINE void | dict_col_copy_type (const dict_col_t *col, dtype_t *type) |
UNIV_INLINE ulint | dict_col_get_min_size (const dict_col_t *col) |
UNIV_INLINE ulint | dict_col_get_max_size (const dict_col_t *col) |
UNIV_INLINE ulint | dict_col_get_fixed_size (const dict_col_t *col, ulint comp) |
UNIV_INLINE ulint | dict_col_get_sql_null_size (const dict_col_t *col, ulint comp) |
UNIV_INLINE ulint | dict_col_get_no (const dict_col_t *col) |
UNIV_INLINE ulint | dict_col_get_clust_pos (const dict_col_t *col, const dict_index_t *clust_index) |
UNIV_INTERN ibool | dict_col_name_is_reserved (const char *name) |
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 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 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, mem_heap_t *heap) |
UNIV_INTERN void | dict_table_remove_from_cache (dict_table_t *table) |
UNIV_INTERN ibool | 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 ulint | dict_foreign_add_to_cache (dict_foreign_t *foreign, ibool check_charsets) |
UNIV_INTERN dict_foreign_t * | dict_table_get_referenced_constraint (dict_table_t *table, dict_index_t *index) |
UNIV_INTERN ibool | dict_table_is_referenced_by_foreign_key (const dict_table_t *table) |
UNIV_INTERN void | dict_table_replace_index_in_foreign_list (dict_table_t *table, dict_index_t *index, const trx_t *trx) |
UNIV_INTERN dict_foreign_t * | dict_table_get_foreign_constraint (dict_table_t *table, dict_index_t *index) |
UNIV_INTERN ulint | dict_create_foreign_constraints (trx_t *trx, const char *sql_string, size_t sql_length, const char *name, ibool reject_fks) |
UNIV_INTERN ulint | 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_table_t * | dict_table_get (const char *table_name, ibool inc_mysql_count) |
UNIV_INTERN dict_index_t * | dict_index_get_on_id_low (dict_table_t *table, index_id_t index_id) |
UNIV_INLINE dict_table_t * | dict_table_check_if_in_cache_low (const char *table_name) |
UNIV_INLINE dict_table_t * | dict_table_get_low (const char *table_name) |
UNIV_INLINE dict_table_t * | dict_table_get_on_id_low (table_id_t table_id) |
UNIV_INTERN dict_index_t * | dict_foreign_find_equiv_index (dict_foreign_t *foreign) |
UNIV_INTERN dict_index_t * | dict_table_get_index_by_max_id (dict_table_t *table, const char *name, const char **columns, ulint n_cols) |
UNIV_INTERN const char * | dict_table_get_col_name (const dict_table_t *table, ulint col_nr) |
UNIV_INTERN void | dict_table_print (dict_table_t *table) |
UNIV_INTERN void | dict_table_print_low (dict_table_t *table) |
UNIV_INTERN void | dict_table_print_by_name (const char *name) |
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_print_info_on_foreign_key_in_create_format (FILE *file, trx_t *trx, dict_foreign_t *foreign, ibool add_newline) |
UNIV_INTERN void | dict_index_name_print (FILE *file, trx_t *trx, const dict_index_t *index) |
UNIV_INLINE ulint | dict_index_is_clust (const dict_index_t *index) __attribute__((pure)) |
UNIV_INLINE ulint | dict_index_is_unique (const dict_index_t *index) __attribute__((pure)) |
UNIV_INLINE ulint | dict_index_is_ibuf (const dict_index_t *index) __attribute__((pure)) |
UNIV_INLINE ulint | dict_index_is_sec_or_ibuf (const dict_index_t *index) __attribute__((pure)) |
UNIV_INLINE ulint | dict_table_get_n_user_cols (const dict_table_t *table) |
UNIV_INLINE ulint | dict_table_get_n_sys_cols (const dict_table_t *table) |
UNIV_INLINE ulint | dict_table_get_n_cols (const dict_table_t *table) |
UNIV_INLINE ulint | dict_table_get_sys_col_no (const dict_table_t *table, ulint sys) |
UNIV_INLINE ulint | dict_index_get_min_size (const dict_index_t *index) |
UNIV_INLINE ibool | dict_table_is_comp (const dict_table_t *table) |
UNIV_INLINE ulint | dict_table_get_format (const dict_table_t *table) |
UNIV_INLINE void | dict_table_set_format (dict_table_t *table, ulint format) |
UNIV_INLINE ulint | dict_table_flags_to_zip_size (ulint flags) __attribute__((const )) |
UNIV_INLINE ulint | dict_table_zip_size (const dict_table_t *table) |
UNIV_INLINE void | dict_table_x_lock_indexes (dict_table_t *table) |
UNIV_INLINE void | dict_table_x_unlock_indexes (dict_table_t *table) |
UNIV_INTERN ibool | dict_table_col_in_clustered_key (const dict_table_t *table, ulint n) |
UNIV_INTERN void | dict_table_copy_types (dtuple_t *tuple, const dict_table_t *table) |
UNIV_INTERN dict_index_t * | dict_index_find_on_id_low (index_id_t id) |
UNIV_INTERN ulint | dict_index_add_to_cache (dict_table_t *table, dict_index_t *index, ulint page_no, ibool strict) |
UNIV_INLINE ulint | dict_index_get_n_fields (const dict_index_t *index) |
UNIV_INLINE ulint | dict_index_get_n_unique (const dict_index_t *index) |
UNIV_INLINE ulint | dict_index_get_n_unique_in_tree (const dict_index_t *index) |
UNIV_INLINE ulint | dict_index_get_n_ordering_defined_by_user (const dict_index_t *index) |
UNIV_INLINE const dict_col_t * | dict_index_get_nth_col (const dict_index_t *index, ulint pos) |
UNIV_INLINE ulint | dict_index_get_nth_col_no (const dict_index_t *index, ulint pos) |
UNIV_INTERN ulint | dict_index_get_nth_col_pos (const dict_index_t *index, ulint n) |
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 ulint | dict_table_get_nth_col_pos (const dict_table_t *table, ulint n) |
UNIV_INLINE ulint | dict_index_get_sys_col_pos (const dict_index_t *index, ulint type) |
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_INLINE const dict_col_t * | dict_field_get_col (const dict_field_t *field) |
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_INLINE ulint | dict_index_get_space (const dict_index_t *index) |
UNIV_INLINE void | dict_index_set_space (dict_index_t *index, ulint space) |
UNIV_INLINE ulint | dict_index_get_page (const dict_index_t *tree) |
UNIV_INLINE void | dict_index_set_page (dict_index_t *index, ulint page) |
UNIV_INLINE rw_lock_t * | dict_index_get_lock (dict_index_t *index) |
UNIV_INLINE ulint | dict_index_get_space_reserve (void) |
UNIV_INTERN ulint | dict_index_calc_min_rec_len (const dict_index_t *index) |
UNIV_INTERN void | dict_update_statistics (dict_table_t *table, ibool only_calc_if_missing_stats) |
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 ibool | dict_tables_have_same_db (const char *name1, const char *name2) |
UNIV_INTERN void | dict_index_remove_from_cache (dict_table_t *table, dict_index_t *index) |
UNIV_INTERN dict_index_t * | dict_table_get_index_on_name (dict_table_t *table, const char *name) |
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_ind_init (void) |
UNIV_INTERN void | dict_close (void) |
Variables | |
FILE * | dict_foreign_err_file |
mutex_t | dict_foreign_err_mutex |
dict_sys_t * | dict_sys |
rw_lock_t | dict_operation_lock |
dict_index_t * | dict_ind_redundant |
dict_index_t * | dict_ind_compact |
UNIV_INTERN void dict_casedn_str | ( | char * | a | ) |
Makes all characters in a NUL-terminated UTF-8 string lower case. in/out: string to put in lower case
Makes all characters in a NUL-terminated UTF-8 string lower case.
a | in/out: string to put in lower case |
Definition at line 187 of file dict0dict.cc.
References innobase_casedn_str().
UNIV_INTERN void dict_close | ( | void | ) |
Closes the data dictionary module.
Definition at line 4944 of file dict0dict.cc.
References HASH_GET_FIRST, hash_get_n_cells(), HASH_GET_NEXT, mem_free, dict_sys_struct::mutex, dict_sys_struct::table_hash, dict_sys_struct::table_id_hash, and ut_a.
UNIV_INLINE void dict_col_copy_type | ( | const dict_col_t * | col, |
dtype_t * | type | ||
) |
Gets the column data type. out: data type
col | in: column |
Referenced by calc_row_difference(), dict_index_copy_types(), and dict_table_copy_types().
UNIV_INLINE ulint dict_col_get_clust_pos | ( | const dict_col_t * | col, |
const dict_index_t * | clust_index | ||
) |
Gets the column position in the clustered index. in: clustered index
col | in: table column |
Referenced by build_template(), calc_row_difference(), dict_index_get_nth_col_pos(), row_upd_changes_ord_field_binary(), row_upd_index_replace_new_col_vals(), and row_upd_replace().
UNIV_INLINE ulint dict_col_get_fixed_size | ( | const dict_col_t * | col, |
ulint | comp | ||
) |
Returns the size of a fixed size column, 0 if not a fixed size column.
col | in: column |
Referenced by btr_index_rec_validate(), dict_index_add_col(), dict_index_add_to_cache(), and dict_index_calc_min_rec_len().
UNIV_INLINE ulint dict_col_get_max_size | ( | const dict_col_t * | col | ) |
Returns the maximum size of the column.
Referenced by dict_index_add_to_cache(), and dict_table_add_to_cache().
UNIV_INLINE ulint dict_col_get_mbmaxlen | ( | const dict_col_t * | col | ) |
Gets the maximum number of bytes per character.
Referenced by build_template().
UNIV_INLINE ulint dict_col_get_mbminlen | ( | const dict_col_t * | col | ) |
Gets the minimum number of bytes per character.
Referenced by build_template().
UNIV_INLINE ulint dict_col_get_min_size | ( | const dict_col_t * | col | ) |
Returns the minimum size of the column.
UNIV_INLINE ulint dict_col_get_no | ( | const dict_col_t * | col | ) |
Gets the column number.
Referenced by dict_index_add_col(), dict_table_get_index_by_max_id(), row_build(), row_build_index_entry(), row_upd_changes_ord_field_binary(), and trx_undo_rec_get_partial_row().
UNIV_INLINE ulint dict_col_get_sql_null_size | ( | const dict_col_t * | col, |
ulint | comp | ||
) |
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. For fixed length types it is the fixed length of the type, otherwise 0.
col | in: column |
Referenced by row_upd_changes_field_size_or_external().
UNIV_INTERN ibool dict_col_name_is_reserved | ( | const char * | name | ) |
If the given column name is reserved for InnoDB system columns, return TRUE.
If the given column name is reserved for InnoDB system columns, return TRUE.
name | in: column name |
Definition at line 1265 of file dict0dict.cc.
References innobase_strcasecmp().
UNIV_INLINE void dict_col_set_mbminmaxlen | ( | dict_col_t * | col, |
ulint | mbminlen, | ||
ulint | mbmaxlen | ||
) |
Sets the minimum and maximum number of bytes per character. in: minimum multi-byte character size, in bytes
col | in/out: column |
mbminlen | in: minimum multi-byte character size, in bytes |
Referenced by dict_mem_fill_column_struct().
UNIV_INTERN ulint 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 bot participating tables. The indexes are allowed to contain more fields than mentioned in the constraint.
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 3811 of file dict0dict.cc.
References mem_free, mem_heap_create, mem_heap_free, trx_struct::mysql_thd, and ut_a.
UNIV_INLINE const dict_col_t* dict_field_get_col | ( | const dict_field_t * | field | ) |
Gets the field column.
Referenced by dict_index_add_to_cache(), dict_index_copy_types(), innobase_rec_to_mysql(), mlog_open_and_write_index(), rec_copy_prefix_to_buf(), rec_get_converted_size_comp_prefix(), rec_get_n_extern_new(), rec_get_offsets_reverse(), rec_init_offsets_comp_ordinary(), row_build(), row_upd_changes_ord_field_binary(), row_upd_changes_some_index_ord_field_binary(), row_upd_index_replace_new_col_vals(), and row_upd_index_replace_new_col_vals_index_pos().
UNIV_INTERN ulint dict_foreign_add_to_cache | ( | dict_foreign_t * | foreign, |
ibool | check_charsets | ||
) |
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 foreign table or referenced table must already be in the dictionary cache!
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 |
check_charsets | in: TRUE=check charset compatibility |
Definition at line 2572 of file dict0dict.cc.
References DICT_FOREIGN_ON_DELETE_SET_NULL, DICT_FOREIGN_ON_UPDATE_SET_NULL, dict_table_check_if_in_cache_low(), dict_foreign_struct::foreign_col_names, dict_foreign_struct::foreign_index, dict_table_struct::foreign_list, dict_foreign_struct::foreign_table, dict_foreign_struct::foreign_table_name, dict_foreign_struct::heap, dict_foreign_struct::id, mem_heap_free, dict_sys_struct::mutex, dict_foreign_struct::n_fields, dict_foreign_struct::referenced_col_names, dict_foreign_struct::referenced_index, dict_table_struct::referenced_list, dict_foreign_struct::referenced_table, dict_foreign_struct::referenced_table_name, dict_foreign_struct::type, ut_a, ut_ad, UT_LIST_ADD_LAST, and UT_LIST_REMOVE.
UNIV_INTERN dict_index_t* dict_foreign_find_equiv_index | ( | dict_foreign_t * | foreign | ) |
Find an index that is equivalent to the one passed in and is not marked for deletion.
Find an index that is equivalent to the one passed in and is not marked for deletion.
foreign | in: foreign key |
Definition at line 2446 of file dict0dict.cc.
References dict_foreign_struct::foreign_col_names, dict_foreign_struct::foreign_index, dict_foreign_struct::foreign_table, dict_foreign_struct::n_fields, and ut_a.
UNIV_INTERN ulint 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.
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 3856 of file dict0dict.cc.
References dict_table_struct::foreign_list, dict_foreign_struct::id, mem_free, mem_heap_alloc(), dict_sys_struct::mutex, trx_struct::mysql_thd, dict_table_struct::name, ut_a, ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, ut_print_name(), and ut_print_timestamp().
UNIV_INTERN ulint dict_get_db_name_len | ( | const char * | name | ) |
Get the database name length in a table name.
Get the database name length in a table name.
name | in: table name in the form dbname '/' tablename |
Definition at line 236 of file dict0dict.cc.
References ut_a.
UNIV_INTERN void dict_ind_init | ( | void | ) |
Inits dict_ind_redundant and dict_ind_compact.
Definition at line 4753 of file dict0dict.cc.
References dict_index_struct::cached, DICT_TF_COMPACT, and dict_index_struct::table.
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. in: column prefix length
Adds a column to index.
index | in/out: index |
table | in: table |
col | in: column |
prefix_len | in: column prefix length |
Definition at line 1833 of file dict0dict.cc.
References dict_field_struct::col, dict_col_get_fixed_size(), dict_col_get_no(), DICT_MAX_INDEX_COL_LEN, dict_table_is_comp(), dict_field_struct::fixed_len, dict_index_struct::n_def, dict_index_struct::n_nullable, and dict_col_struct::prtype.
UNIV_INTERN ulint 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.
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 1547 of file dict0dict.cc.
References BTR_EXTERN_FIELD_REF_SIZE, dict_col_get_fixed_size(), dict_col_get_max_size(), dict_field_get_col(), dict_index_get_n_unique(), dict_index_is_clust(), dict_table_get_format(), DICT_TF_FORMAT_51, DICT_TF_FORMAT_ZIP, DICT_UNIVERSAL, dict_index_struct::heap, dict_table_struct::indexes, dict_index_struct::lock, mem_heap_alloc(), mem_heap_get_size(), dict_sys_struct::mutex, dict_index_struct::n_def, dict_index_struct::n_fields, dict_index_struct::n_uniq, dict_table_struct::name, dict_col_struct::ord_part, dict_index_struct::page, dict_field_struct::prefix_len, rw_lock_create, dict_index_struct::search_info, dict_sys_struct::size, dict_index_struct::stat_index_size, dict_index_struct::stat_n_diff_key_vals, dict_index_struct::stat_n_leaf_pages, dict_index_struct::table, dict_index_struct::table_name, dict_index_struct::type, ut_a, ut_ad, UT_LIST_ADD_LAST, and UT_LIST_GET_LEN.
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.
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 4154 of file dict0dict.cc.
References dict_table_is_comp(), dtuple_check_typed(), dtuple_create(), rec_copy_prefix_to_dtuple(), rec_get_n_fields_old(), dict_index_struct::table, and ut_ad.
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.
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 4054 of file dict0dict.cc.
References dfield_set_data(), dict_index_get_n_unique_in_tree(), dict_table_is_comp(), DICT_UNIVERSAL, dtuple_check_typed(), dtuple_create(), dtuple_get_info_bits(), dtuple_set_info_bits(), dtuple_set_n_fields_cmp(), dtype_set(), mach_write_to_4(), mem_heap_alloc(), rec_copy_prefix_to_dtuple(), rec_get_n_fields_old(), dict_index_struct::table, dict_index_struct::type, ut_a, and ut_ad.
UNIV_INTERN ulint dict_index_calc_min_rec_len | ( | const dict_index_t * | index | ) |
Calculates the minimum record length in an index. in: index
Calculates the minimum record length in an index.
index | in: index |
Definition at line 4181 of file dict0dict.cc.
References dict_col_get_fixed_size(), dict_index_get_n_fields(), dict_index_get_nth_col(), dict_table_is_comp(), dict_col_struct::len, dict_col_struct::prtype, dict_index_struct::table, and UT_BITS_IN_BYTES.
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.
Returns TRUE if the index contains a column or a prefix of that column.
index | in: index |
n | in: column number |
Definition at line 526 of file dict0dict.cc.
References dict_field_struct::col, dict_index_get_n_fields(), dict_index_is_clust(), dict_index_struct::table, and ut_ad.
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.
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 4124 of file dict0dict.cc.
References dict_index_get_n_unique_in_tree(), dict_table_is_comp(), DICT_UNIVERSAL, rec_copy_prefix_to_buf(), rec_get_n_fields_old(), dict_index_struct::table, dict_index_struct::type, and ut_a.
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. in: number of field types to copy
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 1906 of file dict0dict.cc.
References dict_col_copy_type(), dict_field_get_col(), DICT_UNIVERSAL, dtuple_set_types_binary(), and dict_index_struct::type.
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!
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 906 of file dict0dict.cc.
References dict_index_struct::id, dict_sys_struct::table_LRU, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.
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.
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 3995 of file dict0dict.cc.
References dict_sys_struct::mutex, and ut_ad.
UNIV_INLINE rw_lock_t* dict_index_get_lock | ( | dict_index_t * | index | ) |
Gets the read-write lock of the index tree.
Referenced by btr_compress(), btr_cur_compress_if_useful(), btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_pessimistic_delete(), btr_cur_pessimistic_insert(), btr_cur_pessimistic_update(), btr_cur_search_to_nth_level(), btr_discard_page(), btr_free_externally_stored_field(), btr_get_size(), btr_page_split_and_insert(), btr_root_raise_and_insert(), btr_store_big_rec_extern_fields(), and btr_validate_index().
UNIV_INLINE ulint dict_index_get_min_size | ( | const dict_index_t * | index | ) |
Returns the minimum data size of an index record.
UNIV_INLINE ulint dict_index_get_n_fields | ( | const dict_index_t * | index | ) |
Gets the number of fields in the internal representation of an index, including fields added by the dictionary system.
Referenced by btr_cur_pessimistic_insert(), btr_cur_pessimistic_update(), btr_index_rec_validate(), dict_index_calc_min_rec_len(), dict_index_contains_col_or_prefix(), dict_index_get_nth_col_pos(), dict_index_get_nth_field_pos(), dtuple_convert_big_rec(), mlog_open_and_write_index(), rec_convert_dtuple_to_rec_comp(), rec_copy_prefix_to_buf(), rec_get_converted_size_comp(), rec_get_converted_size_comp_prefix(), rec_get_n_extern_new(), rec_get_offsets_func(), rec_get_offsets_reverse(), row_build_index_entry(), row_create_index_for_mysql(), row_rec_to_index_entry_low(), row_upd_index_replace_new_col_vals(), row_upd_index_replace_new_col_vals_index_pos(), and trx_undo_update_rec_get_update().
UNIV_INLINE ulint dict_index_get_n_ordering_defined_by_user | ( | const dict_index_t * | index | ) |
Gets the number of user-defined ordering fields in the index. In the internal representation we add the row id to the ordering fields to make all indexes unique, but this function returns the number of fields the user defined in the index as ordering fields.
Referenced by dict_table_get_index_by_max_id(), row_check_index_for_mysql(), and row_search_max_autoinc().
UNIV_INLINE ulint dict_index_get_n_unique | ( | const dict_index_t * | index | ) |
Gets the number of fields in the internal representation of an index that uniquely determine the position of an index entry in the index, if we do not take multiversioning into account: in the B-tree use the value returned by dict_index_get_n_unique_in_tree.
Referenced by btr_estimate_number_of_different_key_vals(), cmp_rec_rec_simple(), dict_index_add_to_cache(), dict_table_col_in_clustered_key(), dict_update_statistics(), row_build_row_ref(), row_build_row_ref_in_tuple(), row_create_prebuilt(), row_search_for_mysql(), row_search_on_row_ref(), row_upd_changes_ord_field_binary(), row_upd_index_replace_new_col_vals_index_pos(), trx_undo_prev_version_build(), trx_undo_rec_get_row_ref(), and trx_undo_rec_skip_row_ref().
UNIV_INLINE ulint dict_index_get_n_unique_in_tree | ( | const dict_index_t * | index | ) |
Gets the number of fields in the internal representation of an index which uniquely determine the position of an index entry in the index, if we also take multiversioning into account.
Referenced by btr_cur_optimistic_insert(), btr_estimate_number_of_different_key_vals(), btr_page_split_and_insert(), dict_index_build_node_ptr(), dict_index_copy_rec_order_prefix(), dtuple_convert_big_rec(), mlog_open_and_write_index(), rec_convert_dtuple_to_rec_comp(), rec_copy_prefix_to_buf(), rec_get_converted_size_comp(), rec_get_offsets_func(), rec_get_offsets_reverse(), row_build_index_entry(), and row_rec_to_index_entry_low().
UNIV_INLINE const dict_col_t* dict_index_get_nth_col | ( | const dict_index_t * | index, |
ulint | pos | ||
) |
Gets pointer to the nth column in an index.
index | in: index |
Referenced by btr_index_rec_validate(), cmp_rec_rec_simple(), cmp_rec_rec_with_match(), dict_index_calc_min_rec_len(), mlog_parse_index(), row_table_got_default_clust_index(), row_upd_changes_field_size_or_external(), and trx_undo_rec_get_partial_row().
UNIV_INLINE ulint dict_index_get_nth_col_no | ( | const dict_index_t * | index, |
ulint | pos | ||
) |
Gets the column number of the nth field in an index.
index | in: index |
UNIV_INTERN ulint dict_index_get_nth_col_pos | ( | const dict_index_t * | index, |
ulint | n | ||
) |
Looks for column n in an index.
Looks for column n in an index.
index | in: index |
n | in: column number |
Definition at line 486 of file dict0dict.cc.
References dict_field_struct::col, dict_col_get_clust_pos(), dict_index_get_n_fields(), dict_index_is_clust(), dict_field_struct::prefix_len, dict_index_struct::table, and ut_ad.
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.
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 569 of file dict0dict.cc.
References dict_field_struct::col, dict_index_get_n_fields(), dict_field_struct::prefix_len, and ut_ad.
UNIV_INTERN dict_index_t* dict_index_get_on_id_low | ( | dict_table_t * | table, |
index_id_t | id | ||
) |
Returns a index object, based on table and index id, and memoryfixes it.
Looks for an index with the given table and index id. NOTE that we do not reserve the dictionary mutex.
table | in: table |
id | in: index id |
Definition at line 457 of file dict0dict.cc.
References dict_index_struct::id.
UNIV_INLINE ulint dict_index_get_page | ( | const dict_index_t * | tree | ) |
Gets the page number of the root of the index tree.
Referenced by btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_pessimistic_delete(), btr_cur_pessimistic_insert(), btr_cur_search_to_nth_level(), btr_discard_page(), and btr_root_raise_and_insert().
UNIV_INLINE ulint dict_index_get_space | ( | const dict_index_t * | index | ) |
Gets the space id of the root of the index tree.
Referenced by btr_compress(), btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level(), btr_discard_page(), btr_free_externally_stored_field(), btr_page_alloc(), and btr_root_raise_and_insert().
UNIV_INLINE ulint dict_index_get_space_reserve | ( | void | ) |
Returns free space reserved for future updates of records. This is relevant only in the case of many consecutive inserts, as updates which make the records bigger might fragment the index.
Referenced by btr_cur_optimistic_insert().
UNIV_INLINE ulint dict_index_get_sys_col_pos | ( | const dict_index_t * | index, |
ulint | type | ||
) |
Returns the position of a system column in an index.
index | in: index |
Referenced by page_cur_insert_rec_zip(), page_zip_write_rec(), row_get_trx_id_offset(), row_upd_build_difference_binary(), row_upd_index_entry_sys_field(), row_upd_write_sys_vals_to_log(), and trx_undo_update_rec_get_update().
UNIV_INLINE ulint dict_index_is_clust | ( | const dict_index_t * | index | ) |
Check whether the index is the clustered index.
index | in: index |
Referenced by btr_compress(), btr_cur_del_mark_set_clust_rec(), btr_cur_optimistic_delete(), btr_cur_optimistic_insert(), btr_cur_optimistic_update(), btr_cur_pessimistic_update(), btr_cur_search_to_nth_level(), btr_cur_update_alloc_zip(), btr_cur_update_in_place(), btr_page_split_and_insert(), btr_root_raise_and_insert(), btr_store_big_rec_extern_fields(), dict_index_add_to_cache(), dict_index_contains_col_or_prefix(), dict_index_get_nth_col_pos(), dict_update_statistics(), ha_innobase::doOpen(), dtuple_convert_big_rec(), ibuf_insert(), lock_clust_rec_cons_read_sees(), lock_clust_rec_modify_check_and_lock(), lock_clust_rec_read_check_and_lock(), lock_rec_insert_check_and_lock(), lock_sec_rec_modify_check_and_lock(), lock_sec_rec_read_check_and_lock(), opt_find_all_cols(), page_cur_insert_rec_zip(), page_zip_reorganize(), page_zip_write_rec(), pars_update_statement(), rec_init_offsets_comp_ordinary(), row_build(), row_build_index_entry(), row_build_row_ref(), row_build_row_ref_in_tuple(), row_get_clust_rec(), row_get_trx_id_offset(), row_purge_poss_sec(), row_search_for_mysql(), row_unlock_for_mysql(), row_upd_build_difference_binary(), row_upd_build_sec_rec_difference_binary(), row_upd_index_entry_sys_field(), row_upd_replace(), row_upd_write_sys_vals_to_log(), row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), trx_undo_prev_version_build(), trx_undo_rec_get_partial_row(), trx_undo_rec_get_row_ref(), trx_undo_rec_skip_row_ref(), trx_undo_report_row_operation(), and trx_undo_update_rec_get_update().
UNIV_INLINE ulint dict_index_is_ibuf | ( | const dict_index_t * | index | ) |
Check whether the index is the insert buffer tree.
index | in: index |
Referenced by btr_cur_optimistic_delete(), btr_cur_optimistic_update(), btr_cur_pessimistic_update(), btr_cur_search_to_nth_level(), btr_cur_update_alloc_zip(), btr_cur_update_in_place(), btr_page_alloc(), btr_page_free_low(), btr_root_raise_and_insert(), btr_search_drop_page_hash_index(), btr_search_move_or_delete_hash_entries(), btr_search_update_hash_node_on_insert(), btr_search_update_hash_on_delete(), btr_search_update_hash_on_insert(), and page_zip_reorganize().
UNIV_INLINE ulint dict_index_is_sec_or_ibuf | ( | const dict_index_t * | index | ) |
Check whether the index is a secondary index or the insert buffer tree.
index | in: index |
Referenced by btr_cur_pessimistic_update(), page_copy_rec_list_end(), and page_copy_rec_list_start().
UNIV_INLINE ulint dict_index_is_unique | ( | const dict_index_t * | index | ) |
Check whether the index is unique.
index | in: index |
Referenced by row_check_index_for_mysql(), and row_search_for_mysql().
UNIV_INTERN void dict_index_name_print | ( | FILE * | file, |
trx_t * | trx, | ||
const dict_index_t * | index | ||
) |
Displays the names of the index and the table. in: index to print
Displays the names of the index and the table.
file | in: output stream |
trx | in: transaction |
index | in: index to print |
Definition at line 4736 of file dict0dict.cc.
References dict_index_struct::name, dict_index_struct::table_name, and ut_print_name().
UNIV_INTERN void dict_index_remove_from_cache | ( | dict_table_t * | table, |
dict_index_t * | index | ||
) |
Removes an index from the cache in, own: index
Removes an index from the dictionary cache.
table | in/out: table |
index | in, own: index |
Definition at line 1708 of file dict0dict.cc.
References dict_index_struct::heap, dict_table_struct::indexes, dict_index_struct::lock, mem_heap_get_size(), dict_sys_struct::mutex, dict_index_struct::name, dict_table_struct::name, os_thread_sleep(), dict_index_struct::search_info, dict_sys_struct::size, ut_ad, ut_error, and UT_LIST_REMOVE.
UNIV_INLINE void dict_index_set_page | ( | dict_index_t * | index, |
ulint | page | ||
) |
Sets the page number of the root of index tree. in: page number
index | in/out: index |
UNIV_INLINE void dict_index_set_space | ( | dict_index_t * | index, |
ulint | space | ||
) |
Sets the space id of the root of the index tree. in: space id
index | in/out: index |
UNIV_INTERN void dict_init | ( | void | ) |
Inits the data dictionary module.
Definition at line 688 of file dict0dict.cc.
References buf_pool_get_curr_size(), dict_sys_struct::mutex, os_file_create_tmpfile(), rw_lock_create, dict_sys_struct::size, dict_sys_struct::table_hash, dict_sys_struct::table_id_hash, dict_sys_struct::table_LRU, ut_a, and UT_LIST_INIT.
UNIV_INTERN void dict_load_space_id_list | ( | void | ) |
Gets the space id of every table of the data dictionary and makes a linear list and a hash table of them to the data dictionary cache. This function can be called at database startup if we did not need to do a crash recovery. In crash recovery we must scan the space id's from the .ibd files in MySQL database directories.
UNIV_INTERN void dict_mutex_enter_for_mysql | ( | void | ) |
Reserves the dictionary system mutex for MySQL.
Definition at line 251 of file dict0dict.cc.
References dict_sys_struct::mutex.
UNIV_INTERN void dict_mutex_exit_for_mysql | ( | void | ) |
Releases the dictionary system mutex for MySQL.
Definition at line 261 of file dict0dict.cc.
References dict_sys_struct::mutex.
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. in: whether to add a 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 4549 of file dict0dict.cc.
References DICT_FOREIGN_ON_DELETE_CASCADE, DICT_FOREIGN_ON_DELETE_NO_ACTION, DICT_FOREIGN_ON_DELETE_SET_NULL, DICT_FOREIGN_ON_UPDATE_CASCADE, DICT_FOREIGN_ON_UPDATE_NO_ACTION, DICT_FOREIGN_ON_UPDATE_SET_NULL, dict_foreign_struct::foreign_col_names, dict_foreign_struct::foreign_table_name, dict_foreign_struct::id, dict_foreign_struct::referenced_col_names, dict_foreign_struct::referenced_table_name, dict_foreign_struct::type, and ut_print_name().
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. in: 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 4646 of file dict0dict.cc.
References DICT_FOREIGN_ON_DELETE_CASCADE, DICT_FOREIGN_ON_DELETE_NO_ACTION, DICT_FOREIGN_ON_DELETE_SET_NULL, DICT_FOREIGN_ON_UPDATE_CASCADE, DICT_FOREIGN_ON_UPDATE_NO_ACTION, DICT_FOREIGN_ON_UPDATE_SET_NULL, dict_foreign_struct::foreign_col_names, dict_table_struct::foreign_list, dict_sys_struct::mutex, dict_foreign_struct::n_fields, dict_foreign_struct::referenced_col_names, dict_foreign_struct::referenced_table_name, dict_foreign_struct::type, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and ut_print_name().
const char* dict_remove_db_name | ( | const char * | name | ) |
Return the end of table name where we have removed dbname and '/'.
Return the end of table name where we have removed dbname and '/'.
name | in: table name in the form dbname '/' tablename |
Definition at line 220 of file dict0dict.cc.
References ut_a.
UNIV_INTERN void dict_table_add_system_columns | ( | dict_table_t * | table, |
mem_heap_t * | heap | ||
) |
Adds system columns to a table object. in: temporary heap
Adds system columns to a table object.
table | in/out: table |
heap | in: temporary heap |
Definition at line 764 of file dict0dict.cc.
References dict_table_struct::cached, dict_table_struct::n_cols, dict_table_struct::n_def, and ut_ad.
UNIV_INTERN void dict_table_add_to_cache | ( | dict_table_t * | table, |
mem_heap_t * | heap | ||
) |
Adds a table object to the dictionary cache. in: temporary heap
Adds a table object to the dictionary cache.
table | in: table |
heap | in: temporary heap |
Definition at line 811 of file dict0dict.cc.
References dict_table_struct::big_rows, dict_table_struct::cached, dict_col_get_max_size(), HASH_INSERT, HASH_SEARCH, HASH_SEARCH_ALL, dict_table_struct::heap, dict_table_struct::id, mem_heap_get_size(), dict_sys_struct::mutex, dict_table_struct::n_def, dict_table_struct::name, dict_sys_struct::size, dict_sys_struct::table_hash, dict_sys_struct::table_id_hash, dict_sys_struct::table_LRU, ut_a, ut_ad, ut_fold_string(), ut_fold_ull(), UT_LIST_ADD_FIRST, and ut_strcmp().
UNIV_INTERN void dict_table_autoinc_initialize | ( | dict_table_t * | table, |
ib_uint64_t | value | ||
) |
Unconditionally set the autoinc counter. in: next value to assign to a row
Unconditionally set the autoinc counter.
table | in/out: table |
value | in: next value to assign to a row |
Definition at line 396 of file dict0dict.cc.
References dict_table_struct::autoinc, dict_table_struct::autoinc_mutex, and ut_ad.
UNIV_INTERN void dict_table_autoinc_lock | ( | dict_table_t * | table | ) |
Acquire the autoinc lock. in/out: table
Acquire the autoinc lock.
table | in/out: table |
Definition at line 385 of file dict0dict.cc.
References dict_table_struct::autoinc_mutex.
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.
Reads the next autoinc value (== autoinc counter value), 0 if not yet initialized.
table | in: table |
Definition at line 412 of file dict0dict.cc.
References dict_table_struct::autoinc, dict_table_struct::autoinc_mutex, and ut_ad.
UNIV_INTERN void dict_table_autoinc_unlock | ( | dict_table_t * | table | ) |
Release the autoinc lock. in/out: table
Release the autoinc lock.
table | in/out: table |
Definition at line 444 of file dict0dict.cc.
References dict_table_struct::autoinc_mutex.
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. in: value which was assigned to a row
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 426 of file dict0dict.cc.
References dict_table_struct::autoinc, dict_table_struct::autoinc_mutex, and ut_ad.
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. in: new id to set
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 1172 of file dict0dict.cc.
References HASH_DELETE, HASH_INSERT, dict_table_struct::id, dict_sys_struct::mutex, dict_sys_struct::table_id_hash, ut_ad, and ut_fold_ull().
UNIV_INLINE dict_table_t* dict_table_check_if_in_cache_low | ( | const char * | table_name | ) |
Checks if a table is in the dictionary cache.
Referenced by dict_foreign_add_to_cache().
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.
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 653 of file dict0dict.cc.
References dict_field_struct::col, dict_index_get_n_unique(), and ut_ad.
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(). in: 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 1937 of file dict0dict.cc.
References dfield_set_null(), dict_col_copy_type(), and dtuple_get_n_fields().
UNIV_INTERN void dict_table_decrement_handle_count | ( | dict_table_t * | table, |
ibool | dict_locked | ||
) |
Decrements the count of open MySQL handles to a table. in: TRUE=data dictionary locked
Decrements the count of open MySQL handles to a table.
table | in/out: table |
dict_locked | in: TRUE=data dictionary locked |
Definition at line 332 of file dict0dict.cc.
References dict_sys_struct::mutex, dict_table_struct::n_mysql_handles_opened, ut_a, and ut_ad.
UNIV_INLINE ulint dict_table_flags_to_zip_size | ( | ulint | flags | ) | const |
Extract the compressed page size from table flags.
flags | in: flags |
Referenced by fil_extend_space_to_desired_size(), and fil_space_get_zip_size().
UNIV_INTERN dict_table_t* dict_table_get | ( | const char * | table_name, |
ibool | inc_mysql_count | ||
) |
Returns a table object and optionally increment its MySQL open handle count. NOTE! This is a high-level function to be used mainly from outside the 'dict' directory. Inside this directory dict_table_get_low is usually the appropriate function.
Returns a table object and optionally increment its MySQL open handle count. NOTE! This is a high-level function to be used mainly from outside the 'dict' directory. Inside this directory dict_table_get_low is usually the appropriate function.
table_name | in: table name |
inc_mysql_count | in: whether to increment the open handle count on the table |
Definition at line 730 of file dict0dict.cc.
References dict_table_get_low(), dict_sys_struct::mutex, and dict_table_struct::n_mysql_handles_opened.
UNIV_INTERN const char* dict_table_get_col_name | ( | const dict_table_t * | table, |
ulint | col_nr | ||
) |
Returns a column's name.
Returns a column's name.
table | in: table |
col_nr | in: column number |
Definition at line 358 of file dict0dict.cc.
References dict_table_struct::col_names, and ut_ad.
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
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 2253 of file dict0dict.cc.
References dict_foreign_struct::foreign_index, dict_table_struct::foreign_list, dict_foreign_struct::referenced_index, ut_ad, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.
UNIV_INLINE ulint dict_table_get_format | ( | const dict_table_t * | table | ) |
Determine the file format of a table.
Referenced by dict_create_index_step(), dict_index_add_to_cache(), InnobaseEngine::doCreateTable(), ha_innobase::doOpen(), dtuple_convert_big_rec(), row_build(), row_undo_search_clust_to_pcur(), and trx_undo_rec_get_partial_row().
UNIV_INTERN dict_index_t* dict_table_get_index_by_max_id | ( | dict_table_t * | table, |
const char * | name, | ||
const char ** | columns, | ||
ulint | n_cols | ||
) |
Returns an index object by matching on the name and column names and if more than one index matches return the index with the max id
Returns an index object by matching on the name and column names and if more than one index matches return the index with the max id
table | in: table |
name | in: the index name to find |
columns | in: array of column names |
n_cols | in: number of columns |
Definition at line 2469 of file dict0dict.cc.
References dict_field_struct::col, dict_col_get_no(), dict_index_get_n_ordering_defined_by_user(), dict_index_struct::id, innobase_strcasecmp(), dict_index_struct::name, and ut_strcmp().
UNIV_INTERN dict_index_t* dict_table_get_index_on_name | ( | dict_table_t * | table, |
const char * | name | ||
) |
Get index by name
Get index by name
table | in: table |
name | in: name of the index to find |
Definition at line 4809 of file dict0dict.cc.
References dict_index_struct::name, and ut_strcmp().
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).
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 4870 of file dict0dict.cc.
References dict_index_struct::id, dict_index_struct::name, and ut_strcmp().
UNIV_INLINE dict_table_t* dict_table_get_low | ( | const char * | table_name | ) |
Gets a table; loads it to the dictionary cache if necessary. A low-level function.
Referenced by dict_check_tablespaces_and_store_max_id(), dict_create_add_foreigns_to_dictionary(), dict_create_or_check_foreign_constraint_tables(), dict_get_first_table_name_in_db(), dict_load_foreigns(), dict_load_table(), dict_process_sys_tables_rec(), dict_startscan_system(), dict_table_get(), dict_table_print_by_name(), row_create_table_for_mysql(), row_discard_tablespace_for_mysql(), row_drop_database_for_mysql(), row_drop_table_for_mysql(), row_drop_tables_for_mysql_in_background(), row_import_tablespace_for_mysql(), and row_rename_table_for_mysql().
UNIV_INLINE ulint dict_table_get_n_cols | ( | const dict_table_t * | table | ) |
Gets the number of all columns (also system) in a table in the dictionary cache.
Referenced by pars_insert_statement(), row_build(), row_create_prebuilt(), row_create_update_node_for_mysql(), row_upd_replace(), and trx_undo_rec_get_partial_row().
UNIV_INLINE ulint dict_table_get_n_sys_cols | ( | const dict_table_t * | table | ) |
Gets the number of system columns in a table in the dictionary cache.
UNIV_INLINE ulint dict_table_get_n_user_cols | ( | const dict_table_t * | table | ) |
Gets the number of user-defined columns in a table in the dictionary cache.
Referenced by innobase_rec_to_mysql(), and pars_insert_statement().
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.
Looks for column n position in the clustered index.
table | in: table |
n | in: column number |
Definition at line 638 of file dict0dict.cc.
UNIV_INTERN dict_table_t* dict_table_get_on_id | ( | table_id_t | table_id, |
trx_t * | trx | ||
) |
Returns a table object based on table id.
Returns a table object based on table id.
table_id | in: table id |
trx | in: transaction handle |
Definition at line 607 of file dict0dict.cc.
References trx_struct::dict_operation_lock_mode, dict_table_get_on_id_low(), dict_sys_struct::mutex, and ut_ad.
UNIV_INLINE dict_table_t* dict_table_get_on_id_low | ( | table_id_t | table_id | ) |
Returns a table object based on table id.
Referenced by dict_table_get_on_id().
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 the matching instance NULL otherwise.
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 2222 of file dict0dict.cc.
References dict_foreign_struct::referenced_index, dict_table_struct::referenced_list, ut_ad, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.
UNIV_INLINE ulint dict_table_get_sys_col_no | ( | const dict_table_t * | table, |
ulint | sys | ||
) |
Gets the given system column number of a table.
table | in: table |
UNIV_INLINE ibool dict_table_is_comp | ( | const dict_table_t * | table | ) |
Check whether the table uses the compact page format.
Referenced by btr_compress(), btr_create(), btr_cur_del_mark_set_clust_rec(), btr_cur_del_mark_set_sec_rec(), btr_cur_optimistic_insert(), btr_cur_optimistic_update(), btr_cur_parse_del_mark_set_clust_rec(), btr_cur_parse_update_in_place(), btr_cur_pessimistic_insert(), btr_cur_search_to_nth_level(), btr_cur_update_in_place(), btr_index_rec_validate(), calc_row_difference(), dict_check_tablespaces_and_store_max_id(), dict_drop_index_tree(), dict_get_first_table_name_in_db(), dict_index_add_col(), dict_index_build_data_tuple(), dict_index_build_node_ptr(), dict_index_calc_min_rec_len(), dict_index_copy_rec_order_prefix(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), dict_truncate_index_tree(), dtuple_convert_big_rec(), ibuf_insert(), ibuf_update_max_tablespace_id(), mlog_open_and_write_index(), page_copy_rec_list_end_no_locks(), page_create_zip(), page_cur_delete_rec(), page_cur_insert_rec_low(), page_cur_insert_rec_zip(), page_cur_parse_insert_rec(), page_delete_rec_list_start(), page_parse_delete_rec_list(), page_print_list(), page_validate(), rec_convert_dtuple_to_rec(), rec_convert_dtuple_to_rec_comp(), rec_copy_prefix_to_buf(), rec_copy_prefix_to_dtuple(), rec_get_n_extern_new(), rec_get_offsets_func(), rec_get_offsets_reverse(), rec_print(), row_build(), row_search_for_mysql(), row_sel_convert_mysql_key_to_innobase(), row_vers_impl_x_locked_off_kernel(), and row_vers_old_has_index_entry().
UNIV_INTERN ibool dict_table_is_referenced_by_foreign_key | ( | const dict_table_t * | table | ) |
Checks if a table is referenced by foreign keys.
Checks if a table is referenced by foreign keys.
table | in: InnoDB table |
Definition at line 2208 of file dict0dict.cc.
References dict_table_struct::referenced_list, and UT_LIST_GET_LEN.
UNIV_INTERN void dict_table_print | ( | dict_table_t * | table | ) |
Prints a table definition. in: table
Prints a table data.
table | in: table |
Definition at line 4367 of file dict0dict.cc.
References dict_sys_struct::mutex.
UNIV_INTERN void dict_table_print_by_name | ( | const char * | name | ) |
Prints a table data when we know the table name. in: table name
Prints a table data when we know the table name.
name | in: table name |
Definition at line 4380 of file dict0dict.cc.
References dict_table_get_low(), dict_sys_struct::mutex, and ut_a.
UNIV_INTERN void dict_table_print_low | ( | dict_table_t * | table | ) |
Prints a table data. in: table
Prints a table data.
table | in: table |
Definition at line 4400 of file dict0dict.cc.
References dict_table_struct::flags, dict_table_struct::foreign_list, dict_table_struct::id, dict_table_struct::indexes, dict_sys_struct::mutex, dict_table_struct::n_cols, dict_table_struct::name, dict_table_struct::referenced_list, dict_table_struct::stat_n_rows, ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_LEN, and UT_LIST_GET_NEXT.
UNIV_INTERN void dict_table_remove_from_cache | ( | dict_table_t * | table | ) |
Removes a table object from the dictionary cache. in, own: table
Removes a table object from the dictionary cache.
table | in, own: table |
Definition at line 1196 of file dict0dict.cc.
References dict_table_struct::foreign_list, HASH_DELETE, dict_table_struct::heap, dict_table_struct::id, dict_table_struct::indexes, mem_heap_get_size(), dict_sys_struct::mutex, dict_table_struct::name, dict_foreign_struct::referenced_index, dict_table_struct::referenced_list, dict_foreign_struct::referenced_table, dict_sys_struct::size, dict_sys_struct::table_hash, dict_sys_struct::table_id_hash, dict_sys_struct::table_LRU, ut_ad, ut_fold_string(), ut_fold_ull(), UT_LIST_GET_FIRST, UT_LIST_GET_LAST, UT_LIST_GET_NEXT, UT_LIST_REMOVE, and ut_print_name().
UNIV_INTERN ibool dict_table_rename_in_cache | ( | dict_table_t * | table, |
const char * | new_name, | ||
ibool | rename_also_foreigns | ||
) |
Renames a table object.
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 939 of file dict0dict.cc.
References dict_table_struct::cached, dict_table_struct::dir_path_of_temp_table, dict_table_struct::foreign_list, dict_foreign_struct::foreign_table_name, HASH_DELETE, HASH_INSERT, HASH_SEARCH, dict_foreign_struct::heap, dict_foreign_struct::id, mem_free, mem_heap_alloc(), mem_strdup(), dict_sys_struct::mutex, dict_table_struct::name, dict_foreign_struct::referenced_index, dict_table_struct::referenced_list, dict_foreign_struct::referenced_table, dict_foreign_struct::referenced_table_name, dict_sys_struct::size, dict_table_struct::space, dict_sys_struct::table_hash, dict_index_struct::table_name, ut_a, ut_ad, ut_error, ut_fold_string(), UT_LIST_GET_FIRST, UT_LIST_GET_LAST, UT_LIST_GET_NEXT, UT_LIST_INIT, ut_memcpy(), ut_print_filename(), ut_print_name(), ut_print_timestamp(), ut_realloc(), ut_strcmp(), and ut_strlen().
UNIV_INTERN void dict_table_replace_index_in_foreign_list | ( | dict_table_t * | table, |
dict_index_t * | index, | ||
const trx_t * | trx | ||
) |
Replace the index in the foreign key list that matches this index's definition with an equivalent index. in: transaction handle
Replace the index passed in with another equivalent index in the tables foreign key list.
table | in/out: table |
index | in: index to be replaced |
trx | in: transaction handle |
Definition at line 4836 of file dict0dict.cc.
References dict_foreign_struct::foreign_index, dict_table_struct::foreign_list, ut_a, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.
UNIV_INLINE void dict_table_set_format | ( | dict_table_t * | table, |
ulint | format | ||
) |
Set the file format of a table. in: file format version
table | in/out: table |
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. in: RW_S_LATCH or RW_X_LATCH
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 278 of file dict0dict.cc.
References rw_lock_s_lock, ut_ad, and ut_error.
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() in: RW_S_LATCH or RW_X_LATCH
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 305 of file dict0dict.cc.
UNIV_INLINE void dict_table_x_lock_indexes | ( | dict_table_t * | table | ) |
Obtain exclusive locks on all index trees of the table. This is to prevent accessing index trees while InnoDB is updating internal metadata for operations such as truncate tables. in: table
Referenced by row_truncate_table_for_mysql().
UNIV_INLINE void dict_table_x_unlock_indexes | ( | dict_table_t * | table | ) |
Release the exclusive locks on all index tree. in: table
Referenced by row_truncate_table_for_mysql().
UNIV_INLINE ulint dict_table_zip_size | ( | const dict_table_t * | table | ) |
Check whether the table uses the compressed compact page format.
Referenced by btr_compress(), btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_pessimistic_insert(), btr_cur_search_to_nth_level(), btr_discard_page(), btr_free_externally_stored_field(), btr_page_alloc(), btr_store_big_rec_extern_fields(), dtuple_convert_big_rec(), row_build(), row_upd_index_replace_new_col_vals(), row_upd_index_replace_new_col_vals_index_pos(), and row_upd_replace().
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.
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 199 of file dict0dict.cc.
References ut_a.
UNIV_INTERN void dict_update_statistics | ( | dict_table_t * | table, |
ibool | only_calc_if_missing_stats | ||
) |
Calculates new estimates for table and index statistics. The statistics are used in query optimization. in: only update/recalc the stats if they have not been initialized yet, otherwise do nothing
Calculates new estimates for table and index statistics. The statistics are used in query optimization.
table | in/out: table |
only_calc_if_missing_stats | in: only update/recalc the stats if they have not been initialized yet, otherwise do nothing |
Definition at line 4233 of file dict0dict.cc.
References dict_index_get_n_unique(), dict_index_is_clust(), dict_table_struct::ibd_file_missing, dict_table_struct::name, SRV_FORCE_NO_IBUF_MERGE, SRV_FORCE_NO_LOG_REDO, dict_table_struct::stat_clustered_index_size, dict_index_struct::stat_index_size, dict_table_struct::stat_initialized, dict_table_struct::stat_modified_counter, dict_index_struct::stat_n_diff_key_vals, dict_index_struct::stat_n_leaf_pages, dict_table_struct::stat_n_rows, dict_table_struct::stat_sum_of_other_index_sizes, and ut_print_timestamp().
dummy index for ROW_FORMAT=COMPACT supremum and infimum records
Definition at line 35 of file dict0dict.cc.
dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records
Definition at line 33 of file dict0dict.cc.
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_struct::dict_operation_lock_mode
Definition at line 72 of file dict0dict.cc.
the dictionary system
Definition at line 62 of file dict0dict.cc.