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);
312 const char **col_names,
331 const char **col_names,
347 const char *
table_name,
bool dict_locked,
bool try_drop,
356 const char **col_names,
359 const char **columns,
405 const char **col_names,
408 const char **columns,
427 index = index->
next();
433 index = index->
next();
488#ifndef UNIV_HOTBACKUP
522#define dict_table_get_nth_v_col(table, pos) ((table)->v_cols + (pos))
541#ifndef UNIV_HOTBACKUP
549 uint32_t zip_ssize,
bool use_data_dir,
559 bool atomic_blobs,
bool data_dir,
596#ifndef UNIV_HOTBACKUP
632#ifndef UNIV_HOTBACKUP
639 std::chrono::microseconds delay);
742 ulint n,
bool is_virtual);
889#ifndef UNIV_HOTBACKUP
929 bool committed =
true);
996#ifndef UNIV_HOTBACKUP
1010#ifndef UNIV_HOTBACKUP
1057 template <
typename Functor>
1063 for (
ulint i = 0; i < n_cells; i++) {
1170#ifndef UNIV_HOTBACKUP
1227#ifndef UNIV_HOTBACKUP
1236#ifndef UNIV_HOTBACKUP
1253void dict_fs2utf8(
const char *db_and_table,
char *db_utf8mb3,
1254 size_t db_utf8mb3_size,
char *table_utf8mb3,
1255 size_t table_utf8mb3_size);
1399#ifndef UNIV_HOTBACKUP
1501 uint32_t table_flag);
1667 const char *algorithm,
1691 size_t &page_ptr_max);
1703 const size_t page_rec_max,
1704 const size_t page_ptr_max,
1705 size_t &rec_max_size);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
uint32_t page_no_t
Page number.
Definition: api0api.h:46
Wrapper for the mysql.innodb_dynamic_metadata used to buffer the persistent dynamic metadata.
Definition: dict0dict.h:1266
~DDTableBuffer()
Destructor.
Definition: dict0dict.cc:5094
static constexpr unsigned N_USER_COLS
Number of user columns.
Definition: dict0dict.h:1360
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:5444
void init_tuple_with_id(dtuple_t *tuple, table_id_t id)
Initialize the id field of tuple.
Definition: dict0dict.cc:5249
static constexpr unsigned TABLE_ID_COL_NO
Column number of mysql.innodb_dynamic_metadata.table_id.
Definition: dict0dict.h:1351
mem_heap_t * m_replace_heap
The heap used during replace() operation, which should always be freed before return.
Definition: dict0dict.h:1336
void create_tuples()
Create the search and replace tuples.
Definition: dict0dict.cc:5097
dict_index_t * m_index
The clustered index of this system table.
Definition: dict0dict.h:1328
void init()
Initialize m_index, the in-memory clustered index of the table and two tuples used in this class.
Definition: dict0dict.cc:5140
static constexpr unsigned METADATA_COL_NO
Column number of mysql.innodb_dynamic_metadata.metadata.
Definition: dict0dict.h:1357
static constexpr unsigned VERSION_FIELD_NO
Clustered index field number of mysql.innodb_dynamic_metadata.version.
Definition: dict0dict.h:1371
DDTableBuffer()
Default constructor.
Definition: dict0dict.cc:5086
dtuple_t * m_replace_tuple
The tuple used to replace for specified table, it's protected by dict_persist->mutex.
Definition: dict0dict.h:1347
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:1376
void close()
Free the things initialized in init()
Definition: dict0dict.cc:5258
upd_t * update_set_metadata(const dtuple_t *entry, const rec_t *rec)
Prepare for a update on METADATA field.
Definition: dict0dict.cc:5272
void open()
Open the mysql.innodb_dynamic_metadata when DD is not fully up.
Definition: dict0dict.cc:5166
static constexpr unsigned TABLE_ID_FIELD_NO
Clustered index field number of mysql.innodb_dynamic_metadata.table_id.
Definition: dict0dict.h:1367
static constexpr unsigned N_COLS
Number of columns.
Definition: dict0dict.h:1363
static constexpr unsigned N_FIELDS
Number of fields in the clustered index.
Definition: dict0dict.h:1379
dtuple_t * m_search_tuple
The tuple used to search for specified table, it's protected by dict_persist->mutex.
Definition: dict0dict.h:1343
void truncate(void)
Truncate the table.
Definition: dict0dict.cc:5432
dberr_t remove(table_id_t id)
Remove the whole row for a specific table.
Definition: dict0dict.cc:5401
mem_heap_t * m_dynamic_heap
The heap used for dynamic allocations, which should always be freed before return.
Definition: dict0dict.h:1332
mem_heap_t * m_heap
The heap used to create the search tuple and replace tuple.
Definition: dict0dict.h:1339
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:5321
static constexpr unsigned VERSION_COL_NO
Column number of mysql.innodb_dynamic_metadata.version.
Definition: dict0dict.h:1354
A granted metadata lock.
Definition: mdl.h:986
Container of persisters used in the system.
Definition: dict0mem.h:2951
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: hash0hash.h:375
size_t get_n_cells() const
Returns number of cells in cells[] array.
Definition: hash0hash.h:393
Globally unique index identifier.
Definition: dict0types.h:237
Page size descriptor.
Definition: page0size.h:50
constexpr DWORD buf_size
Definition: create_def.cc:229
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:5044
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:658
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:718
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:5915
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:3827
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:3594
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:432
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:4782
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:4999
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:4655
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:3724
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:4137
void dict_persist_close(void)
Clear the structure.
Definition: dict0dict.cc:3943
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:2451
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:985
void dict_table_wait_for_bg_threads_to_exit(dict_table_t *table, std::chrono::microseconds delay)
Definition: dict0dict.cc:2955
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:6049
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:1773
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:2725
void dict_ind_init(void)
Inits dict_ind_redundant.
Definition: dict0dict.cc:4390
dict_index_t * dict_sdi_get_index(space_id_t tablespace_id)
Retrieve in-memory index for SDI table.
Definition: dict0dict.cc:5800
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:3918
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.
ulint dict_index_node_ptr_max_size(const dict_index_t *index)
Return maximum size of the node pointer record.
Definition: dict0dict.cc:2051
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
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:2343
void dict_resize()
Resize the hash tables based on the current buffer pool size.
Definition: dict0dict.cc:4609
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:4377
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:5906
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:425
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:3662
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:4242
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:5840
void dict_table_read_dynamic_metadata(const byte *buffer, ulint size, PersistentTableMetadata *metadata)
Read persistent dynamic metadata stored in a buffer.
Definition: dict0dict.cc:4059
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:6029
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:5023
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:4422
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:4175
void dict_sdi_close_table(dict_table_t *table)
Close SDI table.
Definition: dict0dict.cc:5792
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:2021
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:2887
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:781
@ CHECK_ABORTED_OK
Allow aborted online index creation.
Definition: dict0dict.h:785
@ CHECK_ALL_COMPLETE
Require all indexes to be complete.
Definition: dict0dict.h:783
@ CHECK_PARTIAL_OK
Allow partial indexes to exist.
Definition: dict0dict.h:787
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:3316
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:3450
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:5990
void dict_index_zip_failure(dict_index_t *index)
This function should be called whenever a page compression attempt fails.
Definition: dict0dict.cc:4938
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:2921
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:5872
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:2939
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:2029
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:3323
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:4443
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:4561
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:3645
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:2334
std::string dict_table_get_datadir(const dict_table_t *table)
Get the tablespace data directory if set, otherwise empty string.
Definition: dict0dict.cc:5980
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:4957
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:3371
void dict_index_zip_success(dict_index_t *index)
This function should be called whenever a page is successfully compressed.
Definition: dict0dict.cc:4919
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:2127
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
std::vector< table_id_t > dict_get_all_table_ids()
Gathers ids of all tables in cache at the moment.
Definition: dict0dict.cc:2731
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:4507
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:5816
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:3778
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:4092
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:2260
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:2161
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:3755
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:5953
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:4262
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:1633
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
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
const std::string FILE("FILE")
unsigned long long Object_id
Definition: object_id.h:31
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
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:98
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:29
Definition: completion_hash.h:35
Data structure for newly added virtual column in a table.
Definition: dict0mem.h:830
Data structure for a column in a table.
Definition: dict0mem.h:484
Data structure for a field in an index.
Definition: dict0mem.h:890
Data structure for a foreign key constraint; an example: FOREIGN KEY (A, B) REFERENCES TABLE2 (C,...
Definition: dict0mem.h:1661
Data structure for an index.
Definition: dict0mem.h:1041
const dict_index_t * next() const
Get the next index.
Definition: dict0mem.h:1282
bool is_corrupted() const
Check whether the index is corrupted.
Definition: dict0mem.h:1297
Structure for persisting dynamic metadata of data dictionary.
Definition: dict0dict.h:1169
Persisters * persisters
Collection of instances to persist dynamic metadata.
Definition: dict0dict.h:1233
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:1216
std::atomic< uint32_t > num_dirty_tables
Number of the tables which are of status METADATA_DIRTY.
Definition: dict0dict.h:1220
std::atomic< bool > m_persist_immediately
If set, dynamic metadata is saved to DD buffer table immediately.
Definition: dict0dict.h:1225
DDTableBuffer * table_buffer
DDTableBuffer table for persistent dynamic metadata.
Definition: dict0dict.h:1229
bool check_persist_immediately() const
Definition: dict0dict.h:1198
dirty_dict_tables
List of tables whose dirty_status are marked as METADATA_DIRTY, or METADATA_BUFFERED.
Definition: dict0dict.h:1205
Definition: dict0dict.h:1009
void for_each_table(Functor &functor)
Iterate each table.
Definition: dict0dict.h:1058
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:1019
static constexpr space_id_t s_undo_space_id_range
The number of space IDs dedicated to each undo tablespace.
Definition: dict0dict.h:1108
static constexpr space_id_t s_max_undo_space_id
The highest undo tablespace ID.
Definition: dict0dict.h:1115
dict_table_t * ddl_log
Permanent handle to mysql.innodb_ddl_log.
Definition: dict0dict.h:1044
static bool is_reserved(space_id_t space)
Check if a tablespace id is a reserved tablespace ID.
Definition: dict0dict.h:1078
static constexpr space_id_t s_reserved_space_id
The first reserved tablespace ID.
Definition: dict0dict.h:1128
static std::set< dd::Object_id > s_dd_table_ids
Set of ids of DD tables.
Definition: dict0dict.h:1083
static constexpr table_id_t s_dynamic_meta_table_id
The table ID of mysql.innodb_dynamic_metadata.
Definition: dict0dict.h:1162
static constexpr space_id_t s_min_temp_space_id
Lowest temporary general space id.
Definition: dict0dict.h:1124
static constexpr dd::Object_id s_dd_sys_space_id
The dd::Tablespace::id of innodb_system.
Definition: dict0dict.h:1134
static const char * s_default_undo_space_name_2
Definition: dict0dict.h:1159
UT_LIST_BASE_NODE_T(dict_table_t, table_LRU) Table_LRU_list_base
Definition: dict0dict.h:1047
dict_table_t * sys_fields
SYS_FIELDS table.
Definition: dict0dict.h:1036
static const char * s_file_per_table_name
The hard-coded tablespace name innodb_file_per_table.
Definition: dict0dict.h:1155
static constexpr space_id_t s_log_space_id
The first ID of the redo log pseudo-tablespace.
Definition: dict0dict.h:1096
Table_LRU_list_base table_LRU
List of tables that can be evicted from the cache.
Definition: dict0dict.h:1050
static const char * s_dd_space_name
The name of the data dictionary tablespace.
Definition: dict0dict.h:1140
DictSysMutex mutex
mutex protecting the data dictionary; protects also the disk-based dictionary system tables; this mut...
Definition: dict0dict.h:1011
static constexpr space_id_t s_min_undo_space_id
The lowest undo tablespace ID.
Definition: dict0dict.h:1111
static const char * s_temp_space_file_name
The file name of the predefined temporary tablespace.
Definition: dict0dict.h:1152
static bool is_dd_table_id(table_id_t id)
Check if a table is hardcoded.
Definition: dict0dict.h:1091
static const char * s_default_undo_space_name_1
These two undo tablespaces cannot be dropped.
Definition: dict0dict.h:1158
size_t size
varying space in bytes occupied by the data dictionary table and index objects
Definition: dict0dict.h:1029
static const char * s_dd_space_file_name
The file name of the data dictionary tablespace.
Definition: dict0dict.h:1143
dict_table_t * sys_tables
Handler to sys_* tables, they're only for upgrade.
Definition: dict0dict.h:1033
Table_LRU_list_base table_non_LRU
List of tables that can't be evicted from the cache.
Definition: dict0dict.h:1052
static constexpr dd::Object_id s_dd_dict_space_id
The dd::Tablespace::id of the dictionary tablespace.
Definition: dict0dict.h:1131
static const char * s_sys_space_name
The name of the hard-coded system tablespace.
Definition: dict0dict.h:1146
static constexpr space_id_t s_temp_space_id
The innodb_temporary tablespace ID.
Definition: dict0dict.h:1105
dict_table_t * index_stats
Permanent handle to mysql.innodb_index_stats.
Definition: dict0dict.h:1042
static constexpr space_id_t s_dict_space_id
The data dictionary tablespace ID.
Definition: dict0dict.h:1102
dict_table_t * table_stats
Permanent handle to mysql.innodb_table_stats.
Definition: dict0dict.h:1040
static constexpr space_index_t s_dynamic_meta_index_id
The clustered index ID of mysql.innodb_dynamic_metadata.
Definition: dict0dict.h:1165
static constexpr space_id_t s_max_temp_space_id
Start space_ids for temporary tablespaces.
Definition: dict0dict.h:1118
dict_table_t * sys_indexes
SYS_INDEXES table.
Definition: dict0dict.h:1035
static constexpr dd::Object_id s_dd_temp_space_id
The dd::Tablespace::id of innodb_temporary.
Definition: dict0dict.h:1137
static const char * s_temp_space_name
The name of the predefined temporary tablespace.
Definition: dict0dict.h:1149
static constexpr space_id_t s_invalid_space_id
Use maximum UINT value to indicate invalid space ID.
Definition: dict0dict.h:1099
dict_table_t * dynamic_metadata
Permanent handle to mysql.innodb_dynamic_metadata.
Definition: dict0dict.h:1046
dict_table_t * sys_columns
SYS_COLUMNS table.
Definition: dict0dict.h:1034
static constexpr space_id_t s_temp_space_id_range
The number of space IDs dedicated to temporary tablespaces.
Definition: dict0dict.h:1121
hash_table_t * table_id_hash
hash table of the tables, based on id
Definition: dict0dict.h:1027
dict_table_t * sys_virtual
SYS_VIRTUAL table.
Definition: dict0dict.h:1037
hash_table_t * table_hash
hash table of the tables, based on name
Definition: dict0dict.h:1025
Data structure for a database table.
Definition: dict0mem.h:1904
Data structure for a virtual column in a table.
Definition: dict0mem.h:810
Structure defines template related to virtual columns and their base columns.
Definition: dict0mem.h:1841
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
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:363
Definition: trx0trx.h:675
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
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:1786
int n
Definition: xcom_base.cc:509