Drizzled Public API Documentation

btr0cur.h File Reference
#include "univ.i"
#include "dict0dict.h"
#include "page0cur.h"
#include "btr0types.h"
#include "que0types.h"
#include "row0types.h"
#include "ha0ha.h"

Go to the source code of this file.

Classes

struct  btr_path_struct
struct  btr_cur_struct

Defines

#define BTR_NO_UNDO_LOG_FLAG   1 /* do no undo logging */
#define BTR_NO_LOCKING_FLAG   2 /* do no record lock checking */
#define BTR_KEEP_SYS_FLAG
#define BTR_CUR_ADAPT
#define BTR_CUR_HASH_ADAPT
#define btr_cur_get_page_cur(cursor)   (&(cursor)->page_cur)
#define btr_cur_open_at_index_side(f, i, l, c, m)   btr_cur_open_at_index_side_func(f,i,l,c,__FILE__,__LINE__,m)
#define btr_cur_open_at_rnd_pos(i, l, c, m)   btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
#define BTR_CUR_PAGE_COMPRESS_LIMIT   (UNIV_PAGE_SIZE / 2)
#define BTR_PATH_ARRAY_N_SLOTS   250
#define BTR_CUR_RETRY_DELETE_N_TIMES   100
#define BTR_CUR_RETRY_SLEEP_TIME   50000
#define BTR_EXTERN_SPACE_ID   0
#define BTR_EXTERN_PAGE_NO   4
#define BTR_EXTERN_OFFSET   8
#define BTR_EXTERN_LEN   12
#define BTR_EXTERN_OWNER_FLAG   128
#define BTR_EXTERN_INHERITED_FLAG   64

Typedefs

typedef struct btr_path_struct btr_path_t

Enumerations

enum  btr_cur_method {
  BTR_CUR_HASH = 1, BTR_CUR_HASH_FAIL, BTR_CUR_BINARY, BTR_CUR_INSERT_TO_IBUF,
  BTR_CUR_DEL_MARK_IBUF, BTR_CUR_DELETE_IBUF, BTR_CUR_DELETE_REF
}

Functions

