MySQL 9.1.0
Source Code Documentation
api0api.cc File Reference

InnoDB Native API. More...

#include <dd/properties.h>
#include <dd/types/tablespace.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include "api0api.h"
#include "api0misc.h"
#include "btr0pcur.h"
#include "dict0crea.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "dict0priv.h"
#include "fsp0fsp.h"
#include "ha_prototypes.h"
#include "lob0lob.h"
#include "lock0lock.h"
#include "lock0types.h"
#include "ddl0ddl.h"
#include "dict0sdi-decompress.h"
#include "dict0sdi.h"
#include "pars0pars.h"
#include "rem0cmp.h"
#include "row0ins.h"
#include "row0sel.h"
#include "row0upd.h"
#include "row0vers.h"
#include "srv0start.h"
#include "trx0roll.h"

Classes

struct  ib_qry_grph_t
 Query graph types. More...
 
struct  ib_qry_node_t
 Query node types. More...
 
struct  ib_qry_proc_t
 Query processing fields. More...
 
struct  ib_cursor_t
 Cursor instance for traversing tables/indexes. More...
 
struct  ib_col_t
 InnoDB table columns used during table and index schema creation. More...
 
struct  ib_key_col_t
 InnoDB index columns used during index and index schema creation. More...
 
struct  ib_Index_defn
 InnoDB index schema used during index creation. More...
 
struct  ib_table_def_t
 InnoDB table schema used during table creation. More...
 
struct  ib_tuple_t
 InnoDB tuple used for key operations. More...
 

Enumerations

enum  ib_tuple_type_t { TPL_TYPE_ROW , TPL_TYPE_KEY }
 InnoDB tuple types. More...
 
enum  ib_qry_type_t { QRY_NON , QRY_INS , QRY_UPD , QRY_SEL }
 Query types supported. More...
 

Functions

static bool ib_btr_cursor_is_positioned (btr_pcur_t *pcur)
 Check whether the InnoDB persistent cursor is positioned. More...
 
static dict_table_tib_lookup_table_by_name (const char *name)
 Find table using table name. More...
 
static void ib_wake_master_thread (void)
 Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth time calls srv_active_wake_master_thread. More...
 
static ib_err_t ib_read_tuple (const rec_t *rec, bool page_format, ib_tuple_t *tuple, ib_tuple_t *cmp_tuple, int mode, void **rec_buf_list, ulint *cur_slot, ulint *used_len)
 Read the columns from a rec into a tuple. More...
 
static ib_tpl_t ib_key_tuple_new_low (const dict_index_t *index, ulint n_cols, mem_heap_t *heap)
 Create an InnoDB key tuple. More...
 
static ib_tpl_t ib_key_tuple_new (const dict_index_t *index, ulint n_cols)
 Create an InnoDB key tuple. More...
 
static ib_tpl_t ib_row_tuple_new_low (const dict_index_t *index, ulint n_cols, mem_heap_t *heap)
 Create an InnoDB row tuple. More...
 
static ib_tpl_t ib_row_tuple_new (const dict_index_t *index, ulint n_cols)
 Create an InnoDB row tuple. More...
 
ib_err_t ib_trx_start (ib_trx_t ib_trx, ib_trx_level_t ib_trx_level, bool read_write, bool auto_commit, void *thd)
 Begin a transaction. More...
 
ib_trx_t ib_trx_begin (ib_trx_level_t ib_trx_level, bool read_write, bool auto_commit, void *thd)
 Begin a transaction. More...
 
uint32_t ib_trx_read_only (ib_trx_t ib_trx)
 Check if transaction is read_only. More...
 
uint64_t ib_trx_get_start_time (ib_trx_t ib_trx)
 Get a trx start time. More...
 
ib_err_t ib_trx_release (ib_trx_t ib_trx)
 Release the resources of the transaction. More...
 
ib_err_t ib_trx_commit (ib_trx_t ib_trx)
 Commit a transaction. More...
 
ib_err_t ib_trx_rollback (ib_trx_t ib_trx)
 Rollback a transaction. More...
 
static void ib_normalize_table_name (char *norm_name, const char *name)
 Normalizes a table name string. More...
 
static ib_err_t ib_table_get_id_low (const char *table_name, ib_id_u64_t *table_id)
 Get a table id. More...
 
static ib_err_t ib_create_cursor (ib_crsr_t *ib_crsr, dict_table_t *table, dict_index_t *index, trx_t *trx)
 Create an internal cursor instance. More...
 
static ib_err_t ib_create_cursor_with_clust_index (ib_crsr_t *ib_crsr, dict_table_t *table, trx_t *trx)
 Create an internal cursor instance on the clustered index. More...
 
ib_err_t ib_cursor_open_index_using_name (ib_crsr_t ib_open_crsr, const char *index_name, ib_crsr_t *ib_crsr, int *idx_type, ib_id_u64_t *idx_id)
 Open an InnoDB secondary index cursor and return a cursor handle to it. More...
 
ib_err_t ib_cursor_open_table (const char *name, ib_trx_t ib_trx, ib_crsr_t *ib_crsr)
 Open an InnoDB table and return a cursor handle to it. More...
 
bool ib_is_virtual_table (ib_crsr_t crsr)
 Check the table whether it contains virtual columns. More...
 
static void ib_qry_proc_free (ib_qry_proc_t *q_proc)
 Free a context struct for a table handle. More...
 
ib_err_t ib_cursor_reset (ib_crsr_t ib_crsr)
 Reset the cursor. More...
 
ib_err_t ib_cursor_new_trx (ib_crsr_t ib_crsr, ib_trx_t ib_trx)
 update the cursor with new transactions and also reset the cursor More...
 
ib_err_t ib_cursor_commit_trx (ib_crsr_t ib_crsr, ib_trx_t ib_trx)
 Commit the transaction in a cursor. More...
 
ib_err_t ib_cursor_close (ib_crsr_t ib_crsr)
 Close an InnoDB table and free the cursor. More...
 
static ib_err_t ib_insert_row_with_lock_retry (que_thr_t *thr, ins_node_t *node, trx_savept_t *savept)
 Run the insert query and do error handling. More...
 
static ib_err_t ib_execute_insert_query_graph (dict_table_t *table, que_fork_t *ins_graph, ins_node_t *node)
 Write a row. More...
 
static void ib_insert_query_graph_create (ib_cursor_t *cursor)
 Create an insert query graph node. More...
 
