MySQL 9.0.0
Source Code Documentation
|
Prototypes for global functions in ha_innodb.cc that are called by InnoDB C code. More...
Go to the source code of this file.
Namespaces | |
namespace | ib |
Macros | |
#define | innobase_is_v_fld(field) ((field)->gcol_info && !(field)->stored_in_db) |
Whether this is a computed virtual column. More... | |
Enumerations | |
enum | ib_log_level_t { IB_LOG_LEVEL_INFO , IB_LOG_LEVEL_WARN , IB_LOG_LEVEL_ERROR , IB_LOG_LEVEL_FATAL } |
Corresponds to Sql_condition:enum_warning_level. More... | |
Functions | |
ulint | innobase_raw_format (const char *data, ulint data_len, ulint charset_coll, char *buf, ulint buf_size) |
Formats the raw data in "data" (in InnoDB on-disk format) that is of type DATA_(CHAR|VARCHAR|MYSQL|VARMYSQL) using "charset_coll" and writes the result to "buf". More... | |
void | innobase_quote_identifier (FILE *file, trx_t *trx, const char *id) |
Quote a standard SQL identifier like tablespace, index or column name. More... | |
std::string | innobase_quote_identifier (trx_t *trx, const char *id) |
Quote an standard SQL identifier like tablespace, index or column name. More... | |
char * | innobase_convert_name (char *buf, ulint buflen, const char *id, ulint idlen, THD *thd) |
Convert a table name to the MySQL system_charset_info (UTF-8). More... | |
bool | thd_is_replication_slave_thread (THD *thd) |
Returns true if the thread is the replication thread on the slave server. More... | |
bool | thd_has_edited_nontrans_tables (THD *thd) |
Returns true if the transaction this thread is processing has edited non-transactional tables. More... | |
void | innobase_mysql_print_thd (FILE *f, THD *thd, uint max_query_len) |
Prints info of a THD object (== user session thread) to the given file. More... | |
ulint | get_innobase_type_from_mysql_type (ulint *unsigned_flag, const void *f) |
Converts a MySQL type to an InnoDB type. More... | |
ulint | get_innobase_type_from_mysql_dd_type (ulint *unsigned_flag, ulint *binary_type, ulint *charset_no, dd::enum_column_types dd_type, const CHARSET_INFO *field_charset, bool is_unsigned) |
Converts a MySQL data-dictionary type to an InnoDB type. More... | |
void | innobase_get_cset_width (ulint cset, ulint *mbminlen, ulint *mbmaxlen) |
Get the variable length bounds of the given character set. More... | |
int | innobase_strcasecmp (const char *a, const char *b) |
Compares NUL-terminated UTF-8 strings case insensitively. More... | |
const char * | innobase_basename (const char *path_name) |
Strip dir name from a full path name and return only the file name. More... | |
bool | thd_is_query_block (const THD *thd) |
Returns true if the thread is executing a SELECT statement. More... | |
void | innobase_casedn_str (char *a) |
Makes all characters in a NUL-terminated UTF-8 string lower case. More... | |
void | innobase_casedn_path (char *a) |
Makes all characters in a NUL-terminated UTF-8 path string lower case. More... | |
const CHARSET_INFO * | innobase_get_charset (THD *thd) |
Determines the connection character set. More... | |
const char * | innobase_get_stmt_unsafe (THD *thd, size_t *length) |
Determines the current SQL statement. More... | |
size_t | innobase_get_stmt_safe (THD *thd, char *buf, size_t buflen) |
Determines the current SQL statement. More... | |
ulint | innobase_get_at_most_n_mbchars (ulint charset_id, ulint prefix_len, ulint data_len, const char *str) |
This function is used to find the storage length in bytes of the first n characters for prefix indexes using a multibyte character set. More... | |
bool | innobase_should_madvise_buf_pool () |
Checks sys_vars and determines if allocator should mark large memory segments with MADV_DONTDUMP. More... | |
void | innobase_disable_core_dump () |
Make sure that core file will not be generated, as generating a core file might violate our promise to not dump buffer pool data, and/or might dump not the expected memory pages due to failure in using madvise. More... | |
std::chrono::seconds | thd_lock_wait_timeout (THD *thd) |
Returns the lock wait timeout for the current connection. More... | |
void | thd_set_lock_wait_time (THD *thd, std::chrono::steady_clock::duration value) |
Set the time waited for the lock for the current query. More... | |
const char * | thd_innodb_tmpdir (THD *thd) |
Get the value of innodb_tmpdir. More... | |
char ** | thd_innodb_interpreter_output (THD *thd) |
Obtain the value of the latest output from InnoDB Interpreter/Tester module (ib::Tester). More... | |
char ** | thd_innodb_interpreter (THD *thd) |
Obtain the latest command executed by InnoDB Interpreter/Tester module (ib::Tester). More... | |
ulint | innobase_get_table_cache_size (void) |
Get the current setting of the table_cache_size global parameter. More... | |
ulint | innobase_get_lower_case_table_names (void) |
Get the current setting of the lower_case_table_names global parameter from mysqld.cc. More... | |
int | innobase_nocase_compare (const void *cs, const char *s1, const char *s2) |
Compare two character strings case insensitively according to their charset. More... | |
bool | thd_trx_is_read_only (THD *thd) |
Returns true if transaction should be flagged as read-only. More... | |
THD * | thd_trx_arbitrate (THD *requestor, THD *holder) |
Check if the transaction can be rolled back. More... | |
int | thd_trx_priority (THD *thd) |
bool | thd_trx_is_auto_commit (THD *thd) |
Check if the transaction is an auto-commit transaction. More... | |
std::chrono::system_clock::time_point | thd_start_time (THD *thd) |
Get the thread start time. More... | |
void | innobase_format_name (char *buf, ulint buflen, const char *name) |
A wrapper function of innobase_convert_name(), convert a table name to the MySQL system_charset_info (UTF-8) and quote it if needed. More... | |
void | ib_errf (THD *thd, ib_log_level_t level, uint32_t code, const char *format,...) |
Use this when the args are first converted to a formatted string and then passed to the format string from messages_to_clients.txt. More... | |
void | ib_senderrf (THD *thd, ib_log_level_t level, uint32_t code,...) |
Use this when the args are passed to the format string from messages_to_clients.txt directly as is. More... | |
void | ib::send_errno_error (THD *thd, int err, const std::string &context) |
Sends an error to the client about low-level errno causing high-level err in the specified context . More... | |
void | ib::send_errno_warn (THD *thd, int err, const std::string &context) |
Sends a warning to the client about low-level errno causing high-level err in the specified context . More... | |
const char * | server_get_hostname () |
Returns the NUL terminated value of glob_hostname. More... | |
const char * | innobase_get_err_msg (int error_code) |
Get the error message format string. More... | |
ulonglong | innobase_next_autoinc (ulonglong current, ulonglong need, ulonglong step, ulonglong offset, ulonglong max_value) |
Compute the next autoinc value. More... | |
bool | innobase_check_identifier_length (const char *id) |
uint | innobase_convert_to_system_charset (char *to, const char *from, ulint len, uint *errors) |
uint | innobase_convert_to_filename_charset (char *to, const char *from, ulint len) |
void | ib_warn_row_too_big (const dict_table_t *table) |
ICP_RESULT | innobase_index_cond (ha_innobase *h) |
InnoDB index push-down condition check defined in ha_innodb.cc. More... | |
enum durability_properties | thd_requested_durability (const THD *thd) |
Gets information on the durability property requested by thread. More... | |
void | innodb_set_buf_pool_size (long long buf_pool_size) |
Update the system variable with the given value of the InnoDB buffer pool size. More... | |
trx_t * | check_trx_exists (THD *thd) |
Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still lacks one. More... | |
void | innobase_commit_low (trx_t *trx) |
Commits a transaction in an InnoDB database. More... | |
ulong | thd_parallel_read_threads (THD *thd) |
Return the number of read threads for this session. More... | |
ulong | thd_ddl_buffer_size (THD *thd) |
Return the maximum buffer size to use for DDL. More... | |
size_t | thd_ddl_threads (THD *thd) noexcept |
Variables | |
const char * | TROUBLESHOOTING_MSG |
const char * | TROUBLESHOOT_DATADICT_MSG |
const char * | FORCE_RECOVERY_MSG |
const char * | ERROR_CREATING_MSG |
const char * | OPERATING_SYSTEM_ERROR_MSG |
const char * | FOREIGN_KEY_CONSTRAINTS_MSG |
const char * | INNODB_PARAMETERS_MSG |
Prototypes for global functions in ha_innodb.cc that are called by InnoDB C code.
NOTE: This header is intended to insulate InnoDB from SQL names and functions. Do not include any headers other than univ.i into this unless they are very simple headers.
#define innobase_is_v_fld | ( | field | ) | ((field)->gcol_info && !(field)->stored_in_db) |
Whether this is a computed virtual column.
enum ib_log_level_t |
Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still lacks one.
[in] | thd | MySQL thd (connection) object |
thd | in: user thread handle |
ulint get_innobase_type_from_mysql_dd_type | ( | ulint * | unsigned_flag, |
ulint * | binary_type, | ||
ulint * | charset_no, | ||
dd::enum_column_types | dd_type, | ||
const CHARSET_INFO * | field_charset, | ||
bool | is_unsigned | ||
) |
Converts a MySQL data-dictionary type to an InnoDB type.
Also returns a few attributes which are useful for precise type calculation.
[out] | unsigned_flag | DATA_UNSIGNED if an 'unsigned type'. |
[out] | binary_type | DATA_BINARY_TYPE if a 'binary type'. |
[out] | charset_no | Collation id for string types. |
[in] | dd_type | MySQL data-dictionary type. |
[in] | field_charset | Charset. |
[in] | is_unsigned | MySQL data-dictionary unsigned flag. |
Converts a MySQL type to an InnoDB type.
Note that this function returns the 'mtype' of InnoDB. InnoDB differentiates between MySQL's old <= 4.1 VARCHAR and the new true VARCHAR in >= 5.0.3 by the 'prtype'.
[out] | unsigned_flag | DATA_UNSIGNED if an 'unsigned type'; at least ENUM and SET, and unsigned integer types are 'unsigned types' |
[in] | f | MySQL Field |
void ib_errf | ( | THD * | thd, |
ib_log_level_t | level, | ||
uint32_t | code, | ||
const char * | format, | ||
... | |||
) |
Use this when the args are first converted to a formatted string and then passed to the format string from messages_to_clients.txt.
The error message format must be: "Some string ... %s".
Push a warning message to the client, it is a wrapper around:
void push_warning_printf( THD *thd, Sql_condition::enum_warning_level level, uint code, const char *format, ...);
The error message format must be: "Some string ... %s".
Push a warning message to the client, it is a wrapper around:
void push_warning_printf( THD *thd, Sql_condition::enum_condition_level level, uint code, const char *format, ...);
thd | in/out: session |
level | in: warning level |
code | MySQL error code |
format | printf format |
... | Args |
void ib_senderrf | ( | THD * | thd, |
ib_log_level_t | level, | ||
uint32_t | code, | ||
... | |||
) |
Use this when the args are passed to the format string from messages_to_clients.txt directly as is.
Push a warning message to the client, it is a wrapper around:
void push_warning_printf( THD *thd, Sql_condition::enum_warning_level level, uint code, const char *format, ...);
[in,out] | thd | session |
[in] | level | warning level |
[in] | code | MySQL error code |
[in] | ... | Args |
void ib_warn_row_too_big | ( | const dict_table_t * | table | ) |
const char * innobase_basename | ( | const char * | path_name | ) |
Strip dir name from a full path name and return only the file name.
[in] | path_name | full path name |
void innobase_casedn_path | ( | char * | a | ) |
Makes all characters in a NUL-terminated UTF-8 path string lower case.
in/out: string to put in lower case
a | in/out: string to put in lower case |
void innobase_casedn_str | ( | char * | a | ) |
Makes all characters in a NUL-terminated UTF-8 string lower case.
in/out: string to put in lower case
a | in/out: string to put in lower case |
bool innobase_check_identifier_length | ( | const char * | id | ) |
void innobase_commit_low | ( | trx_t * | trx | ) |
Commits a transaction in an InnoDB database.
[in] | trx | Transaction handle. |
trx | in: transaction handle |
Convert a table name to the MySQL system_charset_info (UTF-8).
buf | out: buffer for converted identifier |
buflen | in: length of buf, in bytes |
id | in: table name to convert |
idlen | in: length of id, in bytes |
thd | in: MySQL connection thread, or NULL |
uint innobase_convert_to_filename_charset | ( | char * | to, |
const char * | from, | ||
ulint | len | ||
) |
uint innobase_convert_to_system_charset | ( | char * | to, |
const char * | from, | ||
ulint | len, | ||
uint * | errors | ||
) |
void innobase_disable_core_dump | ( | ) |
Make sure that core file will not be generated, as generating a core file might violate our promise to not dump buffer pool data, and/or might dump not the expected memory pages due to failure in using madvise.
void innobase_format_name | ( | char * | buf, |
ulint | buflen, | ||
const char * | name | ||
) |
A wrapper function of innobase_convert_name(), convert a table name to the MySQL system_charset_info (UTF-8) and quote it if needed.
[out] | buf | Buffer for converted identifier |
[in] | buflen | Length of buf, in bytes |
[in] | name | Table name to format |
ulint innobase_get_at_most_n_mbchars | ( | ulint | charset_id, |
ulint | prefix_len, | ||
ulint | data_len, | ||
const char * | str | ||
) |
This function is used to find the storage length in bytes of the first n characters for prefix indexes using a multibyte character set.
The function finds charset information and returns length of prefix_len characters in the index field in bytes.
The function finds charset information and returns length of prefix_len characters in the index field in bytes.
< character length in bytes
< number of characters in prefix
< charset used in the field
charset_id | in: character set id |
prefix_len | in: prefix length in bytes of the index (this has to be divided by mbmaxlen to get the number of CHARACTERS n in the prefix) |
data_len | in: length of the string in bytes |
str | in: character string |
const CHARSET_INFO * innobase_get_charset | ( | THD * | mysql_thd | ) |
Determines the connection character set.
mysql_thd | in: MySQL thread handle |
Get the variable length bounds of the given character set.
[in] | cset | Mysql charset-collation code |
[out] | mbminlen | Minimum length of a char (in bytes) |
[out] | mbmaxlen | Maximum length of a char (in bytes) |
const char * innobase_get_err_msg | ( | int | error_code | ) |
Get the error message format string.
error_code | in: MySQL error code |
ulint innobase_get_lower_case_table_names | ( | void | ) |
Get the current setting of the lower_case_table_names global parameter from mysqld.cc.
We do a dirty read because for one there is no synchronization object and secondly there is little harm in doing so even if we get a torn read.
size_t innobase_get_stmt_safe | ( | THD * | thd, |
char * | buf, | ||
size_t | buflen | ||
) |
Determines the current SQL statement.
Thread safe, can be called from any thread as the string is copied into the provided buffer.
[in] | thd | MySQL thread handle |
[out] | buf | Buffer containing SQL statement |
[in] | buflen | Length of provided buffer |
const char * innobase_get_stmt_unsafe | ( | THD * | thd, |
size_t * | length | ||
) |
Determines the current SQL statement.
Thread unsafe, can only be called from the thread owning the THD.
[in] | thd | MySQL thread handle |
[out] | length | Length of the SQL statement |
ulint innobase_get_table_cache_size | ( | void | ) |
Get the current setting of the table_cache_size global parameter.
We do a dirty read because for one there is no synchronization object and secondly there is little harm in doing so even if we get a torn read.
Get the current setting of the table_cache_size global parameter.
We do a dirty read because for one there is no synchronization object and secondly there is little harm in doing so even if we get a torn read.
ICP_RESULT innobase_index_cond | ( | ha_innobase * | h | ) |
InnoDB index push-down condition check defined in ha_innodb.cc.
InnoDB index push-down condition check defined in ha_innodb.cc.
InnoDB index push-down condition check
h | in/out: pointer to ha_innobase |
void innobase_mysql_print_thd | ( | FILE * | f, |
THD * | thd, | ||
uint | max_query_len | ||
) |
Prints info of a THD object (== user session thread) to the given file.
[in] | f | Output stream |
[in] | thd | Pointer to a mysql thd object |
[in] | max_query_len | Max query length to print, must be positive |
f | in: output stream |
thd | in: MySQL THD object |
max_query_len | in: max query length to print, must be positive |
ulonglong innobase_next_autoinc | ( | ulonglong | current, |
ulonglong | need, | ||
ulonglong | step, | ||
ulonglong | offset, | ||
ulonglong | max_value | ||
) |
Compute the next autoinc value.
For MySQL replication the autoincrement values can be partitioned among the nodes. The offset is the start or origin of the autoincrement value for a particular node. For n nodes the increment will be n and the offset will be in the interval [1, n]. The formula tries to allocate the next value for a particular node.
Note: This function is also called with increment set to the number of values we want to reserve for multi-value inserts e.g.,
INSERT INTO T VALUES(), (), ();
innobase_next_autoinc() will be called with increment set to 3 where autoinc_lock_mode != TRADITIONAL because we want to reserve 3 values for the multi-value INSERT above.
For MySQL replication the autoincrement values can be partitioned among the nodes. The offset is the start or origin of the autoincrement value for a particular node. For n nodes the increment will be n and the offset will be in the interval [1, n]. The formula tries to allocate the next value for a particular node.
Note: This function is also called with increment set to the number of values we want to reserve for multi-value inserts e.g.,
INSERT INTO T VALUES(), (), ();
innobase_next_autoinc() will be called with increment set to 3 where autoinc_lock_mode != TRADITIONAL because we want to reserve 3 values for the multi-value INSERT above.
current | in: Current value |
need | in: count of values needed |
step | in: AUTOINC increment step |
offset | in: AUTOINC offset |
max_value | in: max value for type |
int innobase_nocase_compare | ( | const void * | cs, |
const char * | s1, | ||
const char * | s2 | ||
) |
Compare two character strings case insensitively according to their charset.
[in] | cs | character set |
[in] | s1 | string 1 |
[in] | s2 | string 2 |
void innobase_quote_identifier | ( | FILE * | file, |
trx_t * | trx, | ||
const char * | id | ||
) |
Quote a standard SQL identifier like tablespace, index or column name.
[in] | file | output stream |
[in] | trx | InnoDB transaction, or NULL |
[in] | id | identifier to quote |
std::string innobase_quote_identifier | ( | trx_t * | trx, |
const char * | id | ||
) |
Quote an standard SQL identifier like tablespace, index or column name.
Return the string as an std:string object.
[in] | trx | InnoDB transaction, or NULL |
[in] | id | identifier to quote |
ulint innobase_raw_format | ( | const char * | data, |
ulint | data_len, | ||
ulint | charset_coll, | ||
char * | buf, | ||
ulint | buf_size | ||
) |
Formats the raw data in "data" (in InnoDB on-disk format) that is of type DATA_(CHAR|VARCHAR|MYSQL|VARMYSQL) using "charset_coll" and writes the result to "buf".
The result is converted to "system_charset_info". Not more than "buf_size" bytes are written to "buf". The result is always NUL-terminated (provided buf_size > 0) and the number of bytes that were written to "buf" is returned (including the terminating NUL).
The result is converted to "system_charset_info". Not more than "buf_size" bytes are written to "buf". The result is always NUL-terminated (provided buf_size > 0) and the number of bytes that were written to "buf" is returned (including the terminating NUL).
data | in: raw data |
data_len | in: raw data length in bytes |
charset_coll | in: charset collation |
buf | out: output buffer |
buf_size | in: output buffer size in bytes |
bool innobase_should_madvise_buf_pool | ( | ) |
Checks sys_vars and determines if allocator should mark large memory segments with MADV_DONTDUMP.
int innobase_strcasecmp | ( | const char * | a, |
const char * | b | ||
) |
Compares NUL-terminated UTF-8 strings case insensitively.
a | in: first string to compare |
b | in: second string to compare |
void innodb_set_buf_pool_size | ( | long long | buf_pool_size | ) |
Update the system variable with the given value of the InnoDB buffer pool size.
[in] | buf_pool_size | given value of buffer pool size. |
const char * server_get_hostname | ( | ) |
Returns the NUL terminated value of glob_hostname.
ulong thd_ddl_buffer_size | ( | THD * | thd | ) |
Return the maximum buffer size to use for DDL.
[in] | thd | Session instance, or nullptr to query the global innodb_ddl_buffer_size value. |
|
noexcept |
bool thd_has_edited_nontrans_tables | ( | THD * | thd | ) |
Returns true if the transaction this thread is processing has edited non-transactional tables.
Used by the deadlock detector when deciding which transaction to rollback in case of a deadlock - we try to avoid rolling back transactions that have edited non-transactional tables.
Used by the deadlock detector when deciding which transaction to rollback in case of a deadlock - we try to avoid rolling back transactions that have edited non-transactional tables.
thd | in: thread handle |
char ** thd_innodb_interpreter | ( | THD * | thd | ) |
Obtain the latest command executed by InnoDB Interpreter/Tester module (ib::Tester).
[in] | thd | thread handle |
char ** thd_innodb_interpreter_output | ( | THD * | thd | ) |
Obtain the value of the latest output from InnoDB Interpreter/Tester module (ib::Tester).
[in] | thd | thread handle |
const char * thd_innodb_tmpdir | ( | THD * | thd | ) |
Get the value of innodb_tmpdir.
[in] | thd | thread handle, or nullptr to query the global innodb_tmpdir. |
bool thd_is_query_block | ( | const THD * | thd | ) |
Returns true if the thread is executing a SELECT statement.
thd | in: thread handle |
bool thd_is_replication_slave_thread | ( | THD * | thd | ) |
Returns true if the thread is the replication thread on the slave server.
Used in srv_conc_enter_innodb() to determine if the thread should be allowed to enter InnoDB - the replication thread is treated differently than other threads. Also used in srv_conc_force_exit_innodb().
Used in srv_conc_enter_innodb() to determine if the thread should be allowed to enter InnoDB - the replication thread is treated differently than other threads. Also used in srv_conc_force_exit_innodb().
thd | in: thread handle |
std::chrono::seconds thd_lock_wait_timeout | ( | THD * | thd | ) |
Returns the lock wait timeout for the current connection.
ulong thd_parallel_read_threads | ( | THD * | thd | ) |
Return the number of read threads for this session.
[in] | thd | Session instance, or nullptr to query the global innodb_parallel_read_threads value. |
enum durability_properties thd_requested_durability | ( | const THD * | thd | ) |
Gets information on the durability property requested by thread.
Used when writing either a prepare or commit record to the log buffer.
Used when writing either a prepare or commit record to the log buffer.
thd | in: thread handle |
void thd_set_lock_wait_time | ( | THD * | thd, |
std::chrono::steady_clock::duration | value | ||
) |
Set the time waited for the lock for the current query.
[in,out] | thd | Thread handle. |
[in] | value | Time waited for the lock. |
std::chrono::system_clock::time_point thd_start_time | ( | THD * | thd | ) |
Get the thread start time.
Check if the transaction can be rolled back.
[in] | requestor | Session requesting the lock |
[in] | holder | Session that holds the lock |
bool thd_trx_is_auto_commit | ( | THD * | thd | ) |
Check if the transaction is an auto-commit transaction.
true also implies that it is a SELECT (read-only) transaction.
true also implies that it is a SELECT (read-only) transaction.
thd | in: thread handle, can be NULL |
bool thd_trx_is_read_only | ( | THD * | thd | ) |
Returns true if transaction should be flagged as read-only.
thd | in: thread handle |
int thd_trx_priority | ( | THD * | thd | ) |
[in] | thd | Session to check |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |