InnoDB Plugin  1.0
Functions
dict0dict.ic File Reference
#include "data0type.h"
#include "dict0load.h"
#include "rem0types.h"
#include "fsp0fsp.h"
#include "srv0srv.h"
#include "sync0rw.h"
Include dependency graph for dict0dict.ic:
This graph shows which files directly or indirectly include this file:

Functions

UNIV_INLINE ulint dict_col_get_mbminlen (const dict_col_t *col)
UNIV_INLINE ulint dict_col_get_mbmaxlen (const dict_col_t *col)
UNIV_INLINE void dict_col_set_mbminmaxlen (dict_col_t *col, ulint mbminlen, ulint mbmaxlen)
UNIV_INLINE void dict_col_copy_type (const dict_col_t *col, dtype_t *type)
UNIV_INLINE ibool dict_col_type_assert_equal (const dict_col_t *col, const dtype_t *type)
UNIV_INLINE ulint dict_col_get_min_size (const dict_col_t *col)
UNIV_INLINE ulint dict_col_get_max_size (const dict_col_t *col)
UNIV_INLINE ulint dict_col_get_fixed_size (const dict_col_t *col, ulint comp)
UNIV_INLINE ulint dict_col_get_sql_null_size (const dict_col_t *col, ulint comp)
UNIV_INLINE ulint dict_col_get_no (const dict_col_t *col)
UNIV_INLINE ulint dict_col_get_clust_pos (const dict_col_t *col, const dict_index_t *clust_index)
UNIV_INLINE dict_index_tdict_table_get_first_index (const dict_table_t *table)
UNIV_INLINE dict_index_tdict_table_get_last_index (const dict_table_t *table)
UNIV_INLINE dict_index_tdict_table_get_next_index (const dict_index_t *index)
UNIV_INLINE ulint dict_index_is_clust (const dict_index_t *index)
UNIV_INLINE ulint dict_index_is_unique (const dict_index_t *index)
UNIV_INLINE ulint dict_index_is_ibuf (const dict_index_t *index)
UNIV_INLINE ulint dict_index_is_univ (const dict_index_t *index)
UNIV_INLINE ulint dict_index_is_sec_or_ibuf (const dict_index_t *index)
UNIV_INLINE ulint dict_table_get_n_user_cols (const dict_table_t *table)
UNIV_INLINE ulint dict_table_get_n_sys_cols (const dict_table_t *table))
UNIV_INLINE ulint dict_table_get_n_cols (const dict_table_t *table)
UNIV_INLINE ib_uint64_t dict_table_get_n_rows (const dict_table_t *table)
UNIV_INLINE void dict_table_n_rows_inc (dict_table_t *table)
UNIV_INLINE void dict_table_n_rows_dec (dict_table_t *table)
UNIV_INLINE dict_col_tdict_table_get_nth_col (const dict_table_t *table, ulint pos)
UNIV_INLINE dict_col_tdict_table_get_sys_col (const dict_table_t *table, ulint sys)
UNIV_INLINE ulint dict_table_get_sys_col_no (const dict_table_t *table, ulint sys)
UNIV_INLINE ibool dict_table_is_comp (const dict_table_t *table)
UNIV_INLINE ibool dict_table_has_fts_index (dict_table_t *table)
UNIV_INLINE bool dict_tf_is_valid (ulint flags)
UNIV_INLINE ulint dict_sys_tables_type_validate (ulint type, ulint n_cols)
UNIV_INLINE rec_format_t dict_tf_get_rec_format (ulint flags)
UNIV_INLINE ulint dict_tf_get_format (ulint flags)
UNIV_INLINE ulint dict_table_get_format (const dict_table_t *table)
UNIV_INLINE void dict_tf_set (ulint *flags, rec_format_t format, ulint zip_ssize, bool use_data_dir)
UNIV_INLINE ulint dict_tf_to_fsp_flags (ulint table_flags)
UNIV_INLINE ulint dict_sys_tables_type_to_tf (ulint type, ulint n_cols)
UNIV_INLINE ulint dict_tf_to_sys_tables_type (ulint flags)
UNIV_INLINE ulint dict_tf_get_zip_size (ulint flags)
UNIV_INLINE ulint dict_table_zip_size (const dict_table_t *table)
UNIV_INLINE void dict_table_x_lock_indexes (dict_table_t *table)
UNIV_INLINE void dict_table_x_unlock_indexes (dict_table_t *table)
UNIV_INLINE ulint dict_index_get_n_fields (const dict_index_t *index)
UNIV_INLINE ulint dict_index_get_n_unique (const dict_index_t *index)
UNIV_INLINE ulint dict_index_get_n_unique_in_tree (const dict_index_t *index)
UNIV_INLINE ulint dict_index_get_n_ordering_defined_by_user (const dict_index_t *index)
UNIV_INLINE dict_field_tdict_index_get_nth_field (const dict_index_t *index, ulint pos)
UNIV_INLINE ulint dict_index_get_sys_col_pos (const dict_index_t *index, ulint type)
UNIV_INLINE const dict_col_tdict_field_get_col (const dict_field_t *field)
UNIV_INLINE const dict_col_tdict_index_get_nth_col (const dict_index_t *index, ulint pos)
UNIV_INLINE ulint dict_index_get_nth_col_no (const dict_index_t *index, ulint pos)
UNIV_INLINE ulint dict_index_get_nth_col_pos (const dict_index_t *index, ulint n)
UNIV_INLINE ulint dict_index_get_min_size (const dict_index_t *index)
UNIV_INLINE ulint dict_index_get_space (const dict_index_t *index)
UNIV_INLINE void dict_index_set_space (dict_index_t *index, ulint space)
UNIV_INLINE ulint dict_index_get_page (const dict_index_t *index)
UNIV_INLINE rw_lock_tdict_index_get_lock (dict_index_t *index)
UNIV_INLINE ulint dict_index_get_space_reserve (void)
UNIV_INLINE enum
online_index_status 
dict_index_get_online_status (const dict_index_t *index)
UNIV_INLINE void dict_index_set_online_status (dict_index_t *index, enum online_index_status status)
UNIV_INLINE bool dict_index_is_online_ddl (const dict_index_t *index)
UNIV_INLINE ulint dict_table_is_fts_column (ib_vector_t *indexes, ulint col_no)
UNIV_INLINE ulint dict_max_field_len_store_undo (dict_table_t *table, const dict_col_t *col)
UNIV_INLINE ulint dict_table_is_corrupted (const dict_table_t *table)
UNIV_INLINE ulint dict_index_is_corrupted (const dict_index_t *index)
UNIV_INLINE bool dict_table_is_discarded (const dict_table_t *table)
UNIV_INLINE bool dict_table_is_temporary (const dict_table_t *table)
UNIV_INLINE dict_index_tdict_table_get_index_on_first_col (const dict_table_t *table, ulint col_index)