ib_err_t ib_cursor_insert_row (ib_crsr_t ib_crsr, const ib_tpl_t ib_tpl)
 Insert a row to a table. More...
 
static upd_tib_update_vector_create (ib_cursor_t *cursor)
 Gets pointer to a prebuilt update vector used in updates. More...
 
static void ib_update_col (ib_cursor_t *cursor, upd_field_t *upd_field, ulint col_no, dfield_t *dfield)
 Note that a column has changed. More...
 
static ib_err_t ib_calc_diff (ib_cursor_t *cursor, upd_t *upd, const ib_tuple_t *old_tuple, const ib_tuple_t *new_tuple)
 Checks which fields have changed in a row and stores the new data to an update vector. More...
 
static ib_err_t ib_update_row_with_lock_retry (que_thr_t *thr, upd_node_t *node, trx_savept_t *savept)
 Run the update query and do error handling. More...
 
static ib_err_t ib_execute_update_query_graph (ib_cursor_t *cursor, btr_pcur_t *pcur)
 Does an update or delete of a row. More...
 
ib_err_t ib_cursor_update_row (ib_crsr_t ib_crsr, const ib_tpl_t ib_old_tpl, const ib_tpl_t ib_new_tpl)
 Update a row in a table. More...
 
static ib_err_t ib_delete_row (ib_cursor_t *cursor, btr_pcur_t *pcur, const rec_t *rec)
 Build the update query graph to delete a row from an index. More...
 
ib_err_t ib_cursor_delete_row (ib_crsr_t ib_crsr)
 Delete a row in a table. More...
 
ib_err_t ib_cursor_read_row (ib_crsr_t ib_crsr, ib_tpl_t ib_tpl, ib_tpl_t cmp_tpl, int mode, void **row_buf, uint64_t *slot, uint64_t *used_len)
 Read current row. More...
 
static ib_err_t ib_cursor_position (ib_cursor_t *cursor, ib_srch_mode_t mode)
 Move cursor to the first record in the table. More...
 
ib_err_t ib_cursor_first (ib_crsr_t ib_crsr)
 Move cursor to the first record in the table. More...
 
ib_err_t ib_cursor_next (ib_crsr_t ib_crsr)
 Move cursor to the next user record in the table. More...
 
ib_err_t ib_cursor_moveto (ib_crsr_t ib_crsr, ib_tpl_t ib_tpl, ib_srch_mode_t ib_srch_mode, uint64_t direction)
 Search for key. More...
 
void ib_cursor_set_match_mode (ib_crsr_t ib_crsr, ib_match_mode_t match_mode)
 Set the cursor search mode. More...
 
static dfield_tib_col_get_dfield (ib_tuple_t *tuple, ulint col_no)
 Get the dfield instance for the column in the tuple. More...
 
static ib_err_t ib_col_is_capped (const dtype_t *dtype)
 Predicate to check whether a column type contains variable length data. More...
 
ib_err_t ib_col_set_value (ib_tpl_t ib_tpl, ib_ulint_t col_no, const void *src, uint64_t len, bool need_cpy)
 Set a column of the tuple. More...
 
uint64_t ib_col_get_len (ib_tpl_t ib_tpl, ib_ulint_t i)
 Get the size of the data available in the column the tuple. More...
 
uint64_t ib_col_copy_value (ib_tpl_t ib_tpl, ib_ulint_t i, void *dst, uint32_t len)
 Copy a column value from the tuple. More...
 
static ib_col_attr_t ib_col_get_attr (ulint prtype)
 Get the InnoDB column attribute from the internal column precise type. More...
 
const char * ib_col_get_name (ib_crsr_t ib_crsr, ulint i)
 Get a column type, length and attributes from the tuple. More...
 
const char * ib_get_idx_field_name (ib_crsr_t ib_crsr, ulint i)
 Get an index field name from the cursor. More...
 
uint64_t ib_col_get_meta (ib_tpl_t ib_tpl, ulint i, ib_col_meta_t *ib_col_meta)
 Get a column type, length and attributes from the tuple. More...
 
static ib_err_t ib_tuple_check_int (ib_tpl_t ib_tpl, ulint i, bool usign, ulint size)
 Read a signed int 8 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_i8 (ib_tpl_t ib_tpl, ib_ulint_t i, int8_t *ival)
 Read a signed int 8 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_u8 (ib_tpl_t ib_tpl, ib_ulint_t i, uint8_t *ival)
 Read an unsigned int 8 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_i16 (ib_tpl_t ib_tpl, ib_ulint_t i, int16_t *ival)
 Read a signed int 16 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_u16 (ib_tpl_t ib_tpl, ib_ulint_t i, uint16_t *ival)
 Read an unsigned int 16 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_i32 (ib_tpl_t ib_tpl, ib_ulint_t i, int32_t *ival)
 Read a signed int 32 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_u32 (ib_tpl_t ib_tpl, ib_ulint_t i, uint32_t *ival)
 Read an unsigned int 32 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_i64 (ib_tpl_t ib_tpl, ib_ulint_t i, int64_t *ival)
 Read a signed int 64 bit column from an InnoDB tuple. More...
 
ib_err_t ib_tuple_read_u64 (ib_tpl_t ib_tpl, ib_ulint_t i, uint64_t *ival)
 Read an unsigned int 64 bit column from an InnoDB tuple. More...
 
const void * ib_col_get_value (ib_tpl_t ib_tpl, ib_ulint_t i)
 Get a column value pointer from the tuple. More...
 
ib_tpl_t ib_tuple_clear (ib_tpl_t ib_tpl)
 "Clear" or reset an InnoDB tuple. More...
 
ib_err_t ib_tuple_get_cluster_key (ib_crsr_t ib_crsr, ib_tpl_t *ib_dst_tpl, const ib_tpl_t ib_src_tpl)
 Create a new cluster key search tuple and copy the contents of the secondary index key tuple columns that refer to the cluster index record to the cluster key. More...
 
ib_tpl_t ib_sec_search_tuple_create (ib_crsr_t ib_crsr)
 Create an InnoDB tuple used for index/table search. More...
 
ib_tpl_t ib_sec_read_tuple_create (ib_crsr_t ib_crsr)
 Create an InnoDB tuple used for index/table search. More...
 
ib_tpl_t ib_clust_search_tuple_create (ib_crsr_t ib_crsr)
 Create an InnoDB tuple used for table key operations. More...
 
ib_tpl_t ib_clust_read_tuple_create (ib_crsr_t ib_crsr)
 Create an InnoDB tuple for table row operations. More...
 
