MySQL 9.1.0
Source Code Documentation
|
Insert into a table. More...
#include <sys/types.h>
#include "btr0btr.h"
#include "btr0cur.h"
#include "buf0lru.h"
#include "current_thd.h"
#include "data0data.h"
#include "dict0boot.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "eval0eval.h"
#include "fts0fts.h"
#include "fts0types.h"
#include "gis0geo.h"
#include "ha_prototypes.h"
#include "lob0lob.h"
#include "lock0lock.h"
#include "log0chkp.h"
#include "m_string.h"
#include "mach0data.h"
#include "que0que.h"
#include "rem0cmp.h"
#include "row0ins.h"
#include "row0log.h"
#include "row0row.h"
#include "row0sel.h"
#include "row0upd.h"
#include "trx0rec.h"
#include "trx0undo.h"
#include "usr0sess.h"
#include <debug_sync.h>
#include "my_dbug.h"
Classes | |
class | ib_dec_in_dtor |
Functions | |
ins_node_t * | ins_node_create (ulint ins_type, dict_table_t *table, mem_heap_t *heap) |
Creates an insert node struct. More... | |
static void | ins_node_create_entry_list (ins_node_t *node) |
Creates an entry template for each index of a table. More... | |
static void | row_ins_alloc_sys_fields (ins_node_t *node) |
Adds system field buffers to a row. More... | |
void | ins_node_set_new_row (ins_node_t *node, dtuple_t *row) |
Sets a new row to insert for an INS_DIRECT node. More... | |
static dberr_t | row_ins_sec_index_entry_by_modify (ulint flags, ulint mode, btr_cur_t *cursor, ulint **offsets, mem_heap_t *offsets_heap, mem_heap_t *heap, const dtuple_t *entry, que_thr_t *thr, mtr_t *mtr) |
Does an insert operation by updating a delete-marked existing record in the index. More... | |
static dberr_t | row_ins_clust_index_entry_by_modify (btr_pcur_t *pcur, ulint flags, ulint mode, ulint **offsets, mem_heap_t **offsets_heap, mem_heap_t *heap, const dtuple_t *entry, que_thr_t *thr, mtr_t *mtr) |
Does an insert operation by delete unmarking and updating a delete marked existing record in the index. More... | |
static bool | row_ins_cascade_ancestor_updates_table (que_node_t *node, dict_table_t *table) |
Returns true if in a cascaded update/delete an ancestor node of node updates (not DELETE, but UPDATE) table. More... | |
static ulint | row_ins_cascade_n_ancestors (que_node_t *node) |
Returns the number of ancestor UPDATE or DELETE nodes of a cascaded update/delete node. More... | |
static ulint | row_ins_cascade_calc_update_vec (upd_node_t *node, dict_foreign_t *foreign, mem_heap_t *heap, trx_t *trx, bool *fts_col_affected) |
Calculates the update vector node->cascade->update for a child table in a cascaded update. More... | |
static void | row_ins_set_detailed (trx_t *trx, dict_foreign_t *foreign) |
Set detailed error message associated with foreign key errors for the given transaction. More... | |
static void | row_ins_foreign_trx_print (trx_t *trx) |
Acquires dict_foreign_err_mutex, rewinds dict_foreign_err_file and displays information about the given transaction. More... | |
static void | row_ins_foreign_report_err (const char *errstr, que_thr_t *thr, dict_foreign_t *foreign, const rec_t *rec, const dtuple_t *entry) |
Reports a foreign key error associated with an update or a delete of a parent table index entry. More... | |
static void | row_ins_foreign_report_add_err (trx_t *trx, dict_foreign_t *foreign, const rec_t *rec, const dtuple_t *entry) |
Reports a foreign key error to dict_foreign_err_file when we are trying to add an index entry to a child table. More... | |
static void | row_ins_foreign_fill_virtual (upd_node_t *cascade, const rec_t *rec, dict_index_t *index, upd_node_t *node, dict_foreign_t *foreign, dberr_t *err) |
Fill virtual column information in cascade node for the child table. More... | |
static NO_INLINE dberr_t | row_ins_foreign_check_on_constraint (que_thr_t *thr, dict_foreign_t *foreign, btr_pcur_t *pcur, dtuple_t *entry, mtr_t *mtr) |
Perform referential actions or checks when a parent row is deleted or updated and the constraint had an ON DELETE or ON UPDATE condition which was not RESTRICT. More... | |
static dberr_t | row_ins_set_rec_lock (lock_mode mode, ulint type, const buf_block_t *block, const rec_t *rec, dict_index_t *index, const ulint *offsets, que_thr_t *thr) |
Sets a lock on a record. More... | |
dberr_t | row_ins_check_foreign_constraint (bool check_ref, dict_foreign_t *foreign, dict_table_t *table, dtuple_t *entry, que_thr_t *thr) |
Checks if foreign key constraint fails for an index entry. More... | |
static dberr_t | row_ins_check_foreign_constraints (dict_table_t *table, dict_index_t *index, dtuple_t *entry, que_thr_t *thr) |
Checks if foreign key constraints fail for an index entry. More... | |
static bool | row_ins_dupl_error_with_rec (const rec_t *rec, const dtuple_t *entry, dict_index_t *index, const ulint *offsets) |
Checks if a unique key violation to rec would occur at the index entry insert. More... | |
static bool | row_allow_duplicates (que_thr_t *thr) |
Determines if the query is REPLACE or ON DUPLICATE KEY UPDATE in which case duplicate values should be allowed (and further processed) instead of causing an error. More... | |
static dberr_t | row_ins_scan_sec_index_for_duplicate (ulint flags, dict_index_t *index, dtuple_t *entry, que_thr_t *thr, bool s_latch, mtr_t *mtr, mem_heap_t *offsets_heap) |
Scans a unique non-clustered index at a given index entry to determine whether a uniqueness violation has occurred for the key value of the entry. More... | |
static dberr_t | row_ins_duplicate_online (ulint n_uniq, const dtuple_t *entry, const rec_t *rec, const dict_index_t *index, ulint *offsets) |
Checks for a duplicate when the table is being rebuilt online. More... | |
static dberr_t | row_ins_duplicate_error_in_clust_online (ulint n_uniq, const dtuple_t *entry, const btr_cur_t *cursor, ulint **offsets, mem_heap_t **heap) |
Checks for a duplicate when the table is being rebuilt online. More... | |
static dberr_t | row_ins_duplicate_error_in_clust (ulint flags, btr_cur_t *cursor, const dtuple_t *entry, que_thr_t *thr, mtr_t *mtr) |
Checks if a unique key violation error would occur at an index entry insert. More... | |
static bool | row_ins_must_modify_rec (const btr_cur_t *cursor) |
Checks if an index entry has long enough common prefix with an existing record so that the intended insert of the entry must be changed to a modify of the existing record. More... | |
static dberr_t | row_ins_index_entry_big_rec_func (trx_t *trx, const dtuple_t *entry, const big_rec_t *big_rec, ulint *offsets, mem_heap_t **heap, THD *thd, dict_index_t *index) |
Insert the externally stored fields (off-page columns) of a clustered index entry. More... | |
static dberr_t | row_ins_index_entry_big_rec (trx_t *trx, const dtuple_t *e, const big_rec_t *big, ulint *ofs, mem_heap_t **heap, dict_index_t *index, THD *thd) |
static void | row_ins_temp_prebuilt_tree_modified (dict_table_t *table) |
Update all the prebuilts working on this temporary table. More... | |
dberr_t | row_ins_clust_index_entry_low (uint32_t flags, ulint mode, dict_index_t *index, ulint n_uniq, dtuple_t *entry, que_thr_t *thr, bool dup_chk_only) |
Tries to insert an entry into a clustered index, ignoring foreign key constraints. More... | |
static dberr_t | row_ins_sorted_clust_index_entry (ulint mode, dict_index_t *index, dtuple_t *entry, que_thr_t *thr) |
This is a specialized function meant for direct insertion to auto-generated clustered index based on cached position from last successful insert. More... | |
static bool | row_ins_sec_mtr_start_and_check_if_aborted (mtr_t *mtr, dict_index_t *index, bool check, ulint search_mode) |
Start a mini-transaction and check if the index will be dropped. More... | |
dberr_t | row_ins_sec_index_entry_low (uint32_t flags, ulint mode, dict_index_t *index, mem_heap_t *offsets_heap, mem_heap_t *heap, dtuple_t *entry, trx_id_t trx_id, que_thr_t *thr, bool dup_chk_only) |
Tries to insert an entry into a secondary index. More... | |
dberr_t | row_ins_clust_index_entry (dict_index_t *index, dtuple_t *entry, que_thr_t *thr, bool dup_chk_only) |
Inserts an entry into a clustered index. More... | |
dberr_t | row_ins_sec_index_entry (dict_index_t *index, dtuple_t *entry, que_thr_t *thr, bool dup_chk_only) |
Inserts an entry into a secondary index. More... | |
static dberr_t | row_ins_sec_index_multi_value_entry (dict_index_t *index, dtuple_t *entry, uint32_t &multi_val_pos, que_thr_t *thr) |
Inserts an entry into a secondary index, which is created for multi-value field. More... | |
static dberr_t | row_ins_index_entry (dict_index_t *index, dtuple_t *entry, uint32_t &multi_val_pos, que_thr_t *thr) |
Inserts an index entry to index. More... | |
static void | row_ins_spatial_index_entry_set_mbr_field (dfield_t *field, const dfield_t *row_field, uint32_t *srid, const dd::Spatial_reference_system *srs) |
This function generate MBR (Minimum Bounding Box) for spatial objects and set it to spatial index field. More... | |
dberr_t | row_ins_index_entry_set_vals (const dict_index_t *index, dtuple_t *entry, const dtuple_t *row) |
Sets the values of the dtuple fields in entry from the values of appropriate columns in row. More... | |
static dberr_t | row_ins_index_entry_step (ins_node_t *node, que_thr_t *thr) |
Inserts a single index entry to the table. More... | |
static void | row_ins_alloc_row_id_step (ins_node_t *node) |
Allocates a row id for row and inits the node->index field. More... | |
static void | row_ins_get_row_from_values (ins_node_t *node) |
Gets a row to insert from the values list. More... | |
static void | row_ins_get_row_from_query_block (ins_node_t *node) |
Gets a row to insert from the select list. More... | |
static dberr_t | row_ins (ins_node_t *node, que_thr_t *thr) |
Inserts a row to a table. More... | |
que_thr_t * | row_ins_step (que_thr_t *thr) |
Inserts a row to a table. More... | |
Insert into a table.
Created 4/20/1996 Heikki Tuuri
ins_node_t * ins_node_create | ( | ulint | ins_type, |
dict_table_t * | table, | ||
mem_heap_t * | heap | ||
) |
Creates an insert node struct.
ins_type | in: INS_VALUES, ... |
table | in: table where to insert |
heap | in: mem heap where created |
|
static |
Creates an entry template for each index of a table.
node | in: row insert node |
void ins_node_set_new_row | ( | ins_node_t * | node, |
dtuple_t * | row | ||
) |
Sets a new row to insert for an INS_DIRECT node.
This function is only used if we have constructed the row separately, which is a rare case; this function is quite slow.
node | in: insert node |
row | in: new row (or first row) for the node |
|
static |
Determines if the query is REPLACE or ON DUPLICATE KEY UPDATE in which case duplicate values should be allowed (and further processed) instead of causing an error.
thr | The query thread running the query |
|
static |
Inserts a row to a table.
node | in: row insert node |
thr | in: query thread |
|
inlinestatic |
Allocates a row id for row and inits the node->index field.
node | in: row insert node |
|
static |
Adds system field buffers to a row.
node | in: insert node |
|
static |
Returns true if in a cascaded update/delete an ancestor node of node updates (not DELETE, but UPDATE) table.
node | in: node in a query graph |
table | in: table |
|
static |
Calculates the update vector node->cascade->update for a child table in a cascaded update.
node | in: update node of the parent table |
foreign | in: foreign key constraint whose type is != 0 |
heap | in: memory heap to use as temporary storage |
trx | in: update transaction |
fts_col_affected | out: is FTS column affected |
|
static |
Returns the number of ancestor UPDATE or DELETE nodes of a cascaded update/delete node.
node | in: node in a query graph |
dberr_t row_ins_check_foreign_constraint | ( | bool | check_ref, |
dict_foreign_t * | foreign, | ||
dict_table_t * | table, | ||
dtuple_t * | entry, | ||
que_thr_t * | thr | ||
) |
Checks if foreign key constraint fails for an index entry.
Sets shared locks which lock either the success or the failure of the constraint. NOTE that the caller must have a shared latch on dict_operation_lock.
check_ref | in: true if we want to check that the referenced table is ok, false if we want to check the foreign key table |
foreign | in: foreign constraint; NOTE that the tables mentioned in it must be in the dictionary cache if they exist at all |
table | in: if check_ref is true, then the foreign table, else the referenced table |
entry | in: index entry for index |
thr | in: query thread |
|
static |
Checks if foreign key constraints fail for an index entry.
If index is not mentioned in any constraint, this function does nothing, Otherwise does searches to the indexes of referenced tables and sets shared locks which lock either the success or the failure of a constraint.
table | in: table |
index | in: index |
entry | in: index entry for index |
thr | in: query thread |
dberr_t row_ins_clust_index_entry | ( | dict_index_t * | index, |
dtuple_t * | entry, | ||
que_thr_t * | thr, | ||
bool | dup_chk_only | ||
) |
Inserts an entry into a clustered index.
Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough to a delete marked record, performs the insert by updating or delete unmarking the delete marked record.
index | in: clustered index |
entry | in/out: index entry to insert |
thr | in: query thread |
dup_chk_only | in: if true, just do duplicate check and return. don't execute actual insert. |
|
static |
Does an insert operation by delete unmarking and updating a delete marked existing record in the index.
This situation can occur if the delete marked record is kept in the index for consistent reads.
pcur | in/out: a persistent cursor pointing to the clust_rec that is being modified. |
flags | in: undo logging and locking flags |
mode | in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether mtr holds just a leaf latch or also a tree latch |
offsets | out: offsets on cursor->page_cur.rec |
offsets_heap | in/out: pointer to memory heap that can be emptied, or NULL |
heap | in/out: memory heap |
entry | in: index entry to insert |
thr | in: query thread |
mtr | in: mtr; must be committed before latching any further pages |
dberr_t row_ins_clust_index_entry_low | ( | uint32_t | flags, |
ulint | mode, | ||
dict_index_t * | index, | ||
ulint | n_uniq, | ||
dtuple_t * | entry, | ||
que_thr_t * | thr, | ||
bool | dup_chk_only | ||
) |
Tries to insert an entry into a clustered index, ignoring foreign key constraints.
If a record with the same unique key is found, the other record is necessarily marked deleted by a committed transaction, or a unique key violation error occurs. The delete marked record is then updated to an existing record, and we must write an undo log record on the delete marked record.
[in] | flags | Undo logging and locking flags. |
[in] | mode | BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether we wish optimistic or pessimistic descent down the index tree. |
[in] | index | Clustered index. |
[in] | n_uniq | 0 or index->n_uniq. |
[in] | entry | Index entry to insert. |
[in] | thr | Query thread, or nullptr if flags & (BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG) and a duplicate can't occur. |
[in] | dup_chk_only | If true, just do duplicate check and return. don't execute actual insert. |
DB_SUCCESS | on success |
DB_LOCK_WAIT | on lock wait when !(flags & BTR_NO_LOCKING_FLAG) |
DB_FAIL | if retry with BTR_MODIFY_TREE is needed |
|
static |
Checks if a unique key violation to rec would occur at the index entry insert.
rec | in: user record; NOTE that we assume that the caller already has a record lock on the record! |
entry | in: entry to insert |
index | in: index |
offsets | in: rec_get_offsets(rec, index) |
|
static |
Checks if a unique key violation error would occur at an index entry insert.
Sets shared locks on possible duplicate records. Works only for a clustered index!
DB_SUCCESS | if no error |
DB_DUPLICATE_KEY | if error, |
DB_LOCK_WAIT | if we have to wait for a lock on a possible duplicate record |
DB_SUCCESS_LOCKED_REC | if an exact match of the record was found in online table rebuild (flags & (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG)) |
flags | in: undo logging and locking flags |
cursor | in: B-tree cursor |
entry | in: entry to insert |
thr | in: query thread |
mtr | in: mtr |
|
static |
Checks for a duplicate when the table is being rebuilt online.
DB_SUCCESS | when no duplicate is detected |
DB_SUCCESS_LOCKED_REC | when rec is an exact match of entry or a newer version of entry (the entry should not be inserted) |
DB_DUPLICATE_KEY | when entry is a duplicate of rec |
n_uniq | in: offset of DB_TRX_ID |
entry | in: entry that is being inserted |
cursor | in: cursor on insert position |
offsets | in/out: rec_get_offsets(rec) |
heap | in/out: heap for offsets |
|
static |
Checks for a duplicate when the table is being rebuilt online.
[in] | n_uniq | offset of DB_TRX_ID |
[in] | entry | entry being inserted |
[in] | rec | clustered index record at insert position |
[in] | index | clustered index |
[in,out] | offsets | rec_get_offsets(rec) |
DB_SUCCESS | when no duplicate is detected |
DB_SUCCESS_LOCKED_REC | when rec is an exact match of entry or a newer version of entry (the entry should not be inserted) |
DB_DUPLICATE_KEY | when entry is a duplicate of rec |
|
static |
Perform referential actions or checks when a parent row is deleted or updated and the constraint had an ON DELETE or ON UPDATE condition which was not RESTRICT.
thr | in: query thread whose run_node is an update node |
foreign | in: foreign key constraint whose type is != 0 |
pcur | in: cursor placed on a matching index record in the child table |
entry | in: index entry in the parent table |
mtr | in: mtr holding the latch of pcur page |
|
static |
Fill virtual column information in cascade node for the child table.
[out] | cascade | child update node |
[in] | rec | clustered rec of child table |
[in] | index | clustered index of child table |
[in] | node | parent update node |
[in] | foreign | foreign key information. |
[out] | err | error code. |
This can occur when there is a cascading delete or update after restart.
|
static |
Reports a foreign key error to dict_foreign_err_file when we are trying to add an index entry to a child table.
Note that the adding may be the result of an update, too.
trx | in: transaction |
foreign | in: foreign key constraint |
rec | in: a record in the parent table: it does not match entry because we have an error! |
entry | in: index entry to insert in the child table |
|
static |
Reports a foreign key error associated with an update or a delete of a parent table index entry.
errstr | in: error string from the viewpoint of the parent table |
thr | in: query thread whose run_node is an update node |
foreign | in: foreign key constraint |
rec | in: a matching index record in the child table |
entry | in: index entry in the parent table |
|
static |
Acquires dict_foreign_err_mutex, rewinds dict_foreign_err_file and displays information about the given transaction.
The caller must release dict_foreign_err_mutex.
lock_number_of_rows_locked() requires global exclusive latch, and so does accessing trx_locks with trx->mutex
trx | in: transaction |
|
inlinestatic |
Gets a row to insert from the select list.
node | in: row insert node |
|
inlinestatic |
Gets a row to insert from the values list.
node | in: row insert node |
|
static |
Inserts an index entry to index.
Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough to a delete marked record, performs the insert by updating or delete unmarking the delete marked record.
[in] | index | index to insert the entry |
[in,out] | entry | entry to insert |
[in,out] | multi_val_pos | if multi-value index, the start position to insert next multi-value data, and the returned value should be either 0 if all are done, or the position where the insert failed. So return value of 0 could be a bit ambiguous, however the return error can help to see which case it is |
[in] | thr | query thread |
|
inlinestatic |
|
static |
Insert the externally stored fields (off-page columns) of a clustered index entry.
[in] | trx | current transaction |
[in] | entry | index entry to insert |
[in] | big_rec | externally stored fields |
[in,out] | offsets | rec_get_offsets() |
[in,out] | heap | memory heap |
[in] | thd | client connection, or NULL |
[in] | index | clustered index |
DB_SUCCESS | success |
DB_OUT_OF_FILE_SPACE | out of file-space |
dberr_t row_ins_index_entry_set_vals | ( | const dict_index_t * | index, |
dtuple_t * | entry, | ||
const dtuple_t * | row | ||
) |
Sets the values of the dtuple fields in entry from the values of appropriate columns in row.
[in] | index | index handler |
[out] | entry | index entry to make |
[in] | row | row |
|
static |
Inserts a single index entry to the table.
node | in: row insert node |
thr | in: query thread |
|
inlinestatic |
Checks if an index entry has long enough common prefix with an existing record so that the intended insert of the entry must be changed to a modify of the existing record.
In the case of a clustered index, the prefix must be n_unique fields long. In the case of a secondary index, all fields must be equal. InnoDB never updates secondary index records in place, other than clearing or setting the delete-mark flag. We could be able to update the non-unique fields of a unique secondary index record by checking the cursor->up_match, but we do not do so, because it could have some locking implications.
cursor | in: B-tree cursor |
|
static |
Scans a unique non-clustered index at a given index entry to determine whether a uniqueness violation has occurred for the key value of the entry.
Set shared locks on possible duplicate records.
flags | in: undo logging and locking flags |
index | in: non-clustered unique index |
entry | in: index entry |
thr | in: query thread |
s_latch | in: whether index->lock is being held |
mtr | in/out: mini-transaction |
offsets_heap | in/out: memory heap that can be emptied |
dberr_t row_ins_sec_index_entry | ( | dict_index_t * | index, |
dtuple_t * | entry, | ||
que_thr_t * | thr, | ||
bool | dup_chk_only | ||
) |
Inserts an entry into a secondary index.
Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough to a delete marked record, performs the insert by updating or delete unmarking the delete marked record.
index | in: secondary index |
entry | in/out: index entry to insert |
thr | in: query thread |
dup_chk_only | in: if true, just do duplicate check and return. don't execute actual insert. |
|
static |
Does an insert operation by updating a delete-marked existing record in the index.
This situation can occur if the delete-marked record is kept in the index for consistent reads.
flags | in: undo logging and locking flags |
mode | in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether mtr holds just a leaf latch or also a tree latch |
cursor | in: B-tree cursor |
offsets | in/out: offsets on cursor->page_cur.rec |
offsets_heap | in/out: memory heap that can be emptied |
heap | in/out: memory heap |
entry | in: index entry to insert |
thr | in: query thread |
mtr | in: mtr; must be committed before latching any further pages |
dberr_t row_ins_sec_index_entry_low | ( | uint32_t | flags, |
ulint | mode, | ||
dict_index_t * | index, | ||
mem_heap_t * | offsets_heap, | ||
mem_heap_t * | heap, | ||
dtuple_t * | entry, | ||
trx_id_t | trx_id, | ||
que_thr_t * | thr, | ||
bool | dup_chk_only | ||
) |
Tries to insert an entry into a secondary index.
If a record with exactly the same fields is found, the other record is necessarily marked deleted. It is then unmarked. Otherwise, the entry is just inserted to the index.
[in] | flags | undo logging and locking flags |
[in] | mode | BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether we wish optimistic or pessimistic descent down the index tree |
[in] | index | secondary index |
[in,out] | offsets_heap | memory heap that can be emptied |
[in,out] | heap | memory heap |
[in,out] | entry | index entry to insert |
[in] | trx_id | PAGE_MAX_TRX_ID during row_log_table_apply(), or trx_id when undo log is disabled during alter copy operation or 0 |
[in] | thr | query thread |
[in] | dup_chk_only | true, just do duplicate check and return. don't execute actual insert |
DB_SUCCESS | on success |
DB_LOCK_WAIT | on lock wait when !(flags & BTR_NO_LOCKING_FLAG) |
DB_FAIL | if retry with BTR_MODIFY_TREE is needed |
|
static |
Inserts an entry into a secondary index, which is created for multi-value field.
For each value to be inserted, it tries first optimistic, then pessimistic descent down the tree. If the entry matches enough to a delete marked record, performs the insert by updating or delete unmarking the delete marked record.
[in] | index | secondary index which is for multi-value field |
[in,out] | entry | index entry to insert |
[in,out] | multi_val_pos | the start position to insert next multi-value data, and the returned value should be either 0 if all are done, or the position where the insert failed. So return value of 0 could be a bit ambiguous, however the return error can help to see which case it is |
[in] | thr | query thread |
|
static |
Start a mini-transaction and check if the index will be dropped.
[in,out] | mtr | Mini-transaction |
[in,out] | index | Secondary index |
[in] | check | Whether to check |
[in] | search_mode | Flags |
|
static |
Set detailed error message associated with foreign key errors for the given transaction.
trx | in: transaction |
foreign | in: foreign key constraint |
|
static |
Sets a lock on a record.
Used in locking possible duplicate key records and also in checking foreign key constraints.
[in] | mode | requested lock type: LOCK_S or LOCK_X mode |
[in] | type | LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP type lock |
[in] | block | buffer block of rec |
[in] | rec | record |
[in] | index | index |
[in] | offsets | rec_get_offsets(rec, index) |
[in] | thr | query thread |
|
static |
This is a specialized function meant for direct insertion to auto-generated clustered index based on cached position from last successful insert.
To be used when data is sorted.
[in] | mode | BTR_MODIFY_LEAF or BTR_MODIFY_TREE. depending on whether we wish optimistic or pessimistic descent down the index tree |
[in,out] | index | clustered index |
[in,out] | entry | index entry to insert |
[in] | thr | query thread |
|
static |
This function generate MBR (Minimum Bounding Box) for spatial objects and set it to spatial index field.
field | in/out: mbr field |
row_field | in: row field |
srid | in/out: spatial reference id |
srs | in: SRS of row_field |
Inserts a row to a table.
This is a high-level function used in SQL execution graphs.
thr | in: query thread |
|
static |
Update all the prebuilts working on this temporary table.
[in,out] | table | dict_table_t for the table |