UNIV_INLINE buf_block_tbtr_cur_get_block (btr_cur_t *cursor)
UNIV_INLINE rec_t * btr_cur_get_rec (btr_cur_t *cursor)
UNIV_INLINE page_zip_des_tbtr_cur_get_page_zip (btr_cur_t *cursor)
UNIV_INLINE void btr_cur_invalidate (btr_cur_t *cursor)
UNIV_INLINE page_tbtr_cur_get_page (btr_cur_t *cursor)
UNIV_INLINE dict_index_tbtr_cur_get_index (btr_cur_t *cursor)
UNIV_INLINE void btr_cur_position (dict_index_t *index, rec_t *rec, buf_block_t *block, btr_cur_t *cursor)
UNIV_INTERN void btr_cur_search_to_nth_level (dict_index_t *index, ulint level, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_cur_t *cursor, ulint has_search_latch, const char *file, ulint line, mtr_t *mtr)
UNIV_INTERN void btr_cur_open_at_index_side_func (ibool from_left, dict_index_t *index, ulint latch_mode, btr_cur_t *cursor, const char *file, ulint line, mtr_t *mtr)
UNIV_INTERN void btr_cur_open_at_rnd_pos_func (dict_index_t *index, ulint latch_mode, btr_cur_t *cursor, const char *file, ulint line, mtr_t *mtr)
UNIV_INTERN ulint btr_cur_optimistic_insert (ulint flags, btr_cur_t *cursor, dtuple_t *entry, rec_t **rec, big_rec_t **big_rec, ulint n_ext, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ulint btr_cur_pessimistic_insert (ulint flags, btr_cur_t *cursor, dtuple_t *entry, rec_t **rec, big_rec_t **big_rec, ulint n_ext, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ibool btr_cur_update_alloc_zip (page_zip_des_t *page_zip, buf_block_t *block, dict_index_t *index, ulint length, ibool create, mtr_t *mtr) UNIV_WARN_UNUSED_RESULT_NONNULL
UNIV_INTERN ulint btr_cur_update_in_place (ulint flags, btr_cur_t *cursor, const upd_t *update, ulint cmpl_info, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ulint btr_cur_optimistic_update (ulint flags, btr_cur_t *cursor, const upd_t *update, ulint cmpl_info, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ulint btr_cur_pessimistic_update (ulint flags, btr_cur_t *cursor, mem_heap_t **heap, big_rec_t **big_rec, const upd_t *update, ulint cmpl_info, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ulint btr_cur_del_mark_set_clust_rec (ulint flags, btr_cur_t *cursor, ibool val, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ulint btr_cur_del_mark_set_sec_rec (ulint flags, btr_cur_t *cursor, ibool val, que_thr_t *thr, mtr_t *mtr)
UNIV_INTERN ibool btr_cur_compress_if_useful (btr_cur_t *cursor, mtr_t *mtr)
UNIV_INTERN ibool btr_cur_optimistic_delete (btr_cur_t *cursor, mtr_t *mtr)
UNIV_INTERN ibool btr_cur_pessimistic_delete (ulint *err, ibool has_reserved_extents, btr_cur_t *cursor, enum trx_rb_ctx rb_ctx, mtr_t *mtr)
UNIV_INTERN byte * btr_cur_parse_update_in_place (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip, dict_index_t *index)
UNIV_INTERN byte * btr_cur_parse_del_mark_set_clust_rec (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip, dict_index_t *index)
UNIV_INTERN byte * btr_cur_parse_del_mark_set_sec_rec (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip)
UNIV_INTERN ib_int64_t btr_estimate_n_rows_in_range (dict_index_t *index, const dtuple_t *tuple1, ulint mode1, const dtuple_t *tuple2, ulint mode2)
UNIV_INTERN void btr_estimate_number_of_different_key_vals (dict_index_t *index)
UNIV_INTERN ibool btr_cur_mark_extern_inherited_fields (page_zip_des_t *page_zip, rec_t *rec, dict_index_t *index, const ulint *offsets, const upd_t *update, mtr_t *mtr)
UNIV_INTERN void btr_cur_mark_dtuple_inherited_extern (dtuple_t *entry, const upd_t *update)
UNIV_INTERN void btr_cur_unmark_dtuple_extern_fields (dtuple_t *entry)
UNIV_INTERN ulint btr_store_big_rec_extern_fields (dict_index_t *index, buf_block_t *rec_block, rec_t *rec, const ulint *offsets, big_rec_t *big_rec_vec, mtr_t *local_mtr)
UNIV_INTERN void btr_free_externally_stored_field (dict_index_t *index, byte *field_ref, const rec_t *rec, const ulint *offsets, page_zip_des_t *page_zip, ulint i, enum trx_rb_ctx rb_ctx, mtr_t *local_mtr)
UNIV_INTERN ulint btr_copy_externally_stored_field_prefix (byte *buf, ulint len, ulint zip_size, const byte *data, ulint local_len)
UNIV_INTERN byte * btr_rec_copy_externally_stored_field (const rec_t *rec, const ulint *offsets, ulint zip_size, ulint no, ulint *len, mem_heap_t *heap)
UNIV_INTERN ulint btr_push_update_extern_fields (dtuple_t *tuple, const upd_t *update, mem_heap_t *heap) __attribute__((nonnull))
UNIV_INTERN void btr_cur_set_deleted_flag_for_ibuf (rec_t *rec, page_zip_des_t *page_zip, ibool val, mtr_t *mtr)

Variables

ulint btr_cur_n_non_sea
ulint btr_cur_n_sea
ulint btr_cur_n_non_sea_old
ulint btr_cur_n_sea_old

Detailed Description

The index tree cursor

Created 10/16/1994 Heikki Tuuri

Definition in file btr0cur.h.


Define Documentation

#define BTR_CUR_PAGE_COMPRESS_LIMIT   (UNIV_PAGE_SIZE / 2)

In the pessimistic delete, if the page data size drops below this limit, merging it to a neighbor is tried

Definition at line 623 of file btr0cur.h.

Referenced by btr_cur_optimistic_update().

#define BTR_CUR_RETRY_DELETE_N_TIMES   100

If pessimistic delete fails because of lack of file space, there is still a good change of success a little later. Try this many times.

Definition at line 754 of file btr0cur.h.

#define BTR_CUR_RETRY_SLEEP_TIME   50000

If pessimistic delete fails because of lack of file space, there is still a good change of success a little later. Sleep this many microseconds between retries.

Definition at line 758 of file btr0cur.h.

#define BTR_EXTERN_INHERITED_FLAG   64

If the second most significant bit of BTR_EXTERN_LEN (i.e., the second most significant bit of the byte at smallest address) is 1 then it means that the externally stored field was inherited from an earlier version of the row. In rollback we are not allowed to free an inherited external field.

Definition at line 789 of file btr0cur.h.

Referenced by btr_cur_mark_dtuple_inherited_extern(), and btr_free_externally_stored_field().

#define BTR_EXTERN_LEN   12

8 bytes containing the length of the externally stored part of the BLOB. The 2 highest bits are reserved to the flags below.

Definition at line 771 of file btr0cur.h.

Referenced by btr_copy_externally_stored_field_prefix(), btr_cur_mark_dtuple_inherited_extern(), btr_cur_unmark_dtuple_extern_fields(), btr_free_externally_stored_field(), and btr_store_big_rec_extern_fields().

#define BTR_EXTERN_OFFSET   8

offset of BLOB header on that page

Definition at line 769 of file btr0cur.h.

Referenced by btr_copy_externally_stored_field_prefix(), and btr_store_big_rec_extern_fields().

#define BTR_EXTERN_OWNER_FLAG   128

The most significant bit of BTR_EXTERN_LEN (i.e., the most significant bit of the byte at smallest address) is set to 1 if this field does not 'own' the externally stored field; only the owner field is allowed to free the field in purge!

Definition at line 783 of file btr0cur.h.

Referenced by btr_cur_unmark_dtuple_extern_fields(), and btr_free_externally_stored_field().

#define BTR_EXTERN_PAGE_NO   4
#define BTR_EXTERN_SPACE_ID   0

The reference in a field for which data is stored on a different page. The reference is at the end of the 'locally' stored part of the field. 'Locally' means storage in the index record. We store locally a long enough prefix of each column so that we can determine the ordering parts of each index record without looking into the externally stored part. space id where stored

Definition at line 767 of file btr0cur.h.

Referenced by btr_copy_externally_stored_field_prefix(), btr_free_externally_stored_field(), and btr_store_big_rec_extern_fields().

#define BTR_KEEP_SYS_FLAG
Value:
4 /* sys fields will be found from the
          update vector or inserted entry */

Definition at line 38 of file btr0cur.h.

#define BTR_PATH_ARRAY_N_SLOTS   250

size of path array (in slots)

Definition at line 643 of file btr0cur.h.

Referenced by btr_estimate_n_rows_in_range().


Typedef Documentation

typedef struct btr_path_struct btr_path_t

A slot in the path array. We store here info on a search path down the tree. Each slot contains data on a single level of the tree.

Definition at line 628 of file btr0cur.h.


Enumeration Type Documentation

Values for the flag documenting the used search method

Enumerator:
BTR_CUR_HASH 

successful shortcut using the hash index

BTR_CUR_HASH_FAIL 

failure using hash, success using binary search: the misleading hash reference is stored in the field hash_node, and might be necessary to update

BTR_CUR_BINARY 

success using the binary search

BTR_CUR_INSERT_TO_IBUF 

performed the intended insert to the insert buffer

BTR_CUR_DEL_MARK_IBUF 

performed the intended delete mark in the insert/delete buffer

BTR_CUR_DELETE_IBUF 

performed the intended delete in the insert/delete buffer

BTR_CUR_DELETE_REF 

row_purge_poss_sec() failed

Definition at line 646 of file btr0cur.h.


Function Documentation

UNIV_INTERN ulint btr_copy_externally_stored_field_prefix ( byte *  buf,
ulint  len,
ulint  zip_size,
const byte *  data,
ulint  local_len 
)

Copies the prefix of an externally stored field of a record. The clustered index record must be protected by a lock or a page latch.

Returns:
the length of the copied field, or 0 if the column was being or has been deleted in: length of data, in bytes

Copies the prefix of an externally stored field of a record. The clustered index record must be protected by a lock or a page latch.

Returns:
the length of the copied field, or 0 if the column was being or has been deleted
Parameters:
bufout: the field, or a prefix of it
lenin: length of buf, in bytes
zip_sizein: nonzero=compressed BLOB page size, zero for uncompressed BLOBs
datain: 'internally' stored part of the field containing also the reference to the external part; must be protected by a lock or a page latch
local_lenin: length of data, in bytes

Definition at line 4996 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, BTR_EXTERN_LEN, BTR_EXTERN_OFFSET, BTR_EXTERN_PAGE_NO, BTR_EXTERN_SPACE_ID, mach_read_from_4(), and ut_a.

UNIV_INTERN ibool btr_cur_compress_if_useful ( btr_cur_t cursor,
mtr_t mtr 
)

Tries to compress a page of the tree if it seems useful. It is assumed that mtr holds an x-latch on the tree and on the cursor page. To avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist. NOTE: it is assumed that the caller has reserved enough free extents so that the compression will always succeed if done!

Returns:
TRUE if compression occurred in: mtr

Tries to compress a page of the tree if it seems useful. It is assumed that mtr holds an x-latch on the tree and on the cursor page. To avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist. NOTE: it is assumed that the caller has reserved enough free extents so that the compression will always succeed if done!

Returns:
TRUE if compression occurred
Parameters:
cursorin: cursor on the page to compress; cursor does not stay valid if compression occurs
mtrin: mtr

Definition at line 2875 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_index(), dict_index_get_lock(), and ut_ad.

UNIV_INTERN ulint btr_cur_del_mark_set_clust_rec ( ulint  flags,
btr_cur_t cursor,
ibool  val,
que_thr_t thr,
mtr_t mtr 
)

Marks a clustered index record deleted. Writes an undo log record to undo log on this delete marking. Writes in the trx id field the id of the deleting transaction, and in the roll ptr field pointer to the undo log record created.

Returns:
DB_SUCCESS, DB_LOCK_WAIT, or error number in: mtr

Marks a clustered index record deleted. Writes an undo log record to undo log on this delete marking. Writes in the trx id field the id of the deleting transaction, and in the roll ptr field pointer to the undo log record created.

Returns:
DB_SUCCESS, DB_LOCK_WAIT, or error number
Parameters:
flagsin: undo logging and locking flags
cursorin: cursor
valin: value to set
thrin: query thread
mtrin: mtr

Definition at line 2626 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_rec(), btr_search_latch, buf_block_get_page_zip, dict_index_is_clust(), dict_table_is_comp(), btr_cur_struct::index, buf_block_struct::is_hashed, lock_clust_rec_modify_check_and_lock(), mem_heap_free, page_rec_is_comp(), rec_get_deleted_flag(), rec_offs_comp(), rec_print_new(), row_upd_rec_sys_fields(), dict_index_struct::table, thr_get_trx(), trx_undo_report_row_operation(), and ut_ad.

UNIV_INTERN ulint btr_cur_del_mark_set_sec_rec ( ulint  flags,
btr_cur_t cursor,
ibool  val,
que_thr_t thr,
mtr_t mtr 
)

Sets a secondary index record delete mark to TRUE or FALSE.

Returns:
DB_SUCCESS, DB_LOCK_WAIT, or error number in: mtr

Sets a secondary index record delete mark to TRUE or FALSE.

Returns:
DB_SUCCESS, DB_LOCK_WAIT, or error number
Parameters:
flagsin: locking flag
cursorin: cursor
valin: value to set
thrin: query thread
mtrin: mtr

Definition at line 2792 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_rec(), btr_search_latch, buf_block_get_page_zip, dict_table_is_comp(), btr_cur_struct::index, buf_block_struct::is_hashed, lock_sec_rec_modify_check_and_lock(), page_rec_is_comp(), rec_print(), dict_index_struct::table, thr_get_trx(), and ut_ad.

UNIV_INLINE page_t* btr_cur_get_page ( btr_cur_t cursor)

Returns the page of a tree cursor.

Returns:
pointer to page in: tree cursor

Referenced by btr_compress(), btr_estimate_number_of_different_key_vals(), btr_page_get_split_rec_to_left(), btr_page_get_split_rec_to_right(), and btr_root_raise_and_insert().

UNIV_INLINE page_zip_des_t* btr_cur_get_page_zip ( btr_cur_t cursor)

Returns the compressed page on which the tree cursor is positioned.

Returns:
pointer to compressed page, or NULL if the page is not compressed in: tree cursor

Referenced by btr_compress().

UNIV_INLINE void btr_cur_invalidate ( btr_cur_t cursor)

Invalidates a tree cursor by setting record pointer to NULL. in: tree cursor

UNIV_INTERN void btr_cur_mark_dtuple_inherited_extern ( dtuple_t entry,
const upd_t update 
)

The complement of the previous function: in an update entry may inherit some externally stored fields from a record. We must mark them as inherited in entry, so that they are not freed in a rollback. in: update vector

The complement of the previous function: in an update entry may inherit some externally stored fields from a record. We must mark them as inherited in entry, so that they are not freed in a rollback.

Parameters:
entryin/out: updated entry to be inserted to clustered index
updatein: update vector

Definition at line 3823 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, BTR_EXTERN_INHERITED_FLAG, BTR_EXTERN_LEN, dfield_get_len(), dfield_is_ext(), dtuple_get_n_fields(), and upd_get_n_fields().

UNIV_INTERN ibool btr_cur_mark_extern_inherited_fields ( page_zip_des_t page_zip,
rec_t *  rec,
dict_index_t index,
const ulint *  offsets,
const upd_t update,
mtr_t mtr 
)

Marks not updated extern fields as not-owned by this record. The ownership is transferred to the updated record which is inserted elsewhere in the index tree. In purge only the owner of externally stored field is allowed to free the field.

Returns:
TRUE if BLOB ownership was transferred in: mtr, or NULL if not logged

Marks not updated extern fields as not-owned by this record. The ownership is transferred to the updated record which is inserted elsewhere in the index tree. In purge only the owner of externally stored field is allowed to free the field.

Returns:
TRUE if BLOB ownership was transferred
Parameters:
page_zipin/out: compressed page whose uncompressed part will be updated, or NULL
recin/out: record in a clustered index
indexin: index of the page
offsetsin: array returned by rec_get_offsets()
updatein: update vector
mtrin: mtr, or NULL if not logged

Definition at line 3764 of file btr0cur.cc.

References rec_get_node_ptr_flag(), rec_offs_any_extern(), rec_offs_comp(), rec_offs_n_fields(), rec_offs_nth_extern(), rec_offs_validate(), upd_get_n_fields(), and ut_ad.

UNIV_INTERN void btr_cur_open_at_index_side_func ( ibool  from_left,
dict_index_t index,
ulint  latch_mode,
btr_cur_t cursor,
const char *  file,
ulint  line,
mtr_t mtr 
)

Opens a cursor at either end of an index. in: mtr

Opens a cursor at either end of an index.

Parameters:
from_leftin: TRUE if open to the low end, FALSE if to the high end
indexin: index
latch_modein: latch mode
cursorin: cursor
filein: file name
linein: line where called
mtrin: mtr

Definition at line 802 of file btr0cur.cc.

References BTR_CONT_MODIFY_TREE, BTR_ESTIMATE, BTR_MODIFY_TREE, btr_node_ptr_get_child_page_no(), btr_page_get_index_id(), btr_page_get_level(), BUF_GET, buf_block_struct::check_index_page_at_flush, dict_index_get_lock(), dict_index_get_page(), dict_index_get_space(), dict_table_zip_size(), dict_index_struct::id, btr_cur_struct::index, mem_heap_free, mtr_release_s_latch_at_savepoint(), mtr_s_lock, mtr_set_savepoint(), mtr_x_lock, page_cur_move_to_next(), page_cur_move_to_prev(), page_cur_set_after_last(), page_cur_set_before_first(), dict_index_struct::table, and ut_ad.

UNIV_INTERN void btr_cur_open_at_rnd_pos_func ( dict_index_t index,
ulint  latch_mode,
btr_cur_t cursor,
const char *  file,
ulint  line,
mtr_t mtr 
)

Positions a cursor at a randomly chosen position within a B-tree. in: mtr

Positions a cursor at a randomly chosen position within a B-tree.

Parameters:
indexin: index
latch_modein: BTR_SEARCH_LEAF, ...
cursorin/out: B-tree cursor
filein: file name
linein: line where called
mtrin: mtr

Definition at line 934 of file btr0cur.cc.

References BTR_MODIFY_TREE, btr_node_ptr_get_child_page_no(), btr_page_get_index_id(), btr_page_get_level(), BUF_GET, dict_index_get_lock(), dict_index_get_page(), dict_index_get_space(), dict_table_zip_size(), dict_index_struct::id, btr_cur_struct::index, mem_heap_free, mtr_s_lock, mtr_x_lock, page_cur_open_on_rnd_user_rec(), dict_index_struct::table, and ut_ad.

UNIV_INTERN ibool btr_cur_optimistic_delete ( btr_cur_t cursor,
mtr_t mtr 
)

Removes the record on which the tree cursor is positioned. It is assumed that the mtr has an x-latch on the page where the cursor is positioned, but no latch on the whole tree.

Returns:
TRUE if success, i.e., the page did not become too empty in: mtr; if this function returns TRUE on a leaf page of a secondary index, the mtr must be committed before latching any further pages

Removes the record on which the tree cursor is positioned on a leaf page. It is assumed that the mtr has an x-latch on the page where the cursor is positioned, but no latch on the whole tree.

Returns:
TRUE if success, i.e., the page did not become too empty
Parameters:
cursorin: cursor on leaf page, on the record to delete; cursor stays valid: if deletion succeeds, on function exit it points to the successor of the deleted record
mtrin: mtr; if this function returns TRUE on a leaf page of a secondary index, the mtr must be committed before latching any further pages

Definition at line 2899 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_rec(), buf_block_get_page_zip, dict_index_is_clust(), dict_index_is_ibuf(), btr_cur_struct::index, lock_update_delete(), mem_heap_free, page_cur_delete_rec(), page_get_max_insert_size_after_reorganize(), page_is_leaf(), rec_offs_any_extern(), rec_offs_size(), ut_a, and ut_ad.

UNIV_INTERN ulint btr_cur_optimistic_insert ( ulint  flags,
btr_cur_t cursor,
dtuple_t entry,
rec_t **  rec,
big_rec_t **  big_rec,
ulint  n_ext,
que_thr_t thr,
mtr_t mtr 
)

Tries to perform an insert to a page in an index tree, next to cursor. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page. If there is just one record on the page, the insert will always succeed; this is to prevent trying to split a page with just one record.

Returns:
DB_SUCCESS, DB_WAIT_LOCK, DB_FAIL, or error number in: mtr; if this function returns DB_SUCCESS on a leaf page of a secondary index in a compressed tablespace, the mtr must be committed before latching any further pages

Tries to perform an insert to a page in an index tree, next to cursor. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page. If there is just one record on the page, the insert will always succeed; this is to prevent trying to split a page with just one record.

Returns:
DB_SUCCESS, DB_WAIT_LOCK, DB_FAIL, or error number
Parameters:
flagsin: undo logging and locking flags: if not zero, the parameters index and thr should be specified
cursorin: cursor on page after which to insert; cursor stays valid
entryin/out: entry to insert
recout: pointer to inserted record if succeed
big_recout: big rec vector whose fields have to be stored externally by the caller, or NULL
n_extin: number of externally stored columns
thrin: query thread or NULL
mtrin: mtr; if this function returns DB_SUCCESS on a leaf page of a secondary index in a compressed tablespace, the mtr must be committed before latching any further pages

Definition at line 1152 of file btr0cur.cc.

References btr_cur_get_block(), BTR_CUR_HASH, buf_block_get_page_no(), buf_block_get_zip_size(), page_zip_des_struct::data, dict_index_get_n_unique_in_tree(), dict_index_get_space_reserve(), dict_index_is_clust(), dict_table_is_comp(), dtuple_get_n_fields(), dtuple_struct::fields, btr_cur_struct::flag, ibuf_update_free_bits_if_full(), btr_cur_struct::index, lock_update_insert(), dict_index_struct::n_fields, dtuple_struct::n_fields, buf_block_struct::page, page_cur_search(), page_cur_tuple_insert(), page_get_max_insert_size(), page_get_max_insert_size_after_reorganize(), page_get_n_recs(), page_is_comp(), page_is_leaf(), page_zip_empty_size(), page_zip_rec_needs_ext(), rec_get_converted_size(), rec_get_converted_size_comp_prefix(), dict_index_struct::table, thr_get_trx(), dict_index_struct::type, ut_a, ut_ad, ut_error, and buf_page_struct::zip.

UNIV_INTERN ulint btr_cur_optimistic_update ( ulint  flags,
btr_cur_t cursor,
const upd_t update,
ulint  cmpl_info,
que_thr_t thr,
mtr_t mtr 
)

Tries to update a record on a page in an index tree. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page or if the update would result in too empty a page, so that tree compression is recommended.

Returns:
DB_SUCCESS, or DB_OVERFLOW if the updated record does not fit, DB_UNDERFLOW if the page would become too empty, or DB_ZIP_OVERFLOW if there is not enough space left on the compressed page in: mtr; must be committed before latching any further pages

Tries to update a record on a page in an index tree. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page or if the update would result in too empty a page, so that tree compression is recommended. We assume here that the ordering fields of the record do not change.

Returns:
DB_SUCCESS, or DB_OVERFLOW if the updated record does not fit, DB_UNDERFLOW if the page would become too empty, or DB_ZIP_OVERFLOW if there is not enough space left on the compressed page
Parameters:
flagsin: undo logging and locking flags
cursorin: cursor on the record to update; cursor stays valid and positioned on the same record
updatein: update vector; this must also contain trx id and roll ptr fields
cmpl_infoin: compiler info on secondary index updates
thrin: query thread
mtrin: mtr; must be committed before latching any further pages

Definition at line 1936 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_rec(), BTR_CUR_PAGE_COMPRESS_LIMIT, buf_block_get_page_zip, dfield_is_ext(), dict_index_is_clust(), dict_index_is_ibuf(), dict_table_is_comp(), trx_struct::id, btr_cur_struct::index, lock_rec_restore_from_page_infimum(), lock_rec_store_on_page_infimum(), mem_heap_create, mem_heap_free, page_cur_delete_rec(), page_cur_move_to_next(), page_cur_move_to_prev(), page_get_data_size(), page_get_free_space_of_empty(), page_get_max_insert_size_after_reorganize(), page_get_n_recs(), page_is_comp(), page_is_leaf(), page_rec_is_comp(), rec_get_converted_size(), rec_offs_any_extern(), rec_offs_size(), rec_offs_validate(), rec_print_new(), row_rec_to_index_entry(), row_upd_changes_field_size_or_external(), row_upd_index_entry_sys_field(), row_upd_index_replace_new_col_vals_index_pos(), dict_index_struct::table, thr_get_trx(), upd_get_n_fields(), ut_a, and ut_ad.

UNIV_INTERN byte* btr_cur_parse_del_mark_set_clust_rec ( byte *  ptr,
byte *  end_ptr,
page_t page,
page_zip_des_t page_zip,
dict_index_t index 
)

Parses the redo log record for delete marking or unmarking of a clustered index record.

Returns:
end of log record or NULL in: index corresponding to page

Parses the redo log record for delete marking or unmarking of a clustered index record.

Returns:
end of log record or NULL
Parameters:
ptrin: buffer
end_ptrin: buffer end
pagein/out: page or NULL
page_zipin/out: compressed page, or NULL
indexin: index corresponding to page

Definition at line 2543 of file btr0cur.cc.

References dict_table_is_comp(), mach_read_from_1(), mach_read_from_2(), mem_heap_free, page_is_comp(), row_upd_parse_sys_vals(), row_upd_rec_sys_fields_in_recovery(), dict_index_struct::table, ut_a, and ut_ad.

UNIV_INTERN byte* btr_cur_parse_del_mark_set_sec_rec ( byte *  ptr,
byte *  end_ptr,
page_t page,
page_zip_des_t page_zip 
)

Parses the redo log record for delete marking or unmarking of a secondary index record.

Returns:
end of log record or NULL in/out: compressed page, or NULL

Parses the redo log record for delete marking or unmarking of a secondary index record.

Returns:
end of log record or NULL
Parameters:
ptrin: buffer
end_ptrin: buffer end
pagein/out: page or NULL
page_zipin/out: compressed page, or NULL

Definition at line 2749 of file btr0cur.cc.

References mach_read_from_1(), mach_read_from_2(), and ut_a.

UNIV_INTERN byte* btr_cur_parse_update_in_place ( byte *  ptr,
byte *  end_ptr,
page_t page,
page_zip_des_t page_zip,
dict_index_t index 
)

Parses a redo log record of updating a record in-place.

Returns:
end of log record or NULL in: index corresponding to page

Parses a redo log record of updating a record in-place.

Returns:
end of log record or NULL
Parameters:
ptrin: buffer
end_ptrin: buffer end
pagein/out: page or NULL
page_zipin/out: compressed page, or NULL
indexin: index corresponding to page

Definition at line 1669 of file btr0cur.cc.

References dict_table_is_comp(), mach_read_from_1(), mach_read_from_2(), mem_heap_create, mem_heap_free, page_is_comp(), row_upd_index_parse(), row_upd_parse_sys_vals(), row_upd_rec_in_place(), row_upd_rec_sys_fields_in_recovery(), dict_index_struct::table, and ut_a.

UNIV_INTERN ibool btr_cur_pessimistic_delete ( ulint *  err,
ibool  has_reserved_extents,
btr_cur_t cursor,
enum trx_rb_ctx  rb_ctx,
mtr_t mtr 
)

Removes the record on which the tree cursor is positioned. Tries to compress the page if its fillfactor drops below a threshold or if it is the only page on the level. It is assumed that mtr holds an x-latch on the tree and on the cursor page. To avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist.

Returns:
TRUE if compression occurred in: mtr

Removes the record on which the tree cursor is positioned. Tries to compress the page if its fillfactor drops below a threshold or if it is the only page on the level. It is assumed that mtr holds an x-latch on the tree and on the cursor page. To avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist.

Returns:
TRUE if compression occurred
Parameters:
errout: DB_SUCCESS or DB_OUT_OF_FILE_SPACE; the latter may occur because we may have to update node pointers on upper levels, and in the case of variable length keys these may actually grow in size
has_reserved_extentsin: TRUE if the caller has already reserved enough free extents so that he knows that the operation will succeed
cursorin: cursor on the record to delete; if compression does not occur, the cursor stays valid: it points to successor of deleted record on function exit
rb_ctxin: rollback context
mtrin: mtr

Definition at line 2988 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_index(), btr_cur_get_rec(), btr_page_get_level(), btr_page_get_prev(), buf_block_get_page_no(), buf_block_get_page_zip, dict_index_get_lock(), dict_index_get_page(), FIL_NULL, lock_update_delete(), mem_heap_create, mem_heap_free, page_cur_delete_rec(), page_get_n_recs(), page_rec_get_next(), rec_offs_any_extern(), dict_index_struct::space, btr_cur_struct::tree_height, ut_a, and ut_ad.

UNIV_INTERN ulint btr_cur_pessimistic_insert ( ulint  flags,
btr_cur_t cursor,
dtuple_t entry,
rec_t **  rec,
big_rec_t **  big_rec,
ulint  n_ext,
que_thr_t thr,
mtr_t mtr 
)

Performs an insert on a page of an index tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the insert is made on the leaf level, to avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist.

Returns:
DB_SUCCESS or error number in: mtr

Performs an insert on a page of an index tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the insert is made on the leaf level, to avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist.

Returns:
DB_SUCCESS or error number
Parameters:
flagsin: undo logging and locking flags: if not zero, the parameter thr should be specified; if no undo logging is specified, then the caller must have reserved enough free extents in the file space so that the insertion will certainly succeed
cursorin: cursor after which to insert; cursor stays valid
entryin/out: entry to insert
recout: pointer to inserted record if succeed
big_recout: big rec vector whose fields have to be stored externally by the caller, or NULL
n_extin: number of externally stored columns
thrin: query thread or NULL
mtrin: mtr

Definition at line 1414 of file btr0cur.cc.

References BTR_CUR_BINARY, btr_cur_get_block(), btr_cur_get_index(), btr_cur_get_rec(), buf_block_get_page_no(), dict_index_get_lock(), dict_index_get_n_fields(), dict_index_get_page(), dict_table_is_comp(), dict_table_zip_size(), dtuple_check_typed(), btr_cur_struct::flag, btr_cur_struct::index, lock_update_insert(), mem_heap_free, page_rec_get_next(), page_zip_rec_needs_ext(), rec_get_converted_size(), dict_index_struct::space, dict_index_struct::table, btr_cur_struct::tree_height, and ut_ad.

UNIV_INTERN ulint btr_cur_pessimistic_update ( ulint  flags,
btr_cur_t cursor,
mem_heap_t **  heap,
big_rec_t **  big_rec,
const upd_t update,
ulint  cmpl_info,
que_thr_t thr,
mtr_t mtr 
)

Performs an update of a record on a page of a tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the update is made on the leaf level, to avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist.

Returns:
DB_SUCCESS or error code in: mtr; must be committed before latching any further pages

Performs an update of a record on a page of a tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the update is made on the leaf level, to avoid deadlocks, mtr must also own x-latches to brothers of page, if those brothers exist. We assume here that the ordering fields of the record do not change.

Returns:
DB_SUCCESS or error code
Parameters:
flagsin: undo logging, locking, and rollback flags
cursorin: cursor on the record to update
heapin/out: pointer to memory heap, or NULL
big_recout: big rec vector whose fields have to be stored externally by the caller, or NULL
updatein: update vector; this is allowed also contain trx id and roll ptr fields, but the values in update vector have no effect
cmpl_infoin: compiler info on secondary index updates
thrin: query thread
mtrin: mtr; must be committed before latching any further pages

Definition at line 2189 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_rec(), buf_block_get_page_zip, dict_index_get_lock(), dict_index_get_n_fields(), dict_index_is_clust(), dict_index_is_ibuf(), dict_index_is_sec_or_ibuf(), trx_struct::id, btr_cur_struct::index, lock_rec_restore_from_page_infimum(), lock_rec_store_on_page_infimum(), mem_heap_create, page_cur_delete_rec(), page_cur_is_before_first(), page_cur_move_to_prev(), page_is_comp(), page_is_leaf(), page_update_max_trx_id(), page_zip_get_size(), page_zip_rec_needs_ext(), RB_NORMAL, RB_RECOVERY, rec_get_converted_size(), rec_get_deleted_flag(), rec_get_node_ptr_flag(), rec_offs_any_extern(), rec_offs_comp(), rec_offs_validate(), row_rec_to_index_entry(), row_upd_index_entry_sys_field(), row_upd_index_replace_new_col_vals_index_pos(), dict_index_struct::space, thr_get_trx(), btr_cur_struct::tree_height, trx_is_recv(), ut_a, and ut_ad.

UNIV_INLINE void btr_cur_position ( dict_index_t index,
rec_t *  rec,
buf_block_t block,
btr_cur_t cursor 
)

Positions a tree cursor at a given record. in: cursor

Parameters:
indexin: index
recin: record in tree
blockin: buffer block of rec

Referenced by btr_search_guess_on_hash().

UNIV_INTERN void btr_cur_search_to_nth_level ( dict_index_t index,
ulint  level,
const dtuple_t tuple,
ulint  mode,
ulint  latch_mode,
btr_cur_t cursor,
ulint  has_search_latch,
const char *  file,
ulint  line,
mtr_t mtr 
)

Searches an index tree and positions a tree cursor on a given level. NOTE: n_fields_cmp in tuple must be set so that it cannot be compared to node pointer page number fields on the upper levels of the tree! Note that if mode is PAGE_CUR_LE, which is used in inserts, then cursor->up_match and cursor->low_match both will have sensible values. If mode is PAGE_CUR_GE, then up_match will a have a sensible value. in: mtr

Searches an index tree and positions a tree cursor on a given level. NOTE: n_fields_cmp in tuple must be set so that it cannot be compared to node pointer page number fields on the upper levels of the tree! Note that if mode is PAGE_CUR_LE, which is used in inserts, then cursor->up_match and cursor->low_match both will have sensible values. If mode is PAGE_CUR_GE, then up_match will a have a sensible value.

If mode is PAGE_CUR_LE , cursor is left at the place where an insert of the search tuple should be performed in the B-tree. InnoDB does an insert immediately after the cursor. Thus, the cursor may end up on a user record, or on a page infimum record.

Parameters:
indexin: index
levelin: the tree level of search
tuplein: data tuple; NOTE: n_fields_cmp in tuple must be set so that it cannot get compared to the node ptr page number field!
modein: PAGE_CUR_L, ...; Inserts should always be made using PAGE_CUR_LE to search the position!
latch_modein: BTR_SEARCH_LEAF, ..., ORed with at most one of BTR_INSERT, BTR_DELETE_MARK, BTR_DELETE, or BTR_ESTIMATE; cursor->left_block is used to store a pointer to the left neighbor page, in the cases BTR_SEARCH_PREV and BTR_MODIFY_PREV; NOTE that if has_search_latch is != 0, we maybe do not have a latch set on the cursor page, we assume the caller uses his search latch to protect the record!
cursorin/out: tree cursor; the cursor page is s- or x-latched, but see also above!
has_search_latchin: info on the latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0
filein: file name
linein: line where called
mtrin: mtr

Definition at line 331 of file btr0cur.cc.

References BTR_CONT_MODIFY_TREE, BTR_CUR_BINARY, BTR_CUR_DEL_MARK_IBUF, BTR_CUR_DELETE_IBUF, BTR_CUR_DELETE_REF, BTR_CUR_INSERT_TO_IBUF, BTR_DELETE, BTR_DELETE_MARK, BTR_ESTIMATE, BTR_IGNORE_SEC_UNIQUE, BTR_INSERT, BTR_MODIFY_LEAF, BTR_MODIFY_TREE, btr_node_ptr_get_child_page_no(), btr_page_get, btr_page_get_index_id(), btr_page_get_level(), btr_search_get_info(), btr_search_info_update(), btr_search_latch, buf_block_get_page_zip, BUF_GET, BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL_OR_WATCH, buf_block_struct::check_index_page_at_flush, dict_index_get_lock(), dict_index_get_page(), dict_index_get_space(), dict_index_is_clust(), dict_index_is_ibuf(), dict_table_is_comp(), dict_table_zip_size(), dtuple_check_typed(), btr_cur_struct::flag, ibuf_should_try(), dict_index_struct::id, btr_cur_struct::index, btr_search_struct::last_hash_succ, btr_cur_struct::low_bytes, btr_cur_struct::low_match, mem_heap_free, mtr_release_s_latch_at_savepoint(), mtr_s_lock, mtr_set_savepoint(), mtr_x_lock, page_cur_search_with_match(), page_is_comp(), btr_cur_struct::purge_node, rec_get_info_bits(), btr_search_struct::root_guess, row_purge_poss_sec(), rw_lock_get_writer(), rw_lock_s_lock, dict_index_struct::table, btr_cur_struct::thr, btr_cur_struct::tree_height, btr_cur_struct::up_bytes, btr_cur_struct::up_match, ut_a, ut_ad, and ut_error.

UNIV_INTERN void btr_cur_set_deleted_flag_for_ibuf ( rec_t *  rec,
page_zip_des_t page_zip,
ibool  val,
mtr_t mtr 
)

Sets a secondary index record's delete mark to the given value. This function is only used by the insert buffer merge mechanism. in: mtr

Sets a secondary index record's delete mark to the given value. This function is only used by the insert buffer merge mechanism.

Parameters:
recin/out: record
page_zipin/out: compressed page corresponding to rec, or NULL when the tablespace is uncompressed
valin: value to set
mtrin: mtr

Definition at line 2846 of file btr0cur.cc.

UNIV_INTERN void btr_cur_unmark_dtuple_extern_fields ( dtuple_t entry)

Marks all extern fields in a dtuple as owned by the record. in/out: clustered index entry

Marks all extern fields in a dtuple as owned by the record.

Parameters:
entryin/out: clustered index entry

Definition at line 3900 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, BTR_EXTERN_LEN, BTR_EXTERN_OWNER_FLAG, dfield_get_len(), dfield_is_ext(), and dtuple_get_n_fields().

UNIV_INTERN ibool btr_cur_update_alloc_zip ( page_zip_des_t page_zip,
buf_block_t block,
dict_index_t index,
ulint  length,
ibool  create,
mtr_t mtr 
)

See if there is enough place in the page modification log to log an update-in-place.

Returns:
TRUE if enough place
Parameters:
page_zipin/out: compressed page
blockin/out: buffer page
indexin: the index corresponding to the block
lengthin: size needed
createin: TRUE=delete-and-insert, FALSE=update-in-place
mtrin: mini-transaction

Definition at line 1749 of file btr0cur.cc.

References buf_block_get_page_zip, dict_index_is_clust(), dict_index_is_ibuf(), page_zip_des_struct::m_nonempty, page_is_leaf(), page_zip_available(), page_zip_compress(), ut_a, and ut_ad.

UNIV_INTERN ulint btr_cur_update_in_place ( ulint  flags,
btr_cur_t cursor,
const upd_t update,
ulint  cmpl_info,
que_thr_t thr,
mtr_t mtr 
)

Updates a record when the update causes no size changes in its fields.

Returns:
DB_SUCCESS or error number in: mtr; must be committed before latching any further pages

Updates a record when the update causes no size changes in its fields. We assume here that the ordering fields of the record do not change.

Returns:
DB_SUCCESS or error number
Parameters:
flagsin: undo logging and locking flags
cursorin: cursor on the record to update; cursor stays valid and positioned on the same record
updatein: update vector
cmpl_infoin: compiler info on secondary index updates
thrin: query thread
mtrin: mtr; must be committed before latching any further pages

Definition at line 1809 of file btr0cur.cc.

References btr_cur_get_block(), btr_cur_get_rec(), btr_search_latch, buf_block_get_page_zip, dict_index_is_clust(), dict_index_is_ibuf(), dict_table_is_comp(), btr_cur_struct::index, buf_block_struct::is_hashed, mem_heap_free, page_is_comp(), page_is_leaf(), page_rec_is_comp(), rec_get_deleted_flag(), rec_offs_size(), rec_print_new(), row_upd_changes_ord_field_binary(), row_upd_rec_in_place(), row_upd_rec_sys_fields(), dict_index_struct::table, thr_get_trx(), and ut_ad.

UNIV_INTERN ib_int64_t btr_estimate_n_rows_in_range ( dict_index_t index,
const dtuple_t tuple1,
ulint  mode1,
const dtuple_t tuple2,
ulint  mode2 
)

Estimates the number of rows in a given index range.

Returns:
estimated number of rows in: search mode for range end

Estimates the number of rows in a given index range.

Returns:
estimated number of rows
Parameters:
indexin: index
tuple1in: range start, may also be empty tuple
mode1in: search mode for range start
tuple2in: range end, may also be empty tuple
mode2in: search mode for range end

Definition at line 3335 of file btr0cur.cc.

References BTR_ESTIMATE, BTR_PATH_ARRAY_N_SLOTS, BTR_SEARCH_LEAF, dtuple_get_n_fields(), mtr_commit(), mtr_start(), btr_path_struct::n_recs, btr_path_struct::nth_rec, btr_cur_struct::path_arr, dict_table_struct::stat_n_rows, dict_index_struct::table, and ut_ad.

Estimates the number of different key values in a given index, for each n-column prefix of the index where n <= dict_index_get_n_unique(index). The estimates are stored in the array index->stat_n_diff_key_vals. in: index

Estimates the number of different key values in a given index, for each n-column prefix of the index where n <= dict_index_get_n_unique(index). The estimates are stored in the array index->stat_n_diff_key_vals.

Parameters:
indexin: index

Definition at line 3496 of file btr0cur.cc.

References btr_cur_get_page(), btr_page_get_next(), btr_page_get_prev(), BTR_SEARCH_LEAF, cmp_rec_rec_with_match(), dict_index_get_n_unique(), dict_index_get_n_unique_in_tree(), FIL_NULL, mem_free, mem_heap_free, mem_zalloc, mtr_commit(), mtr_start(), page_rec_get_next(), dict_index_struct::stat_index_size, dict_index_struct::stat_n_diff_key_vals, and dict_index_struct::stat_n_leaf_pages.

UNIV_INTERN void btr_free_externally_stored_field ( dict_index_t index,
byte *  field_ref,
const rec_t *  rec,
const ulint *  offsets,
page_zip_des_t page_zip,
ulint  i,
enum trx_rb_ctx  rb_ctx,
mtr_t  
)

Frees the space in an externally stored field to the file space management if the field in data is owned the externally stored field, in a rollback we may have the additional condition that the field must not be inherited. in: mtr containing the latch to data an an X-latch to the index tree

Frees the space in an externally stored field to the file space management if the field in data is owned by the externally stored field, in a rollback we may have the additional condition that the field must not be inherited.

Parameters:
indexin: index of the data, the index tree MUST be X-latched; if the tree height is 1, then also the root page must be X-latched! (this is relevant in the case this function is called from purge where 'data' is located on an undo log page, not an index page)
field_refin/out: field reference
recin: record containing field_ref, for page_zip_write_blob_ptr(), or NULL
offsetsin: rec_get_offsets(rec, index), or NULL
page_zipin: compressed page corresponding to rec, or NULL if rec == NULL
iin: field number of field_ref; ignored if rec == NULL
rb_ctxin: rollback context

Definition at line 4482 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, BTR_EXTERN_INHERITED_FLAG, BTR_EXTERN_LEN, BTR_EXTERN_OWNER_FLAG, BTR_EXTERN_PAGE_NO, BTR_EXTERN_SPACE_ID, buf_page_get, dict_index_get_lock(), dict_index_get_space(), dict_table_zip_size(), FIL_NULL, FIL_PAGE_DATA, FIL_PAGE_NEXT, FIL_PAGE_TYPE_ZBLOB, FIL_PAGE_TYPE_ZBLOB2, mach_read_from_1(), mach_read_from_4(), mach_write_to_4(), MLOG_4BYTES, mlog_write_ulint(), mtr_commit(), mtr_start(), page_align(), page_get_page_no(), page_get_space_id(), page_zip_write_blob_ptr(), RB_NORMAL, RB_RECOVERY, RB_RECOVERY_PURGE_REC, rec_offs_validate(), dict_index_struct::table, ut_a, ut_ad, and ut_error.

UNIV_INTERN ulint btr_push_update_extern_fields ( dtuple_t tuple,
const upd_t update,
mem_heap_t heap 
)

Flags the data tuple fields that are marked as extern storage in the update vector. We use this function to remember which fields we must mark as extern storage in a record inserted for an update.

Returns:
number of flagged external columns
Parameters:
tuplein/out: data tuple
updatein: update vector
heapin: memory heap

Definition at line 3926 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, dfield_get_len(), dfield_is_ext(), dfield_set_data(), dfield_set_ext(), upd_field_struct::field_no, upd_struct::fields, mem_heap_alloc(), upd_field_struct::new_val, upd_field_struct::orig_len, upd_get_n_fields(), ut_a, and ut_ad.

UNIV_INTERN byte* btr_rec_copy_externally_stored_field ( const rec_t *  rec,
const ulint *  offsets,
ulint  zip_size,
ulint  no,
ulint *  len,
mem_heap_t heap 
)

Copies an externally stored field of a record to mem heap.

Returns:
the field copied to heap, or NULL if the field is incomplete in: mem heap

Copies an externally stored field of a record to mem heap.

Returns:
the field copied to heap, or NULL if the field is incomplete
Parameters:
recin: record in a clustered index; must be protected by a lock or a page latch
offsetsin: array returned by rec_get_offsets()
zip_sizein: nonzero=compressed BLOB page size, zero for uncompressed BLOBs
noin: field number
lenout: length of the field
heapin: mem heap

Definition at line 5105 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, rec_offs_nth_extern(), and ut_a.

UNIV_INTERN ulint btr_store_big_rec_extern_fields ( dict_index_t index,
buf_block_t rec_block,
rec_t *  rec,
const ulint *  offsets,
big_rec_t big_rec_vec,
mtr_t  
)

Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. The extern flags in rec will have to be set beforehand. The fields are stored on pages allocated from leaf node file segment of the index tree.

Returns:
DB_SUCCESS or DB_OUT_OF_FILE_SPACE in: mtr containing the latch to rec and to the tree

Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. The extern flags in rec will have to be set beforehand. The fields are stored on pages allocated from leaf node file segment of the index tree.

Returns:
DB_SUCCESS or DB_OUT_OF_FILE_SPACE
Parameters:
indexin: index of rec; the index tree MUST be X-latched
rec_blockin/out: block containing rec
recin/out: record
offsetsin: rec_get_offsets(rec, index); the "external storage" flags in offsets will not correspond to rec when this function returns
big_rec_vecin: vector containing fields to be stored externally

Definition at line 4075 of file btr0cur.cc.

References BTR_EXTERN_FIELD_REF_SIZE, BTR_EXTERN_LEN, BTR_EXTERN_OFFSET, BTR_EXTERN_PAGE_NO, BTR_EXTERN_SPACE_ID, buf_block_get_page_no(), buf_block_get_page_zip, buf_block_get_space(), buf_block_get_zip_size(), buf_page_get, page_zip_des_struct::data, big_rec_field_struct::data, dict_index_get_lock(), dict_index_is_clust(), dict_table_zip_size(), big_rec_field_struct::field_no, big_rec_struct::fields, FIL_NULL, FIL_PAGE_DATA, FIL_PAGE_DATA_END, FIL_PAGE_FILE_FLUSH_LSN, FIL_PAGE_INDEX, FIL_PAGE_NEXT, FIL_PAGE_PREV, FIL_PAGE_TYPE, FIL_PAGE_TYPE_BLOB, FIL_PAGE_TYPE_ZBLOB, FIL_PAGE_TYPE_ZBLOB2, big_rec_field_struct::len, mach_write_to_4(), mem_heap_create, mem_heap_free, MLOG_2BYTES, MLOG_4BYTES, mlog_log_string(), mlog_write_string(), mlog_write_ulint(), mtr_commit(), mtr_start(), big_rec_struct::n_fields, page_align(), page_zip_get_size(), page_zip_set_alloc(), page_zip_write_blob_ptr(), rec_offs_nth_extern(), rec_offs_validate(), dict_index_struct::table, ut_a, and ut_ad.


Variable Documentation

Number of searches down the B-tree in btr_cur_search_to_nth_level().

Definition at line 87 of file btr0cur.cc.

Old value of btr_cur_n_non_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor().

Definition at line 94 of file btr0cur.cc.

Number of successful adaptive hash index lookups in btr_cur_search_to_nth_level().

Definition at line 90 of file btr0cur.cc.

Old value of btr_cur_n_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor().

Definition at line 98 of file btr0cur.cc.