uint64_t ib_tuple_get_n_user_cols (const ib_tpl_t ib_tpl)
 Return the number of user columns in the tuple definition. More...
 
uint64_t ib_tuple_get_n_cols (const ib_tpl_t ib_tpl)
 Return the number of columns in the tuple definition. More...
 
void ib_tuple_delete (ib_tpl_t ib_tpl)
 Destroy an InnoDB tuple. More...
 
ib_err_t ib_table_get_id (const char *table_name, ib_id_u64_t *table_id)
 Get a table id. More...
 
bool ib_cursor_is_positioned (const ib_crsr_t ib_crsr)
 Check if cursor is positioned. More...
 
bool ib_schema_lock_is_exclusive (const ib_trx_t ib_trx)
 Checks if the data dictionary is latched in exclusive mode. More...
 
ib_err_t ib_cursor_lock (ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode)
 Set the Lock an InnoDB cursor/table. More...
 
ib_err_t ib_cursor_set_lock_mode (ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode)
 Set the Lock mode of the cursor. More...
 
void ib_cursor_set_cluster_access (ib_crsr_t ib_crsr)
 Set need to access clustered index record. More...
 
void ib_cursor_stmt_begin (ib_crsr_t ib_crsr)
 Inform the cursor that it's the start of an SQL statement. More...
 
ib_err_t ib_tuple_write_double (ib_tpl_t ib_tpl, int col_no, double val)
 Write a double value to a column. More...
 
ib_err_t ib_tuple_read_double (ib_tpl_t ib_tpl, uint64_t col_no, double *dval)
 Read a double column value from an InnoDB tuple. More...
 
ib_err_t ib_tuple_write_float (ib_tpl_t ib_tpl, uint64_t col_no, float val)
 
ib_err_t ib_tuple_read_float (ib_tpl_t ib_tpl, ulint col_no, float *fval)
 Read a float value from an InnoDB tuple. More...
 
ib_trx_level_t ib_cfg_trx_level ()
 Return isolation configuration set by "innodb_api_trx_level". More...
 
uint64_t ib_cfg_bk_commit_interval ()
 Return configure value for background commit interval (in seconds) More...
 
int ib_cfg_get_cfg ()
 Get generic configure status. More...
 
const char * ib_ut_strerr (ib_err_t num)
 Wrapper of ut_strerr() which converts an InnoDB error number to a human readable text message. More...
 
static ib_err_t ib_cursor_open_table_using_id (ib_id_u64_t table_id, ib_trx_t ib_trx, ib_crsr_t *ib_crsr)
 Open an InnoDB table and return a cursor handle to it. More...
 
static ib_tpl_t ib_sdi_create_search_tuple (ib_crsr_t ib_crsr, const sdi_key_t *sdi_key)
 Create a tuple to search from SDI table. More...
 
static ib_tpl_t ib_sdi_create_insert_tuple (ib_crsr_t ib_crsr, const sdi_key_t *sdi_key, uint32_t uncomp_len, uint32_t comp_len, const void *sdi)
 Create a tuple to insert into SDI table. More...
 
static ib_err_t ib_sdi_open_table (uint32_t tablespace_id, trx_t *trx, ib_crsr_t *ib_crsr)
 Open SDI table. More...
 
dberr_t ib_sdi_set (uint32_t tablespace_id, const ib_sdi_key_t *ib_sdi_key, uint32_t uncomp_len, uint32_t comp_len, const void *sdi, trx_t *trx)
 Insert/Update SDI in tablespace. More...
 
dberr_t ib_sdi_get_keys (uint32_t tablespace_id, ib_sdi_vector_t *ib_sdi_vector, trx_t *trx)
 Get the SDI keys in a tablespace into vector. More...
 
dberr_t ib_sdi_get (uint32_t tablespace_id, const ib_sdi_key_t *ib_sdi_key, void *comp_sdi, uint32_t *comp_sdi_len, uint32_t *uncomp_sdi_len, trx_t *trx)
 Retrieve SDI from tablespace. More...
 
ib_err_t ib_sdi_delete (uint32_t tablespace_id, const ib_sdi_key_t *ib_sdi_key, trx_t *trx)
 Delete SDI from tablespace. More...
 
ib_err_t ib_sdi_create (space_id_t tablespace_id)
 Create SDI in a tablespace. More...
 
ib_err_t ib_sdi_drop (space_id_t tablespace_id)
 Drop SDI Index from tablespace. More...
 
ib_err_t ib_sdi_flush (space_id_t space_id)
 Flush SDI in a tablespace. More...
 

Variables

bool ib_binlog_enabled = false
 configure variable for binlog option with InnoDB APIs More...
 
bool ib_mdl_enabled = false
 configure variable for MDL option with InnoDB APIs More...
 
bool ib_disable_row_lock = false
 configure variable for disable rowlock with InnoDB APIs More...
 
ulong ib_trx_level_setting = IB_TRX_READ_UNCOMMITTED
 configure variable for Transaction isolation levels More...
 
ulong ib_bk_commit_interval = 0
 configure variable for background commit interval in seconds More...
 
constexpr uint32_t INNOBASE_WAKE_INTERVAL = 32
 The following counter is used to convey information to InnoDB about server activity: in case of normal DML ops it is not sensible to call srv_active_wake_master_thread after each operation, we only do it every INNOBASE_WAKE_INTERVAL'th step. More...
 

Detailed Description

InnoDB Native API.

2008-08-01 Created Sunny Bains 3/20/2011 Jimmy Yang extracted from Embedded InnoDB

Enumeration Type Documentation

◆ ib_qry_type_t

Query types supported.

Enumerator
QRY_NON 

None/Sentinel.

QRY_INS 

Insert operation.

QRY_UPD 

Update operation.

QRY_SEL 

Select operation.

◆ ib_tuple_type_t

InnoDB tuple types.

Enumerator
TPL_TYPE_ROW 

Data row tuple.

TPL_TYPE_KEY 

Index key tuple.

Function Documentation

◆ ib_btr_cursor_is_positioned()

static bool ib_btr_cursor_is_positioned ( btr_pcur_t pcur)
inlinestatic

Check whether the InnoDB persistent cursor is positioned.

Returns
IB_true if positioned
Parameters
pcurin: InnoDB persistent cursor

◆ ib_calc_diff()

static ib_err_t ib_calc_diff ( ib_cursor_t cursor,
upd_t upd,
const ib_tuple_t old_tuple,
const ib_tuple_t new_tuple 
)
static

