MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ha_innodb.cc File Reference
#include <sql_table.h>
#include <sql_acl.h>
#include <debug_sync.h>
#include <my_base.h>
#include <mysys_err.h>
#include <mysql/innodb_priv.h>
#include "univ.i"
#include "buf0dump.h"
#include "buf0lru.h"
#include "buf0flu.h"
#include "buf0dblwr.h"
#include "btr0sea.h"
#include "os0file.h"
#include "os0thread.h"
#include "srv0start.h"
#include "srv0srv.h"
#include "trx0roll.h"
#include "trx0trx.h"
#include "trx0sys.h"
#include "mtr0mtr.h"
#include "rem0types.h"
#include "row0ins.h"
#include "row0mysql.h"
#include "row0sel.h"
#include "row0upd.h"
#include "log0log.h"
#include "lock0lock.h"
#include "dict0crea.h"
#include "btr0cur.h"
#include "btr0btr.h"
#include "fsp0fsp.h"
#include "sync0sync.h"
#include "fil0fil.h"
#include "trx0xa.h"
#include "row0merge.h"
#include "dict0boot.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include "ha_prototypes.h"
#include "ut0mem.h"
#include "ibuf0ibuf.h"
#include "dict0dict.h"
#include "srv0mon.h"
#include "api0api.h"
#include "api0misc.h"
#include "pars0pars.h"
#include "fts0fts.h"
#include "fts0types.h"
#include "row0import.h"
#include "row0quiesce.h"
#include "fts0priv.h"
#include "page0zip.h"
#include "ha_innodb.h"
#include "i_s.h"

Go to the source code of this file.

Macros

#define MYSQL_PLUGIN_IMPORT   /* nothing */
#define INSIDE_HA_INNOBASE_CC
#define EQ_CURRENT_THD(thd)   ((thd) == current_thd)
#define INNOBASE_WAKE_INTERVAL   32
#define normalize_table_name(norm_name, name)   normalize_table_name_low(norm_name, name, FALSE)
#define true_word_char(c, ch)   ((c) & (_MY_U | _MY_L | _MY_NMR) || (ch) == '_')
#define misc_word_char(X)   0
#define IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(table_name, thd)
#define CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE(use_tablespace)
#define CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE
#define STATS_SAMPLE_PAGES_DEPRECATED_MSG
#define innodb_srv_buf_dump_filename_validate   NULL

Functions

enum_tx_isolation thd_get_trx_isolation (const THD *thd)
int innodb_page_size_validate (ulong page_size)
UNIV_INTERN ibool thd_is_replication_slave_thread (THD *thd)
UNIV_INTERN enum
durability_properties 
thd_requested_durability (const THD *thd)
UNIV_INTERN ibool thd_trx_is_read_only (THD *thd)
UNIV_INTERN ibool thd_trx_is_auto_commit (THD *thd)
UNIV_INTERN const char * server_get_hostname ()
UNIV_INTERN ibool thd_has_edited_nontrans_tables (THD *thd)
UNIV_INTERN ibool thd_is_select (const THD *thd)
UNIV_INTERN ibool thd_supports_xa (THD *thd)
UNIV_INTERN ulong thd_lock_wait_timeout (THD *thd)
UNIV_INTERN void thd_set_lock_wait_time (THD *thd, ulint value)
 __attribute__ ((warn_unused_result, nonnull)) static inline trx_t *&thd_to_trx(THD *thd)
UNIV_INTERN void innobase_mysql_print_thd (FILE *f, THD *thd, uint max_query_len)
UNIV_INTERN const char * innobase_get_err_msg (int error_code)
UNIV_INTERN void innobase_get_cset_width (ulint cset, ulint *mbminlen, ulint *mbmaxlen)
UNIV_INTERN void innobase_convert_from_table_id (struct charset_info_st *cs, char *to, const char *from, ulint len)
UNIV_INTERN my_bool innobase_check_identifier_length (const char *id)
UNIV_INTERN void innobase_convert_from_id (struct charset_info_st *cs, char *to, const char *from, ulint len)
UNIV_INTERN int innobase_strcasecmp (const char *a, const char *b)
UNIV_INTERN int innobase_wildcasecmp (const char *a, const char *b)
UNIV_INTERN const char * innobase_basename (const char *path_name)
UNIV_INTERN void innobase_casedn_str (char *a)
UNIV_INTERN struct
charset_info_st
innobase_get_charset (THD *mysql_thd)
UNIV_INTERN const char * innobase_get_stmt (THD *thd, size_t *length)
UNIV_INTERN ulint innobase_get_table_cache_size (void)
UNIV_INTERN ulint innobase_get_lower_case_table_names (void)
UNIV_INTERN int innobase_mysql_tmpfile (void)
UNIV_INTERN ulint innobase_convert_string (void *to, ulint to_length, CHARSET_INFO *to_cs, const void *from, ulint from_length, CHARSET_INFO *from_cs, uint *errors)
UNIV_INTERN ulint innobase_raw_format (const char *data, ulint data_len, ulint charset_coll, char *buf, ulint buf_size)
UNIV_INTERN ulonglong innobase_next_autoinc (ulonglong current, ulonglong need, ulonglong step, ulonglong offset, ulonglong max_value)
UNIV_INTERN trx_tinnobase_trx_allocate (THD *thd)
UNIV_INTERN void innobase_copy_frm_flags_from_create_info (dict_table_t *innodb_table, const HA_CREATE_INFO *create_info)
UNIV_INTERN void innobase_copy_frm_flags_from_table_share (dict_table_t *innodb_table, const TABLE_SHARE *table_share)
UNIV_INTERN void innobase_invalidate_query_cache (trx_t *trx, const char *full_name, ulint full_name_len)
UNIV_INTERN char * innobase_convert_name (char *buf, ulint buflen, const char *id, ulint idlen, THD *thd, ibool table_id)
UNIV_INTERN void innobase_format_name (char *buf, ulint buflen, const char *name, ibool is_index_name)
UNIV_INTERN ibool trx_is_interrupted (const trx_t *trx)
UNIV_INTERN ibool trx_is_strict (trx_t *trx)
UNIV_INLINE ibool thd_is_strict (THD *thd)
UNIV_INTERN int innobase_close_thd (THD *thd)
UNIV_INTERN ulonglong innobase_get_int_col_max_value (const Field *field)
UNIV_INTERN int innobase_mysql_cmp (int mysql_type, uint charset_number, const unsigned char *a, unsigned int a_length, const unsigned char *b, unsigned int b_length)
UNIV_INTERN CHARSET_INFOinnobase_get_fts_charset (int mysql_type, uint charset_number)
UNIV_INTERN int innobase_mysql_cmp_prefix (int mysql_type, uint charset_number, const unsigned char *a, unsigned int a_length, const unsigned char *b, unsigned int b_length)
UNIV_INTERN int innobase_fts_text_cmp (const void *cs, const void *p1, const void *p2)
UNIV_INTERN int innobase_fts_text_case_cmp (const void *cs, const void *p1, const void *p2)
UNIV_INTERN ulint innobase_strnxfrm (const CHARSET_INFO *cs, const uchar *str, const ulint len)
UNIV_INTERN int innobase_fts_text_cmp_prefix (const void *cs, const void *p1, const void *p2)
UNIV_INTERN int innobase_fts_string_cmp (const void *cs, const void *p1, const void *p2)
UNIV_INTERN size_t innobase_fts_casedn_str (CHARSET_INFO *cs, char *src, size_t src_len, char *dst, size_t dst_len)
UNIV_INTERN ulint innobase_mysql_fts_get_token (CHARSET_INFO *cs, const byte *start, const byte *end, fts_string_t *token, ulint *offset)
UNIV_INTERN ulint get_innobase_type_from_mysql_type (ulint *unsigned_flag, const void *f)
bool build_template_needs_field_in_icp (const dict_index_t *index, const row_prebuilt_t *prebuilt, bool contains, ulint i)
 mysql_declare_plugin (innobase)
UNIV_INTERN enum icp_result innobase_index_cond (void *file)
UNIV_INTERN void ib_senderrf (THD *thd, ib_log_level_t level, ib_uint32_t code,...)
UNIV_INTERN void ib_errf (THD *thd, ib_log_level_t level, ib_uint32_t code, const char *format,...)
UNIV_INTERN void ib_logf (ib_log_level_t level, const char *format,...)
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)

Variables

struct _ft_vft ft_vft_result
struct _ft_vft_ext ft_vft_ext_result
ib_cb_t innodb_api_cb []
const char innobase_index_reserve_name [] = "GEN_CLUST_INDEX"
static const TABLEform
static const TABLE const char * table_name
static const TABLE const char
const char * 
temp_path
static const TABLE const char
const char const char * 
remote_path
static const TABLE const char
const char const char ulint 
flags
 i_s_innodb_trx
 i_s_innodb_locks
 i_s_innodb_lock_waits
 i_s_innodb_cmp
 i_s_innodb_cmp_reset
 i_s_innodb_cmpmem
 i_s_innodb_cmpmem_reset
 i_s_innodb_cmp_per_index
 i_s_innodb_cmp_per_index_reset
 i_s_innodb_buffer_page
 i_s_innodb_buffer_page_lru
 i_s_innodb_buffer_stats
 i_s_innodb_metrics
 i_s_innodb_ft_default_stopword
 i_s_innodb_ft_deleted
 i_s_innodb_ft_being_deleted
 i_s_innodb_ft_config
 i_s_innodb_ft_index_cache
 i_s_innodb_ft_index_table
 i_s_innodb_sys_tables
 i_s_innodb_sys_tablestats
 i_s_innodb_sys_indexes
 i_s_innodb_sys_columns
 i_s_innodb_sys_fields
 i_s_innodb_sys_foreign
 i_s_innodb_sys_foreign_cols
 i_s_innodb_sys_tablespaces
i_s_innodb_sys_datafiles mysql_declare_plugin_end

Detailed Description

Definition in file ha_innodb.cc.

Macro Definition Documentation

#define CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE (   use_tablespace)
Value:
if (!use_tablespace) { \
push_warning_printf( \
thd, Sql_condition::WARN_LEVEL_WARN, \
ER_ILLEGAL_HA_CREATE_OPTION, \
"InnoDB: ROW_FORMAT=%s requires" \
" innodb_file_per_table.", \
get_row_format_name(row_format)); \
ret = "ROW_FORMAT"; \
}
#define CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE
Value:
if (srv_file_format < UNIV_FORMAT_B) { \
push_warning_printf( \
thd, Sql_condition::WARN_LEVEL_WARN, \
ER_ILLEGAL_HA_CREATE_OPTION, \
"InnoDB: ROW_FORMAT=%s requires" \
" innodb_file_format > Antelope.", \
get_row_format_name(row_format)); \
ret = "ROW_FORMAT"; \
}
#define IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS (   table_name,
  thd 
)
Value:

Definition at line 8351 of file ha_innodb.cc.

#define normalize_table_name (   norm_name,
  name 
)    normalize_table_name_low(norm_name, name, FALSE)

Always normalize table name to lower case on Windows

Definition at line 420 of file ha_innodb.cc.

#define STATS_SAMPLE_PAGES_DEPRECATED_MSG
Value:
"Using innodb_stats_sample_pages is deprecated and " \
"the variable may be removed in future releases. " \
"Please use innodb_stats_transient_sample_pages " \
"instead."

Function Documentation

__attribute__ ( (warn_unused_result, nonnull)  )

Obtain the InnoDB transaction of a MySQL thread.

Returns
reference to transaction pointer

< in: MySQL thread

Definition at line 1286 of file ha_innodb.cc.

bool build_template_needs_field_in_icp ( const dict_index_t index,
const row_prebuilt_t prebuilt,
bool  contains,
ulint  i 
)
inline

Determines if a field is needed in a prebuilt struct 'template'.

Returns
whether the field is needed for index condition pushdown
Parameters
indexin: InnoDB index
prebuiltin: row fetch template
containsin: whether the index contains column i
iin: column number

Definition at line 5959 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN ulint get_innobase_type_from_mysql_type ( ulint *  unsigned_flag,
const void *  f 
)

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'.

Returns
DATA_BINARY, DATA_VARCHAR, ...
Parameters
unsigned_flagout: DATA_UNSIGNED if an 'unsigned type'; at least ENUM and SET, and unsigned integer types are 'unsigned types'
fin: MySQL Field

Definition at line 5472 of file ha_innodb.cc.

UNIV_INTERN void ib_errf ( THD *  thd,
ib_log_level_t  level,
ib_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 errmsg-utf8.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, ...);

Parameters
thdin/out: session
levelin: warning level
codeMySQL error code
formatprintf format

Definition at line 16813 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void ib_logf ( ib_log_level_t  level,
const char *  format,
  ... 
)

Write a message to the MySQL log, prefixed with "InnoDB: "

Parameters
levelin: warning level
formatprintf format

Definition at line 16855 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN void ib_senderrf ( THD *  thd,
ib_log_level_t  level,
ib_uint32_t  code,
  ... 
)

Use this when the args are passed to the format string from errmsg-utf8.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, ...);

Parameters
thdin/out: session
levelin: warning level
codeMySQL error code

Definition at line 16735 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN const char* innobase_basename ( const char *  path_name)

Strip dir name from a full path name and return only the file name

Returns
file name or "null" if no file name
Parameters
path_namein: full path name

Definition at line 1688 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN void innobase_casedn_str ( char *  a)

Makes all characters in a NUL-terminated UTF-8 string lower case.

Parameters
ain/out: string to put in lower case

Definition at line 1701 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN int innobase_close_thd ( THD *  thd)

Frees a possible InnoDB trx object associated with the current THD.

Returns
0 or error number
Parameters
thdin: handle to the MySQL thread of the user whose resources should be free'd

Definition at line 3826 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN void innobase_convert_from_id ( struct charset_info_st cs,
char *  to,
const char *  from,
ulint  len 
)

Converts an identifier to UTF-8.

Parameters
csin: the 'from' character set
toout: converted identifier
fromin: identifier to convert
lenin: length of 'to', in bytes

Definition at line 1634 of file ha_innodb.cc.

UNIV_INTERN void innobase_convert_from_table_id ( struct charset_info_st cs,
char *  to,
const char *  from,
ulint  len 
)

Converts an identifier to a table name.

Parameters
csin: the 'from' character set
toout: converted identifier
fromin: identifier to convert
lenin: length of 'to', in bytes

Definition at line 1593 of file ha_innodb.cc.

UNIV_INTERN char* innobase_convert_name ( char *  buf,
ulint  buflen,
const char *  id,
ulint  idlen,
THD *  thd,
ibool  table_id 
)

Convert a table or index name to the MySQL system_charset_info (UTF-8) and quote it if needed.

Returns
pointer to the end of buf
Parameters
bufout: buffer for converted identifier
buflenin: length of buf, in bytes
idin: identifier to convert
idlenin: length of id, in bytes
thdin: MySQL connection thread, or NULL
table_idin: TRUE=id is a table or database name; FALSE=id is an index name

Definition at line 2557 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ulint innobase_convert_string ( void *  to,
ulint  to_length,
CHARSET_INFO to_cs,
const void *  from,
ulint  from_length,
CHARSET_INFO from_cs,
uint *  errors 
)

Wrapper around MySQL's copy_and_convert function.

Returns
number of bytes copied to 'to'
Parameters
toout: converted string
to_lengthin: number of bytes reserved for the converted string
to_csin: character set to convert to
fromin: string to convert
from_lengthin: number of bytes to convert
from_csin: character set to convert from
errorsout: number of errors encountered during the conversion

Definition at line 1833 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN void innobase_copy_frm_flags_from_create_info ( dict_table_t innodb_table,
const HA_CREATE_INFO create_info 
)

Copy table flags from MySQL's HA_CREATE_INFO into an InnoDB table object. Those flags are stored in .frm file and end up in the MySQL table object, but are frequently used inside InnoDB so we keep their copies into the InnoDB table object.

Parameters
innodb_tablein/out: InnoDB table
create_infoin: create info

Definition at line 2120 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN void innobase_copy_frm_flags_from_table_share ( dict_table_t innodb_table,
const TABLE_SHARE table_share 
)

Copy table flags from MySQL's TABLE_SHARE into an InnoDB table object. Those flags are stored in .frm file and end up in the MySQL table object, but are frequently used inside InnoDB so we keep their copies into the InnoDB table object.

Parameters
innodb_tablein/out: InnoDB table
table_sharein: table share

Definition at line 2156 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void innobase_format_name ( char *  buf,
ulint  buflen,
const char *  name,
ibool  is_index_name 
)

A wrapper function of innobase_convert_name(), convert a table or index name to the MySQL system_charset_info (UTF-8) and quote it if needed.

Returns
pointer to the end of buf
Parameters
bufout: buffer for converted identifier
buflenin: length of buf, in bytes
namein: index or table name to format
is_index_namein: index name

Definition at line 2613 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN size_t innobase_fts_casedn_str ( CHARSET_INFO cs,
char *  src,
size_t  src_len,
char *  dst,
size_t  dst_len 
)

Makes all characters in a string lower case.

Parameters
csin: Character set
srcin: string to put in lower case
src_lenin: input string length
dstin: buffer for result string
dst_lenin: buffer size

Definition at line 5370 of file ha_innodb.cc.

UNIV_INTERN int innobase_fts_string_cmp ( const void *  cs,
const void *  p1,
const void *  p2 
)

compare two character string according to their charset.

Parameters
csin: Character set
p1in: key
p2in: node

Definition at line 5353 of file ha_innodb.cc.

UNIV_INTERN int innobase_fts_text_case_cmp ( const void *  cs,
const void *  p1,
const void *  p2 
)

compare two character string case insensitively according to their charset.

Parameters
csin: Character set
p1in: key
p2in: node

Definition at line 5280 of file ha_innodb.cc.

UNIV_INTERN int innobase_fts_text_cmp ( const void *  cs,
const void *  p1,
const void *  p2 
)

compare two character string according to their charset.

Parameters
csin: Character set
p1in: key
p2in: node

Definition at line 5263 of file ha_innodb.cc.

UNIV_INTERN int innobase_fts_text_cmp_prefix ( const void *  cs,
const void *  p1,
const void *  p2 
)

compare two character string according to their charset.

Parameters
csin: Character set
p1in: prefix key
p2in: value to compare

Definition at line 5331 of file ha_innodb.cc.

UNIV_INTERN struct charset_info_st* innobase_get_charset ( THD *  mysql_thd)
read

Determines the connection character set.

Returns
connection character set
Parameters
mysql_thdin: MySQL thread handle

Definition at line 1713 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN void innobase_get_cset_width ( ulint  cset,
ulint *  mbminlen,
ulint *  mbmaxlen 
)

Get the variable length bounds of the given character set.

Parameters
csetin: MySQL charset-collation code
mbminlenout: minimum length of a char (in bytes)
mbmaxlenout: maximum length of a char (in bytes)

Definition at line 1550 of file ha_innodb.cc.

UNIV_INTERN const char* innobase_get_err_msg ( int  error_code)

Get the error message format string.

Returns
the format string or 0 if not found.
Parameters
error_codein: MySQL error code

Definition at line 1539 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN CHARSET_INFO* innobase_get_fts_charset ( int  mysql_type,
uint  charset_number 
)

Get the next token from the given string and store it in *token.

Parameters
mysql_typein: MySQL type
charset_numberin: number of the charset

Definition at line 5182 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ulonglong innobase_get_int_col_max_value ( const Field *  field)

Get the upper limit of the MySQL integral and floating-point type.

Returns
maximum allowed value for the field
Parameters
fieldin: MySQL field

Definition at line 4241 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN 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.

Returns
value of lower_case_table_names

Definition at line 1758 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN const char* innobase_get_stmt ( THD *  thd,
size_t *  length 
)

Determines the current SQL statement.

Returns
SQL statement string
Parameters
thdin: MySQL thread handle
lengthout: length of the SQL statement

Definition at line 1725 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ulint innobase_get_table_cache_size ( void  )

Get the current setting of the table_def_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.

Returns
value of table_def_size

Definition at line 1744 of file ha_innodb.cc.

UNIV_INTERN enum icp_result innobase_index_cond ( void *  file)

Index Condition Pushdown interface implementation InnoDB index push-down condition check

Returns
ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE
Parameters
filein/out: pointer to ha_innobase

Definition at line 16681 of file ha_innodb.cc.

UNIV_INTERN void innobase_invalidate_query_cache ( trx_t trx,
const char *  full_name,
ulint  full_name_len 
)

Invalidates the MySQL query cache for the table.

Parameters
trxin: transaction which modifies the table
full_namein: concatenation of database name, null char NUL, table name, null char NUL; NOTE that in Windows this is always in LOWER CASE!
full_name_lenin: full name length where also the null chars count

Definition at line 2441 of file ha_innodb.cc.

UNIV_INTERN int innobase_mysql_cmp ( int  mysql_type,
uint  charset_number,
const unsigned char *  a,
unsigned int  a_length,
const unsigned char *  b,
unsigned int  b_length 
)

InnoDB uses this function to compare two data fields for which the data type is such that we must use MySQL code to compare them. NOTE that the prototype of this function is in rem0cmp.cc in InnoDB source code! If you change this function, remember to update the prototype there!

Returns
1, 0, -1, if a is greater, equal, less than b, respectively
Parameters
mysql_typein: MySQL type
charset_numberin: number of the charset
ain: data field
a_lengthin: data field length, not UNIV_SQL_NULL
bin: data field
b_lengthin: data field length, not UNIV_SQL_NULL

Definition at line 5104 of file ha_innodb.cc.

UNIV_INTERN int innobase_mysql_cmp_prefix ( int  mysql_type,
uint  charset_number,
const unsigned char *  a,
unsigned int  a_length,
const unsigned char *  b,
unsigned int  b_length 
)

InnoDB uses this function to compare two data fields for which the data type is such that we must use MySQL code to compare them. NOTE that the prototype of this function is in rem0cmp.c in InnoDB source code! If you change this function, remember to update the prototype there!

Returns
1, 0, -1, if a is greater, equal, less than b, respectively
Parameters
mysql_typein: MySQL type
charset_numberin: number of the charset
ain: data field
a_lengthin: data field length, not UNIV_SQL_NULL
bin: data field
b_lengthin: data field length, not UNIV_SQL_NULL

Definition at line 5238 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN ulint innobase_mysql_fts_get_token ( CHARSET_INFO cs,
const byte *  start,
const byte *  end,
fts_string_t token,
ulint *  offset 
)

Get the next token from the given string and store it in *token. It is mostly copied from MyISAM's doc parsing function ft_simple_get_word()

Returns
length of string processed
Parameters
csin: Character set
startin: start of text
endin: one character past end of text
tokenout: token's text
offsetout: offset to token, measured as characters from 'start'

Definition at line 5399 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN 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.

Parameters
fin: output stream
thdin: MySQL THD object
max_query_lenin: max query length to print, or 0 to use the default max length

Definition at line 1520 of file ha_innodb.cc.

UNIV_INTERN int innobase_mysql_tmpfile ( void  )

Creates a temporary file.

Returns
temporary file descriptor, or < 0 on error

Definition at line 1769 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN 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.

Returns
the next value
Parameters
currentin: Current value
needin: count of values needed
stepin: AUTOINC increment step
offsetin: AUTOINC offset
max_valuein: max value for type

Definition at line 1910 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN 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).

Returns
number of bytes that were written
Parameters
datain: raw data
data_lenin: raw data length in bytes
charset_collin: charset collation
bufout: output buffer
buf_sizein: output buffer size in bytes

Definition at line 1863 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int innobase_strcasecmp ( const char *  a,
const char *  b 
)

Compares NUL-terminated UTF-8 strings case insensitively.

Returns
0 if a=b, <0 if a<b, >1 if a>b
Parameters
ain: first string to compare
bin: second string to compare

Definition at line 1651 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ulint innobase_strnxfrm ( const CHARSET_INFO cs,
const uchar *  str,
const ulint  len 
)

Get the first character's code position for FTS index partition.

Parameters
csin: Character set
strin: string
lenin: string length

Definition at line 5302 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN trx_t* innobase_trx_allocate ( THD *  thd)

Allocates an InnoDB transaction for a MySQL handler object for DML.

Returns
InnoDB transaction handle
Parameters
thdin: user thread handle

Definition at line 2018 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int innobase_wildcasecmp ( const char *  a,
const char *  b 
)

Compares NUL-terminated UTF-8 strings case insensitively. The second string contains wildcards.

Returns
0 if a match is found, 1 if not
Parameters
ain: string to compare
bin: wildcard string to compare

Definition at line 1675 of file ha_innodb.cc.

int innodb_page_size_validate ( ulong  page_size)
inline

Check that a page_size is correct for InnoDB. If correct, set the associated page_size_shift which is the power of 2 for this page size.

Returns
an associated page_size_shift if valid, 0 if invalid.
Parameters
page_sizein: Page Size to evaluate

Definition at line 1055 of file ha_innodb.cc.

UNIV_INTERN const char* server_get_hostname ( )

Returns the NUL terminated value of glob_hostname.

Returns
pointer to glob_hostname.

Definition at line 1207 of file ha_innodb.cc.

UNIV_INTERN ibool 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.

Returns
true if non-transactional tables have been edited
Parameters
thdin: thread handle

Definition at line 1221 of file ha_innodb.cc.

UNIV_INTERN ibool 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().

Returns
true if thd is the replication thread
Parameters
thdin: thread handle

Definition at line 1083 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool thd_is_select ( const THD *  thd)

Returns true if the thread is executing a SELECT statement.

Returns
true if thd is executing SELECT
Parameters
thdin: thread handle

Definition at line 1233 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INLINE ibool thd_is_strict ( THD *  thd)

Determines if the current MySQL thread is running in strict mode. If thd==NULL, THDVAR returns the global value of innodb-strict-mode.

Returns
TRUE if strict
Parameters
thdin: MySQL thread descriptor

Definition at line 2660 of file ha_innodb.cc.

UNIV_INTERN ulong thd_lock_wait_timeout ( THD *  thd)

Returns the lock wait timeout for the current connection.

Returns
the lock wait timeout, in seconds
Parameters
thdin: thread handle, or NULL to query the global innodb_lock_wait_timeout

Definition at line 1259 of file ha_innodb.cc.

UNIV_INTERN 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.

Returns
the durability property.
Parameters
thdin: thread handle

Definition at line 1096 of file ha_innodb.cc.

UNIV_INTERN void thd_set_lock_wait_time ( THD *  thd,
ulint  value 
)

Set the time waited for the lock for the current query.

Parameters
thdin/out: thread handle
valuein: time waited for the lock

Definition at line 1273 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool thd_supports_xa ( THD *  thd)

Returns true if the thread supports XA, global value of innodb_supports_xa if thd is NULL.

Returns
true if thd has XA support
Parameters
thdin: thread handle, or NULL to query the global innodb_supports_xa

Definition at line 1246 of file ha_innodb.cc.

UNIV_INTERN ibool 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.

Returns
true if the transaction is an auto commit read-only transaction.
Parameters
thdin: thread handle, can be NULL

Definition at line 1121 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN ibool thd_trx_is_read_only ( THD *  thd)

Returns true if transaction should be flagged as read-only.

Returns
true if the thd is marked as read-only
Parameters
thdin: thread handle

Definition at line 1108 of file ha_innodb.cc.

UNIV_INTERN ibool trx_is_interrupted ( const trx_t trx)

Determines if the currently running transaction has been interrupted.

Returns
TRUE if interrupted
Parameters
trxin: transaction

Definition at line 2635 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool trx_is_strict ( trx_t trx)

Determines if the currently running transaction is in strict mode.

Returns
TRUE if strict
Parameters
trxin: transaction

Definition at line 2647 of file ha_innodb.cc.

Variable Documentation

const TABLE const char const char const char ulint flags

in: table flags

Definition at line 8423 of file ha_innodb.cc.

const TABLE* form

< in: InnoDB transaction handle in: information on table columns and indexes

Definition at line 8423 of file ha_innodb.cc.

struct _ft_vft_ext ft_vft_ext_result
Initial value:
{innobase_fts_get_version,
innobase_fts_flags,
innobase_fts_retrieve_docid,
innobase_fts_count_matches}

Definition at line 260 of file ha_innodb.cc.

struct _ft_vft ft_vft_result
Initial value:
{NULL,
innobase_fts_find_ranking,
innobase_fts_close_ranking,
innobase_fts_retrieve_ranking,
NULL}

Definition at line 254 of file ha_innodb.cc.

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.

Definition at line 504 of file ha_innodb.cc.

ib_cb_t innodb_api_cb[]

Set up InnoDB API callback function array

Definition at line 425 of file ha_innodb.cc.

const TABLE const char const char const char* remote_path

in: Remote path or zero length-string

Definition at line 8423 of file ha_innodb.cc.

const TABLE const char* table_name

in: table name

Definition at line 8423 of file ha_innodb.cc.

const TABLE const char const char* temp_path

in: if this is a table explicitly created by the user with the TEMPORARY keyword, then this parameter is the dir path where the table should be placed if we create an .ibd file for it (no .ibd extension in the path, though). Otherwise this is a zero length-string

Definition at line 8423 of file ha_innodb.cc.