#include "univ.i"
#include "dict0types.h"
#include "data0type.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "btr0types.h"
#include "lock0types.h"
#include "que0types.h"
#include "sync0rw.h"
#include "ut0mem.h"
#include "ut0lst.h"
#include "ut0rnd.h"
#include "ut0byte.h"
#include "hash0hash.h"
#include "trx0types.h"
#include "dict0mem.ic"
Go to the source code of this file.
Classes | |
struct | dict_col_struct |
struct | dict_field_struct |
struct | dict_index_struct |
struct | dict_foreign_struct |
struct | dict_table_struct |
Defines | |
#define | DICT_TABLE_ORDINARY 1 |
#define | DICT_TF_BITS 6 |
#define | DICT_FK_MAX_RECURSIVE_LOAD 255 |
#define | FK_MAX_CASCADE_DEL 255 |
#define | DICT_MAX_INDEX_COL_LEN REC_MAX_INDEX_COL_LEN |
DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed prefix length). | |
#define | DICT_CLUSTERED 1 |
#define | DICT_UNIQUE 2 |
#define | DICT_UNIVERSAL 4 |
#define | DICT_IBUF 8 |
#define | DICT_TF_COMPACT 1 |
#define | DICT_TF_ZSSIZE_SHIFT 1 |
#define | DICT_TF_ZSSIZE_MASK (15 << DICT_TF_ZSSIZE_SHIFT) |
#define | DICT_TF_ZSSIZE_MAX (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 1) |
#define | DICT_TF_FORMAT_SHIFT 5 |
#define | DICT_TF_FORMAT_MASK ((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT) |
#define | DICT_TF_FORMAT_51 0 |
#define | DICT_TF_FORMAT_ZIP 1 |
#define | DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP |
#define | DICT_TF_FORMAT_MIN DICT_TF_FORMAT_51 |
#define | DICT_TF2_SHIFT DICT_TF_BITS |
Additional table flags. | |
#define | DICT_TF2_TEMPORARY 1 |
#define | DICT_TF2_BITS (DICT_TF2_SHIFT + 1) |
#define | DICT_FOREIGN_ON_DELETE_CASCADE 1 |
#define | DICT_FOREIGN_ON_DELETE_SET_NULL 2 |
#define | DICT_FOREIGN_ON_UPDATE_CASCADE 4 |
#define | DICT_FOREIGN_ON_UPDATE_SET_NULL 8 |
#define | DICT_FOREIGN_ON_DELETE_NO_ACTION 16 |
#define | DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 |
Functions | |
UNIV_INTERN dict_table_t * | dict_mem_table_create (const char *name, ulint space, ulint n_cols, ulint flags) |
UNIV_INTERN void | dict_mem_table_free (dict_table_t *table) |
UNIV_INTERN void | dict_mem_table_add_col (dict_table_t *table, mem_heap_t *heap, const char *name, ulint mtype, ulint prtype, ulint len) |
UNIV_INTERN void | dict_mem_fill_column_struct (dict_col_t *column, ulint col_pos, ulint mtype, ulint prtype, ulint col_len) |
UNIV_INLINE void | dict_mem_fill_index_struct (dict_index_t *index, mem_heap_t *heap, const char *table_name, const char *index_name, ulint space, ulint type, ulint n_fields) |
UNIV_INTERN dict_index_t * | dict_mem_index_create (const char *table_name, const char *index_name, ulint space, ulint type, ulint n_fields) |
UNIV_INTERN void | dict_mem_index_add_field (dict_index_t *index, const char *name, ulint prefix_len) |
UNIV_INTERN void | dict_mem_index_free (dict_index_t *index) |
UNIV_INTERN dict_foreign_t * | dict_mem_foreign_create (void) |
#define DICT_CLUSTERED 1 |
Type flags of an index: OR'ing of the flags is allowed to define a combination of types clustered index
Definition at line 51 of file dict0mem.h.
Referenced by btr_create(), create_clustered_index_when_no_primary(), create_index(), dict_boot(), fsp_header_init(), ibuf_init_at_db_start(), mlog_parse_index(), and pars_create_index().
#define DICT_FK_MAX_RECURSIVE_LOAD 255 |
Tables could be chained together with Foreign key constraint. When first load the parent table, we would load all of its descedents. This could result in rescursive calls and out of stack error eventually. DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads, when exceeded, the child table will not be loaded. It will be loaded when the foreign constraint check needs to be run.
Definition at line 126 of file dict0mem.h.
Referenced by convert_error_code_to_mysql(), and row_mysql_handle_errors().
#define DICT_FOREIGN_ON_DELETE_CASCADE 1 |
The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that a foreign key constraint is enforced, therefore RESTRICT just means no flag ON DELETE CASCADE
Definition at line 422 of file dict0mem.h.
Referenced by dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16 |
ON DELETE NO ACTION
Definition at line 426 of file dict0mem.h.
Referenced by dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().
#define DICT_FOREIGN_ON_DELETE_SET_NULL 2 |
ON UPDATE SET NULL
Definition at line 423 of file dict0mem.h.
Referenced by dict_foreign_add_to_cache(), dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().
#define DICT_FOREIGN_ON_UPDATE_CASCADE 4 |
ON DELETE CASCADE
Definition at line 424 of file dict0mem.h.
Referenced by dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 |
ON UPDATE NO ACTION
Definition at line 427 of file dict0mem.h.
Referenced by dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().
#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8 |
ON UPDATE SET NULL
Definition at line 425 of file dict0mem.h.
Referenced by dict_foreign_add_to_cache(), dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().
#define DICT_IBUF 8 |
insert buffer tree
Definition at line 55 of file dict0mem.h.
Referenced by btr_create(), fsp_header_init(), and ibuf_init_at_db_start().
#define DICT_MAX_INDEX_COL_LEN REC_MAX_INDEX_COL_LEN |
DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed prefix length).
It is set to 3*256, so that one can create a column prefix index on 256 characters of a TEXT or VARCHAR column also in the UTF-8 charset. In that charset, a character may take at most 3 bytes. This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data files would be at risk!
Definition at line 292 of file dict0mem.h.
Referenced by dict_index_add_col(), dtuple_convert_back_big_rec(), dtuple_convert_big_rec(), and row_create_index_for_mysql().
#define DICT_TABLE_ORDINARY 1 |
Types for a table object ordinary table
Definition at line 59 of file dict0mem.h.
#define DICT_TF2_BITS (DICT_TF2_SHIFT + 1) |
Total number of bits in table->flags.
Definition at line 115 of file dict0mem.h.
Referenced by dict_load_table_low(), and dict_mem_table_create().
#define DICT_TF2_SHIFT DICT_TF_BITS |
Additional table flags.
These flags will be stored in SYS_TABLES.MIX_LEN. All unused flags will be written as 0. The column may contain garbage for tables created with old versions of InnoDB that only implemented ROW_FORMAT=REDUNDANT. Shift value for table->flags.
Definition at line 110 of file dict0mem.h.
Referenced by dict_load_table(), dict_load_table_low(), InnobaseEngine::doCreateTable(), and row_drop_table_for_mysql().
#define DICT_TF2_TEMPORARY 1 |
TRUE for tables from CREATE TEMPORARY TABLE.
Definition at line 113 of file dict0mem.h.
Referenced by dict_check_tablespaces_and_store_max_id(), dict_load_table(), InnobaseEngine::doCreateTable(), row_drop_table_for_mysql(), and row_mysql_drop_temp_tables().
#define DICT_TF_BITS 6 |
number of flag bits
Definition at line 97 of file dict0mem.h.
Referenced by dict_load_table(), fil_create_new_single_table_tablespace(), fil_open_single_table_tablespace(), and fil_space_create().
#define DICT_TF_COMPACT 1 |
Table flags. All unused bits must be 0.
Definition at line 68 of file dict0mem.h.
Referenced by convert_error_code_to_mysql(), dict_ind_init(), dict_load_table(), dict_load_table_low(), InnobaseEngine::doCreateTable(), fil_create_new_single_table_tablespace(), fil_open_single_table_tablespace(), fil_space_create(), fsp_header_init_fields(), mlog_parse_index(), and row_import_tablespace_for_mysql().
#define DICT_TF_FORMAT_51 0 |
InnoDB/MySQL up to 5.1
Definition at line 86 of file dict0mem.h.
Referenced by dict_index_add_to_cache().
#define DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP |
Maximum supported file format
Definition at line 91 of file dict0mem.h.
Referenced by innobase_file_format_name_lookup(), innobase_file_format_validate_and_set(), innobase_init(), innodb_file_format_max_validate(), innodb_file_format_name_validate(), trx_sys_file_format_max_check(), trx_sys_file_format_max_set(), and trx_sys_file_format_max_upgrade().
#define DICT_TF_FORMAT_MIN DICT_TF_FORMAT_51 |
Minimum supported file format
Definition at line 94 of file dict0mem.h.
Referenced by innobase_init(), trx_sys_file_format_init(), trx_sys_file_format_max_check(), and trx_sys_file_format_tag_init().
#define DICT_TF_FORMAT_SHIFT 5 |
File format
Definition at line 83 of file dict0mem.h.
Referenced by InnobaseEngine::doCreateTable().
#define DICT_TF_FORMAT_ZIP 1 |
InnoDB plugin for 5.1: compressed tables, new BLOB treatment
Definition at line 87 of file dict0mem.h.
Referenced by dict_create_index_step(), dict_index_add_to_cache(), InnobaseEngine::doCreateTable(), dtuple_convert_big_rec(), row_build(), row_undo_search_clust_to_pcur(), and trx_undo_rec_get_partial_row().
#define DICT_TF_ZSSIZE_SHIFT 1 |
Compressed page size (0=uncompressed, up to 15 compressed sizes)
Definition at line 76 of file dict0mem.h.
Referenced by InnobaseEngine::doCreateTable(), and fil_create_new_single_table_tablespace().
#define DICT_UNIQUE 2 |
unique index
Definition at line 52 of file dict0mem.h.
Referenced by create_index(), dict_boot(), and pars_create_index().
#define DICT_UNIVERSAL 4 |
index which can contain records from any other index
Definition at line 53 of file dict0mem.h.
Referenced by btr_index_rec_validate(), cmp_rec_rec_with_match(), dict_index_add_to_cache(), dict_index_build_node_ptr(), dict_index_copy_rec_order_prefix(), dict_index_copy_types(), fsp_header_init(), ibuf_init_at_db_start(), and row_build_index_entry().
#define FK_MAX_CASCADE_DEL 255 |
Similarly, when tables are chained together with foreign key constraints with on cascading delete/update clause, delete from parent table could result in recursive cascading calls. This defines the maximum number of such cascading deletes/updates allowed. When exceeded, the delete from parent table will fail, and user has to drop excessive foreign constraint before proceeds.
Definition at line 134 of file dict0mem.h.
Referenced by row_update_cascade_for_mysql().
UNIV_INTERN void dict_mem_fill_column_struct | ( | dict_col_t * | column, |
ulint | col_pos, | ||
ulint | mtype, | ||
ulint | prtype, | ||
ulint | col_len | ||
) |
This function populates a dict_col_t memory structure with supplied information. in: column length
This function populates a dict_col_t memory structure with supplied information.
column | out: column struct to be filled |
col_pos | in: column position |
mtype | in: main data type |
prtype | in: precise type |
col_len | in: column length |
Definition at line 215 of file dict0mem.cc.
References dict_col_set_mbminmaxlen(), dtype_get_mblen(), dict_col_struct::ind, dict_col_struct::len, dict_col_struct::mtype, dict_col_struct::ord_part, and dict_col_struct::prtype.
UNIV_INLINE void dict_mem_fill_index_struct | ( | dict_index_t * | index, |
mem_heap_t * | heap, | ||
const char * | table_name, | ||
const char * | index_name, | ||
ulint | space, | ||
ulint | type, | ||
ulint | n_fields | ||
) |
This function poplulates a dict_index_t index memory structure with supplied information. in: number of fields
index | out: index to be filled |
heap | in: memory heap |
table_name | in: table name |
index_name | in: index name |
space | in: space where the index tree is placed, ignored if the index is of the clustered type |
type | in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed |
Referenced by dict_load_index_low(), and dict_mem_index_create().
UNIV_INTERN dict_foreign_t* dict_mem_foreign_create | ( | void | ) |
Creates and initializes a foreign constraint memory object.
Definition at line 275 of file dict0mem.cc.
References dict_foreign_struct::heap, mem_heap_create, and mem_heap_zalloc().
UNIV_INTERN void dict_mem_index_add_field | ( | dict_index_t * | index, |
const char * | name, | ||
ulint | prefix_len | ||
) |
Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied by the column name may be released only after publishing the index. in: 0 or the column prefix length in a MySQL index like INDEX (textcol(25))
Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied by the column name may be released only after publishing the index.
index | in: index |
name | in: column name |
prefix_len | in: 0 or the column prefix length in a MySQL index like INDEX (textcol(25)) |
Definition at line 296 of file dict0mem.cc.
References dict_index_struct::n_def, dict_field_struct::name, dict_field_struct::prefix_len, and ut_ad.
UNIV_INTERN dict_index_t* dict_mem_index_create | ( | const char * | table_name, |
const char * | index_name, | ||
ulint | space, | ||
ulint | type, | ||
ulint | n_fields | ||
) |
Creates an index memory object.
Creates an index memory object.
table_name | in: table name |
index_name | in: index name |
space | in: space where the index tree is placed, ignored if the index is of the clustered type |
type | in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed |
n_fields | in: number of fields |
Definition at line 245 of file dict0mem.cc.
References dict_mem_fill_index_struct(), mem_heap_create, mem_heap_zalloc(), and ut_ad.
UNIV_INTERN void dict_mem_index_free | ( | dict_index_t * | index | ) |
Frees an index memory object. in: index
Frees an index memory object.
index | in: index |
Definition at line 321 of file dict0mem.cc.
References dict_index_struct::heap, mem_heap_free, and ut_ad.
UNIV_INTERN void dict_mem_table_add_col | ( | dict_table_t * | table, |
mem_heap_t * | heap, | ||
const char * | name, | ||
ulint | mtype, | ||
ulint | prtype, | ||
ulint | len | ||
) |
Adds a column definition to a table. in: precision
Adds a column definition to a table.
table | in: table |
heap | in: temporary memory heap, or NULL |
name | in: column name, or NULL |
mtype | in: main datatype |
prtype | in: precise type |
len | in: precision |
Definition at line 172 of file dict0mem.cc.
References dict_table_struct::col_names, dict_table_struct::heap, mem_heap_zalloc(), dict_table_struct::n_cols, dict_table_struct::n_def, and ut_ad.
UNIV_INTERN dict_table_t* dict_mem_table_create | ( | const char * | name, |
ulint | space, | ||
ulint | n_cols, | ||
ulint | flags | ||
) |
Creates a table memory object.
Creates a table memory object.
name | in: table name |
space | in: space where the clustered index of the table is placed; this parameter is ignored if the table is made a member of a cluster |
n_cols | in: number of columns |
flags | in: table flags |
Definition at line 53 of file dict0mem.cc.
References dict_table_struct::autoinc, dict_table_struct::autoinc_lock, dict_table_struct::autoinc_mutex, dict_table_struct::cols, DICT_TF2_BITS, dict_table_struct::flags, dict_table_struct::heap, lock_get_size(), mem_heap_alloc(), mem_heap_create, mem_heap_zalloc(), dict_table_struct::n_cols, dict_table_struct::n_waiting_or_granted_auto_inc_locks, dict_table_struct::name, dict_table_struct::space, ut_a, ut_ad, ut_d, and ut_malloc().
UNIV_INTERN void dict_mem_table_free | ( | dict_table_t * | table | ) |
Free a table memory object. in: table
Free a table memory object.
table | in: table |
Definition at line 105 of file dict0mem.cc.
References dict_table_struct::autoinc_mutex, dict_table_struct::cached, dict_table_struct::heap, mem_heap_free, dict_table_struct::name, ut_ad, ut_d, and ut_free().