Checks which fields have changed in a row and stores the new data to an update vector.

Returns
DB_SUCCESS or err code
Parameters
cursorin: current cursor
updin/out: update vector
old_tuplein: Old tuple in table
new_tuplein: New tuple to update

◆ ib_cfg_bk_commit_interval()

uint64_t ib_cfg_bk_commit_interval ( )

Return configure value for background commit interval (in seconds)

Returns
background commit interval (in seconds)

◆ ib_cfg_get_cfg()

int ib_cfg_get_cfg ( )

Get generic configure status.

Returns
configure status

◆ ib_cfg_trx_level()

ib_trx_level_t ib_cfg_trx_level ( )

Return isolation configuration set by "innodb_api_trx_level".

Returns
trx isolation level

◆ ib_clust_read_tuple_create()

ib_tpl_t ib_clust_read_tuple_create ( ib_crsr_t  ib_crsr)

Create an InnoDB tuple for table row operations.

Returns
own: Tuple for current table
Parameters
ib_crsrin: Cursor instance

◆ ib_clust_search_tuple_create()

ib_tpl_t ib_clust_search_tuple_create ( ib_crsr_t  ib_crsr)

Create an InnoDB tuple used for table key operations.

Returns
own: Tuple for current table
Parameters
ib_crsrin: Cursor instance

◆ ib_col_copy_value()

uint64_t ib_col_copy_value ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
void *  dst,
uint32_t  len 
)

Copy a column value from the tuple.

Parameters
[in]ib_tpltuple instance
[in]iin column index in tuple
[out]dstcopied data value
[in]lenmax data value len to copy
Returns
bytes copied or IB_SQL_NULL

◆ ib_col_get_attr()

static ib_col_attr_t ib_col_get_attr ( ulint  prtype)
inlinestatic

Get the InnoDB column attribute from the internal column precise type.

Returns
precise type in api format
Parameters
prtypein: column definition

◆ ib_col_get_dfield()

static dfield_t * ib_col_get_dfield ( ib_tuple_t tuple,
ulint  col_no 
)
inlinestatic

Get the dfield instance for the column in the tuple.

Returns
dfield instance in tuple
Parameters
tuplein: tuple instance
col_noin: col no. in tuple

◆ ib_col_get_len()

uint64_t ib_col_get_len ( ib_tpl_t  ib_tpl,
ib_ulint_t  i 
)

Get the size of the data available in the column the tuple.

Parameters
[in]ib_tpltuple instance
[in]icolumn index in tuple
Returns
bytes avail or IB_SQL_NULL

◆ ib_col_get_meta()

uint64_t ib_col_get_meta ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
ib_col_meta_t ib_col_meta 
)

Get a column type, length and attributes from the tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ib_col_metacolumn meta data
Returns
len of column data

◆ ib_col_get_name()

const char * ib_col_get_name ( ib_crsr_t  ib_crsr,
ib_ulint_t  i 
)

Get a column type, length and attributes from the tuple.

Parameters
[in]ib_crsrInnoDB cursor instance
[in]icolumn index in tuple
Returns
len of column data

◆ ib_col_get_value()

const void * ib_col_get_value ( ib_tpl_t  ib_tpl,
ib_ulint_t  i 
)

Get a column value pointer from the tuple.

Parameters
[in]ib_tpltuple instance
[in]icolumn index in tuple
Returns
NULL or pointer to buffer

◆ ib_col_is_capped()

static ib_err_t ib_col_is_capped ( const dtype_t dtype)
inlinestatic

Predicate to check whether a column type contains variable length data.

Returns
DB_SUCCESS or error code
Parameters
dtypein: column type

◆ ib_col_set_value()

ib_err_t ib_col_set_value ( ib_tpl_t  ib_tpl,
ib_ulint_t  col_no,
const void *  src,
uint64_t  len,
bool  need_cpy 
)

Set a column of the tuple.

Make a copy using the tuple's heap.

Parameters
[in]ib_tpltuple instance
[in]col_nocolumn index in tuple
[in]srcdata value
[in]lendata value len
[in]need_cpyif need memcpy
Returns
DB_SUCCESS or error code

◆ ib_create_cursor()

static ib_err_t ib_create_cursor ( ib_crsr_t ib_crsr,
dict_table_t table,
dict_index_t index,
trx_t trx 
)
static

Create an internal cursor instance.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrout: InnoDB cursor
tablein: table instance
indexin: index to use
trxin: transaction

◆ ib_create_cursor_with_clust_index()

static ib_err_t ib_create_cursor_with_clust_index ( ib_crsr_t ib_crsr,
dict_table_t table,
trx_t trx 
)
static

Create an internal cursor instance on the clustered index.

Parameters
[out]ib_crsrInnoDB cursor
[in,out]tabletable instance
[in,out]trxtransaction
Returns
DB_SUCCESS or err code

◆ ib_cursor_close()

ib_err_t ib_cursor_close ( ib_crsr_t  ib_crsr)

Close an InnoDB table and free the cursor.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin,own: InnoDB cursor

◆ ib_cursor_commit_trx()

ib_err_t ib_cursor_commit_trx ( ib_crsr_t  ib_crsr,
ib_trx_t  ib_trx 
)

Commit the transaction in a cursor.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin/out: InnoDB cursor
ib_trxin: transaction

◆ ib_cursor_delete_row()

ib_err_t ib_cursor_delete_row ( ib_crsr_t  ib_crsr)

Delete a row in a table.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin: InnoDB cursor instance

◆ ib_cursor_first()

ib_err_t ib_cursor_first ( ib_crsr_t  ib_crsr)

Move cursor to the first record in the table.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin: InnoDB cursor instance

◆ ib_cursor_insert_row()

ib_err_t ib_cursor_insert_row ( ib_crsr_t  ib_crsr,
const ib_tpl_t  ib_tpl 
)

Insert a row to a table.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin/out: InnoDB cursor instance
ib_tplin: tuple to insert

◆ ib_cursor_is_positioned()

bool ib_cursor_is_positioned ( const ib_crsr_t  ib_crsr)

Check if cursor is positioned.

Parameters
[in]ib_crsrInnoDB cursor instance
Returns
IB_true if positioned

◆ ib_cursor_lock()

ib_err_t ib_cursor_lock ( ib_crsr_t  ib_crsr,
ib_lck_mode_t  ib_lck_mode 
)

Set the Lock an InnoDB cursor/table.

Lock an InnoDB cursor/table.

Returns
DB_SUCCESS or error code
Parameters
ib_crsrin/out: InnoDB cursor
ib_lck_modein: InnoDB lock mode

◆ ib_cursor_moveto()

ib_err_t ib_cursor_moveto ( ib_crsr_t  ib_crsr,
ib_tpl_t  ib_tpl,
ib_srch_mode_t  ib_srch_mode,
uint64_t  direction 
)

Search for key.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin: InnoDB cursor instance
ib_tplin: Key to search for
ib_srch_modein: search mode
directionin: search direction

◆ ib_cursor_new_trx()

ib_err_t ib_cursor_new_trx ( ib_crsr_t  ib_crsr,
ib_trx_t  ib_trx 
)

update the cursor with new transactions and also reset the cursor

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin/out: InnoDB cursor
ib_trxin: transaction

◆ ib_cursor_next()

ib_err_t ib_cursor_next ( ib_crsr_t  ib_crsr)

Move cursor to the next user record in the table.

Move cursor to the next record in the table.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin: InnoDB cursor instance

◆ ib_cursor_open_index_using_name()

ib_err_t ib_cursor_open_index_using_name ( ib_crsr_t  ib_open_crsr,
const char *  index_name,
ib_crsr_t ib_crsr,
int *  idx_type,
ib_id_u64_t idx_id 
)

Open an InnoDB secondary index cursor and return a cursor handle to it.

Returns
DB_SUCCESS or err code
Parameters
ib_open_crsrin: open/active cursor
index_namein: secondary index name
ib_crsrout,own: InnoDB index cursor
idx_typeout: index is cluster index
idx_idout: index id

◆ ib_cursor_open_table()

ib_err_t ib_cursor_open_table ( const char *  name,
ib_trx_t  ib_trx,
ib_crsr_t ib_crsr 
)

Open an InnoDB table and return a cursor handle to it.

Open an InnoDB table by name and return a cursor handle to it.

Returns
DB_SUCCESS or err code
Parameters
namein: table name
ib_trxin: Current transaction handle can be NULL
ib_crsrout,own: InnoDB cursor

◆ ib_cursor_open_table_using_id()

static ib_err_t ib_cursor_open_table_using_id ( ib_id_u64_t  table_id,
ib_trx_t  ib_trx,
ib_crsr_t ib_crsr 
)
static

Open an InnoDB table and return a cursor handle to it.

Returns
DB_SUCCESS or err code
Parameters
table_idin: table id of table to open
ib_trxin: Current transaction handle can be NULL
ib_crsrout,own: InnoDB cursor

◆ ib_cursor_position()

static ib_err_t ib_cursor_position ( ib_cursor_t cursor,
ib_srch_mode_t  mode 
)
inlinestatic

Move cursor to the first record in the table.

Returns
DB_SUCCESS or err code
Parameters
cursorin: InnoDB cursor instance
modein: Search mode

◆ ib_cursor_read_row()

ib_err_t ib_cursor_read_row ( ib_crsr_t  ib_crsr,
ib_tpl_t  ib_tpl,
ib_tpl_t  cmp_tpl,
int  mode,
void **  row_buf,
uint64_t *  slot,
uint64_t *  used_len 
)

Read current row.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin: InnoDB cursor instance
ib_tplout: read cols into this tuple
cmp_tplin: tuple to compare and stop reading
modein: mode determine when to stop read
row_bufin/out: row buffer
slotin/out: slot being used
used_lenin/out: buffer len used

◆ ib_cursor_reset()

ib_err_t ib_cursor_reset ( ib_crsr_t  ib_crsr)

Reset the cursor.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin/out: InnoDB cursor

◆ ib_cursor_set_cluster_access()

void ib_cursor_set_cluster_access ( ib_crsr_t  ib_crsr)

Set need to access clustered index record.

Set need to access clustered index record flag.

Parameters
ib_crsrin/out: InnoDB cursor

◆ ib_cursor_set_lock_mode()

ib_err_t ib_cursor_set_lock_mode ( ib_crsr_t  ib_crsr,
ib_lck_mode_t  ib_lck_mode 
)

Set the Lock mode of the cursor.

Returns
DB_SUCCESS or error code
Parameters
ib_crsrin/out: InnoDB cursor
ib_lck_modein: InnoDB lock mode

◆ ib_cursor_set_match_mode()

void ib_cursor_set_match_mode ( ib_crsr_t  ib_crsr,
ib_match_mode_t  match_mode 
)

Set the cursor search mode.

Set the match mode for ib_cursor_move().

Parameters
ib_crsrin: Cursor instance
match_modein: ib_cursor_moveto match mode

◆ ib_cursor_stmt_begin()

void ib_cursor_stmt_begin ( ib_crsr_t  ib_crsr)

Inform the cursor that it's the start of an SQL statement.

Parameters
[in,out]ib_crsrInnoDB cursor
Parameters
ib_crsrin: cursor

◆ ib_cursor_update_row()

ib_err_t ib_cursor_update_row ( ib_crsr_t  ib_crsr,
const ib_tpl_t  ib_old_tpl,
const ib_tpl_t  ib_new_tpl 
)

Update a row in a table.

Returns
DB_SUCCESS or err code
Parameters
ib_crsrin: InnoDB cursor instance
ib_old_tplin: Old tuple in table
ib_new_tplin: New tuple to update

◆ ib_delete_row()

static ib_err_t ib_delete_row ( ib_cursor_t cursor,
btr_pcur_t pcur,
const rec_t rec 
)
static

Build the update query graph to delete a row from an index.

Returns
DB_SUCCESS or err code
Parameters
cursorin: current cursor
pcurin: Btree persistent cursor
recin: record to delete

◆ ib_execute_insert_query_graph()

static ib_err_t ib_execute_insert_query_graph ( dict_table_t table,
que_fork_t ins_graph,
ins_node_t node 
)
static

Write a row.

Returns
DB_SUCCESS or err code
Parameters
tablein: table where to insert
ins_graphin: query graph
nodein: insert node

◆ ib_execute_update_query_graph()

static ib_err_t ib_execute_update_query_graph ( ib_cursor_t cursor,
btr_pcur_t pcur 
)
inlinestatic

Does an update or delete of a row.

Returns
DB_SUCCESS or err code
Parameters
cursorin: Cursor instance
pcurin: Btree persistent cursor

◆ ib_get_idx_field_name()

const char * ib_get_idx_field_name ( ib_crsr_t  ib_crsr,
ib_ulint_t  i 
)

Get an index field name from the cursor.

