MySQL 9.1.0
Source Code Documentation
|
Data dictionary memory object creation. More...
#include "sql/dd/object_id.h"
#include "sql/dd/types/column.h"
#include "univ.i"
#include "btr0types.h"
#include "data0type.h"
#include "dict0types.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "row0types.h"
#include "lock0types.h"
#include "que0types.h"
#include "hash0hash.h"
#include "sync0rw.h"
#include "trx0types.h"
#include "ut0byte.h"
#include "ut0mem.h"
#include "ut0rnd.h"
#include "fts0fts.h"
#include "buf0buf.h"
#include "gis0type.h"
#include "os0once.h"
#include "dict/mem.h"
#include "ut0new.h"
#include "sql/sql_const.h"
#include "sql/table.h"
#include <algorithm>
#include <iterator>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "dict0mem.ic"
Go to the source code of this file.
Classes | |
class | id_name_t |
SQL identifier name wrapper for pretty-printing. More... | |
struct | table_name_t |
Table name wrapper for pretty-printing. More... | |
struct | dict_col_default_t |
Data structure for default value of a column in a table. More... | |
struct | dict_col_t |
Data structure for a column in a table. More... | |
struct | dict_v_idx_t |
Index information put in a list of virtual column structure. More... | |
struct | dict_v_col_t |
Data structure for a virtual column in a table. More... | |
struct | dict_add_v_col_t |
Data structure for newly added virtual column in a table. More... | |
struct | dict_s_col_t |
Data structure for a stored column in a table. More... | |
struct | dict_field_t |
Data structure for a field in an index. More... | |
struct | zip_pad_info_t |
Data structure to hold information about about how much space in an uncompressed page should be left as padding to avoid compression failures. More... | |
struct | rec_cache_t |
If key is fixed length key then cache the record offsets on first computation. More... | |
class | last_ops_cur_t |
Cache position of last inserted or selected record by caching record and holding reference to the block where record resides. More... | |
struct | dict_index_t |
Data structure for an index. More... | |
struct | dict_foreign_t |
Data structure for a foreign key constraint; an example: FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D). More... | |
struct | dict_foreign_print |
struct | dict_foreign_compare |
Compare two dict_foreign_t objects using their ids. More... | |
struct | dict_foreign_with_index |
A function object to find a foreign key with the given index as the referenced index. More... | |
struct | dict_foreign_different_tables |
struct | dict_foreign_not_exists |
Function object to check if a foreign key object is there in the given foreign key set or not. More... | |
struct | dict_foreign_set_free |
The destructor will free all the foreign key constraints in the set by calling dict_foreign_free() on each of the foreign key constraints. More... | |
struct | dict_vcol_templ_t |
Structure defines template related to virtual columns and their base columns. More... | |
struct | dict_table_t |
Data structure for a database table. More... | |
class | PersistentTableMetadata |
Persistent dynamic metadata for a table. More... | |
class | Persister |
Interface for persistent dynamic table metadata. More... | |
class | CorruptedIndexPersister |
Persister used for corrupted indexes. More... | |
class | AutoIncPersister |
Persister used for autoinc counters. More... | |
class | Persisters |
Container of persisters used in the system. More... | |
struct | dict_foreign_add_to_referenced_table |
A function object to add the foreign key constraint to the referenced set of the referenced table, if it exists in the dictionary cache. More... | |
Namespaces | |
namespace | dd |
The version of the current data dictionary table definitions. | |
Macros | |
#define | DICT_MAX_FIELD_LEN_BY_FORMAT(table) |
Find out maximum indexed column length by its table format. More... | |
#define | DICT_STATS_PERSISTENT_ON (1 << 1) |
The two bits below are set in the 'stat_persistent' member. More... | |
#define | DICT_STATS_PERSISTENT_OFF (1 << 2) |
#define | DICT_STATS_AUTO_RECALC_ON (1 << 1) |
The two bits below are set in the 'stats_auto_recalc' member. More... | |
#define | DICT_STATS_AUTO_RECALC_OFF (1 << 2) |
#define | BG_STAT_NONE 0 |
Background stats thread is not working on this table. More... | |
#define | BG_STAT_IN_PROGRESS (1 << 0) |
Set in 'stats_bg_flag' when the background stats code is working on this table. More... | |
#define | BG_STAT_SHOULD_QUIT (1 << 1) |
Set in 'stats_bg_flag' when DROP TABLE starts waiting on BG_STAT_IN_PROGRESS to be cleared. More... | |
Typedefs | |
typedef std::list< dict_v_idx_t, ut::allocator< dict_v_idx_t > > | dict_v_idx_list |
Index list to put in dict_v_col_t. More... | |
typedef std::list< dict_s_col_t, ut::allocator< dict_s_col_t > > | dict_s_col_list |
list to put stored column for dict_table_t More... | |
typedef std::set< dict_v_col_t *, std::less< dict_v_col_t * >, ut::allocator< dict_v_col_t * > > | dict_vcol_set |
Set to store the virtual columns which are affected by Foreign key constraint. More... | |
typedef std::set< dict_foreign_t *, dict_foreign_compare, ut::allocator< dict_foreign_t * > > | dict_foreign_set |
typedef ut_list_base< lock_t, TableLockGetNode > | table_lock_list_t |
typedef std::vector< row_prebuilt_t * > | temp_prebuilt_vec |
A vector to collect prebuilt from different readers working on the same temp table. More... | |
typedef std::vector< index_id_t, ut::allocator< index_id_t > > | corrupted_ids_t |
Enumerations | |
enum | online_index_status { ONLINE_INDEX_COMPLETE = 0 , ONLINE_INDEX_CREATION , ONLINE_INDEX_ABORTED , ONLINE_INDEX_ABORTED_DROPPED } |
The status of online index creation. More... | |
enum | table_dirty_status { METADATA_DIRTY = 0 , METADATA_BUFFERED , METADATA_CLEAN } |
The dirty status of tables, used to indicate if a table has some dynamic metadata changed to be written back. More... | |
enum | persistent_type_t { PM_SMALLEST_TYPE = 0 , PM_INDEX_CORRUPTED = 1 , PM_TABLE_AUTO_INC = 2 , PM_BIGGEST_TYPE = 3 } |
Persistent dynamic metadata type, there should be 1 to 1 relationship between the metadata and the type. More... | |
Functions | |
dict_v_col_t * | dict_mem_table_add_v_col (dict_table_t *table, mem_heap_t *heap, const char *name, ulint mtype, ulint prtype, ulint len, ulint pos, ulint num_base, bool is_visible) |
Adds a virtual column definition to a table. More... | |
void | dict_mem_table_add_s_col (dict_table_t *table, ulint num_base) |
Adds a stored column definition to a table. More... | |
void | dict_mem_table_col_rename (dict_table_t *table, ulint nth_col, const char *from, const char *to, bool is_virtual) |
Renames a column of a table in the data dictionary cache. More... | |
static void | dict_mem_fill_index_struct (dict_index_t *index, mem_heap_t *heap, const char *table_name, const char *index_name, ulint space, ulint type, ulint n_fields) |
This function poplulates a dict_index_t index memory structure with supplied information. More... | |
void | dict_mem_index_free (dict_index_t *index) |
Frees an index memory object. More... | |
dict_foreign_t * | dict_mem_foreign_create (void) |
Creates and initializes a foreign constraint memory object. More... | |
void | dict_mem_foreign_table_name_lookup_set (dict_foreign_t *foreign, bool do_alloc) |
Sets the foreign_table_name_lookup pointer based on the value of lower_case_table_names. More... | |
void | dict_mem_referenced_table_name_lookup_set (dict_foreign_t *foreign, bool do_alloc) |
Sets the referenced_table_name_lookup pointer based on the value of lower_case_table_names. More... | |
void | dict_mem_foreign_fill_vcol_set (dict_foreign_t *foreign) |
Fills the dependent virtual columns in a set. More... | |
void | dict_mem_table_fill_foreign_vcol_set (dict_table_t *table) |
Fill virtual columns set in each fk constraint present in the table. More... | |
void | dict_mem_table_free_foreign_vcol_set (dict_table_t *table) |
Free the vcol_set from all foreign key constraint on the table. More... | |
char * | dict_mem_create_temporary_tablename (mem_heap_t *heap, const char *dbtab, table_id_t id) |
Create a temporary tablename like "#sql-ibtid-inc" where tid = the Table ID inc = a randomly initialized number that is incremented for each file The table ID is a 64 bit integer, can use up to 20 digits, and is initialized at bootstrap. More... | |
static bool | is_valid_row_version (const row_version_t version) |
void | dict_mem_init (void) |
Initialize dict memory variables. More... | |
static uint32_t | DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG (uint32_t flags) |
std::ostream & | operator<< (std::ostream &out, const dict_foreign_t &foreign) |
std::ostream & | operator<< (std::ostream &out, const dict_foreign_set &fk_set) |
bool | dict_foreign_set_validate (const dict_foreign_set &fk_set) |
Validate the search order in the foreign key set. More... | |
bool | dict_foreign_set_validate (const dict_table_t &table) |
Validate the search order in the foreign key sets of the table (foreign_set and referenced_set). More... | |
void | dict_foreign_free (dict_foreign_t *foreign) |
Frees a foreign key struct. More... | |
std::ostream & | operator<< (std::ostream &s, const id_name_t &id_name) |
Display an identifier. More... | |
std::ostream & | operator<< (std::ostream &s, const table_name_t &table_name) |
Display a table name. More... | |
static void | DICT_TF2_FLAG_SET (dict_table_t *table, uint32_t flag) |
static bool | DICT_TF2_FLAG_IS_SET (const dict_table_t *table, uint32_t flag) |
static void | DICT_TF2_FLAG_UNSET (dict_table_t *table, uint32_t flag) |
void | dict_table_mutex_create_lazy (dict_table_t *table) |
Request for lazy creation of the mutex of a given table. More... | |
void | dict_table_mutex_destroy (dict_table_t *table) |
Destroy the mutex of a given table. More... | |
void | dict_table_autoinc_destroy (dict_table_t *table) |
Destroy the autoinc latch of the given table. More... | |
void | dict_table_autoinc_create_lazy (dict_table_t *table) |
Request for lazy creation of the autoinc latch of a given table. More... | |
void | dict_index_zip_pad_mutex_create_lazy (dict_index_t *index) |
Request a lazy creation of dict_index_t::zip_pad::mutex. More... | |
void | dict_index_zip_pad_mutex_destroy (dict_index_t *index) |
Destroy the zip_pad_mutex of the given index. More... | |
void | dict_index_zip_pad_unlock (dict_index_t *index) |
Release the zip_pad_mutex of a given index. More... | |
bool | dict_table_autoinc_own (const dict_table_t *table) |
Check if the current thread owns the autoinc_mutex of a given table. More... | |
Variables | |
constexpr char | INSTANT_DROP_SUFFIX_8_0_29 [] = "_dropped_v" |
Format of INSTANTLY DROPPED column names. More... | |
constexpr char | INSTANT_DROP_PREFIX_8_0_32 [] = "!hidden!_dropped_" |
constexpr char | RECOVERY_INDEX_TABLE_NAME [] = "LOG_DUMMY" |
index/table name used while applying REDO logs during recovery More... | |
constexpr uint32_t | DICT_FK_MAX_RECURSIVE_LOAD = 20 |
Tables could be chained together with Foreign key constraint. More... | |
constexpr uint32_t | FK_MAX_CASCADE_DEL = 15 |
Similarly, when tables are chained together with foreign key constraints with on cascading delete/update clause, delete from parent table could result in recursive cascading calls. More... | |
constexpr uint32_t | DICT_ANTELOPE_MAX_INDEX_COL_LEN |
DICT_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed prefix length) in ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT. More... | |
constexpr uint32_t | DICT_MAX_FIXED_COL_LEN = DICT_ANTELOPE_MAX_INDEX_COL_LEN |
Defines the maximum fixed length column size. More... | |
constexpr uint32_t | ZIP_PAD_ROUND_LEN = 128 |
PADDING HEURISTIC BASED ON LINEAR INCREASE OF PADDING TO AVOID COMPRESSION FAILURES (Note: this is relevant only for compressed indexes) GOAL: Avoid compression failures by maintaining information about the compressibility of data. More... | |
constexpr uint32_t | ZIP_PAD_SUCCESSFUL_ROUND_LIMIT = 5 |
Number of successful rounds after which the padding is decreased. More... | |
constexpr uint32_t | ZIP_PAD_INCR = 128 |
Amount by which padding is increased. More... | |
ulong | zip_failure_threshold_pct |
Percentage of compression failures that are allowed in a single round. More... | |
ulong | zip_pad_max |
Maximum percentage of a page that can be allowed as a pad to avoid compression failures. More... | |
const char | innobase_index_reserve_name [] = "GEN_CLUST_INDEX" |
"GEN_CLUST_INDEX" is the name reserved for InnoDB default system clustered index when there is no primary key. More... | |
constexpr uint32_t | DICT_INDEX_MAGIC_N = 76789786 |
Value of dict_index_t::magic_n. More... | |
constexpr uint32_t | DICT_INDEX_MERGE_THRESHOLD_DEFAULT = 50 |
constexpr uint32_t | MAX_KEY_LENGTH_BITS = 12 |
constexpr uint32_t | DICT_TABLE_MAGIC_N = 76333786 |
Value of 'magic_n'. More... | |
constexpr uint32_t | DICT_CLUSTERED = 1 |
Type flags of an index: OR'ing of the flags is allowed to define a combination of types. More... | |
constexpr uint32_t | DICT_UNIQUE = 2 |
unique index More... | |
constexpr uint32_t | DICT_IBUF = 8 |
insert buffer tree More... | |
constexpr uint32_t | DICT_CORRUPT = 16 |
bit to store the corrupted flag in SYS_INDEXES.TYPE More... | |
constexpr uint32_t | DICT_FTS = 32 |
FTS index; can't be combined with the other flags. More... | |
constexpr uint32_t | DICT_SPATIAL = 64 |
SPATIAL index; can't be combined with the other flags. More... | |
constexpr uint32_t | DICT_VIRTUAL = 128 |
Index on Virtual column. More... | |
constexpr uint32_t | DICT_SDI = 256 |
constexpr uint32_t | DICT_MULTI_VALUE = 512 |
Multi-value index. More... | |
constexpr uint32_t | DICT_IT_BITS = 10 |
number of bits used for SYS_INDEXES.TYPE More... | |
constexpr uint32_t | DICT_TF2_BITS = 11 |
Table Flags set number 2. More... | |
constexpr uint32_t | DICT_TF2_UNUSED_BIT_MASK = ~0U << DICT_TF2_BITS |
constexpr uint32_t | DICT_TF2_BIT_MASK = ~DICT_TF2_UNUSED_BIT_MASK |
constexpr uint32_t | DICT_TF2_TEMPORARY = 1 |
TEMPORARY; true for tables from CREATE TEMPORARY TABLE. More... | |
constexpr uint32_t | DICT_TF2_FTS_HAS_DOC_ID = 2 |
The table has an internal defined DOC ID column. More... | |
constexpr uint32_t | DICT_TF2_FTS = 4 |
The table has an FTS index. More... | |
constexpr uint32_t | DICT_TF2_FTS_ADD_DOC_ID = 8 |
Need to add Doc ID column for FTS index build. More... | |
constexpr uint32_t | DICT_TF2_USE_FILE_PER_TABLE = 16 |
This bit is used during table creation to indicate that it will use its own tablespace instead of the system tablespace. More... | |
constexpr uint32_t | DICT_TF2_DISCARDED = 32 |
Set when we discard/detach the tablespace. More... | |
constexpr uint32_t | DICT_TF2_INTRINSIC = 128 |
Intrinsic table bit Intrinsic table is table created internally by MySQL modules viz. More... | |
constexpr uint32_t | DICT_TF2_ENCRYPTION_FILE_PER_TABLE = 256 |
Encryption table bit for innodb_file-per-table only. More... | |
constexpr uint32_t | DICT_TF2_AUX = 512 |
FTS AUX hidden table bit. More... | |
constexpr uint32_t | DICT_TF2_RESURRECT_PREPARED = 1024 |
Table is opened by resurrected trx during crash recovery. More... | |
constexpr uint32_t | DICT_FOREIGN_ON_DELETE_CASCADE = 1 |
The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that a foreign key constraint is enforced, therefore RESTRICT just means no flag. More... | |
constexpr uint32_t | DICT_FOREIGN_ON_DELETE_SET_NULL = 2 |
ON DELETE SET NULL. More... | |
constexpr uint32_t | DICT_FOREIGN_ON_UPDATE_CASCADE = 4 |
ON UPDATE CASCADE. More... | |
constexpr uint32_t | DICT_FOREIGN_ON_UPDATE_SET_NULL = 8 |
ON UPDATE SET NULL. More... | |
constexpr uint32_t | DICT_FOREIGN_ON_DELETE_NO_ACTION = 16 |
ON DELETE NO ACTION. More... | |
constexpr uint32_t | DICT_FOREIGN_ON_UPDATE_NO_ACTION = 32 |
ON UPDATE NO ACTION. More... | |
constexpr uint32_t | DICT_TF_REDUNDANT = 0 |
dict_table_t::flags bit 0 is equal to 0 if the row format = Redundant More... | |
constexpr uint32_t | DICT_TF_COMPACT = 1 |
dict_table_t::flags bit 0 is equal to 1 if the row format = Compact More... | |
constexpr uint32_t | DICT_N_COLS_COMPACT = 0x80000000UL |
This bitmask is used in SYS_TABLES.N_COLS to set and test whether the Compact page format is used, i.e ROW_FORMAT != REDUNDANT. More... | |
constexpr uint32_t | DICT_TF_WIDTH_COMPACT = 1 |
Width of the COMPACT flag. More... | |
constexpr uint32_t | DICT_TF_WIDTH_ZIP_SSIZE = 4 |
Width of the ZIP_SSIZE flag. More... | |
constexpr uint32_t | DICT_TF_WIDTH_ATOMIC_BLOBS = 1 |
Width of the ATOMIC_BLOBS flag. More... | |
constexpr uint32_t | DICT_TF_WIDTH_DATA_DIR = 1 |
If a table is created with the MYSQL option DATA DIRECTORY and innodb-file-per-table, an older engine will not be able to find that table. More... | |
constexpr uint32_t | DICT_TF_WIDTH_SHARED_SPACE = 1 |
Width of the SHARED tablespace flag. More... | |
constexpr uint32_t | DICT_TF_BITS |
Width of all the currently known table flags. More... | |
constexpr uint32_t | DICT_TF_BIT_MASK = ~(~0U << DICT_TF_BITS) |
A mask of all the known/used bits in table flags. More... | |
constexpr uint32_t | DICT_TF_POS_COMPACT = 0 |
Zero relative shift position of the COMPACT field. More... | |
constexpr uint32_t | DICT_TF_POS_ZIP_SSIZE |
Zero relative shift position of the ZIP_SSIZE field. More... | |
constexpr uint32_t | DICT_TF_POS_ATOMIC_BLOBS |
Zero relative shift position of the ATOMIC_BLOBS field. More... | |
constexpr uint32_t | DICT_TF_POS_DATA_DIR |
Zero relative shift position of the DATA_DIR field. More... | |
constexpr uint32_t | DICT_TF_POS_SHARED_SPACE |
Zero relative shift position of the SHARED TABLESPACE field. More... | |
constexpr uint32_t | DICT_TF_POS_UNUSED |
Zero relative shift position of the start of the UNUSED bits. More... | |
constexpr uint32_t | DICT_TF_MASK_COMPACT |
Bit mask of the COMPACT field. More... | |
constexpr uint32_t | DICT_TF_MASK_ZIP_SSIZE |
Bit mask of the ZIP_SSIZE field. More... | |
constexpr uint32_t | DICT_TF_MASK_ATOMIC_BLOBS |
Bit mask of the ATOMIC_BLOBS field. More... | |
constexpr uint32_t | DICT_TF_MASK_DATA_DIR |
Bit mask of the DATA_DIR field. More... | |
constexpr uint32_t | DICT_TF_MASK_SHARED_SPACE |
Bit mask of the SHARED_SPACE field. More... | |
uint32_t | DICT_TF_GET_COMPACT (uint32_t flags) |
Return the value of the COMPACT field. More... | |
uint32_t | DICT_TF_GET_ZIP_SSIZE (uint32_t flags) |
Return the value of the ZIP_SSIZE field. More... | |
uint32_t | DICT_TF_HAS_ATOMIC_BLOBS (uint32_t flags) |
Return the value of the ATOMIC_BLOBS field. More... | |
uint32_t | DICT_TF_HAS_DATA_DIR (uint32_t flags) |
Return the value of the DATA_DIR field. More... | |
uint32_t | DICT_TF_HAS_SHARED_SPACE (uint32_t flags) |
Return the value of the SHARED_SPACE field. More... | |
uint32_t | DICT_TF_GET_UNUSED (uint32_t flags) |
Return the contents of the UNUSED bits. More... | |
Data dictionary memory object creation.
Created 1/8/1996 Heikki Tuuri
#define BG_STAT_IN_PROGRESS (1 << 0) |
Set in 'stats_bg_flag' when the background stats code is working on this table.
The DROP TABLE code waits for this to be cleared before proceeding.
#define BG_STAT_NONE 0 |
Background stats thread is not working on this table.
#define BG_STAT_SHOULD_QUIT (1 << 1) |
Set in 'stats_bg_flag' when DROP TABLE starts waiting on BG_STAT_IN_PROGRESS to be cleared.
The background stats thread will detect this and will eventually quit sooner.
#define DICT_MAX_FIELD_LEN_BY_FORMAT | ( | table | ) |
Find out maximum indexed column length by its table format.
For ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT, the maximum field length is REC_ANTELOPE_MAX_INDEX_COL_LEN - 1 (767). For ROW_FORMAT=COMPRESSED and ROW_FORMAT=DYNAMIC, the length could be REC_VERSION_56_MAX_INDEX_COL_LEN (3072) bytes
#define DICT_STATS_AUTO_RECALC_OFF (1 << 2) |
#define DICT_STATS_AUTO_RECALC_ON (1 << 1) |
The two bits below are set in the 'stats_auto_recalc' member.
They have the following meaning:
#define DICT_STATS_PERSISTENT_OFF (1 << 2) |
#define DICT_STATS_PERSISTENT_ON (1 << 1) |
The two bits below are set in the 'stat_persistent' member.
They have the following meaning:
typedef std::vector<index_id_t, ut::allocator<index_id_t> > corrupted_ids_t |
typedef std::set<dict_foreign_t *, dict_foreign_compare, ut::allocator<dict_foreign_t *> > dict_foreign_set |
typedef std::list<dict_s_col_t, ut::allocator<dict_s_col_t> > dict_s_col_list |
list to put stored column for dict_table_t
typedef std::list<dict_v_idx_t, ut::allocator<dict_v_idx_t> > dict_v_idx_list |
Index list to put in dict_v_col_t.
typedef std::set<dict_v_col_t *, std::less<dict_v_col_t *>, ut::allocator<dict_v_col_t *> > dict_vcol_set |
Set to store the virtual columns which are affected by Foreign key constraint.
typedef ut_list_base<lock_t, TableLockGetNode> table_lock_list_t |
typedef std::vector<row_prebuilt_t *> temp_prebuilt_vec |
A vector to collect prebuilt from different readers working on the same temp table.
enum online_index_status |
The status of online index creation.
enum persistent_type_t |
Persistent dynamic metadata type, there should be 1 to 1 relationship between the metadata and the type.
Please keep them in order so that we can iterate over it
enum table_dirty_status |
The dirty status of tables, used to indicate if a table has some dynamic metadata changed to be written back.
|
inline |
Frees a foreign key struct.
in, own: foreign key struct
foreign | in, own: foreign key struct |
bool dict_foreign_set_validate | ( | const dict_foreign_set & | fk_set | ) |
Validate the search order in the foreign key set.
[in] | fk_set | the foreign key set to be validated |
bool dict_foreign_set_validate | ( | const dict_table_t & | table | ) |
Validate the search order in the foreign key sets of the table (foreign_set and referenced_set).
[in] | table | table whose foreign key sets are to be validated |
|
inline |
Request a lazy creation of dict_index_t::zip_pad::mutex.
This function is only called from either single threaded environment or from a thread that has not shared the table object with other threads.
[in,out] | index | index whose zip_pad mutex is to be created |
|
inline |
Destroy the zip_pad_mutex of the given index.
This function is only called from either single threaded environment or from a thread that has not shared the table object with other threads.
[in,out] | index | index whose stats latch to destroy |
|
inline |
Release the zip_pad_mutex of a given index.
[in,out] | index | index whose zip_pad_mutex is to be released |
|
inlinestatic |
char * dict_mem_create_temporary_tablename | ( | mem_heap_t * | heap, |
const char * | dbtab, | ||
table_id_t | id | ||
) |
Create a temporary tablename like "#sql-ibtid-inc" where tid = the Table ID inc = a randomly initialized number that is incremented for each file The table ID is a 64 bit integer, can use up to 20 digits, and is initialized at bootstrap.
The second number is 32 bits, can use up to 10 digits, and is initialized at startup to a randomly distributed number. It is hoped that the combination of these two numbers will provide a reasonably unique temporary file name.
[in] | heap | A memory heap |
[in] | dbtab | Table name in the form database/table name |
[in] | id | Table id |
|
inlinestatic |
This function poplulates a dict_index_t index memory structure with supplied information.
[out] | index | index to be filled |
[in] | heap | memory heap |
[in] | table_name | table name |
[in] | index_name | index name |
[in] | space | space where the index tree is placed, the clustered type ignored if the index is of the clustered type |
[in] | type | DICT_UNIQUE, DICT_CLUSTERED, ... ORed |
[in] | n_fields | number of fields |
dict_foreign_t * dict_mem_foreign_create | ( | void | ) |
Creates and initializes a foreign constraint memory object.
void dict_mem_foreign_fill_vcol_set | ( | dict_foreign_t * | foreign | ) |
Fills the dependent virtual columns in a set.
Reason for being dependent are 1) FK can be present on base column of virtual columns 2) FK can be present on column which is a part of virtual index
[in,out] | foreign | foreign key information. |
FK can be present on base columns of virtual columns.
FK can be present on the columns which can be a part of virtual index.
void dict_mem_foreign_table_name_lookup_set | ( | dict_foreign_t * | foreign, |
bool | do_alloc | ||
) |
Sets the foreign_table_name_lookup pointer based on the value of lower_case_table_names.
If that is 0 or 1, foreign_table_name_lookup will point to foreign_table_name. If 2, then another string is allocated from the heap and set to lower case. in: is an alloc needed
If that is 0 or 1, foreign_table_name_lookup will point to foreign_table_name. If 2, then another string is allocated from foreign->heap and set to lower case.
foreign | in/out: foreign struct |
do_alloc | in: is an alloc needed |
void dict_mem_index_free | ( | dict_index_t * | index | ) |
Frees an index memory object.
in: index
index | in: index |
void dict_mem_init | ( | void | ) |
Initialize dict memory variables.
void dict_mem_referenced_table_name_lookup_set | ( | dict_foreign_t * | foreign, |
bool | do_alloc | ||
) |
Sets the referenced_table_name_lookup pointer based on the value of lower_case_table_names.
If that is 0 or 1, referenced_table_name_lookup will point to referenced_table_name. If 2, then another string is allocated from the heap and set to lower case. in: is an alloc needed
If that is 0 or 1, referenced_table_name_lookup will point to referenced_table_name. If 2, then another string is allocated from foreign->heap and set to lower case.
foreign | in/out: foreign struct |
do_alloc | in: is an alloc needed |
void dict_mem_table_add_s_col | ( | dict_table_t * | table, |
ulint | num_base | ||
) |
Adds a stored column definition to a table.
[in,out] | table | table |
[in] | num_base | number of base columns. |
dict_v_col_t * dict_mem_table_add_v_col | ( | dict_table_t * | table, |
mem_heap_t * | heap, | ||
const char * | name, | ||
ulint | mtype, | ||
ulint | prtype, | ||
ulint | len, | ||
ulint | pos, | ||
ulint | num_base, | ||
bool | is_visible | ||
) |
Adds a virtual column definition to a table.
[in,out] | table | table |
[in] | heap | temporary memory heap, or NULL. It is used to store name when we have not finished adding all columns. When all columns are added, the whole name will copy to memory from table->heap |
[in] | name | column name |
[in] | mtype | main datatype |
[in] | prtype | precise type |
[in] | len | length |
[in] | pos | position in a table |
[in] | num_base | number of base columns |
[in] | is_visible | True if virtual column is visible to user |
void dict_mem_table_col_rename | ( | dict_table_t * | table, |
ulint | nth_col, | ||
const char * | from, | ||
const char * | to, | ||
bool | is_virtual | ||
) |
Renames a column of a table in the data dictionary cache.
[in,out] | table | Table |
[in] | nth_col | Column index |
[in] | from | Old column name |
[in] | to | New column name |
[in] | is_virtual | If this is a virtual column |
void dict_mem_table_fill_foreign_vcol_set | ( | dict_table_t * | table | ) |
Fill virtual columns set in each fk constraint present in the table.
[in,out] | table | innodb table object. |
void dict_mem_table_free_foreign_vcol_set | ( | dict_table_t * | table | ) |
Free the vcol_set from all foreign key constraint on the table.
[in,out] | table | innodb table object. |
|
inline |
Request for lazy creation of the autoinc latch of a given table.
This function is only called from either single threaded environment or from a thread that has not shared the table object with other threads.
[in,out] | table | table whose autoinc latch is to be created. |
|
inline |
Destroy the autoinc latch of the given table.
This function is only called from either single threaded environment or from a thread that has not shared the table object with other threads.
[in,out] | table | table whose stats latch to destroy |
|
inline |
Check if the current thread owns the autoinc_mutex of a given table.
[in] | table | the autoinc_mutex belongs to this table |
|
inline |
Request for lazy creation of the mutex of a given table.
This function is only called from either single threaded environment or from a thread that has not shared the table object with other threads.
[in,out] | table | table whose mutex is to be created |
|
inline |
Destroy the mutex of a given table.
This function is only called from either single threaded environment or from a thread that has not shared the table object with other threads.
[in,out] | table | table whose mutex is to be created |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
Return the value of the COMPACT field.
|
inline |
Return the contents of the UNUSED bits.
|
inline |
Return the value of the ZIP_SSIZE field.
|
inline |
Return the value of the ATOMIC_BLOBS field.
|
inline |
Return the value of the DATA_DIR field.
|
inline |
Return the value of the SHARED_SPACE field.
|
inlinestatic |
std::ostream & operator<< | ( | std::ostream & | out, |
const dict_foreign_set & | fk_set | ||
) |
std::ostream & operator<< | ( | std::ostream & | out, |
const dict_foreign_t & | foreign | ||
) |
std::ostream & operator<< | ( | std::ostream & | s, |
const id_name_t & | id_name | ||
) |
Display an identifier.
[in,out] | s | output stream |
[in] | id_name | SQL identifier (other than table name) |
std::ostream & operator<< | ( | std::ostream & | s, |
const table_name_t & | table_name | ||
) |
Display a table name.
[in,out] | s | output stream |
[in] | table_name | table name |
|
constexpr |
DICT_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed prefix length) in ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT.
Also, in any format, any fixed-length field that is longer than this will be encoded as a variable-length field.
It is set to 3*256, so that one can create a column prefix index on 256 characters of a TEXT or VARCHAR column also in the UTF-8 charset. In that charset, a character may take at most 3 bytes. This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data files would be at risk!
|
constexpr |
Type flags of an index: OR'ing of the flags is allowed to define a combination of types.
clustered index; for other than auto-generated clustered indexes, also DICT_UNIQUE will be set
|
constexpr |
bit to store the corrupted flag in SYS_INDEXES.TYPE
|
constexpr |
Tables could be chained together with Foreign key constraint.
When first load the parent table, we would load all of its descedents. This could result in rescursive calls and out of stack error eventually. DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads, when exceeded, the child table will not be loaded. It will be loaded when the foreign constraint check needs to be run.
|
constexpr |
The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that a foreign key constraint is enforced, therefore RESTRICT just means no flag.
ON DELETE CASCADE
|
constexpr |
ON DELETE NO ACTION.
|
constexpr |
ON DELETE SET NULL.
|
constexpr |
ON UPDATE CASCADE.
|
constexpr |
ON UPDATE NO ACTION.
|
constexpr |
ON UPDATE SET NULL.
|
constexpr |
FTS index; can't be combined with the other flags.
|
constexpr |
insert buffer tree
|
constexpr |
Value of dict_index_t::magic_n.
|
constexpr |
|
constexpr |
number of bits used for SYS_INDEXES.TYPE
|
constexpr |
Defines the maximum fixed length column size.
|
constexpr |
Multi-value index.
|
constexpr |
This bitmask is used in SYS_TABLES.N_COLS to set and test whether the Compact page format is used, i.e ROW_FORMAT != REDUNDANT.
|
constexpr |
|
constexpr |
SPATIAL index; can't be combined with the other flags.
|
constexpr |
Value of 'magic_n'.
|
constexpr |
FTS AUX hidden table bit.
|
constexpr |
|
constexpr |
Table Flags set number 2.
These flags will be stored in SYS_TABLES.MIX_LEN. All unused flags will be written as 0. The column may contain garbage for tables created with old versions of InnoDB that only implemented ROW_FORMAT=REDUNDANT. InnoDB engines do not check these flags for unknown bits in order to protect backward incompatibility. Total number of bits in table->flags2.
|
constexpr |
Set when we discard/detach the tablespace.
|
constexpr |
Encryption table bit for innodb_file-per-table only.
|
constexpr |
The table has an FTS index.
|
constexpr |
Need to add Doc ID column for FTS index build.
This is a transient bit for index build
|
constexpr |
The table has an internal defined DOC ID column.
|
constexpr |
Intrinsic table bit Intrinsic table is table created internally by MySQL modules viz.
Optimizer, FTS, etc.... Intrinsic table has all the properties of the normal table except it is not created by user and so not visible to end-user.
|
constexpr |
Table is opened by resurrected trx during crash recovery.
|
constexpr |
TEMPORARY; true for tables from CREATE TEMPORARY TABLE.
|
constexpr |
|
constexpr |
This bit is used during table creation to indicate that it will use its own tablespace instead of the system tablespace.
|
constexpr |
A mask of all the known/used bits in table flags.
|
constexpr |
Width of all the currently known table flags.
|
constexpr |
dict_table_t::flags bit 0 is equal to 1 if the row format = Compact
Compact row format.
|
constexpr |
Bit mask of the ATOMIC_BLOBS field.
|
constexpr |
Bit mask of the COMPACT field.
|
constexpr |
Bit mask of the DATA_DIR field.
|
constexpr |
Bit mask of the SHARED_SPACE field.
|
constexpr |
Bit mask of the ZIP_SSIZE field.
|
constexpr |
Zero relative shift position of the ATOMIC_BLOBS field.
|
constexpr |
Zero relative shift position of the COMPACT field.
|
constexpr |
Zero relative shift position of the DATA_DIR field.
|
constexpr |
Zero relative shift position of the SHARED TABLESPACE field.
|
constexpr |
Zero relative shift position of the start of the UNUSED bits.
|
constexpr |
Zero relative shift position of the ZIP_SSIZE field.
|
constexpr |
dict_table_t::flags bit 0 is equal to 0 if the row format = Redundant
Redundant row format.
|
constexpr |
Width of the ATOMIC_BLOBS flag.
The ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT broke up BLOB and TEXT fields, storing the first 768 bytes in the clustered index. ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED store the whole blob or text field off-page atomically. Secondary indexes are created from this external data using row_ext_t to cache the BLOB prefixes.
|
constexpr |
Width of the COMPACT flag.
|
constexpr |
If a table is created with the MYSQL option DATA DIRECTORY and innodb-file-per-table, an older engine will not be able to find that table.
This flag prevents older engines from attempting to open the table and allows InnoDB to update_create_info() accordingly.
|
constexpr |
Width of the SHARED tablespace flag.
It is used to identify tables that exist inside a shared general tablespace. If a table is created with the TABLESPACE=tsname option, an older engine will not be able to find that table. This flag prevents older engines from attempting to open the table and allows InnoDB to quickly find the tablespace.
|
constexpr |
Width of the ZIP_SSIZE flag.
|
constexpr |
unique index
|
constexpr |
Index on Virtual column.
|
constexpr |
Similarly, when tables are chained together with foreign key constraints with on cascading delete/update clause, delete from parent table could result in recursive cascading calls.
This defines the maximum number of such cascading deletes/updates allowed. When exceeded, the delete from parent table will fail, and user has to drop excessive foreign constraint before proceeds.
const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX" |
"GEN_CLUST_INDEX" is the name reserved for InnoDB default system clustered index when there is no primary key.
|
constexpr |
|
constexpr |
Format of INSTANTLY DROPPED column names.
|
constexpr |
|
constexpr |
index/table name used while applying REDO logs during recovery
|
extern |
Percentage of compression failures that are allowed in a single round.
|
constexpr |
Amount by which padding is increased.
|
extern |
Maximum percentage of a page that can be allowed as a pad to avoid compression failures.
|
constexpr |
PADDING HEURISTIC BASED ON LINEAR INCREASE OF PADDING TO AVOID COMPRESSION FAILURES (Note: this is relevant only for compressed indexes) GOAL: Avoid compression failures by maintaining information about the compressibility of data.
If data is not very compressible then leave some extra space 'padding' in the uncompressed page making it more likely that compression of less than fully packed uncompressed page will succeed.
This padding heuristic works by increasing the pad linearly until the desired failure rate is reached. A "round" is a fixed number of compression operations. After each round, the compression failure rate for that round is computed. If the failure rate is too high, then padding is incremented by a fixed value, otherwise it's left intact. If the compression failure is lower than the desired rate for a fixed number of consecutive rounds, then the padding is decreased by a fixed value. This is done to prevent overshooting the padding value, and to accommodate the possible change in data compressibility. Number of zip ops in one round.
|
constexpr |
Number of successful rounds after which the padding is decreased.