MySQL 8.0.39
Source Code Documentation
|
Interface between Innobase row operations and MySQL. More...
#include <debug_sync.h>
#include <gstream.h>
#include <spatial.h>
#include <sql_class.h>
#include <sql_const.h>
#include <sys/types.h>
#include <algorithm>
#include <deque>
#include <new>
#include <vector>
#include "btr0sea.h"
#include "ddl0ddl.h"
#include "dict0boot.h"
#include "dict0crea.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "dict0load.h"
#include "dict0priv.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include "fil0fil.h"
#include "fsp0file.h"
#include "fsp0sysspace.h"
#include "fts0fts.h"
#include "fts0types.h"
#include "ha_prototypes.h"
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "log0buf.h"
#include "log0chkp.h"
#include "pars0pars.h"
#include "que0que.h"
#include "rem0cmp.h"
#include "row0ext.h"
#include "row0import.h"
#include "row0ins.h"
#include "row0mysql.h"
#include "row0pread.h"
#include "row0row.h"
#include "row0sel.h"
#include "row0upd.h"
#include "trx0purge.h"
#include "trx0rec.h"
#include "trx0roll.h"
#include "trx0undo.h"
#include "ut0cpu_cache.h"
#include "ut0new.h"
#include "current_thd.h"
#include "my_dbug.h"
#include "my_io.h"
Classes | |
struct | row_mysql_drop_t |
Chain node of the list of tables to drop in the background. More... | |
class | ib_dec_counter |
Macros | |
#define | PREBUILT_HEAP_INITIAL_SIZE |
Typedefs | |
typedef std::vector< btr_pcur_t, ut::allocator< btr_pcur_t > > | cursors_t |
Functions | |
static | UT_LIST_BASE_NODE_T (row_mysql_drop_t, row_mysql_drop_list) row_mysql_drop_list |
List of tables we should drop in background. More... | |
static bool | row_add_table_to_background_drop_list (const char *name) |
If a table is not yet in the drop list, adds the table to the list of tables which the master thread drops in background. More... | |
void | row_wait_for_background_drop_list_empty () |
Wait for the background drop list to become empty. More... | |
static void | row_mysql_delay_if_needed (void) |
Delays an INSERT, DELETE or UPDATE operation if the purge is lagging. More... | |
void | row_mysql_prebuilt_free_blob_heap (row_prebuilt_t *prebuilt) |
Frees the blob heap in prebuilt when no longer needed. More... | |
byte * | row_mysql_store_true_var_len (byte *dest, ulint len, ulint lenlen) |
Stores a >= 5.0.3 format true VARCHAR length to dest, in the MySQL row format. More... | |
const byte * | row_mysql_read_true_varchar (ulint *len, const byte *field, ulint lenlen) |
Reads a >= 5.0.3 format true VARCHAR length, in the MySQL row format, and returns a pointer to the data. More... | |
void | row_mysql_store_blob_ref (byte *dest, ulint col_len, const void *data, ulint len) |
Stores a reference to a BLOB in the MySQL format. More... | |
const byte * | row_mysql_read_blob_ref (ulint *len, const byte *ref, ulint col_len) |
Reads a reference to a BLOB in the MySQL format. More... | |
void | row_mysql_store_geometry (byte *dest, ulint dest_len, const byte *src, ulint src_len) |
Converting InnoDB geometry data format to MySQL data format. More... | |
static const byte * | row_mysql_read_geometry (ulint *len, const byte *ref, ulint col_len) |
Read geometry data in the MySQL format. More... | |
void | row_mysql_pad_col (ulint mbminlen, byte *pad, ulint len) |
Pad a column with spaces. More... | |
byte * | row_mysql_store_col_in_innobase_format (dfield_t *dfield, byte *buf, bool row_format_col, const byte *mysql_data, ulint col_len, ulint comp) |
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format. More... | |
static void | row_mysql_convert_row_to_innobase (dtuple_t *row, row_prebuilt_t *prebuilt, const byte *mysql_rec, mem_heap_t **heap) |
Convert a row in the MySQL format to a row in the Innobase format. More... | |
bool | row_mysql_handle_errors (dberr_t *new_err, trx_t *trx, que_thr_t *thr, trx_savept_t *savept) |
Handles user errors and lock waits detected by the database engine. More... | |
row_prebuilt_t * | row_create_prebuilt (dict_table_t *table, ulint mysql_row_len) |
Create a prebuilt struct for a MySQL table handle. More... | |
void | row_prebuilt_free (row_prebuilt_t *prebuilt, bool dict_locked) |
Free a prebuilt struct for a MySQL table handle. More... | |
void | row_update_prebuilt_trx (row_prebuilt_t *prebuilt, trx_t *trx) |
Updates the transaction pointers in query graphs stored in the prebuilt struct. More... | |
static dtuple_t * | row_get_prebuilt_insert_row (row_prebuilt_t *prebuilt) |
Gets pointer to a prebuilt dtuple used in insertions. More... | |
static void | row_update_statistics_if_needed (dict_table_t *table) |
Updates the table modification counter and calculates new estimates for table and index statistics if necessary. More... | |
dberr_t | row_lock_table_autoinc_for_mysql (row_prebuilt_t *prebuilt) |
Sets an AUTO_INC type lock on the table mentioned in prebuilt. More... | |
dberr_t | row_lock_table (row_prebuilt_t *prebuilt) |
Sets a table lock on the table mentioned in prebuilt. More... | |
static dberr_t | row_explicit_rollback (dict_index_t *index, const dtuple_t *entry, que_thr_t *thr, mtr_t *mtr) |
Perform explicit rollback in absence of UNDO logs. More... | |
static void | row_mysql_to_innobase (dtuple_t *row, row_prebuilt_t *prebuilt, const byte *mysql_rec) |
Convert a row in the MySQL format to a row in the Innobase format. More... | |
static dberr_t | row_insert_for_mysql_using_cursor (const byte *mysql_rec, row_prebuilt_t *prebuilt) |
Does an insert for MySQL using cursor interface. More... | |
static dberr_t | row_insert_for_mysql_using_ins_graph (const byte *mysql_rec, row_prebuilt_t *prebuilt) |
Does an insert for MySQL using INSERT graph. More... | |
dberr_t | row_insert_for_mysql (const byte *mysql_rec, row_prebuilt_t *prebuilt) |
Does an insert for MySQL. More... | |
void | row_prebuild_sel_graph (row_prebuilt_t *prebuilt) |
Builds a dummy query graph used in selects. More... | |
upd_node_t * | row_create_update_node_for_mysql (dict_table_t *table, mem_heap_t *heap) |
Creates an query graph node of 'update' type to be used in the MySQL interface. More... | |
upd_t * | row_get_prebuilt_update_vector (row_prebuilt_t *prebuilt) |
Gets pointer to a prebuilt update vector used in updates. More... | |
static void | row_fts_do_update (trx_t *trx, dict_table_t *table, doc_id_t old_doc_id, doc_id_t new_doc_id) |
static dberr_t | row_fts_update_or_delete (row_prebuilt_t *prebuilt) |
static void | init_fts_doc_id_for_ref (dict_table_t *table, ulint *depth) |
Initialize the Doc ID system for FK table with FTS index. More... | |
static dberr_t | row_update_inplace_for_intrinsic (const upd_node_t *node) |
Do an in-place update in the intrinsic table. More... | |
static dberr_t | row_delete_for_mysql_using_cursor (const upd_node_t *node, cursors_t &delete_entries, const bool restore_delete) |
Delete row from table (corresponding entries from all the indexes). More... | |
static dberr_t | row_update_for_mysql_using_cursor (const upd_node_t *node, cursors_t &delete_entries, que_thr_t *thr) |
Does an update of a row for MySQL by inserting new entry with update values. More... | |
static dberr_t | row_del_upd_for_mysql_using_cursor (row_prebuilt_t *prebuilt) |
Does an update or delete of a row for MySQL. More... | |
static dberr_t | row_update_for_mysql_using_upd_graph (const byte *mysql_rec, row_prebuilt_t *prebuilt) |
Does an update or delete of a row for MySQL. More... | |
dberr_t | row_update_for_mysql (const byte *mysql_rec, row_prebuilt_t *prebuilt) |
Does an update or delete of a row for MySQL. More... | |
void | row_delete_all_rows (dict_table_t *table) |
Delete all rows for the given table by freeing/truncating indexes. More... | |
dberr_t | row_update_cascade_for_mysql (que_thr_t *thr, upd_node_t *node, dict_table_t *table) |
Does a cascaded delete or set null in a foreign key operation. More... | |
bool | row_table_got_default_clust_index (const dict_table_t *table) |
Checks if a table is such that we automatically created a clustered index on it (on row id). More... | |
void | row_mysql_freeze_data_dictionary (trx_t *trx, ut::Location location) |
Locks the data dictionary in shared mode from modifications, for performing foreign key check, rollback, or other operation invisible to MySQL. More... | |
void | row_mysql_unfreeze_data_dictionary (trx_t *trx) |
Unlocks the data dictionary shared lock. More... | |
void | row_mysql_lock_data_dictionary (trx_t *trx, ut::Location location) |
Locks the data dictionary exclusively for performing a table create or other data dictionary modification operation. More... | |
void | row_mysql_unlock_data_dictionary (trx_t *trx) |
Unlocks the data dictionary exclusive lock. More... | |
dberr_t | row_create_table_for_mysql (dict_table_t *&table, const char *compression, const HA_CREATE_INFO *create_info, trx_t *trx, mem_heap_t *heap) |
Creates a table for MySQL. More... | |
dberr_t | row_create_index_for_mysql (dict_index_t *index, trx_t *trx, const ulint *field_lengths, dict_table_t *handler) |
Does an index creation operation for MySQL. More... | |
dberr_t | row_table_load_foreign_constraints (trx_t *trx, const char *name, const dd::Table *dd_table) |
Loads foreign key constraints for the table being created. More... | |
static dberr_t | row_drop_table_for_mysql_in_background (const char *name) |
Drops a table for MySQL as a background operation. More... | |
ulint | row_drop_tables_for_mysql_in_background (void) |
TODO: NewDD: Need to check if there is need to keep background drop, in such case, the thd would be NULL (no MDL can be acquired) The master thread in srv0srv.cc calls this regularly to drop tables which we must drop in background after queries to them have ended. More... | |
static bool | row_add_table_to_background_drop_list (const char *name[[maybe_unused]]) |
If a table is not yet in the drop list, adds the table to the list of tables which the master thread drops in background. More... | |
static dberr_t | row_mysql_table_id_reassign (dict_table_t *table, table_id_t *new_id) |
Reassigns the table identifier of a table. More... | |
static dict_table_t * | row_discard_tablespace_begin (const char *name, trx_t *trx) |
Setup the pre-requisites for DISCARD TABLESPACE. More... | |
static dberr_t | row_discard_tablespace_foreign_key_checks (const trx_t *trx, const dict_table_t *table) |
Do the foreign key constraint checks. More... | |
static dberr_t | row_discard_tablespace_end (trx_t *trx, dict_table_t *table, dberr_t err, aux_name_vec_t *aux_vec) |
Cleanup after the DISCARD TABLESPACE operation. More... | |
static dberr_t | row_discard_tablespace (trx_t *trx, dict_table_t *table, aux_name_vec_t *aux_vec) |
Do the DISCARD TABLESPACE operation. More... | |
dberr_t | row_discard_tablespace_for_mysql (const char *name, trx_t *trx) |
Discards the tablespace of a table which stored in an .ibd file. More... | |
dberr_t | row_mysql_lock_table (trx_t *trx, dict_table_t *table, enum lock_mode mode, const char *op_info) |
Sets an exclusive lock on a table. More... | |
static dberr_t | row_drop_ancillary_fts_tables (dict_table_t *table, aux_name_vec_t *aux_vec, trx_t *trx) |
Drop ancillary FTS tables as part of dropping a table. More... | |
static dberr_t | row_drop_table_from_cache (dict_table_t *table, trx_t *trx) |
Drop a table from the memory cache as part of dropping a table. More... | |
dberr_t | row_drop_tablespace (space_id_t space_id, const char *filepath) |
Drop a tablespace as part of dropping or renaming a table. More... | |
dberr_t | row_drop_table_for_mysql (const char *name, trx_t *trx, bool nonatomic, dict_table_t *handler) |
Drop a table for MySQL. More... | |
bool | row_is_mysql_tmp_table_name (const char *name) |
Checks if a table name contains the string "/#sql" which denotes temporary tables in MySQL. More... | |
dberr_t | row_rename_table_for_mysql (const char *old_name, const char *new_name, const dd::Table *dd_table, trx_t *trx, bool replay) |
Renames a table for MySQL. More... | |
dberr_t | row_mysql_parallel_select_count_star (trx_t *trx, std::vector< dict_index_t * > &indexes, size_t n_threads, ulint *n_rows) |
Read the total number of records in a consistent view. More... | |
static dberr_t | parallel_check_table (trx_t *trx, dict_index_t *index, size_t n_threads, ulint *n_rows) |
dberr_t | row_scan_index_for_mysql (row_prebuilt_t *prebuilt, dict_index_t *index, size_t max_threads, bool check_keys, ulint *n_rows) |
Scans an index for either COUNT(*) or CHECK TABLE. More... | |
void | row_mysql_init (void) |
Initialize this module. More... | |
void | row_mysql_close (void) |
Close this module. More... | |
Variables | |
static const char * | MODIFICATIONS_NOT_ALLOWED_MSG_FORCE_RECOVERY |
bool | row_rollback_on_timeout = false |
Provide optional 4.x backwards compatibility for 5.0 and above. More... | |
static ib_mutex_t | row_drop_list_mutex |
Mutex protecting the background table drop list. More... | |
static bool | row_mysql_drop_list_inited = false |
Flag: has row_mysql_drop_list been initialized? More... | |
constexpr uint32_t | MAX_SRCH_KEY_VAL_BUFFER = 2 * 8 * MAX_REF_PARTS |
Interface between Innobase row operations and MySQL.
Contains also create table and other data dictionary operations.
Created 9/17/2000 Heikki Tuuri
#define PREBUILT_HEAP_INITIAL_SIZE |
typedef std::vector<btr_pcur_t, ut::allocator<btr_pcur_t> > cursors_t |
|
static |
Initialize the Doc ID system for FK table with FTS index.
table | in: table |
depth | in: recursive call depth |
|
static |
|
static |
If a table is not yet in the drop list, adds the table to the list of tables which the master thread drops in background.
We need this on Unix because in ALTER TABLE MySQL may call drop table even if the table has running queries on it. Also, if there are running foreign key checks on the table, we drop the table lazily.
|
static |
If a table is not yet in the drop list, adds the table to the list of tables which the master thread drops in background.
We need this on Unix because in ALTER TABLE MySQL may call drop table even if the table has running queries on it. Also, if there are running foreign key checks on the table, we drop the table lazily.
dberr_t row_create_index_for_mysql | ( | dict_index_t * | index, |
trx_t * | trx, | ||
const ulint * | field_lengths, | ||
dict_table_t * | handler | ||
) |
Does an index creation operation for MySQL.
TODO: currently failure to create an index results in dropping the whole table! This is no problem currently as all indexes must be created at the same time as the table.
index | in, own: index definition (will be freed) |
trx | in: transaction handle |
field_lengths | in: if not NULL, must contain dict_index_get_n_fields(index) actual field lengths for the index columns, which are then checked for not being too large. |
handler | in/out: table handler. |
row_prebuilt_t * row_create_prebuilt | ( | dict_table_t * | table, |
ulint | mysql_row_len | ||
) |
Create a prebuilt struct for a MySQL table handle.
table | in: Innobase table handle |
mysql_row_len | in: length in bytes of a row in the MySQL format |
dberr_t row_create_table_for_mysql | ( | dict_table_t *& | table, |
const char * | compression, | ||
const HA_CREATE_INFO * | create_info, | ||
trx_t * | trx, | ||
mem_heap_t * | heap | ||
) |
Creates a table for MySQL.
On success the in-memory table could be kept in non-LRU list while on failure the 'table' object will be freed.
[in,out] | table | table definition(will be freed, or on DB_SUCCESS added to the data dictionary cache) |
[in] | compression | compression algorithm to use, can be nullptr |
[in] | create_info | HA_CREATE_INFO object |
[in,out] | trx | transaction |
[in] | heap | temp memory heap or nullptr |
upd_node_t * row_create_update_node_for_mysql | ( | dict_table_t * | table, |
mem_heap_t * | heap | ||
) |
Creates an query graph node of 'update' type to be used in the MySQL interface.
table | in: table to update |
heap | in: mem heap from which allocated |
|
static |
Does an update or delete of a row for MySQL.
[in,out] | prebuilt | prebuilt struct in MySQL handle |
void row_delete_all_rows | ( | dict_table_t * | table | ) |
Delete all rows for the given table by freeing/truncating indexes.
[in,out] | table | table handler |
|
static |
Delete row from table (corresponding entries from all the indexes).
Function will maintain cursor to the entries to invoke explicitly rollback just in case update action following delete fails.
[in] | node | update node carrying information to delete. |
[out] | delete_entries | vector of cursor to deleted entries. |
[in] | restore_delete | if true, then restore DELETE records by unmarking delete. |
|
static |
Do the DISCARD TABLESPACE operation.
[in,out] | trx | transaction handle |
[in,out] | table | table to be discarded |
[in,out] | aux_vec | fts aux table name vector |
|
static |
Setup the pre-requisites for DISCARD TABLESPACE.
It will start the transaction, acquire the data dictionary lock in X mode and open the table.
name | in: table name |
trx | in: transaction handle |
|
static |
Cleanup after the DISCARD TABLESPACE operation.
[in,out] | trx | transaction handle |
[in,out] | table | table to be discarded |
[in] | err | error code |
[in,out] | aux_vec | fts aux table name vector |
Discards the tablespace of a table which stored in an .ibd file.
Discarding means that this function renames the .ibd file and assigns a new table id for the table. Also the flag table->ibd_file_missing is set to true.
name | in: table name |
trx | in: transaction handle |
|
static |
Do the foreign key constraint checks.
trx | in: transaction handle |
table | in: table to be discarded |
|
inlinestatic |
Drop ancillary FTS tables as part of dropping a table.
[in,out] | table | Table cache entry |
[in,out] | aux_vec | Fts aux table name vector |
[in,out] | trx | Transaction handle |
dberr_t row_drop_table_for_mysql | ( | const char * | name, |
trx_t * | trx, | ||
bool | nonatomic, | ||
dict_table_t * | handler | ||
) |
Drop a table for MySQL.
If the data dictionary was not already locked by the transaction, the transaction will be committed. Otherwise, the data dictionary will remain locked.
[in] | name | Table name |
[in] | trx | Transaction handle |
[in] | nonatomic | Whether it is permitted to release and reacquire dict_operation_lock |
[in,out] | handler | Table handler or NULL |
|
static |
Drops a table for MySQL as a background operation.
MySQL relies on Unix in ALTER TABLE to the fact that the table handler does not remove the table before all handles to it has been removed. Furthermore, the MySQL's call to drop table must be non-blocking. Therefore we do the drop table as a background operation, which is taken care of by the master thread in srv0srv.cc.
name | in: table name |
|
inlinestatic |
Drop a table from the memory cache as part of dropping a table.
[in,out] | table | Table cache entry |
[in,out] | trx | Transaction handle |
ulint row_drop_tables_for_mysql_in_background | ( | void | ) |
TODO: NewDD: Need to check if there is need to keep background drop, in such case, the thd would be NULL (no MDL can be acquired) The master thread in srv0srv.cc calls this regularly to drop tables which we must drop in background after queries to them have ended.
The master thread in srv0srv.cc calls this regularly to drop tables which we must drop in background after queries to them have ended.
Such lazy dropping of tables is needed in ALTER TABLE on Unix.
dberr_t row_drop_tablespace | ( | space_id_t | space_id, |
const char * | filepath | ||
) |
Drop a tablespace as part of dropping or renaming a table.
This deletes the fil_space_t if found and the file on disk.
[in] | space_id | Tablespace ID |
[in] | filepath | File path of tablespace to delete |
|
static |
Perform explicit rollback in absence of UNDO logs.
[in] | index | Apply rollback action on this index |
[in] | entry | Entry to remove/rollback. |
[in,out] | thr | Thread handler. |
[in,out] | mtr | Mini-transaction. |
|
static |
|
static |
|
static |
Gets pointer to a prebuilt dtuple used in insertions.
If the insert graph has not yet been built in the prebuilt struct, then this function first builds it.
prebuilt | in: prebuilt struct in MySQL handle |
upd_t * row_get_prebuilt_update_vector | ( | row_prebuilt_t * | prebuilt | ) |
Gets pointer to a prebuilt update vector used in updates.
If the update graph has not yet been built in the prebuilt struct, then this function first builds it.
prebuilt | in: prebuilt struct in MySQL handle |
dberr_t row_insert_for_mysql | ( | const byte * | mysql_rec, |
row_prebuilt_t * | prebuilt | ||
) |
Does an insert for MySQL.
[in] | mysql_rec | row in the MySQL format |
[in,out] | prebuilt | prebuilt struct in MySQL handle |
|
static |
Does an insert for MySQL using cursor interface.
Cursor interface is low level interface that directly interacts at Storage Level by-passing all the locking and transaction semantics. For InnoDB case, this will also by-pass hidden column generation.
[in] | mysql_rec | row in the MySQL format |
[in,out] | prebuilt | prebuilt struct in MySQL handle |
|
static |
Does an insert for MySQL using INSERT graph.
This function will run/execute INSERT graph.
[in] | mysql_rec | row in the MySQL format |
[in,out] | prebuilt | prebuilt struct in MySQL handle |
bool row_is_mysql_tmp_table_name | ( | const char * | name | ) |
Checks if a table name contains the string "/#sql" which denotes temporary tables in MySQL.
dberr_t row_lock_table | ( | row_prebuilt_t * | prebuilt | ) |
Sets a table lock on the table mentioned in prebuilt.
[in,out] | prebuilt | table handle |
dberr_t row_lock_table_autoinc_for_mysql | ( | row_prebuilt_t * | prebuilt | ) |
Sets an AUTO_INC type lock on the table mentioned in prebuilt.
The AUTO_INC lock gives exclusive access to the auto-inc counter of the table. The lock is reserved only for the duration of an SQL statement. It is not compatible with another AUTO_INC or exclusive lock on the table.
prebuilt | in: prebuilt struct in the MySQL table handle |
void row_mysql_close | ( | void | ) |
Close this module.
|
static |
Convert a row in the MySQL format to a row in the Innobase format.
Note that the function to convert a MySQL format key value to an InnoDB dtuple is row_sel_convert_mysql_key_to_innobase() in row0sel.cc.
row | in/out: Innobase row where the field type information is already copied there! |
prebuilt | in: prebuilt struct where template must be of type ROW_MYSQL_WHOLE_ROW |
mysql_rec | in: row in the MySQL format; NOTE: do not discard as long as row is used, as row may contain pointers to this record! |
heap | in: heap will be used to duplicate multi_value & blob data |
|
static |
Delays an INSERT, DELETE or UPDATE operation if the purge is lagging.
void row_mysql_freeze_data_dictionary | ( | trx_t * | trx, |
ut::Location | location | ||
) |
Locks the data dictionary in shared mode from modifications, for performing foreign key check, rollback, or other operation invisible to MySQL.
[in,out] | trx | Transaction |
[in] | location | Location |
bool row_mysql_handle_errors | ( | dberr_t * | new_err, |
trx_t * | trx, | ||
que_thr_t * | thr, | ||
trx_savept_t * | savept | ||
) |
Handles user errors and lock waits detected by the database engine.
new_err | out: possible new error encountered in lock wait, or if no new error, the value of trx->error_state at the entry of this function |
trx | in: transaction |
thr | in: query thread, or NULL |
savept | in: savepoint, or NULL |
void row_mysql_init | ( | void | ) |
Initialize this module.
void row_mysql_lock_data_dictionary | ( | trx_t * | trx, |
ut::Location | location | ||
) |
Locks the data dictionary exclusively for performing a table create or other data dictionary modification operation.
[in,out] | trx | Transaction |
[in] | location | Location |
dberr_t row_mysql_lock_table | ( | trx_t * | trx, |
dict_table_t * | table, | ||
enum lock_mode | mode, | ||
const char * | op_info | ||
) |
Sets an exclusive lock on a table.
trx | in/out: transaction |
table | in: table to lock |
mode | in: LOCK_X or LOCK_S |
op_info | in: string for trx->op_info |
Pad a column with spaces.
[in] | mbminlen | Minimum size of a character, in bytes |
[out] | pad | Padded buffer |
[in] | len | Number of bytes to pad |
dberr_t row_mysql_parallel_select_count_star | ( | trx_t * | trx, |
std::vector< dict_index_t * > & | indexes, | ||
size_t | max_threads, | ||
ulint * | n_rows | ||
) |
Read the total number of records in a consistent view.
[in,out] | trx | Covering transaction. |
[in] | indexes | Indexes to scan. |
[in] | max_threads | Maximum number of threads to use. |
[out] | n_rows | Number of rows seen. |
void row_mysql_prebuilt_free_blob_heap | ( | row_prebuilt_t * | prebuilt | ) |
Frees the blob heap in prebuilt when no longer needed.
in: prebuilt struct of a ha_innobase:: table handle
Reads a reference to a BLOB in the MySQL format.
[out] | len | BLOB length. |
[in] | ref | BLOB reference in the MySQL format. |
[in] | col_len | BLOB reference length (not BLOB length). |
Read geometry data in the MySQL format.
Show the meaning of geometry data.
len | out: data length |
ref | in: geometry data in the MySQL format |
col_len | in: MySQL format length |
Reads a >= 5.0.3 format true VARCHAR length, in the MySQL row format, and returns a pointer to the data.
len | out: variable-length field length |
field | in: field in the MySQL format |
lenlen | in: storage length of len: either 1 or 2 bytes |
Stores a reference to a BLOB in the MySQL format.
[in] | dest | Where to store |
[in,out] | col_len | Dest buffer size: determines into how many bytes the blob length is stored, the space for the length may vary from 1 to 4 bytes |
[in] | data | Blob data; if the value to store is sql null this should be null pointer |
[in] | len | Blob length; if the value to store is sql null this should be 0; remember also to set the null bit in the mysql record header! |
byte * row_mysql_store_col_in_innobase_format | ( | dfield_t * | dfield, |
byte * | buf, | ||
bool | row_format_col, | ||
const byte * | mysql_data, | ||
ulint | col_len, | ||
ulint | comp | ||
) |
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
The counterpart of this function is row_sel_field_store_in_mysql_format() in row0sel.cc.
dfield | in/out: dfield where dtype information must be already set when this function is called! |
buf | in/out: buffer for a converted integer value; this must be at least col_len long then! NOTE that dfield may also get a pointer to 'buf', therefore do not discard this as long as dfield is used! |
row_format_col | true if the mysql_data is from a MySQL row, false if from a MySQL key value; in MySQL, a true VARCHAR storage format differs in a row and in a key value: in a key value the length is always stored in 2 bytes! |
mysql_data | in: MySQL column value, not SQL NULL; NOTE that dfield may also get a pointer to mysql_data, therefore do not discard this as long as dfield is used! |
col_len | in: MySQL column length; NOTE that this is the storage length of the column in the MySQL format row, not necessarily the length of the actual payload data; if the column is a true VARCHAR then this is irrelevant |
comp | in: nonzero=compact format |
Converting InnoDB geometry data format to MySQL data format.
Converts InnoDB geometry data format to MySQL data format.
Show the meaning of geometry data.
dest | in/out: where to store |
dest_len | in: dest buffer size: determines into how many bytes the GEOMETRY length is stored, the space for the length may vary from 1 to 4 bytes |
src | in: GEOMETRY data; if the value to store is SQL NULL this should be NULL pointer |
src_len | in: GEOMETRY length; if the value to store is SQL NULL this should be 0; remember also to set the NULL bit in the MySQL record header! |
Stores a >= 5.0.3 format true VARCHAR length to dest, in the MySQL row format.
dest | in: where to store |
len | in: length, must fit in two bytes |
lenlen | in: storage length of len: either 1 or 2 bytes |
|
static |
Reassigns the table identifier of a table.
[in,out] | table | table |
[out] | new_id | new table id |
|
static |
Convert a row in the MySQL format to a row in the Innobase format.
This is specialized function used for intrinsic table with reduce branching.
[in,out] | row | row where field values are copied. |
[in] | prebuilt | prebuilt handler |
[in] | mysql_rec | row in mysql format. |
void row_mysql_unfreeze_data_dictionary | ( | trx_t * | trx | ) |
Unlocks the data dictionary shared lock.
in/out: transaction
trx | in/out: transaction |
void row_mysql_unlock_data_dictionary | ( | trx_t * | trx | ) |
Unlocks the data dictionary exclusive lock.
in/out: transaction
trx | in/out: transaction |
void row_prebuild_sel_graph | ( | row_prebuilt_t * | prebuilt | ) |
Builds a dummy query graph used in selects.
in: prebuilt struct in MySQL handle
void row_prebuilt_free | ( | row_prebuilt_t * | prebuilt, |
bool | dict_locked | ||
) |
Free a prebuilt struct for a MySQL table handle.
[in,out] | prebuilt | Prebuilt struct |
[in] | dict_locked | True=data dictionary locked |
dberr_t row_rename_table_for_mysql | ( | const char * | old_name, |
const char * | new_name, | ||
const dd::Table * | dd_table, | ||
trx_t * | trx, | ||
bool | replay | ||
) |
Renames a table for MySQL.
[in] | old_name | old table name |
[in] | new_name | new table name |
[in] | dd_table | dd::Table for new table |
[in,out] | trx | transaction |
[in] | replay | whether in replay stage |
dberr_t row_scan_index_for_mysql | ( | row_prebuilt_t * | prebuilt, |
dict_index_t * | index, | ||
size_t | n_threads, | ||
bool | check_keys, | ||
ulint * | n_rows | ||
) |
Scans an index for either COUNT(*) or CHECK TABLE.
If CHECK TABLE; Checks that the index contains entries in an ascending order, unique constraint is not broken, and calculates the number of index entries in the read view of the current transaction.
[in,out] | prebuilt | Prebuilt struct in MySQL handle. |
[in,out] | index | Index to scan. |
[in] | n_threads | Number of threads to use for the scan |
[in] | check_keys | True if called form check table. |
[out] | n_rows | Number of entries seen in the consistent read. |
bool row_table_got_default_clust_index | ( | const dict_table_t * | table | ) |
Checks if a table is such that we automatically created a clustered index on it (on row id).
table | in: table |
dberr_t row_table_load_foreign_constraints | ( | trx_t * | trx, |
const char * | name, | ||
const dd::Table * | dd_table | ||
) |
Loads foreign key constraints for the table being created.
This function should be called after the indexes for a table have been created. Each foreign key constraint must be accompanied with indexes in both participating tables. The indexes are allowed to contain more fields than mentioned in the constraint.
[in] | trx | transaction |
[in] | name | table full name in normalized form |
[in] | dd_table | MySQL dd::Table for the table |
dberr_t row_update_cascade_for_mysql | ( | que_thr_t * | thr, |
upd_node_t * | node, | ||
dict_table_t * | table | ||
) |
Does a cascaded delete or set null in a foreign key operation.
thr | in: query thread |
node | in: update node used in the cascade or set null operation |
table | in: table where we do the operation |
dberr_t row_update_for_mysql | ( | const byte * | mysql_rec, |
row_prebuilt_t * | prebuilt | ||
) |
Does an update or delete of a row for MySQL.
[in] | mysql_rec | row in the MySQL format |
[in,out] | prebuilt | prebuilt struct in MySQL handle |
|
static |
Does an update of a row for MySQL by inserting new entry with update values.
[in] | node | update node carrying information to delete. |
[out] | delete_entries | vector of cursor to deleted entries. |
[in] | thr | thread handler |
|
static |
Does an update or delete of a row for MySQL.
[in] | mysql_rec | row in the MySQL format |
[in,out] | prebuilt | prebuilt struct in MySQL handle |
|
static |
Do an in-place update in the intrinsic table.
The update should not modify any of the keys and it should not change the size of any fields.
[in] | node | the update node. |
void row_update_prebuilt_trx | ( | row_prebuilt_t * | prebuilt, |
trx_t * | trx | ||
) |
Updates the transaction pointers in query graphs stored in the prebuilt struct.
[in,out] | prebuilt | Prebuilt struct in MySQL handle. |
[in,out] | trx | Transaction handle. |
|
inlinestatic |
Updates the table modification counter and calculates new estimates for table and index statistics if necessary.
table | in: table |
void row_wait_for_background_drop_list_empty | ( | ) |
Wait for the background drop list to become empty.
|
static |
List of tables we should drop in background.
ALTER TABLE in MySQL requires that the table handler can drop the table in background when there are no queries to it any more. Protected by row_drop_list_mutex.
|
constexpr |
|
static |
|
static |
Mutex protecting the background table drop list.
|
static |
Flag: has row_mysql_drop_list been initialized?
bool row_rollback_on_timeout = false |
Provide optional 4.x backwards compatibility for 5.0 and above.