Parameters
[in]ib_crsrInnoDB cursor instance
[in]icolumn index in tuple
Returns
name of the field

◆ ib_insert_query_graph_create()

static void ib_insert_query_graph_create ( ib_cursor_t cursor)
static

Create an insert query graph node.

Parameters
cursorin: Cursor instance

◆ ib_insert_row_with_lock_retry()

static ib_err_t ib_insert_row_with_lock_retry ( que_thr_t thr,
ins_node_t node,
trx_savept_t savept 
)
inlinestatic

Run the insert query and do error handling.

Returns
DB_SUCCESS or error code
Parameters
thrin: insert query graph
nodein: insert node for the query
saveptin: savepoint to rollback to in case of an error

◆ ib_is_virtual_table()

bool ib_is_virtual_table ( ib_crsr_t  crsr)

Check the table whether it contains virtual columns.

Parameters
[in]crsrInnoDB Cursor
Returns
true if the table contains virtual column else failure.

◆ ib_key_tuple_new()

static ib_tpl_t ib_key_tuple_new ( const dict_index_t index,
ulint  n_cols 
)
static

Create an InnoDB key tuple.

Returns
tuple instance created, or NULL
Parameters
indexin: index of tuple
n_colsin: no. of user defined cols

◆ ib_key_tuple_new_low()

static ib_tpl_t ib_key_tuple_new_low ( const dict_index_t index,
ulint  n_cols,
mem_heap_t heap 
)
static

Create an InnoDB key tuple.

Returns
tuple instance created, or NULL
Parameters
indexin: index for which tuple required
n_colsin: no. of user defined cols
heapin: memory heap

◆ ib_lookup_table_by_name()

static dict_table_t * ib_lookup_table_by_name ( const char *  name)
static

Find table using table name.

Returns
table instance if found
Parameters
namein: table name to lookup

◆ ib_normalize_table_name()

static void ib_normalize_table_name ( char *  norm_name,
const char *  name 
)
static

Normalizes a table name string.

A normalized name consists of the database name catenated to '/' and table name. An example: test/mytable. On Windows normalization puts both the database name and the table name always to lower case. This function can be called for system tables and they don't have a database component. For tables that don't have a database component, we don't normalize them to lower case on Windows. The assumption is that they are system tables that reside in the system table space.

Parameters
norm_nameout: normalized name as a null-terminated string
namein: table name string

◆ ib_qry_proc_free()

static void ib_qry_proc_free ( ib_qry_proc_t q_proc)
static

Free a context struct for a table handle.

Parameters
q_procin, own: qproc struct

◆ ib_read_tuple()

static ib_err_t ib_read_tuple ( const rec_t rec,
bool  page_format,
ib_tuple_t tuple,
ib_tuple_t cmp_tuple,
int  mode,
void **  rec_buf_list,
ulint cur_slot,
ulint used_len 
)
static

Read the columns from a rec into a tuple.

Parameters
recin: Record to read
page_formatin: true if compressed format
tuplein: tuple to read into
cmp_tuplein: tuple to compare and stop reading
modein: mode determine when to stop read
rec_buf_listin/out: row buffer
cur_slotin/out: buffer slot being used
used_lenin/out: used buf len

◆ ib_row_tuple_new()

static ib_tpl_t ib_row_tuple_new ( const dict_index_t index,
ulint  n_cols 
)
static

Create an InnoDB row tuple.

Returns
tuple instance, or NULL
Parameters
indexin: index of tuple
n_colsin: no. of cols in tuple

◆ ib_row_tuple_new_low()

static ib_tpl_t ib_row_tuple_new_low ( const dict_index_t index,
ulint  n_cols,
mem_heap_t heap 
)
static

Create an InnoDB row tuple.

Returns
tuple instance, or NULL
Parameters
indexin: index of tuple
n_colsin: no. of cols in tuple
heapin: memory heap

◆ ib_schema_lock_is_exclusive()

bool ib_schema_lock_is_exclusive ( const ib_trx_t  ib_trx)

Checks if the data dictionary is latched in exclusive mode.

Checks if the data dictionary is latched in exclusive mode by a user transaction.

Returns
true if exclusive latch
Parameters
ib_trxin: transaction

◆ ib_sdi_create()

ib_err_t ib_sdi_create ( space_id_t  tablespace_id)

Create SDI in a tablespace.

Parameters
[in]tablespace_idInnoDB tablespace id
Returns
DB_SUCCESS if SDI index creation is successful, else error

◆ ib_sdi_create_insert_tuple()

static ib_tpl_t ib_sdi_create_insert_tuple ( ib_crsr_t  ib_crsr,
const sdi_key_t sdi_key,
uint32_t  uncomp_len,
uint32_t  comp_len,
const void *  sdi 
)
static

Create a tuple to insert into SDI table.

Parameters
[in,out]ib_crsrInnoDB cursor
[in]sdi_keySDI Key
[in]uncomp_lenuncompressed length of SDI
[in]comp_lencompressed length of SDI
[in]sdicompressed SDI data
Returns
insert tuple

◆ ib_sdi_create_search_tuple()

static ib_tpl_t ib_sdi_create_search_tuple ( ib_crsr_t  ib_crsr,
const sdi_key_t sdi_key 
)
static

Create a tuple to search from SDI table.

Parameters
[in,out]ib_crsrInnoDB cursor
[in,out]sdi_keySDI Key
Returns
search tuple

◆ ib_sdi_delete()

ib_err_t ib_sdi_delete ( uint32_t  tablespace_id,
const ib_sdi_key_t ib_sdi_key,
trx_t trx 
)

Delete SDI from tablespace.

Parameters
[in]tablespace_idtablespace id
[in]ib_sdi_keySDI key to uniquely identify the tablespace object
[in,out]trxinnodb transaction
Returns
DB_SUCCESS if SDI deletion is successful, else error

◆ ib_sdi_drop()

ib_err_t ib_sdi_drop ( space_id_t  tablespace_id)

Drop SDI Index from tablespace.

This should be used only when SDI is corrupted.

Parameters
[in]tablespace_idInnoDB tablespace id
Returns
DB_SUCCESS if dropping of SDI indexes is successful, else error

◆ ib_sdi_flush()

ib_err_t ib_sdi_flush ( space_id_t  space_id)

Flush SDI in a tablespace.

The pages of a SDI Index modified by the transaction will be flushed to disk.

Parameters
[in]space_idtablespace id
Returns
DB_SUCCESS always

◆ ib_sdi_get()