Detailed Description

Data dictionary system

Created 1/8/1996 Heikki Tuuri

Function Documentation

UNIV_INLINE void dict_col_copy_type ( const dict_col_t col,
dtype_t type 
)

Gets the column data type.

Parameters
colin: column
typeout: data type
UNIV_INLINE 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.

Parameters
colin: table column
clust_indexin: clustered index
UNIV_INLINE ulint dict_col_get_fixed_size ( const dict_col_t col,
ulint  comp 
)

Returns the size of a fixed size column, 0 if not a fixed size column.

Returns
fixed size, or 0
Parameters
colin: column
compin: nonzero=ROW_FORMAT=COMPACT
UNIV_INLINE ulint dict_col_get_max_size ( const dict_col_t col)

Returns the maximum size of the column.

Returns
maximum size
Parameters
colin: column
UNIV_INLINE ulint dict_col_get_mbmaxlen ( const dict_col_t col)

Gets the maximum number of bytes per character.

Returns
maximum multi-byte char size, in bytes
Parameters
colin: column
UNIV_INLINE ulint dict_col_get_mbminlen ( const dict_col_t col)

Gets the minimum number of bytes per character.

Returns
minimum multi-byte char size, in bytes
Parameters
colin: column
UNIV_INLINE ulint dict_col_get_min_size ( const dict_col_t col)

Returns the minimum size of the column.

Returns
minimum size
Parameters
colin: column
UNIV_INLINE ulint dict_col_get_no ( const dict_col_t col)

Gets the column number.

Returns
col->ind, table column position (starting from 0)
Parameters
colin: column
UNIV_INLINE ulint dict_col_get_sql_null_size ( const dict_col_t col,
ulint  comp 
)

Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. For fixed length types it is the fixed length of the type, otherwise 0.

Returns
SQL null storage size in ROW_FORMAT=REDUNDANT
Parameters
colin: column
compin: nonzero=ROW_FORMAT=COMPACT
UNIV_INLINE void dict_col_set_mbminmaxlen ( dict_col_t col,
ulint  mbminlen,
ulint  mbmaxlen 
)

Sets the minimum and maximum number of bytes per character.

Parameters
colin/out: column
mbminlenin: minimum multi-byte character size, in bytes
mbmaxlenin: minimum multi-byte character size, in bytes
UNIV_INLINE ibool dict_col_type_assert_equal ( const dict_col_t col,
const dtype_t type 
)

Assert that a column and a data type match.

Returns
TRUE
Parameters
colin: column
typein: data type
UNIV_INLINE const dict_col_t* dict_field_get_col ( const dict_field_t field)

Gets the field column.

Returns
field->col, pointer to the table column
Parameters
fieldin: index field
UNIV_INLINE rw_lock_t* dict_index_get_lock ( dict_index_t index)

Gets the read-write lock of the index tree.

Returns
read-write lock
Parameters
indexin: index
UNIV_INLINE ulint dict_index_get_min_size ( const dict_index_t index)

Returns the minimum data size of an index record.

Returns
minimum data size in bytes
Parameters
indexin: index
UNIV_INLINE 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 dictionary system.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)
UNIV_INLINE 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. In the internal representation of clustered indexes we add the row id to the ordering fields to make a clustered index unique, but this function returns the number of fields the user defined in the index as ordering fields.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)
UNIV_INLINE 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 position of an index entry in the index, if we do not take multiversioning into account: in the B-tree use the value returned by dict_index_get_n_unique_in_tree.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)
UNIV_INLINE 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 position of an index entry in the index, if we also take multiversioning into account.

Returns
number of fields
Parameters
indexin: an internal representation of index (in the dictionary cache)
UNIV_INLINE const dict_col_t* dict_index_get_nth_col ( const dict_index_t index,
ulint  pos 
)

Gets pointer to the nth column in an index.

Returns
column
Parameters
indexin: index
posin: position of the field
UNIV_INLINE ulint dict_index_get_nth_col_no ( const dict_index_t index,
ulint  pos 
)

Gets the column number the nth field in an index.

Returns
column number
Parameters
indexin: index
posin: position of the field
UNIV_INLINE ulint dict_index_get_nth_col_pos ( const dict_index_t index,
ulint  n 
)

Looks for column n in an index.

Returns
position in internal representation of the index; ULINT_UNDEFINED if not contained
Parameters
indexin: index
nin: column number
UNIV_INLINE dict_field_t* dict_index_get_nth_field ( const dict_index_t index,
ulint  pos 
)

Gets the nth field of an index.

Returns
pointer to field object
Parameters
indexin: index
posin: position of field
UNIV_INLINE enum online_index_status dict_index_get_online_status ( const dict_index_t index)

Gets the status of online index creation.

Returns
the status
Parameters
indexin: secondary index
UNIV_INLINE ulint dict_index_get_page ( const dict_index_t index)

Gets the page number of the root of the index tree.

Returns
page number
Parameters
indexin: index
UNIV_INLINE ulint dict_index_get_space ( const dict_index_t index)

Gets the space id of the root of the index tree.

Returns
space id
Parameters
indexin: index
UNIV_INLINE ulint dict_index_get_space_reserve ( void  )

Returns free space reserved for future updates of records. This is relevant only in the case of many consecutive inserts, as updates which make the records bigger might fragment the index.

Returns
number of free bytes on page, reserved for updates
UNIV_INLINE ulint dict_index_get_sys_col_pos ( const dict_index_t index,
ulint  type 
)

Returns the position of a system column in an index.

Returns
position, ULINT_UNDEFINED if not contained
Parameters
indexin: index
typein: DATA_ROW_ID, ...
UNIV_INLINE ulint dict_index_is_clust ( const dict_index_t index)

Check whether the index is the clustered index.

Returns
nonzero for clustered index, zero for other indexes
Parameters
indexin: index
UNIV_INLINE ulint dict_index_is_corrupted ( const dict_index_t index)

Check whether the index is corrupted.

Returns
nonzero for corrupted index, zero for valid indexes
Parameters
indexin: index
UNIV_INLINE ulint dict_index_is_ibuf ( const dict_index_t index)

Check whether the index is the insert buffer tree.

Returns
nonzero for insert buffer, zero for other indexes
Parameters
indexin: index
UNIV_INLINE 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 online, allowing concurrent modifications to the table.

Return values
trueif the index is being or has been built online, or if this is a clustered index and the table is being or has been rebuilt online
falseif the index has been created or the table has been rebuilt completely
Parameters
indexin: index
UNIV_INLINE 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.

Returns
nonzero for insert buffer, zero for other indexes
Parameters
indexin: index
UNIV_INLINE ulint dict_index_is_unique ( const dict_index_t index)

Check whether the index is unique.

Returns
nonzero for unique index, zero for other indexes
Parameters
indexin: index
UNIV_INLINE ulint dict_index_is_univ ( const dict_index_t index)

Check whether the index is an universal index tree.

Returns
nonzero for universal tree, zero for other indexes
Parameters
indexin: index
UNIV_INLINE void dict_index_set_online_status ( dict_index_t index,
enum online_index_status  status 
)

Sets the status of online index creation.

Parameters
indexin/out: index
statusin: status
UNIV_INLINE void dict_index_set_space ( dict_index_t index,
ulint  space 
)

Sets the space id of the root of the index tree.

Parameters
indexin/out: index
spacein: space id
UNIV_INLINE 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. Please note if the table format is UNIV_FORMAT_A (< UNIV_FORMAT_B), no prefix needs to be stored in the undo log.

Returns
bytes of column prefix to be stored in the undo log
Parameters
tablein: table
colin: column which index prefix is based on
UNIV_INLINE ulint dict_sys_tables_type_to_tf ( ulint  type,
ulint  n_cols 
)

Convert a 32 bit integer from SYS_TABLES.TYPE to dict_table_t::flags The following chart shows the translation of the low order bit. Other bits are the same. ========================= Low order bit ========================== | REDUNDANT | COMPACT | COMPRESSED and DYNAMIC SYS_TABLES.TYPE | 1 | 1 | 1

dict_table_t::flags | 0 | 1 | 1

Returns
ulint containing SYS_TABLES.TYPE
Parameters
typein: SYS_TABLES.TYPE field
n_colsin: SYS_TABLES.N_COLS field
UNIV_INLINE ulint dict_sys_tables_type_validate ( ulint  type,
ulint  n_cols 
)

Validate a SYS_TABLES TYPE field and return it.

Returns
Same as input after validating it as a SYS_TABLES TYPE field. If there is an error, return ULINT_UNDEFINED.
Parameters
typein: SYS_TABLES.TYPE
n_colsin: SYS_TABLES.N_COLS
UNIV_INLINE dict_index_t* dict_table_get_first_index ( const dict_table_t table)

Gets the first index on the table (the clustered index).

Returns
index, NULL if none exists
Parameters
tablein: table
UNIV_INLINE ulint dict_table_get_format ( const dict_table_t table)

Determine the file format of a table.

Returns
file format version
Parameters
tablein: table
UNIV_INLINE dict_index_t* dict_table_get_index_on_first_col ( const dict_table_t table,
ulint  col_index 
)

Get index by first field of the index

Returns
index which is having first field matches with the field present in field_index position of table
Parameters
tablein: table
col_indexin: position of column in table
UNIV_INLINE dict_index_t* dict_table_get_last_index ( const dict_table_t table)

Gets the last index on the table.

Returns
index, NULL if none exists
Parameters
tablein: table
UNIV_INLINE ulint dict_table_get_n_cols ( const dict_table_t table)

Gets the number of all columns (also system) in a table in the dictionary cache.

Returns
number of columns of a table
Parameters
tablein: table
UNIV_INLINE ib_uint64_t dict_table_get_n_rows ( const dict_table_t table)

Gets the approximately estimated number of rows in the table.

Returns
estimated number of rows
Parameters
tablein: table
UNIV_INLINE ulint dict_table_get_n_sys_cols ( const dict_table_t table)

Gets the number of system columns in a table in the dictionary cache.

Returns
number of system (e.g., ROW_ID) columns of a table

< in: table

Parameters
tablein: table
UNIV_INLINE ulint dict_table_get_n_user_cols ( const dict_table_t table)

Gets the number of user-defined columns in a table in the dictionary cache.

Returns
number of user-defined (e.g., not ROW_ID) columns of a table
Parameters
tablein: table
UNIV_INLINE dict_index_t* dict_table_get_next_index ( const dict_index_t index)

Gets the next index on the table.

Returns
index, NULL if none left
Parameters
indexin: index
UNIV_INLINE dict_col_t* dict_table_get_nth_col ( const dict_table_t table,
ulint  pos 
)

Gets the nth column of a table.

Returns
pointer to column object
Parameters
tablein: table
posin: position of column
UNIV_INLINE dict_col_t* dict_table_get_sys_col ( const dict_table_t table,
ulint  sys 
)

Gets the given system column of a table.

Returns
pointer to column object
Parameters
tablein: table
sysin: DATA_ROW_ID, ...
UNIV_INLINE ulint dict_table_get_sys_col_no ( const dict_table_t table,
ulint  sys 
)

Gets the given system column number of a table.

Returns
column number
Parameters
tablein: table
sysin: DATA_ROW_ID, ...
UNIV_INLINE ibool dict_table_has_fts_index ( dict_table_t table)

Check if the table has an FTS index.

Returns
TRUE if table has an FTS index
Parameters
tablein: table
UNIV_INLINE ibool dict_table_is_comp ( const dict_table_t table)

Check whether the table uses the compact page format.

Returns
TRUE if table uses the compact page format
Parameters
tablein: table
UNIV_INLINE ulint dict_table_is_corrupted ( const dict_table_t table)

Check whether the table is corrupted.

Returns
nonzero for corrupted table, zero for valid tables
Parameters
tablein: table
UNIV_INLINE bool dict_table_is_discarded ( const dict_table_t table)

Check if the tablespace for the table has been discarded.

Returns
true if the tablespace has been discarded.
Parameters
tablein: table to check
UNIV_INLINE ulint dict_table_is_fts_column ( ib_vector_t indexes,
ulint  col_no 
)

Check whether a column exists in an FTS index.

