📄 dict0dict.h
字号:
/************************************************************************Returns the position of a system column in an index. */UNIV_INLINEulintdict_index_get_sys_col_pos(/*=======================*/ /* out: position, ULINT_UNDEFINED if not contained */ dict_index_t* index, /* in: index */ ulint type); /* in: DATA_ROW_ID, ... *//***********************************************************************Adds a column to index. */voiddict_index_add_col(/*===============*/ dict_index_t* index, /* in: index */ dict_col_t* col, /* in: column */ ulint order, /* in: order criterion */ ulint prefix_len); /* in: column prefix length *//***********************************************************************Copies types of fields contained in index to tuple. */voiddict_index_copy_types(/*==================*/ dtuple_t* tuple, /* in: data tuple */ dict_index_t* index, /* in: index */ ulint n_fields); /* in: number of field types to copy *//*************************************************************************Gets the index tree where the index is stored. */UNIV_INLINEdict_tree_t*dict_index_get_tree(/*================*/ /* out: index tree */ dict_index_t* index); /* in: index *//*************************************************************************Gets the field order criterion. */UNIV_INLINEulintdict_field_get_order(/*=================*/ dict_field_t* field);/*************************************************************************Gets the field column. */UNIV_INLINEdict_col_t*dict_field_get_col(/*===============*/ dict_field_t* field);/**************************************************************************Creates an index tree struct. */dict_tree_t*dict_tree_create(/*=============*/ /* out, own: created tree */ dict_index_t* index, /* in: the index for which to create: in the case of a mixed tree, this should be the index of the cluster object */ ulint page_no);/* in: root page number of the index *//**************************************************************************Frees an index tree struct. */voiddict_tree_free(/*===========*/ dict_tree_t* tree); /* in, own: index tree *//**************************************************************************In an index tree, finds the index corresponding to a record in the tree. */dict_index_t*dict_tree_find_index(/*=================*/ /* out: index */ dict_tree_t* tree, /* in: index tree */ rec_t* rec); /* in: record for which to find correct index *//**************************************************************************In an index tree, finds the index corresponding to a dtuple which is usedin a search to a tree. */dict_index_t*dict_tree_find_index_for_tuple(/*===========================*/ /* out: index; NULL if the tuple does not contain the mix id field in a mixed tree */ dict_tree_t* tree, /* in: index tree */ dtuple_t* tuple); /* in: tuple for which to find index *//***********************************************************************Checks if a table which is a mixed cluster member owns a record. */ibooldict_is_mixed_table_rec(/*====================*/ /* out: TRUE if the record belongs to this table */ dict_table_t* table, /* in: table in a mixed cluster */ rec_t* rec); /* in: user record in the clustered index *//**************************************************************************Returns an index object if it is found in the dictionary cache. */dict_index_t*dict_index_get_if_in_cache(/*=======================*/ /* out: index, NULL if not found */ dulint index_id); /* in: index id *//**************************************************************************Checks that a tuple has n_fields_cmp value in a sensible range, so thatno comparison can occur with the page number field in a node pointer. */ibooldict_tree_check_search_tuple(/*=========================*/ /* out: TRUE if ok */ dict_tree_t* tree, /* in: index tree */ dtuple_t* tuple); /* in: tuple used in a search *//**************************************************************************Builds a node pointer out of a physical record and a page number. */dtuple_t*dict_tree_build_node_ptr(/*=====================*/ /* out, own: node pointer */ dict_tree_t* tree, /* in: index tree */ rec_t* rec, /* in: record for which to build node pointer */ ulint page_no,/* in: page number to put in node pointer */ mem_heap_t* heap, /* in: memory heap where pointer created */ ulint level); /* in: level of rec in tree: 0 means leaf level *//**************************************************************************Copies an initial segment of a physical record, long enough to specify anindex entry uniquely. */rec_t*dict_tree_copy_rec_order_prefix(/*============================*/ /* out: pointer to the prefix record */ dict_tree_t* tree, /* in: index tree */ rec_t* rec, /* in: record for which to copy prefix */ ulint* n_fields,/* out: number of fields copied */ byte** buf, /* in/out: memory buffer for the copied prefix, or NULL */ ulint* buf_size);/* in/out: buffer size *//**************************************************************************Builds a typed data tuple out of a physical record. */dtuple_t*dict_tree_build_data_tuple(/*=======================*/ /* out, own: data tuple */ dict_tree_t* tree, /* in: index tree */ rec_t* rec, /* in: record for which to build data tuple */ ulint n_fields,/* in: number of data fields */ mem_heap_t* heap); /* in: memory heap where tuple created *//*************************************************************************Gets the space id of the root of the index tree. */UNIV_INLINEulintdict_tree_get_space(/*================*/ /* out: space id */ dict_tree_t* tree); /* in: tree *//*************************************************************************Sets the space id of the root of the index tree. */UNIV_INLINEvoiddict_tree_set_space(/*================*/ dict_tree_t* tree, /* in: tree */ ulint space); /* in: space id *//*************************************************************************Gets the page number of the root of the index tree. */UNIV_INLINEulintdict_tree_get_page(/*===============*/ /* out: page number */ dict_tree_t* tree); /* in: tree *//*************************************************************************Sets the page number of the root of index tree. */UNIV_INLINEvoiddict_tree_set_page(/*===============*/ dict_tree_t* tree, /* in: tree */ ulint page); /* in: page number *//*************************************************************************Gets the type of the index tree. */UNIV_INLINEulintdict_tree_get_type(/*===============*/ /* out: type */ dict_tree_t* tree); /* in: tree *//*************************************************************************Gets the read-write lock of the index tree. */UNIV_INLINErw_lock_t*dict_tree_get_lock(/*===============*/ /* out: read-write lock */ dict_tree_t* tree); /* in: tree *//************************************************************************Returns free space reserved for future updates of records. This isrelevant only in the case of many consecutive inserts, as updateswhich make the records bigger might fragment the index. */UNIV_INLINEulintdict_tree_get_space_reserve(/*========================*/ /* out: number of free bytes on page, reserved for updates */ dict_tree_t* tree); /* in: a tree *//*************************************************************************Calculates the minimum record length in an index. */ulintdict_index_calc_min_rec_len(/*========================*/ dict_index_t* index); /* in: index *//*************************************************************************Calculates new estimates for table and index statistics. The statisticsare used in query optimization. */voiddict_update_statistics_low(/*=======================*/ dict_table_t* table, /* in: table */ ibool has_dict_mutex);/* in: TRUE if the caller has the dictionary mutex */ /*************************************************************************Calculates new estimates for table and index statistics. The statisticsare used in query optimization. */voiddict_update_statistics(/*===================*/ dict_table_t* table); /* in: table *//************************************************************************Reserves the dictionary system mutex for MySQL. */voiddict_mutex_enter_for_mysql(void);/*============================*//************************************************************************Releases the dictionary system mutex for MySQL. */voiddict_mutex_exit_for_mysql(void);/*===========================*//************************************************************************Checks if the database name in two table names is the same. */ibooldict_tables_have_same_db(/*=====================*/ /* out: TRUE if same db name */ const char* name1, /* in: table name in the form dbname '/' tablename */ const char* name2); /* in: table name in the form dbname '/' tablename *//*************************************************************************Scans from pointer onwards. Stops if is at the start of a copy of'string' where characters are compared without case sensitivity. Stopsalso at '\0'. */const char*dict_scan_to(/*=========*/ /* out: scanned up to this */ const char* ptr, /* in: scan from */ const char* string);/* in: look for this *//* Buffers for storing detailed information about the latest foreign keyand unique key errors */extern FILE* dict_foreign_err_file;extern mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */extern dict_sys_t* dict_sys; /* the dictionary system */extern rw_lock_t dict_operation_lock;/* Dictionary system struct */struct dict_sys_struct{ mutex_t mutex; /* mutex protecting the data dictionary; protects also the disk-based dictionary system tables; this mutex serializes CREATE TABLE and DROP TABLE, as well as reading the dictionary data for a table from system tables */ dulint row_id; /* the next row id to assign; NOTE that at a checkpoint this must be written to the dict system header and flushed to a file; in recovery this must be derived from the log records */ hash_table_t* table_hash; /* hash table of the tables, based on name */ hash_table_t* table_id_hash; /* hash table of the tables, based on id */ hash_table_t* col_hash; /* hash table of the columns */ UT_LIST_BASE_NODE_T(dict_table_t) table_LRU; /* LRU list of tables */ ulint size; /* varying space in bytes occupied by the data dictionary table and index objects */ dict_table_t* sys_tables; /* SYS_TABLES table */ dict_table_t* sys_columns; /* SYS_COLUMNS table */ dict_table_t* sys_indexes; /* SYS_INDEXES table */ dict_table_t* sys_fields; /* SYS_FIELDS table */};#ifndef UNIV_NONINL#include "dict0dict.ic"#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -