diff options
Diffstat (limited to 'storage/xtradb/include/dict0dict.h')
-rw-r--r-- | storage/xtradb/include/dict0dict.h | 119 |
1 files changed, 88 insertions, 31 deletions
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index d18b3ecb1b0..d99177e0330 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -75,8 +75,8 @@ UNIV_INTERN dict_table_t* dict_table_get_on_id( /*=================*/ - dulint table_id, /*!< in: table id */ - trx_t* trx); /*!< in: transaction handle */ + table_id_t table_id, /*!< in: table id */ + trx_t* trx); /*!< in: transaction handle */ /********************************************************************//** Decrements the count of open MySQL handles to a table. */ UNIV_INTERN @@ -102,6 +102,33 @@ void dict_load_space_id_list(void); /*=========================*/ /*********************************************************************//** +Gets the minimum number of bytes per character. +@return minimum multi-byte char size, in bytes */ +UNIV_INLINE +ulint +dict_col_get_mbminlen( +/*==================*/ + const dict_col_t* col); /*!< in: column */ +/*********************************************************************//** +Gets the maximum number of bytes per character. +@return maximum multi-byte char size, in bytes */ +UNIV_INLINE +ulint +dict_col_get_mbmaxlen( +/*==================*/ + const dict_col_t* col); /*!< in: column */ +/*********************************************************************//** +Sets the minimum and maximum number of bytes per character. */ +UNIV_INLINE +void +dict_col_set_mbminmaxlen( +/*=====================*/ + dict_col_t* col, /*!< in/out: column */ + ulint mbminlen, /*!< in: minimum multi-byte + character size, in bytes */ + ulint mbmaxlen); /*!< in: minimum multi-byte + character size, in bytes */ +/*********************************************************************//** Gets the column data type. */ UNIV_INLINE void @@ -109,6 +136,19 @@ dict_col_copy_type( /*===============*/ const dict_col_t* col, /*!< in: column */ dtype_t* type); /*!< out: data type */ +/**********************************************************************//** +Determine bytes of column prefix to be stored in the undo log. Please +note if the table format is UNIV_FORMAT_A (< DICT_TF_FORMAT_ZIP), no prefix +needs to be stored in the undo log. +@return bytes of column prefix to be stored in the undo log */ +UNIV_INLINE +ulint +dict_max_field_len_store_undo( +/*==========================*/ + dict_table_t* table, /*!< in: table */ + const dict_col_t* col); /*!< in: column which index prefix + is based on */ + #endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /*********************************************************************//** @@ -277,7 +317,7 @@ void dict_table_change_id_in_cache( /*==========================*/ dict_table_t* table, /*!< in/out: table object already in cache */ - dulint new_id);/*!< in: new id to set */ + table_id_t new_id);/*!< in: new id to set */ /**********************************************************************//** 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. @@ -318,7 +358,8 @@ void dict_table_replace_index_in_foreign_list( /*=====================================*/ dict_table_t* table, /*!< in/out: table */ - dict_index_t* index); /*!< in: index to be replaced */ + dict_index_t* index, /*!< in: index to be replaced */ + const trx_t* trx); /*!< in: transaction handle */ /*********************************************************************//** 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 @@ -397,7 +438,7 @@ dict_index_t* dict_index_get_on_id_low( /*=====================*/ dict_table_t* table, /*!< in: table */ - dulint index_id); /*!< in: index id */ + index_id_t index_id); /*!< in: index id */ /**********************************************************************//** Checks if a table is in the dictionary cache. @return table, NULL if not found */ @@ -413,6 +454,18 @@ function. @return table, NULL if not found */ UNIV_INLINE dict_table_t* +dict_table_get_low_ignore_err( +/*===========================*/ + const char* table_name, /*!< in: table name */ + dict_err_ignore_t + ignore_err); /*!< in: error to be ignored when + loading a table definition */ +/**********************************************************************//** +Gets a table; loads it to the dictionary cache if necessary. A low-level +function. +@return table, NULL if not found */ +UNIV_INLINE +dict_table_t* dict_table_get_low( /*===============*/ const char* table_name); /*!< in: table name */ @@ -423,7 +476,7 @@ UNIV_INLINE dict_table_t* dict_table_get_on_id_low( /*=====================*/ - dulint table_id); /*!< in: table id */ + table_id_t table_id); /*!< in: table id */ /**********************************************************************//** Find an index that is equivalent to the one passed in and is not marked for deletion. @@ -726,7 +779,7 @@ UNIV_INTERN dict_index_t* dict_index_find_on_id_low( /*======================*/ - dulint id); /*!< in: index id */ + index_id_t id); /*!< in: index id */ /**********************************************************************//** Adds an index to the dictionary cache. @return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */ @@ -917,7 +970,7 @@ UNIV_INTERN dict_index_t* dict_index_get_if_in_cache_low( /*===========================*/ - dulint index_id); /*!< in: index id */ + index_id_t index_id); /*!< in: index id */ #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /**********************************************************************//** Returns an index object if it is found in the dictionary cache. @@ -926,7 +979,7 @@ UNIV_INTERN dict_index_t* dict_index_get_if_in_cache( /*=======================*/ - dulint index_id); /*!< in: index id */ + index_id_t index_id); /*!< in: index id */ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #ifdef UNIV_DEBUG /**********************************************************************//** @@ -1053,21 +1106,21 @@ Calculates new estimates for table and index statistics. The statistics are used in query optimization. */ UNIV_INTERN void -dict_update_statistics_low( -/*=======================*/ +dict_update_statistics( +/*===================*/ dict_table_t* table, /*!< in/out: table */ - ibool has_dict_mutex, /*!< in: TRUE if the caller has the - dictionary mutex */ + ibool only_calc_if_missing_stats, /*!< in: only + update/recalc the stats if they have + not been initialized yet, otherwise + do nothing */ ibool sync); /*********************************************************************//** -Calculates new estimates for table and index statistics. The statistics -are used in query optimization. */ +*/ UNIV_INTERN -void -dict_update_statistics( -/*===================*/ - dict_table_t* table, /*!< in/out: table */ - ibool sync); +ibool +dict_is_older_statistics( +/*=====================*/ + dict_index_t* index); /********************************************************************//** Reserves the dictionary system mutex for MySQL. */ UNIV_INTERN @@ -1081,21 +1134,25 @@ void dict_mutex_exit_for_mysql(void); /*===========================*/ /**********************************************************************//** -Lock the appropriate mutex to protect index->stat_n_diff_key_vals[]. -index->id is used to pick the right mutex and it should not change -before dict_index_stat_mutex_exit() is called on this index. */ +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. */ UNIV_INTERN void -dict_index_stat_mutex_enter( -/*========================*/ - const dict_index_t* index); /*!< in: index */ +dict_table_stats_lock( +/*==================*/ + const dict_table_t* table, /*!< in: table */ + ulint latch_mode); /*!< in: RW_S_LATCH or + RW_X_LATCH */ /**********************************************************************//** -Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */ +Unlock the latch that has been locked by dict_table_stats_lock() */ UNIV_INTERN void -dict_index_stat_mutex_exit( -/*=======================*/ - const dict_index_t* index); /*!< in: index */ +dict_table_stats_unlock( +/*====================*/ + const dict_table_t* table, /*!< in: table */ + ulint latch_mode); /*!< in: RW_S_LATCH or + RW_X_LATCH */ /********************************************************************//** Checks if the database name in two table names is the same. @return TRUE if same db name */ @@ -1159,7 +1216,7 @@ struct dict_sys_struct{ 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; + row_id_t 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 |