dberr_t ib_sdi_get ( uint32_t  tablespace_id,
const ib_sdi_key_t ib_sdi_key,
void *  comp_sdi,
uint32_t *  comp_sdi_len,
uint32_t *  uncomp_sdi_len,
trx_t trx 
)

Retrieve SDI from tablespace.

Parameters
[in]tablespace_idtablespace id
[in]ib_sdi_keySDI key
[in,out]comp_sdiin: buffer to hold the SDI BLOB out: compressed SDI retrieved from tablespace
[in,out]comp_sdi_lenin: Size of memory allocated out: compressed length of SDI
[out]uncomp_sdi_lenout: uncompressed length of SDI
[in,out]trxinnodb transaction
Returns
DB_SUCCESS if SDI retrieval is successful, else error.
DB_OUT_OF_MEMORY if the passed buffer is not sufficient to hold the compressed SDI retrieved from tablespace.

◆ ib_sdi_get_keys()

dberr_t ib_sdi_get_keys ( uint32_t  tablespace_id,
ib_sdi_vector_t ib_sdi_vector,
trx_t trx 
)

Get the SDI keys in a tablespace into vector.

Parameters
[in]tablespace_idtablespace id
[in,out]ib_sdi_vectorvector to hold objects with tablespace types and ids
[in,out]trxdata dictionary transaction
Returns
DB_SUCCESS if retrieval of SDI kyes is successful, else error

◆ ib_sdi_open_table()

static ib_err_t ib_sdi_open_table ( uint32_t  tablespace_id,
trx_t trx,
ib_crsr_t ib_crsr 
)
static

Open SDI table.

Parameters
[in]tablespace_idtablespace id
[in,out]trxinnodb transaction
[in,out]ib_crsrInnoDB cursor
Returns
DB_SUCCESS if SDI table is opened, else error

◆ ib_sdi_set()

dberr_t ib_sdi_set ( uint32_t  tablespace_id,
const ib_sdi_key_t ib_sdi_key,
uint32_t  uncomp_len,
uint32_t  comp_len,
const void *  sdi,
trx_t trx 
)

Insert/Update SDI in tablespace.

Parameters
[in]tablespace_idtablespace id
[in]ib_sdi_keySDI key to uniquely identify the tablespace object
[in]uncomp_lenuncompressed length of SDI
[in]comp_lencompressed length of SDI
[in]sdicompressed SDI to be stored in tablespace
[in,out]trxinnodb transaction
Returns
DB_SUCCESS if SDI Insert/Update is successful, else error

◆ ib_sec_read_tuple_create()

ib_tpl_t ib_sec_read_tuple_create ( ib_crsr_t  ib_crsr)

Create an InnoDB tuple used for index/table search.

Returns
own: Tuple for current index
Parameters
ib_crsrin: Cursor instance

◆ ib_sec_search_tuple_create()

ib_tpl_t ib_sec_search_tuple_create ( ib_crsr_t  ib_crsr)

Create an InnoDB tuple used for index/table search.

Returns
own: Tuple for current index
Parameters
ib_crsrin: Cursor instance

◆ ib_table_get_id()

ib_err_t ib_table_get_id ( const char *  table_name,
ib_id_u64_t table_id 
)

Get a table id.

This function will acquire the dictionary mutex.

Returns
DB_SUCCESS if found
Parameters
table_namein: table to find
table_idout: table id if found

◆ ib_table_get_id_low()

static ib_err_t ib_table_get_id_low ( const char *  table_name,
ib_id_u64_t table_id 
)
static

Get a table id.

The caller must have acquired the dictionary mutex.

Returns
DB_SUCCESS if found
Parameters
table_namein: table to find
table_idout: table id if found

◆ ib_trx_begin()

ib_trx_t ib_trx_begin ( ib_trx_level_t  ib_trx_level,
bool  read_write,
bool  auto_commit,
void *  thd 
)

Begin a transaction.

This will allocate a new transaction handle. put the transaction in the active state.

Returns
innobase txn handle
Parameters
ib_trx_levelin: trx isolation level
read_writein: true if read write transaction
auto_commitin: auto commit after each single DML
thdin,out: MySQL THD

◆ ib_trx_commit()

ib_err_t ib_trx_commit ( ib_trx_t  ib_trx)

Commit a transaction.

This function will also release the schema latches too.

Returns
DB_SUCCESS or err code
Parameters
ib_trxin: trx handle

◆ ib_trx_get_start_time()

uint64_t ib_trx_get_start_time ( ib_trx_t  ib_trx)

Get a trx start time.

Returns
trx start_time
Parameters
ib_trxin: transaction

◆ ib_trx_read_only()

uint32_t ib_trx_read_only ( ib_trx_t  ib_trx)

Check if transaction is read_only.

Check if the transaction is read_only.

Returns
transaction read_only status
Parameters
ib_trxin: trx handle

◆ ib_trx_release()

ib_err_t ib_trx_release ( ib_trx_t  ib_trx)

Release the resources of the transaction.

Returns
DB_SUCCESS or err code
Parameters
ib_trxin: trx handle

◆ ib_trx_rollback()

ib_err_t ib_trx_rollback ( ib_trx_t  ib_trx)

Rollback a transaction.

This function will also release the schema latches too.

Returns
DB_SUCCESS or err code
Parameters
ib_trxin: trx handle

◆ ib_trx_start()

ib_err_t ib_trx_start ( ib_trx_t  ib_trx,
ib_trx_level_t  ib_trx_level,
bool  read_write,
bool  auto_commit,
void *  thd 
)

Begin a transaction.

Start a transaction that's been rolled back.

Returns
innobase txn handle
Parameters
ib_trxin: transaction to restart
ib_trx_levelin: trx isolation level
read_writein: true if read write transaction
auto_commitin: auto commit after each single DML
thdin: THD

◆ ib_tuple_check_int()

static ib_err_t ib_tuple_check_int ( ib_tpl_t  ib_tpl,
ulint  i,
bool  usign,
ulint  size 
)
inlinestatic

Read a signed int 8 bit column from an InnoDB tuple.

Parameters
ib_tplin: InnoDB tuple
iin: column number
usignin: true if unsigned
sizein: size of integer

◆ ib_tuple_clear()

ib_tpl_t ib_tuple_clear ( ib_tpl_t  ib_tpl)

"Clear" or reset an InnoDB tuple.

We free the heap and recreate the tuple.

Returns
new tuple, or NULL
Parameters
ib_tplin,own: tuple (will be freed)

