MySQL 5.6.14 Source Code Document
|
Go to the source code of this file.
Classes | |
struct | mci_column |
struct | mci_item |
Macros | |
#define | LOCK_CONN_IF_NOT_LOCKED(has_lock, engine) |
#define | UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine) |
#define | LOCK_CURRENT_CONN_IF_NOT_LOCKED(has_lock, conn) |
#define | UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(has_lock, conn) |
#define | MCI_COL_TO_GET 5 |
Typedefs | |
typedef enum mci_col | mci_col_t |
typedef struct mci_column | mci_column_t |
typedef struct mci_item | mci_item_t |
typedef enum conn_op_type | conn_op_type_t |
Enumerations | |
enum | mci_col { MCI_COL_KEY, MCI_COL_VALUE, MCI_COL_FLAG, MCI_COL_CAS, MCI_COL_EXP } |
enum | conn_op_type { CONN_OP_READ, CONN_OP_WRITE, CONN_OP_DELETE, CONN_OP_FLUSH } |
Functions | |
void | register_innodb_cb (void *p) |
ib_err_t | innodb_api_begin (innodb_engine_t *engine, const char *dbname, const char *name, innodb_conn_data_t *conn_data, ib_trx_t ib_trx, ib_crsr_t *crsr, ib_crsr_t *idx_crsr, ib_lck_mode_t lock_mode) |
ib_err_t | innodb_api_search (innodb_conn_data_t *cursor_data, ib_crsr_t *crsr, const char *key, int len, mci_item_t *item, ib_tpl_t *r_tpl, bool sel_only) |
ib_err_t | innodb_api_insert (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len, uint32_t val_len, uint64_t exp, uint64_t *cas, uint64_t flags) |
ENGINE_ERROR_CODE | innodb_api_delete (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len) |
ENGINE_ERROR_CODE | innodb_api_arithmetic (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len, int delta, bool increment, uint64_t *cas, rel_time_t exp_time, bool create, uint64_t initial, uint64_t *result) |
ENGINE_ERROR_CODE | innodb_api_store (innodb_engine_t *engine, innodb_conn_data_t *cursor_data, const char *key, int len, uint32_t val_len, uint64_t exp, uint64_t *cas, uint64_t input_cas, uint64_t flags, ENGINE_STORE_OPERATION op) |
ENGINE_ERROR_CODE | innodb_api_flush (innodb_engine_t *engine, innodb_conn_data_t *conn_data, const char *dbname, const char *name) |
uint64_t | mci_get_time (void) |
void | innodb_api_cursor_reset (innodb_engine_t *engine, innodb_conn_data_t *conn_data, conn_op_type_t op_type, bool commit) |
bool | innodb_reset_conn (innodb_conn_data_t *conn_data, bool has_lock, bool commit, bool has_binlog) |
ib_err_t | innodb_verify_low (meta_cfg_info_t *info, ib_crsr_t crsr, bool runtime) |
ib_err_t | innodb_cb_cursor_close (ib_crsr_t ib_crsr) |
ib_trx_t | innodb_cb_trx_begin (ib_trx_level_t ib_trx_level) |
ib_err_t | innodb_cb_trx_commit (ib_trx_t ib_trx) |
ib_err_t | innodb_cb_close_thd (void *thd) |
ib_err_t | innodb_cb_cursor_new_trx (ib_crsr_t ib_crsr, ib_trx_t ib_trx) |
ib_err_t | innodb_cb_cursor_lock (innodb_engine_t *eng, ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode) |
ib_tpl_t | innodb_cb_read_tuple_create (ib_crsr_t ib_crsr) |
ib_err_t | innodb_cb_cursor_first (ib_crsr_t ib_crsr) |
ib_err_t | innodb_cb_read_row (ib_crsr_t ib_crsr, ib_tpl_t ib_tpl) |
ib_ulint_t | innodb_cb_col_get_meta (ib_tpl_t ib_tpl, ib_ulint_t i, ib_col_meta_t *ib_col_meta) |
void | innodb_cb_tuple_delete (ib_tpl_t ib_tpl) |
ib_ulint_t | innodb_cb_tuple_get_n_cols (const ib_tpl_t ib_tpl) |
const void * | innodb_cb_col_get_value (ib_tpl_t ib_tpl, ib_ulint_t i) |
ib_err_t | innodb_cb_open_table (const char *name, ib_trx_t ib_trx, ib_crsr_t *ib_crsr) |
char * | innodb_cb_col_get_name (ib_crsr_t ib_crsr, ib_ulint_t i) |
ib_err_t | innodb_cb_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) |
int | innodb_cb_get_cfg () |
Created 03/15/2011 Jimmy Yang
Definition in file innodb_api.h.
#define LOCK_CONN_IF_NOT_LOCKED | ( | has_lock, | |
engine | |||
) |
Macros to lock/unlock the engine connection mutex
Definition at line 34 of file innodb_api.h.
#define LOCK_CURRENT_CONN_IF_NOT_LOCKED | ( | has_lock, | |
conn | |||
) |
Macros to lock/unlock the connection mutex, used for any
connection specific operations
Definition at line 46 of file innodb_api.h.
#define MCI_COL_TO_GET 5 |
We would need to fetch 5 column values from each key value rows if they
are available. They are the "key", "value", "cas", "exp" and "flag"
Definition at line 58 of file innodb_api.h.
#define UNLOCK_CONN_IF_NOT_LOCKED | ( | has_lock, | |
engine | |||
) |
Definition at line 39 of file innodb_api.h.
#define UNLOCK_CURRENT_CONN_IF_NOT_LOCKED | ( | has_lock, | |
conn | |||
) |
Definition at line 51 of file innodb_api.h.
typedef enum conn_op_type conn_op_type_t |
types of operations performed
typedef struct mci_column mci_column_t |
mci_column is the structure that stores and describes a column info
in InnoDB Memcached. The supported column types are either character type or integer type (see above "enum mci_col" for columns supporting memcached)
typedef struct mci_item mci_item_t |
"mci_item_t" represents values we read from a table row, and enough
to assemble to an memcached response. As described in above mci_col, we must have "MCI_COL_TO_GET" (5) column values to read. In addition, the user table could have multiple "value" columns, and it is possible to map such multiple "value" columns to a single memcached key, such value is separated by "separator" as defined in the "config_option" table. And we will assemble and disassemble the memcached value from these column values. And "extra_col_value" and "n_extra_col" is used to support multiple value columns
enum conn_op_type |
types of operations performed
CONN_OP_READ |
read operation |
CONN_OP_WRITE |
write operation |
CONN_OP_DELETE |
delete operation |
CONN_OP_FLUSH |
flush operation |
Definition at line 227 of file innodb_api.h.
enum mci_col |
MCI_COL_KEY |
key |
MCI_COL_VALUE |
value |
MCI_COL_FLAG |
flag |
MCI_COL_CAS |
check and set value |
MCI_COL_EXP |
expiration |
Definition at line 60 of file innodb_api.h.
ENGINE_ERROR_CODE innodb_api_arithmetic | ( | innodb_engine_t * | engine, |
innodb_conn_data_t * | cursor_data, | ||
const char * | key, | ||
int | len, | ||
int | delta, | ||
bool | increment, | ||
uint64_t * | cas, | ||
rel_time_t | exp_time, | ||
bool | create, | ||
uint64_t | initial, | ||
uint64_t * | result | ||
) |
Update a row with arithmetic operation
engine | in: InnoDB Memcached engine |
cursor_data | in/out: cursor info |
key | in: key values |
len | in: key length |
delta | in: value to add or subtract |
increment | in: increment or decrement |
cas | out: cas |
exp_time | in: expire time |
create | in: whether to create new entry if not found |
initial | in: initialize value |
ib_err_t innodb_api_begin | ( | innodb_engine_t * | engine, |
const char * | dbname, | ||
const char * | name, | ||
innodb_conn_data_t * | conn_data, | ||
ib_trx_t | ib_trx, | ||
ib_crsr_t * | crsr, | ||
ib_crsr_t * | idx_crsr, | ||
ib_lck_mode_t | lock_mode | ||
) |
in: lock mode
Open a table and return a cursor for the table.
engine | in: InnoDB Memcached engine |
dbname | in: NUL terminated database name |
name | in: NUL terminated table name |
conn_data | in/out: connnection specific data |
ib_trx | in: transaction |
crsr | out: innodb cursor |
idx_crsr | out: innodb index cursor |
lock_mode | in: lock mode |
Definition at line 139 of file innodb_api.c.
void innodb_api_cursor_reset | ( | innodb_engine_t * | engine, |
innodb_conn_data_t * | conn_data, | ||
conn_op_type_t | op_type, | ||
bool | commit | ||
) |
Increment read and write counters, if they exceed the batch size, commit the transaction. in: commit or abort trx
Increment read and write counters, if they exceed the batch size, commit the transaction.
engine | in: InnoDB Memcached engine |
conn_data | in/out: cursor affiliated with a connection |
op_type | in: type of DML performed |
commit | in: commit or abort trx |
Definition at line 1984 of file innodb_api.c.
ENGINE_ERROR_CODE innodb_api_delete | ( | innodb_engine_t * | engine, |
innodb_conn_data_t * | cursor_data, | ||
const char * | key, | ||
int | len | ||
) |
Delete a row, implements the "remove" command
Delete a row, support the memcached "remove" command
engine | in: InnoDB Memcached engine |
cursor_data | in/out: cursor info |
key | in: value to insert |
len | in: value length |
Definition at line 1367 of file innodb_api.c.
ENGINE_ERROR_CODE innodb_api_flush | ( | innodb_engine_t * | engine, |
innodb_conn_data_t * | conn_data, | ||
const char * | dbname, | ||
const char * | name | ||
) |
in: table name
Implement the "flush_all" command, map to InnoDB's "trunk table" operation return ENGINE_SUCCESS is all successful
engine | in: InnoDB Memcached engine |
conn_data | in/out: cursor affiliated with a connection |
dbname | in: database name |
name | in: table name |
Definition at line 1842 of file innodb_api.c.
ib_err_t innodb_api_insert | ( | innodb_engine_t * | engine, |
innodb_conn_data_t * | cursor_data, | ||
const char * | key, | ||
int | len, | ||
uint32_t | val_len, | ||
uint64_t | exp, | ||
uint64_t * | cas, | ||
uint64_t | flags | ||
) |
Insert a row
Insert a row
engine | in: InnoDB Memcached engine |
cursor_data | in/out: cursor info |
key | in: key and value to insert |
len | in: key length |
val_len | in: value length |
exp | in: expiration time |
cas | in/out: cas value |
flags | in: flags |
Definition at line 1234 of file innodb_api.c.
ib_err_t innodb_api_search | ( | innodb_conn_data_t * | cursor_data, |
ib_crsr_t * | crsr, | ||
const char * | key, | ||
int | len, | ||
mci_item_t * | item, | ||
ib_tpl_t * | r_tpl, | ||
bool | sel_only | ||
) |
Position a row accord to key, and fetch value if needed
Position a row according to the search key, and fetch value if needed
cursor_data | in/out: cursor info |
crsr | in/out: cursor used to search |
key | in: key to search |
len | in: key length |
item | in: result |
r_tpl | in: tpl for other DML operations |
sel_only | in: for select only |
Definition at line 748 of file innodb_api.c.
ENGINE_ERROR_CODE innodb_api_store | ( | innodb_engine_t * | engine, |
innodb_conn_data_t * | cursor_data, | ||
const char * | key, | ||
int | len, | ||
uint32_t | val_len, | ||
uint64_t | exp, | ||
uint64_t * | cas, | ||
uint64_t | input_cas, | ||
uint64_t | flags, | ||
ENGINE_STORE_OPERATION | op | ||
) |
This is the interface to following commands: 1) add 2) replace 3) append 4) prepend 5) set 6) cas
This is the main interface to following memcached commands: 1) add 2) replace 3) append 4) prepend 5) set 6) cas
engine | in: InnoDB Memcached engine |
cursor_data | in/out: cursor info |
key | in: key value |
len | in: key length |
val_len | in: value length |
exp | in: expire time |
cas | out: cas value |
input_cas | in: cas value supplied by user |
flags | in: flags |
op | in: Operations |
Definition at line 1727 of file innodb_api.c.
ib_err_t innodb_cb_close_thd | ( | void * | thd | ) |
Close table associated to the connection
Close table associated to the connection
thd | in: THD |
Definition at line 2059 of file innodb_api.c.
ib_ulint_t innodb_cb_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.
Get a column type, length and attributes from the tuple.
ib_tpl | in: tuple instance |
i | in: column index in tuple |
ib_col_meta | out: column meta data |
Definition at line 2156 of file innodb_api.c.
char* innodb_cb_col_get_name | ( | ib_crsr_t | ib_crsr, |
ib_ulint_t | i | ||
) |
Get a column name from the tuple.
Get a column name from the tuple.
ib_crsr | in: InnoDB cursor instance |
i | in: column index in tuple |
Definition at line 2216 of file innodb_api.c.
const void* innodb_cb_col_get_value | ( | ib_tpl_t | ib_tpl, |
ib_ulint_t | i | ||
) |
Get a column value pointer from the tuple.
Get a column value pointer from the tuple.
ib_tpl | in: tuple instance |
i | in: column index in tuple |
Definition at line 2191 of file innodb_api.c.
Following are a set of InnoDB callback function wrappers for functions that will be used outside innodb_api.c
Following are a set of InnoDB callback function wrappers for functions
that will be used outside innodb_api.c Close a cursor
ib_crsr | in/out: cursor to close |
Definition at line 2037 of file innodb_api.c.
Move cursor to the first record in the table.
Move cursor to the first record in the table.
ib_crsr | in: InnoDB cursor instance |
Definition at line 2133 of file innodb_api.c.
ib_err_t innodb_cb_cursor_lock | ( | innodb_engine_t * | eng, |
ib_crsr_t | ib_crsr, | ||
ib_lck_mode_t | ib_lck_mode | ||
) |
Lock the table with specified lock mode
Set the Lock an InnoDB cursor/table.
eng | in: InnoDB Memcached engine |
ib_crsr | in/out: InnoDB cursor |
ib_lck_mode | in: InnoDB lock mode |
Definition at line 2093 of file innodb_api.c.
update the cursor with new transactions and also reset the cursor
update the cursor with new transactions and also reset the cursor
ib_crsr | in/out: InnoDB cursor |
ib_trx | in: transaction |
Definition at line 2081 of file innodb_api.c.
ib_err_t innodb_cb_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.
Open an InnoDB secondary index cursor and return a cursor handle to it.
ib_open_crsr | in: open/active cursor |
index_name | in: secondary index name |
ib_crsr | out,own: InnoDB index cursor |
idx_type | out: index is cluster index |
idx_id | out: index id |
Definition at line 2228 of file innodb_api.c.
int innodb_cb_get_cfg | ( | ) |
Get InnoDB API configure option
Definition at line 2243 of file innodb_api.c.
Open a table using the table name.
Open a table using the table name.
name | in: table name to lookup |
ib_trx | in: transaction |
ib_crsr | in: cursor to be used |
Definition at line 2203 of file innodb_api.c.
Read current row.
Read current row.
ib_crsr | in: InnoDB cursor instance |
ib_tpl | out: read cols into this tuple |
Definition at line 2144 of file innodb_api.c.
Create an InnoDB tuple used for index/table search.
Create an InnoDB tuple used for index/table search.
ib_crsr | in: Cursor instance |
Definition at line 2122 of file innodb_api.c.
ib_trx_t innodb_cb_trx_begin | ( | ib_trx_level_t | ib_trx_level | ) |
Start a transaction
Start a transaction
ib_trx_level | in: trx isolation level |
Definition at line 2070 of file innodb_api.c.
Commit the transaction
Commit the transaction
ib_trx | in/out: transaction to commit |
Definition at line 2048 of file innodb_api.c.
void innodb_cb_tuple_delete | ( | ib_tpl_t | ib_tpl | ) |
Destroy an InnoDB tuple. in,own: Tuple instance to delete
Destroy an InnoDB tuple.
ib_tpl | in,own: Tuple instance to delete |
Definition at line 2168 of file innodb_api.c.
ib_ulint_t innodb_cb_tuple_get_n_cols | ( | const ib_tpl_t | ib_tpl | ) |
Return the number of columns in the tuple definition.
Return the number of columns in the tuple definition.
ib_tpl | in: Tuple for table/index |
Definition at line 2180 of file innodb_api.c.
bool innodb_reset_conn | ( | innodb_conn_data_t * | conn_data, |
bool | has_lock, | ||
bool | commit, | ||
bool | has_binlog | ||
) |
Increment read and write counters, if they exceed the batch size, commit the transaction. in: binlog enabled
Increment read and write counters, if they exceed the batch size, commit the transaction.
conn_data | in/out: cursor affiliated with a connection |
has_lock | in: has lock on connection |
commit | in: commit or abort trx |
has_binlog | in: binlog enabled |
Definition at line 1878 of file innodb_api.c.
ib_err_t innodb_verify_low | ( | meta_cfg_info_t * | info, |
ib_crsr_t | crsr, | ||
bool | runtime | ||
) |
This function verifies the table configuration information on an opened table, and fills in columns used for memcached functionalities (cas, exp etc.)
This function verifies the table configuration information on an opened table, and fills in columns used for memcached functionalities (cas, exp etc.)
info | in/out: meta info structure |
crsr | in: crsr |
runtime | in: verify at the runtime |
Definition at line 877 of file innodb_config.c.
uint64_t mci_get_time | ( | void | ) |
Get current time
Get current time
Definition at line 997 of file innodb_api.c.
void register_innodb_cb | ( | void * | p | ) |
Register InnoDB Callback functions in: Pointer to callback function arrary
Register InnoDB Callback functions
p | in: Pointer to callback function array |
Definition at line 118 of file innodb_api.c.