63#define dict_sys_mutex_enter() mutex_enter(&dict_sys->mutex)
65#define dict_sys_mutex_exit() mutex_exit(&dict_sys->mutex)
67#define dict_sys_mutex_own() mutex_own(&dict_sys->mutex)
69#define dict_sys_mutex_free() mutex_free(&dict_sys->mutex)
140#ifndef UNIV_HOTBACKUP
181#ifndef UNIV_HOTBACKUP
250#ifndef UNIV_HOTBACKUP
280 const char *new_name,
281 bool rename_also_foreigns);
308 const char **col_names,
327 const char **col_names,
343 const char *
table_name,
bool dict_locked,
bool try_drop,
352 const char **col_names,
355 const char **columns,
401 const char **col_names,
404 const char **columns,
423 index = index->
next();
429 index = index->
next();
484#ifndef UNIV_HOTBACKUP
518#define dict_table_get_nth_v_col(table, pos) ((table)->v_cols + (pos))
537#ifndef UNIV_HOTBACKUP
545 uint32_t zip_ssize,
bool use_data_dir,
555 bool atomic_blobs,
bool data_dir,
592#ifndef UNIV_HOTBACKUP
628#ifndef UNIV_HOTBACKUP
635 std::chrono::microseconds delay);
738 ulint n,
bool is_virtual);
885#ifndef UNIV_HOTBACKUP
925 bool committed =
true);
992#ifndef UNIV_HOTBACKUP
1006#ifndef UNIV_HOTBACKUP
1053 template <
typename Functor>
1059 for (
ulint i = 0; i < n_cells; i++) {
1166#ifndef UNIV_HOTBACKUP
1223#ifndef UNIV_HOTBACKUP
1232#ifndef UNIV_HOTBACKUP
1249void dict_fs2utf8(
const char *db_and_table,
char *db_utf8mb3,
1250 size_t db_utf8mb3_size,
char *table_utf8mb3,
1251 size_t table_utf8mb3_size);
1395#ifndef UNIV_HOTBACKUP
1497 uint32_t table_flag);
1675 const char *algorithm,
1699 size_t &page_ptr_max);
1711 const size_t page_rec_max,
1712 const size_t page_ptr_max,
1713 size_t &rec_max_size);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:51
uint32_t page_no_t
Page number.
Definition: api0api.h:49
Wrapper for the mysql.innodb_dynamic_metadata used to buffer the persistent dynamic metadata.
Definition: dict0dict.h:1262
~DDTableBuffer()
Destructor.
Definition: dict0dict.cc:5075
static constexpr unsigned N_USER_COLS
Number of user columns.
Definition: dict0dict.h:1356
std::vector< byte > get(table_id_t id, uint64_t *version)
Get the buffered metadata for a specific table, the caller has to delete the returned std::string obj...
Definition: dict0dict.cc:5425
void init_tuple_with_id(dtuple_t *tuple, table_id_t id)
Initialize the id field of tuple.
Definition: dict0dict.cc:5230
static constexpr unsigned TABLE_ID_COL_NO
Column number of mysql.innodb_dynamic_metadata.table_id.
Definition: dict0dict.h:1347
mem_heap_t * m_replace_heap
The heap used during replace() operation, which should always be freed before return.
Definition: dict0dict.h:1332
void create_tuples()
Create the search and replace tuples.
Definition: dict0dict.cc:5078
dict_index_t * m_index
The clustered index of this system table.
Definition: dict0dict.h:1324
void init()
Initialize m_index, the in-memory clustered index of the table and two tuples used in this class.
Definition: dict0dict.cc:5121
static constexpr unsigned METADATA_COL_NO
Column number of mysql.innodb_dynamic_metadata.metadata.
Definition: dict0dict.h:1353
static constexpr unsigned VERSION_FIELD_NO
Clustered index field number of mysql.innodb_dynamic_metadata.version.
Definition: dict0dict.h:1367
DDTableBuffer()
Default constructor.
Definition: dict0dict.cc:5067
dtuple_t * m_replace_tuple
The tuple used to replace for specified table, it's protected by dict_persist->mutex.
Definition: dict0dict.h:1343
static constexpr unsigned METADATA_FIELD_NO
Clustered index field number of mysql.innodb_dynamic_metadata.metadata Plusing 2 here skips the DATA_...
Definition: dict0dict.h:1372
void close()
Free the things initialized in init()
Definition: dict0dict.cc:5239
upd_t * update_set_metadata(const dtuple_t *entry, const rec_t *rec)
Prepare for a update on METADATA field.
Definition: dict0dict.cc:5253
void open()
Open the mysql.innodb_dynamic_metadata when DD is not fully up.
Definition: dict0dict.cc:5147
static constexpr unsigned TABLE_ID_FIELD_NO
Clustered index field number of mysql.innodb_dynamic_metadata.table_id.
Definition: dict0dict.h:1363
static constexpr unsigned N_COLS
Number of columns.
Definition: dict0dict.h:1359
static constexpr unsigned N_FIELDS
Number of fields in the clustered index.
Definition: dict0dict.h:1375
dtuple_t * m_search_tuple
The tuple used to search for specified table, it's protected by dict_persist->mutex.
Definition: dict0dict.h:1339
void truncate(void)
Truncate the table.
Definition: dict0dict.cc:5413
dberr_t remove(table_id_t id)
Remove the whole row for a specific table.
Definition: dict0dict.cc:5382
mem_heap_t * m_dynamic_heap
The heap used for dynamic allocations, which should always be freed before return.
Definition: dict0dict.h:1328
mem_heap_t * m_heap
The heap used to create the search tuple and replace tuple.
Definition: dict0dict.h:1335
dberr_t replace(table_id_t id, uint64_t version, const byte *metadata, size_t len)
Replace the dynamic metadata for a specific table.
Definition: dict0dict.cc:5302
static constexpr unsigned VERSION_COL_NO
Column number of mysql.innodb_dynamic_metadata.version.
Definition: dict0dict.h:1350
A granted metadata lock.
Definition: mdl.h:984
Container of persisters used in the system.
Definition: dict0mem.h:2946
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Definition: hash0hash.h:374
size_t get_n_cells()
Returns number of cells in cells[] array.
Definition: hash0hash.h:392
Globally unique index identifier.
Definition: dict0types.h:237
Page size descriptor.
Definition: page0size.h:50
constexpr DWORD buf_size
Definition: create_def.cc:228
SQL data field and tuple.
constexpr uint32_t DATA_N_SYS_COLS
number of system columns defined above
Definition: data0type.h:194
dberr_t
Definition: db0err.h:39
page_no_t dict_table_extent_size(const dict_table_t *table)
Determine the extent size (in pages) for the given table.
Definition: dict0dict.cc:5025
static void dict_free_vc_templ(dict_vcol_templ_t *vc_templ)
Free the virtual column template.
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.
Definition: dict0dict.cc:1845
bool dict_table_autoinc_log(dict_table_t *table, uint64_t value, mtr_t *mtr)
Write redo logs for autoinc counter that is to be inserted, or to update some existing smaller one to...
Definition: dict0dict.cc:758
void dict_init(void)
Inits the data dictionary module.
Definition: dict0dict.cc:1009
constexpr uint32_t BIG_ROW_SIZE
Definition: dict0dict.h:654
static ulint dict_table_encode_n_col(ulint n_col, ulint n_v_col)
encode number of columns and number of virtual columns in one 4 bytes value.
constexpr uint32_t DICT_INDEX_SPATIAL_NODEPTR_SIZE
The number of fields in the nonleaf page of spatial index, except the page no field.
Definition: dict0dict.h:714
dberr_t dd_sdi_acquire_exclusive_mdl(THD *thd, space_id_t space_id, MDL_ticket **sdi_mdl)
Acquire exclusive MDL on SDI tables.
Definition: dict0dict.cc:5969
ulint dict_get_db_name_len(const char *name)
Get the database name length in a table name.
Definition: dict0dict.cc:295
void dict_print_info_on_foreign_key_in_create_format(FILE *file, trx_t *trx, dict_foreign_t *foreign, bool add_newline)
Outputs info on a foreign key of a table in a format suitable for CREATE TABLE.
Definition: dict0dict.cc:3808
static dict_v_col_t * dict_table_get_nth_v_col(const dict_table_t *table, ulint pos)
Gets the nth virtual column of a table.
ulint dict_table_get_highest_foreign_id(dict_table_t *table)
Finds the highest [number] for foreign key constraints of the table.
Definition: dict0dict.cc:3575
static bool dict_index_has_desc(const dict_index_t *index)
Check whether the index consists of descending columns only.
static void dict_index_set_space(dict_index_t *index, space_id_t space)
Sets the space id of the root of the index tree.
static ulint dict_table_get_sys_col_no(const dict_table_t *table, ulint sys)
Gets the given system column number of a table.
ulint dict_table_mysql_pos_to_innodb(const dict_table_t *table, ulint n)
Get the innodb column position for a non-virtual column according to its original MySQL table positio...
Definition: dict0dict.cc:951
static void dict_table_next_uncorrupted_index(dict_index_t *&index)
Definition: dict0dict.h:428
void dict_partitioned_table_remove_from_cache(const char *name)
Try to invalidate an entry from the dict cache, for a partitioned table, if any table found.
Definition: dict0dict.cc:1982
const char * dict_remove_db_name(const char *name)
Return the end of table name where we have removed dbname and '/'.
Definition: dict0dict.cc:283
bool dict_foreign_qualify_index(const dict_table_t *table, const char **col_names, const char **columns, ulint n_cols, const dict_index_t *index, const dict_index_t *types_idx, bool check_charsets, ulint check_null)
Tries to find an index whose first fields are the columns in the array, in the same order and is not ...
Definition: dict0dict.cc:4763
static ulint dict_col_get_index_pos(const dict_col_t *col, const dict_index_t *index)
Gets the column position in the given index.
static void dict_table_prevent_eviction(dict_table_t *table)
Prevent table eviction by moving a table to the non-LRU list from the LRU list if it is not already t...
dberr_t dict_table_rename_in_cache(dict_table_t *table, const char *new_name, bool rename_also_foreigns)
Renames a table object.
Definition: dict0dict.cc:1463
void dict_mutex_exit_for_mysql(void)
Releases the dictionary system mutex for MySQL.
Definition: dict0dict.cc:311
uint32_t dict_tf_to_fsp_flags(uint32_t table_flags)
Convert a 32 bit integer table flags to the 32 bit FSP Flags.
Definition: dict0dict.cc:4980
bool dict_tables_have_same_db(const char *name1, const char *name2)
Checks if the database name in two table names is the same.
Definition: dict0dict.cc:267
static bool dict_table_in_shared_tablespace(const dict_table_t *table)
Check if the table is in a shared tablespace (System or General).
void dict_close(void)
Closes the data dictionary module.
Definition: dict0dict.cc:4636
static bool dict_table_is_discarded(const dict_table_t *table)
Check if the tablespace for the table has been discarded.
rec_t * dict_index_copy_rec_order_prefix(const dict_index_t *index, const rec_t *rec, ulint *n_fields, byte **buf, size_t *buf_size)
Copies an initial segment of a physical record, long enough to specify an index entry uniquely.
Definition: dict0dict.cc:3705
static ulint dict_table_get_n_tot_u_cols(const dict_table_t *table)
static trx_id_t dict_table_get_curr_table_sess_trx_id(const dict_table_t *table)
Get current session trx-id.
static bool dict_table_has_indexed_v_cols(const dict_table_t *table)
Check if a table has indexed virtual columns.
static 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.
void dict_table_mark_dirty(dict_table_t *table)
Mark the dirty_status of a table as METADATA_DIRTY, and add it to the dirty_dict_tables list if neces...
Definition: dict0dict.cc:4118
void dict_persist_close(void)
Clear the structure.
Definition: dict0dict.cc:3924
static bool dict_tf2_is_valid(uint32_t flags, uint32_t flags2)
Validate both table flags and table flags2 and make sure they are compatible.
static void dict_table_n_rows_dec(dict_table_t *table)
Decrement the number of rows in the table by one.
static row_id_t dict_table_get_next_table_sess_row_id(dict_table_t *table)
Get table session row-id and increment the row-id counter for next use.
dberr_t dict_index_add_to_cache_w_vcol(dict_table_t *table, dict_index_t *index, const dict_add_v_col_t *add_v, page_no_t page_no, bool strict)
Adds an index to the dictionary cache, with possible indexing newly added column.
Definition: dict0dict.cc:2447
static ulint dict_index_is_ibuf(const dict_index_t *index)
Check whether the index is the insert buffer tree.
static void dict_table_x_unlock_indexes(dict_table_t *table)
Release the exclusive locks on all index tree.
static void dict_disable_redo_if_temporary(const dict_table_t *table, mtr_t *mtr)
Turn-off redo-logging if temporary table.
static 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.
const char * dict_table_get_v_col_name(const dict_table_t *table, ulint col_nr)
Returns a virtual column's name.
Definition: dict0dict.cc:625
constexpr uint32_t MAX_NUM_FK_COLUMNS
Maximum number of columns in a foreign key constraint.
Definition: dict0dict.h:981
void dict_table_wait_for_bg_threads_to_exit(dict_table_t *table, std::chrono::microseconds delay)
Definition: dict0dict.cc:2936
rw_lock_t * dict_operation_lock
the data dictionary rw-latch protecting dict_sys
Definition: dict0dict.cc:177
void dict_table_move_from_non_lru_to_lru(dict_table_t *table)
Move a table to the LRU end from the non LRU list.
Definition: dict0dict.cc:1394
void dict_validate_no_purge_rollback_threads()
Validate no active background threads to cause purge or rollback operations.
Definition: dict0dict.cc:6103
void dict_table_stats_latch_destroy(dict_table_t *table)
Destroy a dict_table_t's stats latch.
Definition: dict0dict.cc:360
void dict_foreign_free(dict_foreign_t *foreign)
Frees a foreign key struct.
Definition: dict0mem.h:1778
dict_persist_t * dict_persist
the dictionary persisting structure
Definition: dict0dict.cc:167
static 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.
void dict_table_autoinc_lock(dict_table_t *table)
Acquire the autoinc lock.
Definition: dict0dict.cc:732
static page_no_t dict_index_get_page(const dict_index_t *tree)
Gets the page number of the root of the index tree.
ib_mutex_t dict_foreign_err_mutex
Definition: dict0dict.cc:263
void dict_table_add_to_cache(dict_table_t *table, bool can_be_evicted)
Adds a table object to the dictionary cache.
Definition: dict0dict.cc:1191
static ulint dict_max_v_field_len_store_undo(dict_table_t *table, ulint col_no)
Determine maximum bytes of a virtual column need to be stored in the undo log.
void dict_table_move_from_lru_to_non_lru(dict_table_t *table)
Move a table to the non LRU end of the LRU list.
Definition: dict0dict.cc:1376
void dict_index_remove_from_cache(dict_table_t *table, dict_index_t *index)
Removes an index from the dictionary cache.
Definition: dict0dict.cc:2721
void dict_ind_init(void)
Inits dict_ind_redundant.
Definition: dict0dict.cc:4371
dict_index_t * dict_sdi_get_index(space_id_t tablespace_id)
Retrieve in-memory index for SDI table.
Definition: dict0dict.cc:5781
void dict_table_close(dict_table_t *table, bool dict_locked, bool try_drop)
Decrements the count of open handles to a table.
Definition: dict0dict.cc:495
void dict_persist_init(void)
Inits the structure for persisting dynamic metadata.
Definition: dict0dict.cc:3899
void dict_index_set_merge_threshold(dict_index_t *index, ulint merge_threshold)
Sets merge_threshold in the SYS_INDEXES.
void dict_table_close_and_drop(trx_t *trx, dict_table_t *table)
Closes the only open handle to a table and drops a table while assuring that dict_sys->mutex is held ...
Definition: dict0dict.cc:571
const dict_index_t * dict_index_find(const index_id_t &id)
Look up an index among already opened tables.
Definition: dict0dict.cc:1426
static uint16_t dict_index_get_n_unique_in_tree_nonleaf(const dict_index_t *index)
Gets the number of fields on nonleaf page level in the internal representation of an index which uniq...
void dict_move_to_mru(dict_table_t *table)
Move to the most recently used segment of the LRU list.
Definition: dict0dict.cc:1042
static bool dict_table_have_virtual_index(dict_table_t *table)
Check whether the table have virtual index.
void dict_upgrade_evict_tables_cache()
Evict all tables that are loaded for applying purge.
Definition: dict0dict.cc:5888
ulint dict_index_node_ptr_max_size(const dict_index_t *index)
Return maximum size of the node pointer record.
Definition: dict0dict.cc:2047
static bool dict_index_is_online_ddl(const dict_index_t *index)
Determines if a secondary index is being or has been created online, or if the table is being rebuilt...
const uint32_t SDI_VERSION
SDI version.
Definition: dict0dict.h:74
void dict_table_autoinc_unlock(dict_table_t *table)
Release the autoinc lock.
Definition: dict0dict.cc:851
bool dict_sys_table_id_build()
Build the table_id array of SYS_* tables.
Definition: dict0dict.cc:5940
static bool dict_table_is_partition(const dict_table_t *table)
Check whether the dict_table_t is a partition.
ulint dict_table_get_all_fts_indexes(dict_table_t *table, ib_vector_t *indexes)
Get all the FTS indexes on a table.
Definition: dict0dict.cc:813
void dict_index_remove_from_v_col_list(dict_index_t *index)
Clears the virtual column's index list before index is being freed.
Definition: dict0dict.cc:2339
void dict_resize()
Resize the hash tables based on the current buffer pool size.
Definition: dict0dict.cc:4590
void dict_set_merge_threshold_all_debug(uint merge_threshold_all)
Sets merge_threshold for all indexes in dictionary cache for debug.
Definition: dict0dict.cc:4358
static bool dict_index_is_sdi(const dict_index_t *index)
Check if the index is SDI index.
static ulint dict_index_is_unique(const dict_index_t *index)
Check whether the index is unique.
static bool dict_table_is_table_buffer(const dict_table_t *table)
Check whether the table is DDTableBuffer.
static void dict_table_decode_n_col(uint32_t encoded, uint32_t *n_col, uint32_t *n_v_col)
Decode number of virtual and non-virtual columns in one 4 bytes value.
FILE * dict_foreign_err_file
Definition: dict0dict.cc:261
bool dict_table_is_system(table_id_t table_id)
Definition: dict0dict.cc:5960
static bool dict_table_is_comp(const dict_table_t *table)
Check whether the table uses the compact page format.
static ulint dict_index_get_space_reserve(void)
Returns free space reserved for future updates of records.
static void dict_table_skip_corrupt_index(dict_index_t *&index)
Definition: dict0dict.h:421
static void dict_table_autoinc_persisted_update(dict_table_t *table, uint64_t autoinc)
Update the persisted autoinc counter to specified one, we should hold autoinc_persisted_mutex.
dtuple_t * dict_index_build_node_ptr(const dict_index_t *index, const rec_t *rec, page_no_t page_no, mem_heap_t *heap, ulint level)
Builds a node pointer out of a physical record and a page number.
Definition: dict0dict.cc:3643
void dict_table_persist_to_dd_table_buffer(dict_table_t *table)
Write back the dirty persistent dynamic metadata of the table to DDTableBuffer.
Definition: dict0dict.cc:4223
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.
Definition: dict0dict.cc:895
void dict_sdi_remove_from_cache(space_id_t space_id, dict_table_t *sdi_table, bool dict_locked)
Remove the SDI table from table cache.
Definition: dict0dict.cc:5821
void dict_table_read_dynamic_metadata(const byte *buffer, ulint size, PersistentTableMetadata *metadata)
Read persistent dynamic metadata stored in a buffer.
Definition: dict0dict.cc:4040
void dict_table_stats_latch_create(dict_table_t *table, bool enabled)
Create a dict_table_t's stats latch or delay for lazy creation.
Definition: dict0dict.cc:344
uint32_t dict_vcol_base_is_foreign_key(dict_v_col_t *vcol, dict_foreign_t *foreign)
Definition: dict0dict.cc:6083
static bool dict_tf_is_valid(uint32_t flags)
Validate the table flags.
static ulint dict_table_get_n_v_cols(const dict_table_t *table)
Gets the number of virtual columns in a table in the dictionary cache.
static 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 pos...
const char * dict_tf_to_row_format_string(uint32_t table_flag)
Convert table flag to row format string.
Definition: dict0dict.cc:5004
dict_index_t * dict_table_get_index_on_name(dict_table_t *table, const char *name, bool committed=true)
Get an index by name.
Definition: dict0dict.cc:4403
ulint dict_table_has_column(const dict_table_t *table, const char *col_name, ulint col_nr=0)
Check if the table has a given (non_virtual) column.
Definition: dict0dict.cc:597
void dict_set_corrupted(dict_index_t *index) UNIV_COLD
Flags an index corrupted in the data dictionary cache only.
Definition: dict0dict.cc:4156
void dict_sdi_close_table(dict_table_t *table)
Close SDI table.
Definition: dict0dict.cc:5773
void dict_table_stats_unlock(dict_table_t *table, ulint latch_mode)
Unlock the latch that has been locked by dict_table_stats_lock().
Definition: dict0dict.cc:401
dict_index_t * dict_ind_redundant
dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records
Definition: dict0dict.cc:71
static trx_id_t dict_table_get_next_table_sess_trx_id(dict_table_t *table)
Get table session trx-id and increment the trx-id counter for next use.
static void dict_tf_set(uint32_t *flags, rec_format_t format, uint32_t zip_ssize, bool use_data_dir, bool shared_space)
Set the various values in a dict_table_t::flags pointer.
void dict_table_remove_from_cache_debug(dict_table_t *table, bool lru_evict)
Removes a table object from the dictionary cache, for debug purpose.
Definition: dict0dict.cc:2017
static const page_size_t dict_tf_get_page_size(uint32_t flags)
Extract the page size info from table flags.
void dict_table_stats_lock(dict_table_t *table, ulint latch_mode)
Lock the appropriate latch to protect a given table's statistics.
Definition: dict0dict.cc:370
static void dict_table_n_rows_inc(dict_table_t *table)
Increment the number of rows in the table by one.
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.
Definition: dict0dict.cc:2868
static ulint dict_table_is_fts_column(ib_vector_t *indexes, ulint col_no, bool is_virtual)
Check whether a column exists in an FTS index.
check_name
Whether and when to allow temporary index names.
Definition: dict0dict.h:777
@ CHECK_ABORTED_OK
Allow aborted online index creation.
Definition: dict0dict.h:781
@ CHECK_ALL_COMPLETE
Require all indexes to be complete.
Definition: dict0dict.h:779
@ CHECK_PARTIAL_OK
Allow partial indexes to exist.
Definition: dict0dict.h:783
const space_id_t SYSTEM_TABLE_SPACE
Space id of system tablespace.
Definition: dict0dict.h:77
static bool dict_index_is_auto_gen_clust(const dict_index_t *index)
Check if index is auto-generated clustered index.
static void dict_allocate_mem_intrinsic_cache(dict_index_t *index)
Allocate memory for intrinsic cache elements in the index.
bool dict_table_is_referenced_by_foreign_key(const dict_table_t *table)
Checks if a table is referenced by foreign keys.
Definition: dict0dict.cc:3297
static bool dict_table_is_locking_disabled(const dict_table_t *table)
Check whether locking is disabled for this table.
static const page_size_t dict_table_page_size(const dict_table_t *table)
Get the table page size.
void dict_mutex_enter_for_mysql(void)
Reserves the dictionary system mutex for MySQL.
Definition: dict0dict.cc:308
dberr_t dict_foreign_add_to_cache(dict_foreign_t *foreign, const char **col_names, bool check_charsets, bool can_free_fk, dict_err_ignore_t ignore_err)
Adds a foreign key constraint object to the dictionary cache.
Definition: dict0dict.cc:3431
dberr_t dict_set_compression(dict_table_t *table, const char *algorithm, bool is_import_op)
Set the compression type for the tablespace of a table.
Definition: dict0dict.cc:6044
void dict_index_zip_failure(dict_index_t *index)
This function should be called whenever a page compression attempt fails.
Definition: dict0dict.cc:4919
void dict_table_copy_v_types(dtuple_t *tuple, const dict_table_t *table)
Copies types of virtual columns contained in table to tuple and sets all fields of the tuple to the S...
Definition: dict0dict.cc:2902
void dict_table_change_id_sys_tables()
Change the table_id of SYS_* tables if they have been created after an earlier upgrade.
Definition: dict0dict.cc:5852
constexpr uint32_t DICT_HEAP_SIZE
initial memory heap size when creating a table or index object
Definition: dict0dict.h:71
ulint dict_make_room_in_cache(ulint max_tables, ulint pct_check)
Make room in the table cache by evicting an unused table.
Definition: dict0dict.cc:1316
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 ...
Definition: dict0dict.cc:2920
static ulint dict_col_get_no(const dict_col_t *col)
Gets the column number.
static uint32_t dict_tf_init(bool compact, ulint zip_ssize, bool atomic_blobs, bool data_dir, bool shared_space)
Initialize a dict_table_t::flags pointer.
bool dict_col_name_is_reserved(const char *name)
If the given column name is reserved for InnoDB system columns, return true.
Definition: dict0dict.cc:2025
static void dict_table_ddl_acquire(dict_table_t *table)
Move this table to non-LRU list for DDL operations if it's currently not there.
void dict_foreign_remove_from_cache(dict_foreign_t *foreign)
Removes a foreign constraint struct from the dictionary cache.
Definition: dict0dict.cc:3304
static uint64_t dict_table_get_n_rows(const dict_table_t *table)
Gets the approximately estimated number of rows in the table.
bool dict_foreign_replace_index(dict_table_t *table, const char **col_names, const dict_index_t *index)
Replace the index passed in with another equivalent index in the foreign key lists of the table.
Definition: dict0dict.cc:4424
uint64_t dict_table_autoinc_read(const dict_table_t *table)
Reads the next autoinc value (== autoinc counter value), 0 if not yet initialized.
Definition: dict0dict.cc:831
void dict_fs2utf8(const char *db_and_table, char *db_utf8mb3, size_t db_utf8mb3_size, char *table_utf8mb3, size_t table_utf8mb3_size)
Converts a database and table name from filesystem encoding (e.g.
Definition: dict0dict.cc:4542
bool dict_index_check_search_tuple(const dict_index_t *index, const dtuple_t *tuple)
Checks that a tuple has n_fields_cmp value in a sensible range, so that no comparison can occur with ...
Definition: dict0dict.cc:3626
dberr_t dict_index_add_to_cache(dict_table_t *table, dict_index_t *index, page_no_t page_no, bool strict)
Adds an index to the dictionary cache.
Definition: dict0dict.cc:2330
std::string dict_table_get_datadir(const dict_table_t *table)
Get the tablespace data directory if set, otherwise empty string.
Definition: dict0dict.cc:6034
void dict_table_autoinc_update_if_greater(dict_table_t *table, uint64_t value)
Updates the autoinc counter if the value supplied is greater than the current value.
Definition: dict0dict.cc:842
ulint dict_index_zip_pad_optimal_page_size(dict_index_t *index)
Return the optimal page size, for which page will likely compress.
Definition: dict0dict.cc:4938
static ulint dict_index_has_virtual(const dict_index_t *index)
Check whether the index contains a virtual column.
dict_index_t * dict_foreign_find_index(const dict_table_t *table, const char **col_names, const char **columns, ulint n_cols, const dict_index_t *types_idx, bool check_charsets, ulint check_null)
Tries to find an index whose first fields are the columns in the array, in the same order and is not ...
Definition: dict0dict.cc:3352
void dict_index_zip_success(dict_index_t *index)
This function should be called whenever a page is successfully compressed.
Definition: dict0dict.cc:4900
void dict_table_add_system_columns(dict_table_t *table, mem_heap_t *heap)
Adds system columns to a table object.
Definition: dict0dict.cc:1131
void get_permissible_max_size(const dict_table_t *table, const dict_index_t *index, size_t &page_rec_max, size_t &page_ptr_max)
Get the maximum size of a record permissible on an index page.
Definition: dict0dict.cc:2123
void dict_table_set_big_rows(dict_table_t *table)
Mark if table has big rows.
Definition: dict0dict.cc:1172
void dict_table_autoinc_initialize(dict_table_t *table, uint64_t value)
Unconditionally set the autoinc counter.
Definition: dict0dict.cc:752
static void dict_table_allow_eviction(dict_table_t *table)
Allow the table to be evicted by moving a table to the LRU list from the non-LRU list if it is not al...
ulint dict_table_get_nth_col_pos(const dict_table_t *table, ulint n)
Looks for non-virtual column n position in the clustered index.
Definition: dict0dict.cc:940
void dict_table_check_for_dup_indexes(const dict_table_t *table, enum check_name check)
Check for duplicate index entries in a table [using the index name].
Definition: dict0dict.cc:4488
dict_table_op_t
Operation to perform when opening a table.
Definition: dict0dict.h:103
@ DICT_TABLE_OP_NORMAL
Expect the tablespace to exist.
Definition: dict0dict.h:105
@ DICT_TABLE_OP_LOAD_TABLESPACE
Silently load the tablespace if it does not exist, and do not load the definitions of incomplete inde...
Definition: dict0dict.h:110
@ DICT_TABLE_OP_DROP_ORPHAN
Drop any orphan indexes after an aborted online index creation.
Definition: dict0dict.h:107
static bool dict_table_is_sdi(uint64_t table_id)
Check if an table id belongs SDI table.
dict_table_t * dict_sdi_get_table(space_id_t tablespace_id, bool dict_locked, bool is_create)
Retrieve in-memory table object for SDI table.
Definition: dict0dict.cc:5797
static rw_lock_t * dict_index_get_lock(dict_index_t *index)
Gets the read-write lock of the index tree.
static bool dict_table_has_fts_index(dict_table_t *table)
Check if the table has an FTS index.
bool 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.
Definition: dict0dict.cc:978
static void dict_table_ddl_release(dict_table_t *table)
Move this table to LRU list after DDL operations if it was moved to non-LRU list.
ulint dict_index_calc_min_rec_len(const dict_index_t *index)
Calculates the minimum record length in an index.
Definition: dict0dict.cc:3759
static void dict_index_set_online_status(dict_index_t *index, enum online_index_status status)
Sets the status of online index creation.
static ulint dict_max_field_len_store_undo(dict_table_t *table, const dict_col_t *col)
Determine bytes of column prefix to be stored in the undo log.
void dict_table_load_dynamic_metadata(dict_table_t *table)
Check if there is any latest persistent dynamic metadata recorded in DDTableBuffer table of the speci...
Definition: dict0dict.cc:4073
static dict_index_t * dict_table_get_index_on_first_col(dict_table_t *table, ulint col_index)
Get index by first field of the index.
bool dict_index_validate_max_rec_size(const dict_table_t *table, const dict_index_t *index, bool strict, const size_t page_rec_max, const size_t page_ptr_max, size_t &rec_max_size)
validate that maximum possible size of a row is within permissible limit.
Definition: dict0dict.cc:2256
dict_v_col_t * dict_table_get_nth_v_col_mysql(const dict_table_t *table, ulint col_nr)
Get nth virtual column according to its original MySQL table position.
Definition: dict0dict.cc:694
static enum online_index_status dict_index_get_online_status(const dict_index_t *index)
Gets the status of online index creation.
bool dict_index_contains_col_or_prefix(const dict_index_t *index, ulint n, bool is_virtual)
Returns true if the index contains a column or a prefix of that column.
Definition: dict0dict.cc:856
static void dict_table_autoinc_set_col_pos(dict_table_t *table, ulint pos)
Set the column position of autoinc column in clustered index for a table.
void dict_table_remove_from_cache(dict_table_t *table)
Removes a table object from the dictionary cache.
Definition: dict0dict.cc:1974
static ulint dict_index_is_spatial(const dict_index_t *index)
Check whether the index is a Spatial Index.
const char * dict_table_get_v_col_name_mysql(const dict_table_t *table, ulint col_nr)
Returns a virtual column's name according to its original MySQL table position.
Definition: dict0dict.cc:679
static space_id_t dict_index_get_space(const dict_index_t *index)
Gets the space id of the root of the index tree.
void get_field_max_size(const dict_table_t *table, const dict_index_t *index, const dict_field_t *field, size_t &rec_max_size)
Get maximum possible size needed for a field.
Definition: dict0dict.cc:2157
static bool dict_table_has_autoinc_col(const dict_table_t *table)
Check if a table has an autoinc counter column.
bool dict_table_is_compressed_temporary(const dict_table_t *table)
Check if a table is a temporary table with compressed row format, we should always expect false.
Definition: dict0dict.ic:757
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.
Definition: dict0dict.cc:3736
dberr_t dd_sdi_acquire_shared_mdl(THD *thd, space_id_t space_id, MDL_ticket **sdi_mdl)
Acquire shared MDL on SDI tables.
Definition: dict0dict.cc:6007
static 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 posi...
dict_sys_t * dict_sys
the dictionary system
Definition: dict0dict.cc:137
static 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 d...
void dict_persist_to_dd_table_buffer()
Check if any table has any dirty persistent data, if so write dirty persistent data of table to mysql...
Definition: dict0dict.cc:4243
static void dict_table_x_lock_indexes(dict_table_t *table)
Obtain exclusive locks on all index trees of the table.
dict_table_t * dict_table_open_on_name(const char *table_name, bool dict_locked, bool try_drop, dict_err_ignore_t ignore_err)
Returns a table object and increments its open handle count.
Definition: dict0dict.cc:1062
static bool dict_table_has_atomic_blobs(const dict_table_t *table)
Determine if a table uses atomic BLOBs (no locally stored prefix).
Data dictionary memory object creation.
online_index_status
The status of online index creation.
Definition: dict0mem.h:1638
Data dictionary global types.
ib_id_t space_index_t
Index identifier (unique within a tablespace).
Definition: dict0types.h:234
ib_mutex_t DictSysMutex
Definition: dict0types.h:318
dict_err_ignore_t
Error to ignore when we load table dictionary into memory.
Definition: dict0types.h:294
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:232
Multi file, shared, system tablespace implementation.
constexpr size_t FSP_MAX_UNDO_TABLESPACES
Definition: fsp0types.h:403
The simple hash table utility.
static void *& hash_get_first(hash_table_t *table, size_t cell_id)
Gets the first struct in a hash chain, NULL if none.
Definition: hash0hash.h:159
#define HASH_GET_NEXT(NAME, DATA)
Gets the next struct in a hash chain, NULL if none.
Definition: hash0hash.h:165
static int flags[50]
Definition: hp_test1.cc:40
Definition: buf0block_hint.cc:30
const std::string FILE("FILE")
unsigned long long Object_id
Definition: object_id.h:31
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
const char * table_name
Definition: rules_table_service.cc:56
Record manager global types.
byte rec_t
Definition: rem0types.h:41
enum rec_format_enum rec_format_t
Definition: rem0types.h:83
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
required uint64 version
Definition: replication_group_member_actions.proto:41
required bool enabled
Definition: replication_group_member_actions.proto:33
Row operation global types.
Server monitor counter related defines.
case opt name
Definition: sslopt-case.h:33
Definition: completion_hash.h:35
Data structure for newly added virtual column in a table.
Definition: dict0mem.h:835
Data structure for a column in a table.
Definition: dict0mem.h:489
Data structure for a field in an index.
Definition: dict0mem.h:895
Data structure for a foreign key constraint; an example: FOREIGN KEY (A, B) REFERENCES TABLE2 (C,...
Definition: dict0mem.h:1666
Data structure for an index.
Definition: dict0mem.h:1046
const dict_index_t * next() const
Get the next index.
Definition: dict0mem.h:1287
bool is_corrupted() const
Check whether the index is corrupted.
Definition: dict0mem.h:1302
Structure for persisting dynamic metadata of data dictionary.
Definition: dict0dict.h:1165
Persisters * persisters
Collection of instances to persist dynamic metadata.
Definition: dict0dict.h:1229
ib_mutex_t mutex
Mutex to protect data in this structure, also the dict_table_t::dirty_status and dict_table_t::in_dir...
Definition: dict0dict.h:1212
std::atomic< uint32_t > num_dirty_tables
Number of the tables which are of status METADATA_DIRTY.
Definition: dict0dict.h:1216
std::atomic< bool > m_persist_immediately
If set, dynamic metadata is saved to DD buffer table immediately.
Definition: dict0dict.h:1221
DDTableBuffer * table_buffer
DDTableBuffer table for persistent dynamic metadata.
Definition: dict0dict.h:1225
bool check_persist_immediately() const
Definition: dict0dict.h:1194
dirty_dict_tables
List of tables whose dirty_status are marked as METADATA_DIRTY, or METADATA_BUFFERED.
Definition: dict0dict.h:1201
Definition: dict0dict.h:1005
void for_each_table(Functor &functor)
Iterate each table.
Definition: dict0dict.h:1054
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 a...
Definition: dict0dict.h:1015
static constexpr space_id_t s_undo_space_id_range
The number of space IDs dedicated to each undo tablespace.
Definition: dict0dict.h:1104
static constexpr space_id_t s_max_undo_space_id
The highest undo tablespace ID.
Definition: dict0dict.h:1111
dict_table_t * ddl_log
Permanent handle to mysql.innodb_ddl_log.
Definition: dict0dict.h:1040
static bool is_reserved(space_id_t space)
Check if a tablespace id is a reserved tablespace ID.
Definition: dict0dict.h:1074
static constexpr space_id_t s_reserved_space_id
The first reserved tablespace ID.
Definition: dict0dict.h:1124
static std::set< dd::Object_id > s_dd_table_ids
Set of ids of DD tables.
Definition: dict0dict.h:1079
static constexpr table_id_t s_dynamic_meta_table_id
The table ID of mysql.innodb_dynamic_metadata.
Definition: dict0dict.h:1158
static constexpr space_id_t s_min_temp_space_id
Lowest temporary general space id.
Definition: dict0dict.h:1120
static constexpr dd::Object_id s_dd_sys_space_id
The dd::Tablespace::id of innodb_system.
Definition: dict0dict.h:1130
static const char * s_default_undo_space_name_2
Definition: dict0dict.h:1155
UT_LIST_BASE_NODE_T(dict_table_t, table_LRU) Table_LRU_list_base
Definition: dict0dict.h:1043
dict_table_t * sys_fields
SYS_FIELDS table.
Definition: dict0dict.h:1032
static const char * s_file_per_table_name
The hard-coded tablespace name innodb_file_per_table.
Definition: dict0dict.h:1151
static constexpr space_id_t s_log_space_id
The first ID of the redo log pseudo-tablespace.
Definition: dict0dict.h:1092
Table_LRU_list_base table_LRU
List of tables that can be evicted from the cache.
Definition: dict0dict.h:1046
static const char * s_dd_space_name
The name of the data dictionary tablespace.
Definition: dict0dict.h:1136
DictSysMutex mutex
mutex protecting the data dictionary; protects also the disk-based dictionary system tables; this mut...
Definition: dict0dict.h:1007
static constexpr space_id_t s_min_undo_space_id
The lowest undo tablespace ID.
Definition: dict0dict.h:1107
static const char * s_temp_space_file_name
The file name of the predefined temporary tablespace.
Definition: dict0dict.h:1148
static bool is_dd_table_id(table_id_t id)
Check if a table is hardcoded.
Definition: dict0dict.h:1087
static const char * s_default_undo_space_name_1
These two undo tablespaces cannot be dropped.
Definition: dict0dict.h:1154
size_t size
varying space in bytes occupied by the data dictionary table and index objects
Definition: dict0dict.h:1025
static const char * s_dd_space_file_name
The file name of the data dictionary tablespace.
Definition: dict0dict.h:1139
dict_table_t * sys_tables
Handler to sys_* tables, they're only for upgrade.
Definition: dict0dict.h:1029
Table_LRU_list_base table_non_LRU
List of tables that can't be evicted from the cache.
Definition: dict0dict.h:1048
static constexpr dd::Object_id s_dd_dict_space_id
The dd::Tablespace::id of the dictionary tablespace.
Definition: dict0dict.h:1127
static const char * s_sys_space_name
The name of the hard-coded system tablespace.
Definition: dict0dict.h:1142
static constexpr space_id_t s_temp_space_id
The innodb_temporary tablespace ID.
Definition: dict0dict.h:1101
dict_table_t * index_stats
Permanent handle to mysql.innodb_index_stats.
Definition: dict0dict.h:1038
static constexpr space_id_t s_dict_space_id
The data dictionary tablespace ID.
Definition: dict0dict.h:1098
dict_table_t * table_stats
Permanent handle to mysql.innodb_table_stats.
Definition: dict0dict.h:1036
static constexpr space_index_t s_dynamic_meta_index_id
The clustered index ID of mysql.innodb_dynamic_metadata.
Definition: dict0dict.h:1161
static constexpr space_id_t s_max_temp_space_id
Start space_ids for temporary tablespaces.
Definition: dict0dict.h:1114
dict_table_t * sys_indexes
SYS_INDEXES table.
Definition: dict0dict.h:1031
static constexpr dd::Object_id s_dd_temp_space_id
The dd::Tablespace::id of innodb_temporary.
Definition: dict0dict.h:1133
static const char * s_temp_space_name
The name of the predefined temporary tablespace.
Definition: dict0dict.h:1145
static constexpr space_id_t s_invalid_space_id
Use maximum UINT value to indicate invalid space ID.
Definition: dict0dict.h:1095
dict_table_t * dynamic_metadata
Permanent handle to mysql.innodb_dynamic_metadata.
Definition: dict0dict.h:1042
dict_table_t * sys_columns
SYS_COLUMNS table.
Definition: dict0dict.h:1030
static constexpr space_id_t s_temp_space_id_range
The number of space IDs dedicated to temporary tablespaces.
Definition: dict0dict.h:1117
hash_table_t * table_id_hash
hash table of the tables, based on id
Definition: dict0dict.h:1023
dict_table_t * sys_virtual
SYS_VIRTUAL table.
Definition: dict0dict.h:1033
hash_table_t * table_hash
hash table of the tables, based on name
Definition: dict0dict.h:1021
Data structure for a database table.
Definition: dict0mem.h:1909
Data structure for a virtual column in a table.
Definition: dict0mem.h:815
Structure defines template related to virtual columns and their base columns.
Definition: dict0mem.h:1846
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:682
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:360
Definition: trx0trx.h:684
Definition: row0upd.h:565
The read-write lock (for threads, not for database transactions)
typedef UT_LIST_BASE_NODE_T(rw_lock_t, list) rw_lock_list_t
Transaction system global type definitions.
ib_id_t row_id_t
Row identifier (DB_ROW_ID, DATA_ROW_ID)
Definition: trx0types.h:132
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
static const space_id_t TRX_SYS_SPACE
Space id of the transaction system page (the system tablespace)
Definition: trx0types.h:52
unsigned int uint
Definition: uca9-dump.cc:75
Version control for database, common definitions, and include files.
#define UNIV_COLD
Definition: univ.i:267
unsigned long int ulint
Definition: univ.i:406
Utilities for byte operations.
#define mutex_exit(M)
Definition: ut0mutex.h:123
#define mutex_enter(M)
Definition: ut0mutex.h:117
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
Random numbers and hashing.
uint32_t new_id()
Create a new (hopefully unique) ID.
Definition: xcom_base.cc:1782
int n
Definition: xcom_base.cc:509