◆ ib_tuple_delete()

void ib_tuple_delete ( ib_tpl_t  ib_tpl)

Destroy an InnoDB tuple.

Parameters
[in]ib_tplTuple for current table
Parameters
ib_tplin,own: Tuple instance to delete

◆ ib_tuple_get_cluster_key()

ib_err_t ib_tuple_get_cluster_key ( ib_crsr_t  ib_crsr,
ib_tpl_t ib_dst_tpl,
const ib_tpl_t  ib_src_tpl 
)

Create a new cluster key search tuple and copy the contents of the secondary index key tuple columns that refer to the cluster index record to the cluster key.

It does a deep copy of the column data.

Returns
DB_SUCCESS or error code
Parameters
ib_crsrin: secondary index cursor
ib_dst_tplout,own: destination tuple
ib_src_tplin: source tuple

◆ ib_tuple_get_n_cols()

uint64_t ib_tuple_get_n_cols ( const ib_tpl_t  ib_tpl)

Return the number of columns in the tuple definition.

Returns
number of columns
Parameters
ib_tplin: Tuple for table/index

◆ ib_tuple_get_n_user_cols()

uint64_t ib_tuple_get_n_user_cols ( const ib_tpl_t  ib_tpl)

Return the number of user columns in the tuple definition.

Returns
number of user columns
Parameters
ib_tplin: Tuple for current table

◆ ib_tuple_read_double()

ib_err_t ib_tuple_read_double ( ib_tpl_t  ib_tpl,
uint64_t  col_no,
double *  dval 
)

Read a double column value from an InnoDB tuple.

Returns
DB_SUCCESS or error
Parameters
ib_tplin: InnoDB tuple
col_noin: column number
dvalout: double value

◆ ib_tuple_read_float()

ib_err_t ib_tuple_read_float ( ib_tpl_t  ib_tpl,
ulint  col_no,
float *  fval 
)

Read a float value from an InnoDB tuple.

Returns
DB_SUCCESS or error
Parameters
ib_tplin: InnoDB tuple
col_noin: column number
fvalout: float value

◆ ib_tuple_read_i16()

ib_err_t ib_tuple_read_i16 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
int16_t *  ival 
)

Read a signed int 16 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_i32()

ib_err_t ib_tuple_read_i32 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
int32_t *  ival 
)

Read a signed int 32 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_i64()

ib_err_t ib_tuple_read_i64 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
int64_t *  ival 
)

Read a signed int 64 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_i8()

ib_err_t ib_tuple_read_i8 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
int8_t *  ival 
)

Read a signed int 8 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_u16()

ib_err_t ib_tuple_read_u16 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
uint16_t *  ival 
)

Read an unsigned int 16 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_u32()

ib_err_t ib_tuple_read_u32 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
uint32_t *  ival 
)

Read an unsigned int 32 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_u64()

ib_err_t ib_tuple_read_u64 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
uint64_t *  ival 
)

Read an unsigned int 64 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuple
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_read_u8()

ib_err_t ib_tuple_read_u8 ( ib_tpl_t  ib_tpl,
ib_ulint_t  i,
uint8_t *  ival 
)

Read an unsigned int 8 bit column from an InnoDB tuple.

Parameters
[in]ib_tplInnoDB tuplr
[in]icolumn number
[out]ivalinteger value
Returns
DB_SUCCESS or error

◆ ib_tuple_write_double()

ib_err_t ib_tuple_write_double ( ib_tpl_t  ib_tpl,
int  col_no,
double  val 
)

Write a double value to a column.

Returns
DB_SUCCESS or error
Parameters
ib_tplin/out: tuple to write to
col_noin: column number
valin: value to write

◆ ib_tuple_write_float()

ib_err_t ib_tuple_write_float ( ib_tpl_t  ib_tpl,
uint64_t  col_no,
float  val 
)

◆ ib_update_col()

static void ib_update_col ( ib_cursor_t cursor,
upd_field_t upd_field,
ulint  col_no,
dfield_t dfield 
)
static

Note that a column has changed.

Parameters
cursorin: current cursor
upd_fieldin/out: update field
col_noin: column number
dfieldin: updated dfield

◆ ib_update_row_with_lock_retry()

static ib_err_t ib_update_row_with_lock_retry ( que_thr_t thr,
upd_node_t node,
trx_savept_t savept 
)
inlinestatic

Run the update query and do error handling.

Returns
DB_SUCCESS or error code
Parameters
thrin: Update query graph
nodein: Update node for the query
saveptin: savepoint to rollback to in case of an error

◆ ib_update_vector_create()

static upd_t * ib_update_vector_create ( ib_cursor_t cursor)
inlinestatic

Gets pointer to a prebuilt update vector used in updates.

Returns
update vector
Parameters
cursorin: current cursor

◆ ib_ut_strerr()

const char * ib_ut_strerr ( ib_err_t  num)

Wrapper of ut_strerr() which converts an InnoDB error number to a human readable text message.

Returns
string, describing the error
Parameters
numin: error number

◆ ib_wake_master_thread()

static void ib_wake_master_thread ( void  )
inlinestatic

Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth time calls srv_active_wake_master_thread.

This function should be used when a single database operation may introduce a small need for server utility activity, like checkpointing.

Variable Documentation

◆ ib_binlog_enabled

bool ib_binlog_enabled = false

configure variable for binlog option with InnoDB APIs

Whether binlog is enabled for applications using InnoDB APIs.

◆ ib_bk_commit_interval

ulong ib_bk_commit_interval = 0

configure variable for background commit interval in seconds

configure value for background commit interval (in seconds)

◆ ib_disable_row_lock

bool ib_disable_row_lock = false

configure variable for disable rowlock with InnoDB APIs

Whether InnoDB row lock is disabled for applications using InnoDB APIs.

◆ ib_mdl_enabled

bool ib_mdl_enabled = false

configure variable for MDL option with InnoDB APIs

Whether MySQL MDL is enabled for applications using InnoDB APIs.

◆ ib_trx_level_setting

ulong ib_trx_level_setting = IB_TRX_READ_UNCOMMITTED

configure variable for Transaction isolation levels

configure value for transaction isolation level

◆ INNOBASE_WAKE_INTERVAL

constexpr uint32_t INNOBASE_WAKE_INTERVAL = 32
constexpr

The following counter is used to convey information to InnoDB about server activity: in case of normal DML ops it is not sensible to call srv_active_wake_master_thread after each operation, we only do it every INNOBASE_WAKE_INTERVAL'th step.