Returns
ULINT_UNDEFINED if no match else the offset within the vector
Parameters
indexesin: vector containing only FTS indexes
col_noin: col number to search for
UNIV_INLINE bool dict_table_is_temporary ( const dict_table_t table)

Check if it is a temporary table.

Returns
true if temporary table flag is set.
Parameters
tablein: table to check
UNIV_INLINE void dict_table_n_rows_dec ( dict_table_t table)

Decrement the number of rows in the table by one. Notice that this operation is not protected by any latch, the number is approximate.

Parameters
tablein/out: table
UNIV_INLINE void dict_table_n_rows_inc ( dict_table_t table)

Increment the number of rows in the table by one. Notice that this operation is not protected by any latch, the number is approximate.

Parameters
tablein/out: table
UNIV_INLINE void dict_table_x_lock_indexes ( dict_table_t table)

Obtain exclusive locks on all index trees of the table. This is to prevent accessing index trees while InnoDB is updating internal metadata for operations such as truncate tables.

Parameters
tablein: table
UNIV_INLINE void dict_table_x_unlock_indexes ( dict_table_t table)

Release the exclusive locks on all index tree.

Parameters
tablein: table
UNIV_INLINE ulint dict_table_zip_size ( const dict_table_t table)

Check whether the table uses the compressed compact page format.

Returns
compressed page size, or 0 if not compressed
Parameters
tablein: table
UNIV_INLINE ulint dict_tf_get_format ( ulint  flags)

Determine the file format from a dict_table_t::flags.

Returns
file format version
Parameters
flagsin: dict_table_t::flags
UNIV_INLINE rec_format_t dict_tf_get_rec_format ( ulint  flags)

Determine the file format from dict_table_t::flags The low order bit will be zero for REDUNDANT and 1 for COMPACT. For any other row_format, file_format is > 0 and DICT_TF_COMPACT will also be set.

Returns
file format version
Parameters
flagsin: dict_table_t::flags
UNIV_INLINE ulint dict_tf_get_zip_size ( ulint  flags)

Extract the compressed page size from dict_table_t::flags. These flags are in memory, so assert that they are valid.

Returns
compressed page size, or 0 if not compressed
Parameters
flagsin: flags
UNIV_INLINE bool dict_tf_is_valid ( ulint  flags)

Validate the table flags.

Returns
true if valid.
Parameters
flagsin: table flags
UNIV_INLINE void dict_tf_set ( ulint *  flags,
rec_format_t  format,
ulint  zip_ssize,
bool  use_data_dir 
)

Set the file format and zip size in a dict_table_t::flags. If zip size is not needed, it should be 0.

Parameters
flagsin/out: table flags
formatin: file format
zip_ssizein: zip shift size
use_data_dirin: table uses DATA DIRECTORY
UNIV_INLINE ulint dict_tf_to_fsp_flags ( ulint  table_flags)

Convert a 32 bit integer table flags to the 32 bit integer that is written into the tablespace header at the offset FSP_SPACE_FLAGS and is also stored in the fil_space_t::flags field. The following chart shows the translation of the low order bit. Other bits are the same. ========================= Low order bit ========================== | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC dict_table_t::flags | 0 | 1 | 1 | 1

fil_space_t::flags | 0 | 0 | 1 | 1

Returns
tablespace flags (fil_space_t::flags)
Parameters
table_flagsin: dict_table_t::flags
UNIV_INLINE ulint dict_tf_to_sys_tables_type ( ulint  flags)

Convert a 32 bit integer table flags to the 32bit integer that is written to a SYS_TABLES.TYPE field. The following chart shows the translation of the low order bit. Other bits are the same. ========================= Low order bit ========================== | REDUNDANT | COMPACT | COMPRESSED and DYNAMIC dict_table_t::flags | 0 | 1 | 1

SYS_TABLES.TYPE | 1 | 1 | 1

Returns
ulint containing SYS_TABLES.TYPE
Parameters
flagsin: dict_table_t::flags