45#if defined(WITH_INNODB_MEMCACHED) && !defined(NDEBUG)
46#define UNIV_MEMCACHED_SDI
382 bool auto_commit,
void *thd);
407 const char *index_name,
496 uint64_t len,
bool need_cpy);
752 void *comp_sdi, uint32_t *comp_sdi_len,
753 uint32_t *uncomp_sdi_len,
ib_trx_t trx);
765 uint32_t uncomp_len, uint32_t comp_len,
const void *sdi,
794#ifdef UNIV_MEMCACHED_SDI
837 uint64_t list_buf_len);
845#ifdef UNIV_MEMCACHED_SDI
846#define ONLY_FOR_MEMCACHED_SDI(x) x
848#define ONLY_FOR_MEMCACHED_SDI(x)
851#define FOR_EACH_API_METHOD_NAME_STEM(transform) \
852 transform(cursor_open_table) \
853 transform(cursor_read_row) \
854 transform(cursor_insert_row) \
855 transform(cursor_delete_row) \
856 transform(cursor_update_row) \
857 transform(cursor_moveto) \
858 transform(cursor_first) \
859 transform(cursor_next) \
860 transform(cursor_set_match_mode) \
861 transform(sec_search_tuple_create) \
862 transform(clust_read_tuple_create) \
863 transform(tuple_delete) \
864 transform(tuple_read_u8) \
865 transform(tuple_read_u16) \
866 transform(tuple_read_u32) \
867 transform(tuple_read_u64) \
868 transform(tuple_read_i8) \
869 transform(tuple_read_i16) \
870 transform(tuple_read_i32) \
871 transform(tuple_read_i64) \
872 transform(tuple_get_n_cols) \
873 transform(col_set_value) \
874 transform(col_get_value) \
875 transform(col_get_meta) \
876 transform(trx_begin) \
877 transform(trx_commit) \
878 transform(trx_rollback) \
879 transform(trx_start) \
880 transform(trx_release) \
881 transform(cursor_lock) \
882 transform(cursor_close) \
883 transform(cursor_new_trx) \
884 transform(cursor_reset) \
885 transform(col_get_name) \
886 transform(cursor_open_index_using_name) \
887 transform(cfg_get_cfg) \
888 transform(cursor_set_cluster_access) \
889 transform(cursor_commit_trx) \
890 transform(cfg_trx_level) \
891 transform(tuple_get_n_user_cols) \
892 transform(cursor_set_lock_mode) \
893 transform(get_idx_field_name) \
894 transform(trx_get_start_time) \
895 transform(cfg_bk_commit_interval) \
896 transform(ut_strerr) \
897 transform(cursor_stmt_begin) \
898 ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_get)) \
899 ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_delete)) \
900 ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_set)) \
901 ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_create)) \
902 ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_drop)) \
903 ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_get_keys)) \
904 transform(trx_read_only) \
905 transform(is_virtual_table)
constexpr uint32_t IB_SQL_NULL
Represents SQL_NULL length.
Definition: api0api.h:356
void ib_tuple_delete(ib_tpl_t ib_tpl)
Destroy an InnoDB tuple.
Definition: api0api.cc:2454
ib_tpl_t ib_sec_search_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple used for index/table search.
Definition: api0api.cc:2376
ib_err_t ib_sdi_delete(uint32_t tablespace_id, const ib_sdi_key_t *sdi_key, ib_trx_t trx)
Delete SDI from tablespace.
ib_cfg_type_t
Possible types for a configuration variable.
Definition: api0api.h:75
@ IB_CFG_ULINT
The configuration parameter is of type ulint.
Definition: api0api.h:91
@ IB_CFG_ULONG
The configuration parameter is of type ulong.
Definition: api0api.h:94
@ IB_CFG_TEXT
The configuration parameter is of type char*.
Definition: api0api.h:97
@ IB_CFG_CB
The configuration parameter is a callback parameter.
Definition: api0api.h:100
@ IB_CFG_BOOL
The configuration parameter is of type bool.
Definition: api0api.h:76
ib_err_t ib_cursor_first(ib_crsr_t ib_crsr)
Move cursor to the first record in the table.
Definition: api0api.cc:1696
bool ib_is_virtual_table(ib_crsr_t crsr)
Check the table whether it contains virtual columns.
Definition: api0api.cc:896
ib_err_t ib_sdi_flush(space_id_t space_id)
Flush SDI in a tablespace.
Definition: api0api.cc:3174
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.
Definition: api0api.cc:1815
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.
Definition: api0api.cc:1726
uint64_t ib_trx_get_start_time(ib_trx_t ib_trx)
Get a trx start time.
Definition: api0api.cc:565
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.
Definition: api0api.cc:2245
ib_tpl_t ib_clust_search_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple used for table key operations.
Definition: api0api.cc:2401
enum dberr_t ib_err_t
All InnoDB error codes are represented by ib_err_t.
Definition: api0api.h:59
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.
Definition: api0api.cc:2197
constexpr uint32_t IB_CFG_BINLOG_ENABLED
Definition: api0api.h:299
unsigned char ib_byte_t
Representation of a byte within InnoDB.
Definition: api0api.h:61
ib_err_t ib_trx_rollback(ib_trx_t ib_trx)
Rollback a transaction.
Definition: api0api.cc:603
ib_err_t ib_tuple_write_double(ib_tpl_t ib_tpl, int col_no, double val)
Write a double value to a column.
Definition: api0api.cc:2560
ib_tpl_t ib_tuple_clear(ib_tpl_t ib_tpl)
"Clear" or reset an InnoDB tuple.
Definition: api0api.cc:2285
uint64_t ib_tuple_get_n_user_cols(const ib_tpl_t ib_tpl)
Return the number of user columns in the tuple definition.
Definition: api0api.cc:2431
struct ib_cursor_t * ib_crsr_t
InnoDB cursor handle.
Definition: api0api.h:338
constexpr uint32_t IB_CFG_MDL_ENABLED
Definition: api0api.h:300
FILE * ib_msg_stream_t
The first argument to the InnoDB message logging function.
Definition: api0api.h:310
ib_err_t ib_sdi_drop(space_id_t tablespace_id)
Drop SDI Index from tablespace.
Definition: api0api.cc:3120
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.
Definition: api0api.cc:781
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 ...
Definition: api0api.cc:2309
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.
Definition: api0api.cc:1426
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.
Definition: api0api.cc:2579
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:52
void ib_cursor_set_match_mode(ib_crsr_t ib_crsr, ib_match_mode_t match_mode)
Set the match mode for ib_cursor_move().
Definition: api0api.cc:1778
static const size_t REC_BUF_SLOT_SIZE
Used by ib_read_tuple to determine number of bytes to allocate for new slot if needed.
Definition: api0api.h:305
ib_err_t ib_cursor_close(ib_crsr_t ib_crsr)
Close an InnoDB table and free the cursor.
Definition: api0api.cc:978
ib_err_t ib_cursor_insert_row(ib_crsr_t ib_crsr, const ib_tpl_t ib_tpl)
Insert a row to a table.
Definition: api0api.cc:1128
ib_err_t ib_sdi_create(space_id_t tablespace_id)
Create SDI in a tablespace.
Definition: api0api.cc:3083
ib_tbl_fmt_t
InnoDB table format types.
Definition: api0api.h:147
@ IB_TBL_COMPRESSED
Similar to dynamic format but with pages compressed.
Definition: api0api.h:162
@ IB_TBL_DYNAMIC
Compact row format.
Definition: api0api.h:159
@ IB_TBL_COMPACT
Compact row format, the column type is not stored in the row.
Definition: api0api.h:151
@ IB_TBL_REDUNDANT
Redundant row format, the column type and length is stored in the row.
Definition: api0api.h:148
ib_err_t ib_cursor_lock(ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode)
Lock an InnoDB cursor/table.
Definition: api0api.cc:2502
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.
Definition: api0api.cc:2209
ib_err_t ib_sdi_set(uint32_t tablespace_id, const ib_sdi_key_t *sdi_key, uint32_t uncomp_len, uint32_t comp_len, const void *sdi, ib_trx_t trx)
Insert/Update SDI in tablespace.
ib_err_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, ib_trx_t trx)
Retrieve SDI from tablespace.
ib_err_t ib_tuple_write_float(ib_tpl_t ib_tpl, int col_no, float val)
Write a float value to a column.
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.
Definition: api0api.cc:2124
constexpr uint32_t IB_CFG_DISABLE_ROWLOCK
Definition: api0api.h:301
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.
Definition: api0api.cc:1990
ib_tpl_t ib_clust_read_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple for table row operations.
Definition: api0api.cc:2416
ib_err_t ib_cursor_commit_trx(ib_crsr_t ib_crsr, ib_trx_t ib_trx)
Commit the transaction in a cursor.
Definition: api0api.cc:961
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
Definition: api0api.cc:937
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.
Definition: api0api.cc:2173
bool ib_cursor_is_positioned(const ib_crsr_t ib_crsr)
Check if cursor is positioned.
Definition: api0api.cc:2484
uint64_t ib_cfg_bk_commit_interval()
Return configure value for background commit interval (in seconds)
Definition: api0api.cc:2642
bool ib_schema_lock_is_exclusive(const ib_trx_t ib_trx)
Checks if the data dictionary is latched in exclusive mode by a user transaction.
Definition: api0api.cc:2493
ib_trx_t ib_trx_begin(ib_trx_level_t ib_trx_level, bool read_write, bool auto_commit, void *thd)
Begin a transaction.
Definition: api0api.cc:536
ib_tpl_t ib_sec_read_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple used for index/table search.
Definition: api0api.cc:2389
ib_match_mode_t
Various match modes used by ib_cursor_moveto()
Definition: api0api.h:240
@ IB_EXACT_MATCH
Search using a complete key value.
Definition: api0api.h:243
@ IB_EXACT_PREFIX
Search using a key prefix which must match to rows: the prefix may contain an incomplete field (the l...
Definition: api0api.h:246
@ IB_CLOSEST_MATCH
Closest match possible.
Definition: api0api.h:241
ib_err_t ib_cursor_reset(ib_crsr_t ib_crsr)
Reset the cursor.
Definition: api0api.cc:916
uint64_t ib_tuple_get_n_cols(const ib_tpl_t ib_tpl)
Return the number of columns in the tuple definition.
Definition: api0api.cc:2445
ib_trx_level_t
Transaction isolation levels.
Definition: api0api.h:269
@ IB_TRX_SERIALIZABLE
All plain SELECTs are converted to LOCK IN SHARE MODE reads.
Definition: api0api.h:292
@ IB_TRX_READ_COMMITTED
Somewhat Oracle-like isolation, except that in range UPDATE and DELETE we must block phantom rows wit...
Definition: api0api.h:277
@ IB_TRX_READ_UNCOMMITTED
Dirty read: non-locking SELECTs are performed so that we do not look at a possible earlier version of...
Definition: api0api.h:270
@ IB_TRX_REPEATABLE_READ
All consistent reads in the same trx read the same snapshot; full next-key locking used in locking re...
Definition: api0api.h:287
ib_col_type_t
column types that are supported.
Definition: api0api.h:105
@ IB_DECIMAL
C (double) floating point value.
Definition: api0api.h:137
@ IB_INT
Integer: can be any size from 1 - 8 bytes.
Definition: api0api.h:121
@ IB_DOUBLE
Definition: api0api.h:135
@ IB_SYS
System column, this column can be one of DATA_TRX_ID, DATA_ROLL_PTR or DATA_ROW_ID.
Definition: api0api.h:129
@ IB_VARBINARY
Variable length binary.
Definition: api0api.h:116
@ IB_CHAR_ANYCHARSET
Any charset, fixed length.
Definition: api0api.h:142
@ IB_BINARY
Fixed length binary, similar to IB_CHAR but the column is not padded to the right.
Definition: api0api.h:112
@ IB_VARCHAR
Character varying length.
Definition: api0api.h:106
@ IB_FLOAT
C (float) floating point value.
Definition: api0api.h:133
@ IB_CHAR
Fixed length character string.
Definition: api0api.h:109
@ IB_BLOB
Binary large object, or a TEXT type.
Definition: api0api.h:118
@ IB_VARCHAR_ANYCHARSET
Any charset, varying length.
Definition: api0api.h:140
struct ib_tuple_t * ib_tpl_t
InnoDB tuple handle.
Definition: api0api.h:326
ib_err_t ib_table_get_id(const char *table_name, ib_id_u64_t *table_id)
Get a table id.
Definition: api0api.cc:2467
void * ib_opaque_t
Definition: api0api.h:70
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.
Definition: api0api.cc:2002
ib_err_t ib_tuple_read_float(ib_tpl_t ib_tpl, uint64_t col_no, float *fval)
Read a float value from an InnoDB tuple.
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.
Definition: api0api.cc:2185
ib_col_attr_t
InnoDB column attributes.
Definition: api0api.h:167
@ IB_COL_NONE
No special attributes.
Definition: api0api.h:168
@ IB_COL_NOT_USED
Future use, reserved.
Definition: api0api.h:174
@ IB_COL_CUSTOM3
Custom precision type, this is a bit that is ignored by InnoDB and so can be set and queried by users...
Definition: api0api.h:184
@ IB_COL_CUSTOM1
Custom precision type, this is a bit that is ignored by InnoDB and so can be set and queried by users...
Definition: api0api.h:176
@ IB_COL_CUSTOM2
Custom precision type, this is a bit that is ignored by InnoDB and so can be set and queried by users...
Definition: api0api.h:180
@ IB_COL_UNSIGNED
Column is IB_INT and unsigned.
Definition: api0api.h:172
@ IB_COL_NOT_NULL
Column data can't be NULL.
Definition: api0api.h:170
ib_opaque_t ib_charset_t
Definition: api0api.h:71
ib_err_t ib_cursor_next(ib_crsr_t ib_crsr)
Move cursor to the next record in the table.
Definition: api0api.cc:1705
void ib_cursor_stmt_begin(ib_crsr_t ib_crsr)
Inform the cursor that it's the start of an SQL statement.
Definition: api0api.cc:2551
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.
Definition: api0api.cc:2221
ib_lck_mode_t
InnoDB lock modes.
Definition: api0api.h:191
@ IB_LOCK_X
Exclusive locks should be used to lock rows.
Definition: api0api.h:201
@ IB_LOCK_IS
Intention shared, an intention lock should be used to lock tables.
Definition: api0api.h:192
@ IB_LOCK_TABLE_X
exclusive table lock
Definition: api0api.h:204
@ IB_LOCK_IX
Intention exclusive, an intention lock should be used to lock tables.
Definition: api0api.h:195
@ IB_LOCK_S
Shared locks should be used to lock rows.
Definition: api0api.h:198
@ IB_LOCK_NONE
This is used internally to note consistent read.
Definition: api0api.h:206
@ IB_LOCK_NUM
number of lock modes
Definition: api0api.h:209
const char * ib_get_idx_field_name(ib_crsr_t ib_crsr, ib_ulint_t i)
Get an index field name from the cursor.
Definition: api0api.cc:2109
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.
Definition: api0api.cc:2516
ib_trx_level_t ib_cfg_trx_level()
Return isolation configuration set by "innodb_api_trx_level".
Definition: api0api.cc:2636
uint32_t ib_trx_read_only(ib_trx_t ib_trx)
Check if the transaction is read_only.
Definition: api0api.cc:557
int(* ib_msg_log_t)(ib_msg_stream_t, const char *,...)
All log messages are written to this function.It should have the same behavior as fprintf(3).
Definition: api0api.h:314
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.
Definition: api0api.cc:2233
ib_err_t ib_sdi_get_keys(uint32_t tablespace_id, ib_sdi_vector_t *ib_sdi_vector, ib_trx_t trx)
Get the SDI keys in a tablespace into vector.
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.
Definition: api0api.cc:2665
uint64_t ib_id_u64_t
Definition: api0api.h:72
int(* ib_client_cmp_t)(const ib_col_meta_t *col_meta, const ib_byte_t *p1, uint64_t p1_len, const ib_byte_t *p2, uint64_t p2_len)
This function is used to compare two data fields for which the data type is such that we must use the...
Definition: api0api.h:350
uint32_t page_no_t
Page number.
Definition: api0api.h:50
ib_err_t ib_cursor_delete_row(ib_crsr_t ib_crsr)
Delete a row in a table.
Definition: api0api.cc:1529
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 *row_len, uint64_t *used_len)
Read current row.
Definition: api0api.cc:1597
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.
Definition: api0api.cc:2257
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)
Start a transaction that's been rolled back.
Definition: api0api.cc:504
void(* ib_cb_t)(void)
Generical InnoDB callback prototype.
Definition: api0api.h:297
ib_err_t ib_cursor_open_table(const char *name, ib_trx_t ib_trx, ib_crsr_t *ib_crsr)
Open an InnoDB table by name and return a cursor handle to it.
Definition: api0api.cc:846
int ib_cfg_get_cfg()
Get generic configure status.
Definition: api0api.cc:2646
ib_err_t ib_trx_commit(ib_trx_t ib_trx)
Commit a transaction.
Definition: api0api.cc:586
const void * ib_col_get_value(ib_tpl_t ib_tpl, ib_ulint_t i)
Get a column value pointer from the tuple.
Definition: api0api.cc:2269
struct trx_t * ib_trx_t
InnoDB transaction handle, all database operations need to be covered by transactions.
Definition: api0api.h:335
ib_index_type_t
Definition: api0api.h:212
@ IB_UNIQUE
unique index
Definition: api0api.h:214
@ IB_CLUSTERED
clustered index
Definition: api0api.h:213
ib_err_t ib_trx_release(ib_trx_t ib_trx)
Release the resources of the transaction.
Definition: api0api.cc:573
ib_srch_mode_t
InnoDB cursor search modes for ib_cursor_moveto().
Definition: api0api.h:219
@ IB_CUR_L
If search key is not found then position the cursor on the row that is less than the search key.
Definition: api0api.h:229
@ IB_CUR_GE
If the search key not found then position the cursor on the row that is greater than or equal to the ...
Definition: api0api.h:224
@ IB_CUR_G
If search key is not found then position the cursor on the row that is greater than the search key.
Definition: api0api.h:220
@ IB_CUR_LE
If search key is not found then position the cursor on the row that is less than or equal to the sear...
Definition: api0api.h:233
void ib_cursor_set_cluster_access(ib_crsr_t ib_crsr)
Set need to access clustered index record flag.
Definition: api0api.cc:2541
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.
Definition: api0api.cc:2097
unsigned long int ib_ulint_t
Representation of an unsigned long int within InnoDB.
Definition: api0api.h:67
Global error codes for the database.
dberr_t
Definition: db0err.h:39
#define dval(x)
Definition: dtoa.cc:607
const std::string FILE("FILE")
const char * table_name
Definition: rules_table_service.cc:56
mode
Definition: file_handle.h:60
required string key
Definition: replication_asynchronous_connection_failover.proto:60
case opt name
Definition: sslopt-case.h:33
Cursor instance for traversing tables/indexes.
Definition: api0api.cc:124
ib_match_mode_t match_mode
ib_cursor_moveto match mode
Definition: api0api.cc:131
Definition: api0misc.h:61
Definition: api0misc.h:65
InnoDB tuple used for key operations.
Definition: api0api.cc:200
Definition: trx0trx.h:675