51 #ifndef UNIV_HOTBACKUP
72 typedef enum btr_op_enum {
75 BTR_INSERT_IGNORE_UNIQUE_OP,
83 UNIV_INTERN ibool btr_cur_print_record_ops = FALSE;
102 #define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32)
107 #define BTR_BLOB_HDR_PART_LEN 0
109 #define BTR_BLOB_HDR_NEXT_PAGE_NO 4
112 #define BTR_BLOB_HDR_SIZE 8
122 #define BTR_TABLE_STATS_FROM_SAMPLE(value, index, sample, ext_size, not_empty)\
123 (((value) * (ib_int64_t) index->stat_n_leaf_pages \
124 + (sample) - 1 + (ext_size) + (not_empty)) / ((sample) + (ext_size)))
134 #ifndef UNIV_HOTBACKUP
141 btr_cur_unmark_extern_fields(
147 const ulint* offsets,
154 btr_cur_add_path_info(
165 btr_rec_free_updated_extern_fields(
172 const ulint* offsets,
181 btr_rec_free_externally_stored_fields(
186 const ulint* offsets,
198 btr_rec_get_externally_stored_len(
201 const ulint* offsets);
208 btr_rec_set_deleted_flag(
222 #ifndef UNIV_HOTBACKUP
229 btr_cur_latch_leaves(
248 switch (latch_mode) {
252 get_block =
btr_block_get(space, zip_size, page_no, mode, mtr);
253 #ifdef UNIV_BTR_DEBUG
266 #ifdef UNIV_BTR_DEBUG
277 #ifdef UNIV_BTR_DEBUG
288 #ifdef UNIV_BTR_DEBUG
307 left_page_no, mode, mtr);
309 #ifdef UNIV_BTR_DEBUG
318 get_block =
btr_block_get(space, zip_size, page_no, mode, mtr);
319 #ifdef UNIV_BTR_DEBUG
366 ulint has_search_latch,
391 ulint root_height = 0;
397 ulint offsets_[REC_OFFS_NORMAL_SIZE];
398 ulint* offsets = offsets_;
399 rec_offs_init(offsets_);
403 ut_ad(level == 0 || mode == PAGE_CUR_LE);
404 ut_ad(dict_index_check_search_tuple(index, tuple));
416 switch (UNIV_EXPECT(latch_mode
424 ? BTR_INSERT_IGNORE_UNIQUE_OP
428 btr_op = BTR_DELETE_OP;
432 btr_op = BTR_DELMARK_OP;
455 cursor->
index = index;
457 cursor->ibuf_cnt = ULINT_UNDEFINED;
459 #ifndef BTR_CUR_ADAPT
466 #ifdef BTR_CUR_HASH_ADAPT
468 #ifdef UNIV_SEARCH_PERF_STAT
475 #ifdef PAGE_CUR_LE_OR_EXTENDS
476 && mode != PAGE_CUR_LE_OR_EXTENDS
484 has_search_latch, mtr)) {
489 || mode != PAGE_CUR_GE);
491 || mode != PAGE_CUR_LE);
493 || mode != PAGE_CUR_LE);
505 if (has_search_latch) {
526 page_cursor = btr_cur_get_page_cur(cursor);
536 height = ULINT_UNDEFINED;
544 page_mode = PAGE_CUR_L;
547 page_mode = PAGE_CUR_LE;
550 #ifdef PAGE_CUR_LE_OR_EXTENDS
551 ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE
552 || mode == PAGE_CUR_LE_OR_EXTENDS);
554 ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE);
564 rw_latch = RW_NO_LATCH;
569 rw_latch = latch_mode;
571 if (btr_op != BTR_NO_OP
577 buf_mode = btr_op == BTR_DELETE_OP
587 space, zip_size, page_no, rw_latch, guess, buf_mode,
599 case BTR_INSERT_IGNORE_UNIQUE_OP:
603 space, zip_size, page_no,
616 index, space, zip_size,
617 page_no, cursor->
thr)) {
635 index, space, zip_size,
663 page = buf_block_get_frame(block);
665 if (rw_latch != RW_NO_LATCH) {
666 #ifdef UNIV_ZIP_DEBUG
669 ut_a(!page_zip || page_zip_validate(page_zip, page));
672 buf_block_dbg_add_level(block, SYNC_TREE_NODE);
677 if (UNIV_UNLIKELY(height == ULINT_UNDEFINED)) {
681 root_height = height;
685 if (block != guess) {
692 if (rw_latch == RW_NO_LATCH) {
694 btr_cur_latch_leaves(
695 page, space, zip_size, page_no, latch_mode,
712 block, index, tuple, page_mode, &up_match, &up_bytes,
713 &low_match, &low_bytes, page_cursor);
716 btr_cur_add_path_info(cursor, height, root_height);
724 if (level != height) {
726 const rec_t* node_ptr;
732 node_ptr = page_cur_get_rec(page_cursor);
734 offsets = rec_get_offsets(
735 node_ptr, index, offsets, ULINT_UNDEFINED, &heap);
749 & REC_INFO_MIN_REC_FLAG;
755 ut_a(cursor->ibuf_cnt <= 0xFFFF
756 || cursor->ibuf_cnt == ULINT_UNDEFINED);
760 rw_latch = RW_NO_LATCH;
770 space, zip_size, page_no, RW_X_LATCH, mtr);
791 || mode != PAGE_CUR_GE);
793 || mode != PAGE_CUR_LE);
795 || mode != PAGE_CUR_LE);
800 if (UNIV_LIKELY_NULL(heap)) {
804 if (has_search_latch) {
830 ulint root_height = 0;
835 ulint offsets_[REC_OFFS_NORMAL_SIZE];
836 ulint* offsets = offsets_;
837 rec_offs_init(offsets_);
840 latch_mode = latch_mode & ~BTR_ESTIMATE;
853 page_cursor = btr_cur_get_page_cur(cursor);
854 cursor->
index = index;
860 height = ULINT_UNDEFINED;
868 page = buf_block_get_frame(block);
873 if (height == ULINT_UNDEFINED) {
877 root_height = height;
881 btr_cur_latch_leaves(page, space, zip_size, page_no,
882 latch_mode, cursor, mtr);
909 btr_cur_add_path_info(cursor, height,
925 btr_cur_add_path_info(cursor, height, root_height);
930 node_ptr = page_cur_get_rec(page_cursor);
931 offsets = rec_get_offsets(node_ptr, cursor->
index, offsets,
932 ULINT_UNDEFINED, &heap);
937 if (UNIV_LIKELY_NULL(heap)) {
962 ulint offsets_[REC_OFFS_NORMAL_SIZE];
963 ulint* offsets = offsets_;
964 rec_offs_init(offsets_);
972 page_cursor = btr_cur_get_page_cur(cursor);
973 cursor->
index = index;
979 height = ULINT_UNDEFINED;
988 page = buf_block_get_frame(block);
991 if (height == ULINT_UNDEFINED) {
998 btr_cur_latch_leaves(page, space, zip_size, page_no,
999 latch_mode, cursor, mtr);
1013 node_ptr = page_cur_get_rec(page_cursor);
1014 offsets = rec_get_offsets(node_ptr, cursor->
index, offsets,
1015 ULINT_UNDEFINED, &heap);
1020 if (UNIV_LIKELY_NULL(heap)) {
1035 btr_cur_insert_if_possible(
1052 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
1053 page_cursor = btr_cur_get_page_cur(cursor);
1057 cursor->
index, n_ext, mtr);
1059 if (UNIV_UNLIKELY(!rec)) {
1065 PAGE_CUR_LE, page_cursor);
1068 cursor->
index, n_ext, mtr);
1080 btr_cur_ins_lock_and_undo(
1102 index = cursor->
index;
1106 index, thr, mtr, inherit);
1108 if (err != DB_SUCCESS) {
1119 if (err != DB_SUCCESS) {
1126 if (!(flags & BTR_KEEP_SYS_FLAG)) {
1129 DATA_ROLL_PTR, roll_ptr);
1147 fprintf(stderr,
"Trx with id " TRX_ID_FMT " going to ",
1202 page = buf_block_get_frame(block);
1203 index = cursor->
index;
1205 #ifdef UNIV_DEBUG_VALGRIND
1207 UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
1208 UNIV_MEM_ASSERT_RW(block->
page.
zip.
data, zip_size);
1213 fputs(
"InnoDB: Error in a tuple to insert into ", stderr);
1217 if (btr_cur_print_record_ops && thr) {
1218 btr_cur_trx_report(
thr_get_trx(thr), index,
"insert into ");
1223 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
1237 if (UNIV_UNLIKELY(big_rec_vec == NULL)) {
1239 return(DB_TOO_BIG_RECORD);
1245 if (UNIV_UNLIKELY(zip_size)) {
1259 if (UNIV_LIKELY(entry->
n_fields >= n_uniq)
1260 && UNIV_UNLIKELY(REC_NODE_PTR_SIZE
1262 index, entry->
fields, n_uniq,
1268 - (REC_N_NEW_EXTRA_BYTES - 2)
1269 > free_space_zip / 2)) {
1273 index, entry, big_rec_vec);
1276 return(DB_TOO_BIG_RECORD);
1286 && UNIV_LIKELY(leaf)
1301 if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
1302 || max_size < rec_size)
1310 err = btr_cur_ins_lock_and_undo(flags, cursor, entry,
1311 thr, mtr, &inherit);
1313 if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
1318 page_cursor = btr_cur_get_page_cur(cursor);
1323 const rec_t* page_cursor_rec = page_cur_get_rec(page_cursor);
1326 reorg = page_cursor_rec != page_cur_get_rec(page_cursor);
1328 if (UNIV_UNLIKELY(reorg)) {
1334 if (UNIV_UNLIKELY(!*rec) && UNIV_LIKELY(!reorg)) {
1352 if (UNIV_UNLIKELY(!*rec)) {
1353 if (UNIV_LIKELY(zip_size != 0)) {
1358 fputs(
"InnoDB: Error: cannot insert tuple ", stderr);
1360 fputs(
" into ", stderr);
1362 fprintf(stderr,
"\nInnoDB: max insert size %lu\n",
1368 #ifdef BTR_CUR_HASH_ADAPT
1376 if (!(flags & BTR_NO_LOCKING_FLAG) && inherit) {
1382 fprintf(stderr,
"Insert into page %lu, max ins size %lu,"
1383 " rec %lu ind type %lu\n",
1385 rec_size + PAGE_DIR_SLOT_SIZE, index->
type);
1409 rec_size + PAGE_DIR_SLOT_SIZE);
1413 *big_rec = big_rec_vec;
1453 ulint n_extents = 0;
1460 ut_ad(mtr_memo_contains(mtr,
1464 MTR_MEMO_PAGE_X_FIX));
1472 big_rec, n_ext, thr, mtr);
1473 if (err != DB_FAIL) {
1481 err = btr_cur_ins_lock_and_undo(flags, cursor, entry,
1482 thr, mtr, &dummy_inh);
1484 if (err != DB_SUCCESS) {
1489 if (!(flags & BTR_NO_UNDO_LOG_FLAG)) {
1497 n_extents, FSP_NORMAL, mtr);
1499 return(DB_OUT_OF_FILE_SPACE);
1510 if (UNIV_LIKELY_NULL(big_rec_vec)) {
1519 if (big_rec_vec == NULL) {
1521 if (n_extents > 0) {
1525 return(DB_TOO_BIG_RECORD);
1538 if (UNIV_LIKELY_NULL(heap)) {
1544 #ifdef BTR_CUR_ADAPT
1547 if (!(flags & BTR_NO_LOCKING_FLAG)) {
1552 if (n_extents > 0) {
1556 *big_rec = big_rec_vec;
1568 btr_cur_upd_lock_and_undo(
1572 const upd_t* update,
1583 ut_ad(cursor && update && thr && roll_ptr);
1586 index = cursor->
index;
1601 if (!(flags & BTR_NO_LOCKING_FLAG)) {
1603 ulint offsets_[REC_OFFS_NORMAL_SIZE];
1604 rec_offs_init(offsets_);
1608 rec_get_offsets(rec, index, offsets_,
1609 ULINT_UNDEFINED, &heap), thr);
1610 if (UNIV_LIKELY_NULL(heap)) {
1613 if (err != DB_SUCCESS) {
1622 index, NULL, update,
1623 cmpl_info, rec, roll_ptr);
1631 btr_cur_update_in_place_log(
1636 const upd_t* update,
1649 1 + DATA_ROLL_PTR_LEN + 14 + 2
1662 index = dict_table_get_first_index(index->
table);
1699 if (end_ptr < ptr + 1) {
1714 if (end_ptr < ptr + 2) {
1722 ut_a(rec_offset <= UNIV_PAGE_SIZE);
1728 if (!ptr || !page) {
1734 rec = page + rec_offset;
1739 offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
1741 if (!(flags & BTR_KEEP_SYS_FLAG)) {
1743 pos, trx_id, roll_ptr);
1754 #ifndef UNIV_HOTBACKUP
1827 const upd_t* update,
1841 ulint was_delete_marked;
1843 ulint offsets_[REC_OFFS_NORMAL_SIZE];
1844 ulint* offsets = offsets_;
1845 rec_offs_init(offsets_);
1848 index = cursor->
index;
1854 offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
1856 if (btr_cur_print_record_ops && thr) {
1857 btr_cur_trx_report(trx, index,
"update ");
1866 if (UNIV_LIKELY_NULL(page_zip)
1869 return(DB_ZIP_OVERFLOW);
1873 err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
1874 thr, mtr, &roll_ptr);
1875 if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
1877 if (UNIV_LIKELY_NULL(heap)) {
1889 || row_upd_changes_ord_field_binary(index, update, thr,
1899 if (!(flags & BTR_KEEP_SYS_FLAG)) {
1901 index, offsets, trx, roll_ptr);
1919 btr_cur_update_in_place_log(flags, rec, index, update,
1920 trx, roll_ptr, mtr);
1922 if (was_delete_marked
1924 buf_block_get_frame(block)))) {
1928 btr_cur_unmark_extern_fields(page_zip,
1929 rec, index, offsets, mtr);
1932 if (UNIV_LIKELY_NULL(heap)) {
1955 const upd_t* update,
1982 page = buf_block_get_frame(block);
1984 index = cursor->
index;
1986 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
1991 offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
1994 if (btr_cur_print_record_ops && thr) {
1995 btr_cur_trx_report(
thr_get_trx(thr), index,
"update ");
2009 cmpl_info, thr, mtr));
2018 return(DB_OVERFLOW);
2022 if (
dfield_is_ext(&upd_get_nth_field(update, i)->new_val)) {
2028 page_cursor = btr_cur_get_page_cur(cursor);
2044 #ifdef UNIV_ZIP_DEBUG
2045 ut_a(!page_zip || page_zip_validate(page_zip, page));
2048 if (UNIV_LIKELY_NULL(page_zip)
2050 new_rec_size, TRUE, mtr)) {
2051 err = DB_ZIP_OVERFLOW;
2055 if (UNIV_UNLIKELY(new_rec_size
2064 - old_rec_size + new_rec_size
2073 max_size = old_rec_size
2076 if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
2077 && (max_size >= new_rec_size))
2089 err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
2090 thr, mtr, &roll_ptr);
2091 if (err != DB_SUCCESS) {
2108 rec_offs_make_valid(page_cur_get_rec(page_cursor), index, offsets);
2116 if (!(flags & BTR_KEEP_SYS_FLAG)) {
2124 rec = btr_cur_insert_if_possible(cursor, new_entry, 0, mtr);
2153 btr_cur_pess_upd_restore_supremum(
2165 page = buf_block_get_frame(block);
2180 #ifdef UNIV_BTR_DEBUG
2186 ut_ad(mtr_memo_contains(mtr, prev_block, MTR_MEMO_PAGE_X_FIX));
2189 PAGE_HEAP_NO_SUPREMUM,
2210 const upd_t* update,
2233 ulint n_extents = 0;
2236 ulint* offsets = NULL;
2241 page = buf_block_get_frame(block);
2244 index = cursor->
index;
2248 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
2249 #ifdef UNIV_ZIP_DEBUG
2250 ut_a(!page_zip || page_zip_validate(page_zip, page));
2256 cmpl_info, thr, mtr);
2258 switch (optim_err) {
2261 case DB_ZIP_OVERFLOW:
2268 err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
2269 thr, mtr, &roll_ptr);
2270 if (err != DB_SUCCESS) {
2275 if (optim_err == DB_OVERFLOW) {
2284 if (flags & BTR_NO_UNDO_LOG_FLAG) {
2285 reserve_flag = FSP_CLEANING;
2287 reserve_flag = FSP_NORMAL;
2291 n_extents, reserve_flag, mtr)) {
2292 return(DB_OUT_OF_FILE_SPACE);
2299 offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, heap);
2309 rec_offs_make_valid(rec, index, offsets);
2319 if (!(flags & BTR_KEEP_SYS_FLAG)) {
2334 ut_ad(big_rec_vec == NULL);
2336 btr_rec_free_updated_extern_fields(
2337 index, rec, page_zip, offsets, update,
2345 offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, heap);
2348 if (UNIV_LIKELY_NULL(page_zip)) {
2363 if (UNIV_UNLIKELY(big_rec_vec == NULL)) {
2365 err = DB_TOO_BIG_RECORD;
2366 goto return_after_reservations;
2383 #ifdef UNIV_ZIP_DEBUG
2384 ut_a(!page_zip || page_zip_validate(page_zip, page));
2386 page_cursor = btr_cur_get_page_cur(cursor);
2392 rec = btr_cur_insert_if_possible(cursor, new_entry, n_ext, mtr);
2398 offsets = rec_get_offsets(rec, index, offsets,
2399 ULINT_UNDEFINED, heap);
2404 btr_cur_unmark_extern_fields(page_zip,
2405 rec, index, offsets, mtr);
2417 goto return_after_reservations;
2419 ut_a(optim_err != DB_UNDERFLOW);
2436 | BTR_NO_LOCKING_FLAG
2437 | BTR_KEEP_SYS_FLAG,
2438 cursor, new_entry, &rec,
2439 &dummy_big_rec, n_ext, NULL, mtr);
2441 ut_a(err == DB_SUCCESS);
2442 ut_a(dummy_big_rec == NULL);
2462 #ifdef UNIV_ZIP_DEBUG
2463 ut_a(!page_zip || page_zip_validate(page_zip, page));
2464 page = buf_block_get_frame(rec_block);
2468 offsets = rec_get_offsets(rec, index, offsets,
2469 ULINT_UNDEFINED, heap);
2470 btr_cur_unmark_extern_fields(page_zip,
2471 rec, index, offsets, mtr);
2487 return_after_reservations:
2488 #ifdef UNIV_ZIP_DEBUG
2489 ut_a(!page_zip || page_zip_validate(page_zip, page));
2492 if (n_extents > 0) {
2496 *big_rec = big_rec_vec;
2508 btr_cur_del_mark_set_clust_rec_log(
2528 1 + 1 + DATA_ROLL_PTR_LEN
2575 if (end_ptr < ptr + 2) {
2592 if (end_ptr < ptr + 2) {
2600 ut_a(offset <= UNIV_PAGE_SIZE);
2603 rec = page + offset;
2609 btr_rec_set_deleted_flag(rec, page_zip, val);
2611 if (!(flags & BTR_KEEP_SYS_FLAG)) {
2613 ulint offsets_[REC_OFFS_NORMAL_SIZE];
2614 rec_offs_init(offsets_);
2618 rec_get_offsets(rec, index, offsets_,
2619 ULINT_UNDEFINED, &heap),
2620 pos, trx_id, roll_ptr);
2621 if (UNIV_LIKELY_NULL(heap)) {
2630 #ifndef UNIV_HOTBACKUP
2645 const ulint* offsets,
2662 if (btr_cur_print_record_ops && thr) {
2663 btr_cur_trx_report(
thr_get_trx(thr), index,
"del mark ");
2672 rec, index, offsets, thr);
2674 if (err != DB_SUCCESS) {
2680 index, NULL, NULL, 0, rec,
2682 if (err != DB_SUCCESS) {
2693 btr_blob_dbg_set_deleted_flag(rec, index, offsets, val);
2694 btr_rec_set_deleted_flag(rec, page_zip, val);
2698 if (!(flags & BTR_KEEP_SYS_FLAG)) {
2700 index, offsets, trx, roll_ptr);
2707 btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
2718 btr_cur_del_mark_set_sec_rec_log(
2764 if (end_ptr < ptr + 3) {
2775 ut_a(offset <= UNIV_PAGE_SIZE);
2778 rec = page + offset;
2784 btr_rec_set_deleted_flag(rec, page_zip, val);
2790 #ifndef UNIV_HOTBACKUP
2812 if (btr_cur_print_record_ops && thr) {
2821 rec, cursor->
index, thr, mtr);
2822 if (err != DB_SUCCESS) {
2840 btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
2863 btr_rec_set_deleted_flag(rec, page_zip, val);
2865 btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
2886 ut_ad(mtr_memo_contains(mtr,
2890 MTR_MEMO_PAGE_X_FIX));
2892 return(btr_cur_compress_recommendation(cursor, mtr)
2917 ulint offsets_[REC_OFFS_NORMAL_SIZE];
2918 ulint* offsets = offsets_;
2919 ibool no_compress_needed;
2920 rec_offs_init(offsets_);
2923 MTR_MEMO_PAGE_X_FIX));
2931 offsets = rec_get_offsets(rec, cursor->
index, offsets,
2932 ULINT_UNDEFINED, &heap);
2935 && btr_cur_can_delete_without_compress(
2938 if (no_compress_needed) {
2940 page_t* page = buf_block_get_frame(block);
2952 #ifdef UNIV_ZIP_DEBUG
2953 ut_a(!page_zip || page_zip_validate(page_zip, page));
2956 cursor->
index, offsets, mtr);
2957 #ifdef UNIV_ZIP_DEBUG
2958 ut_a(!page_zip || page_zip_validate(page_zip, page));
2968 }
else if (page_zip) {
2975 if (UNIV_LIKELY_NULL(heap)) {
2979 return(no_compress_needed);
2999 ibool has_reserved_extents,
3016 ulint n_extents = 0;
3025 page = buf_block_get_frame(block);
3030 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
3031 if (!has_reserved_extents) {
3043 *err = DB_OUT_OF_FILE_SPACE;
3052 #ifdef UNIV_ZIP_DEBUG
3053 ut_a(!page_zip || page_zip_validate(page_zip, page));
3056 offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
3059 btr_rec_free_externally_stored_fields(index,
3060 rec, offsets, page_zip,
3062 #ifdef UNIV_ZIP_DEBUG
3063 ut_a(!page_zip || page_zip_validate(page_zip, page));
3079 goto return_after_reservations;
3087 page_get_infimum_rec(page)))) {
3115 btr_insert_on_non_leaf_level(index,
3116 level + 1, node_ptr, mtr);
3123 #ifdef UNIV_ZIP_DEBUG
3124 ut_a(!page_zip || page_zip_validate(page_zip, page));
3127 ut_ad(btr_check_node_ptr(index, block, mtr));
3131 return_after_reservations:
3138 if (n_extents > 0) {
3150 btr_cur_add_path_info(
3167 slot->
nth_rec = ULINT_UNDEFINED;
3174 slot = cursor->
path_arr + root_height + 1;
3175 slot->
nth_rec = ULINT_UNDEFINED;
3180 slot = cursor->
path_arr + (root_height - height);
3204 btr_estimate_n_rows_in_range_on_level(
3209 ib_int64_t n_rows_on_prev_level,
3214 ibool* is_n_rows_exact)
3232 *is_n_rows_exact = TRUE;
3255 # define N_PAGES_READ_LIMIT 10
3268 block =
buf_page_get(space, zip_size, page_no, RW_S_LATCH,
3271 page = buf_block_get_frame(block);
3290 if (page_no != slot1->
page_no) {
3300 if (n_pages_read == N_PAGES_READ_LIMIT
3309 }
while (page_no != slot2->
page_no);
3315 *is_n_rows_exact = FALSE;
3319 if (n_pages_read > 0) {
3323 n_rows = n_rows_on_prev_level
3324 * n_rows / n_pages_read;
3354 ulint divergence_level;
3356 ibool is_n_rows_exact;
3369 __FILE__, __LINE__, &mtr);
3371 btr_cur_open_at_index_side(TRUE, index,
3387 __FILE__, __LINE__, &mtr);
3389 btr_cur_open_at_index_side(FALSE, index,
3399 is_n_rows_exact = TRUE;
3402 diverged_lot = FALSE;
3404 divergence_level = 1000000;
3406 for (i = 0; ; i++) {
3412 if (slot1->
nth_rec == ULINT_UNDEFINED
3413 || slot2->
nth_rec == ULINT_UNDEFINED) {
3415 if (i > divergence_level + 1 && !is_n_rows_exact) {
3420 n_rows = n_rows * 2;
3428 && !is_n_rows_exact) {
3451 diverged_lot = TRUE;
3452 divergence_level = i;
3466 }
else if (diverged && !diverged_lot) {
3471 diverged_lot = TRUE;
3472 divergence_level = i;
3485 }
else if (diverged_lot) {
3487 n_rows = btr_estimate_n_rows_in_range_on_level(
3488 index, slot1, slot2, n_rows,
3501 btr_record_not_null_field_in_rec(
3507 const ulint* offsets,
3510 ib_int64_t* n_not_null)
3517 if (n_not_null == NULL) {
3521 for (i = 0; i < n_unique; i++) {
3524 rec_get_nth_field(rec, offsets, i, &rec_len);
3526 if (rec_len != UNIV_SQL_NULL) {
3552 ulint matched_fields;
3553 ulint matched_bytes;
3555 ib_int64_t* n_not_null;
3556 ibool stats_null_not_equal;
3557 ullint n_sample_pages;
3558 ulint not_empty_flag = 0;
3559 ulint total_external_size = 0;
3565 ulint* offsets_rec = NULL;
3566 ulint* offsets_next_rec = NULL;
3573 * (
sizeof *offsets_rec
3574 +
sizeof *offsets_next_rec));
3576 n_diff =
static_cast<ib_int64_t *
>(
mem_heap_zalloc(heap, (n_cols + 1) *
sizeof(ib_int64_t)));
3583 switch (srv_innodb_stats_method) {
3584 case SRV_STATS_NULLS_IGNORED:
3585 n_not_null =
static_cast<ib_int64_t *
>(
mem_heap_zalloc(heap, (n_cols + 1)
3586 *
sizeof *n_not_null));
3589 case SRV_STATS_NULLS_UNEQUAL:
3592 stats_null_not_equal = TRUE;
3595 case SRV_STATS_NULLS_EQUAL:
3596 stats_null_not_equal = FALSE;
3612 n_sample_pages = srv_stats_sample_pages;
3617 for (i = 0; i < n_sample_pages; i++) {
3634 offsets_rec = rec_get_offsets(rec, index, offsets_rec,
3635 ULINT_UNDEFINED, &heap);
3638 btr_record_not_null_field_in_rec(
3639 rec, n_cols, offsets_rec, n_not_null);
3646 total_external_size +=
3647 btr_rec_get_externally_stored_len(
3654 offsets_next_rec = rec_get_offsets(next_rec, index,
3660 offsets_rec, offsets_next_rec,
3661 index, stats_null_not_equal,
3665 for (j = matched_fields + 1; j <= n_cols; j++) {
3673 btr_record_not_null_field_in_rec(
3674 next_rec, n_cols, offsets_next_rec,
3679 += btr_rec_get_externally_stored_len(
3687 ulint* offsets_tmp = offsets_rec;
3688 offsets_rec = offsets_next_rec;
3689 offsets_next_rec = offsets_tmp;
3723 for (j = 0; j <= n_cols; j++) {
3725 = BTR_TABLE_STATS_FROM_SAMPLE(
3726 n_diff[j], index, n_sample_pages,
3727 total_external_size, not_empty_flag);
3738 / (10 * (n_sample_pages
3739 + total_external_size));
3741 if (add_on > n_sample_pages) {
3742 add_on = n_sample_pages;
3751 if (n_not_null != NULL && (j < n_cols)) {
3752 index->stat_n_non_null_key_vals[j] =
3753 BTR_TABLE_STATS_FROM_SAMPLE(
3754 n_not_null[j], index, n_sample_pages,
3755 total_external_size, not_empty_flag);
3769 btr_rec_get_field_ref_offs(
3771 const ulint* offsets,
3774 ulint field_ref_offs;
3779 ut_a(local_len != UNIV_SQL_NULL);
3790 #define btr_rec_get_field_ref(rec, offsets, n) \
3791 ((rec) + btr_rec_get_field_ref_offs(offsets, n))
3798 btr_rec_get_externally_stored_len(
3801 const ulint* offsets)
3804 ulint total_extern_len = 0;
3815 for (i = 0; i < n_fields; i++) {
3819 btr_rec_get_field_ref(rec, offsets, i)
3827 return(total_extern_len / UNIV_PAGE_SIZE);
3834 btr_cur_set_ownership_of_extern_field(
3840 const ulint* offsets,
3849 data = rec_get_nth_field(rec, offsets, i, &local_len);
3860 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
3866 if (UNIV_LIKELY_NULL(page_zip)) {
3869 }
else if (UNIV_LIKELY(mtr != NULL)) {
3877 btr_blob_dbg_owner(rec, index, offsets, i, val);
3893 const ulint* offsets,
3894 const upd_t* update,
3907 btr_cur_set_ownership_of_extern_field(
3908 page_zip, rec, index, offsets, i, FALSE, mtr);
3919 btr_cur_unmark_extern_fields(
3925 const ulint* offsets,
3939 for (i = 0; i < n; i++) {
3942 btr_cur_set_ownership_of_extern_field(
3943 page_zip, rec, index, offsets, i, TRUE, mtr);
3974 = dtuple_get_nth_field(tuple, uf->
field_no);
4005 data = (
unsigned char *)dfield_get_data(field);
4033 btr_blob_get_part_len(
4035 const byte* blob_header)
4045 btr_blob_get_next_page_no(
4047 const byte* blob_header)
4067 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
4072 mutex_enter(&block->
mutex);
4092 mutex_exit(&block->
mutex);
4109 const ulint* offsets,
4117 #
if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
4118 ibool update_in_place,
4143 ut_ad(mtr_memo_contains(local_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
4156 if (UNIV_LIKELY_NULL(page_zip)) {
4167 err = deflateInit2(&c_stream, Z_DEFAULT_COMPRESSION,
4168 Z_DEFLATED, 15, 7, Z_DEFAULT_STRATEGY);
4172 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
4180 field_ref = btr_rec_get_field_ref(rec, offsets, i);
4186 ut_a(update_in_place
4195 for (i = 0; i < big_rec_vec->n_fields; i++) {
4196 field_ref = btr_rec_get_field_ref(
4197 rec, offsets, big_rec_vec->fields[i].field_no);
4198 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
4203 extern_len = big_rec_vec->fields[i].len;
4204 UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
4207 ut_a(extern_len > 0);
4211 if (UNIV_LIKELY_NULL(page_zip)) {
4212 int err = deflateReset(&c_stream);
4215 c_stream.next_in = (Bytef *) big_rec_vec->fields[i].data;
4216 c_stream.avail_in = extern_len;
4226 hint_page_no = 1 + rec_page_no;
4228 hint_page_no = prev_page_no + 1;
4232 FSP_NO_DIR, 0, &mtr);
4233 if (UNIV_UNLIKELY(block == NULL)) {
4237 if (UNIV_LIKELY_NULL(page_zip)) {
4238 deflateEnd(&c_stream);
4242 return(DB_OUT_OF_FILE_SPACE);
4246 page = buf_block_get_frame(block);
4255 buf_block_dbg_add_level(prev_block,
4256 SYNC_EXTERN_STORAGE);
4257 prev_page = buf_block_get_frame(prev_block);
4259 if (UNIV_LIKELY_NULL(page_zip)) {
4270 + BTR_BLOB_HDR_NEXT_PAGE_NO,
4276 if (UNIV_LIKELY_NULL(page_zip)) {
4296 c_stream.next_out = page
4302 err = deflate(&c_stream, Z_FINISH);
4303 ut_a(err == Z_OK || err == Z_STREAM_END);
4304 ut_a(err == Z_STREAM_END
4305 || c_stream.avail_out == 0);
4338 - c_stream.avail_out,
4339 0, c_stream.avail_out);
4348 ut_ad(blob_page_zip);
4351 memcpy(blob_page_zip->
data, page,
4354 if (err == Z_OK && prev_page_no !=
FIL_NULL) {
4362 buf_block_dbg_add_level(rec_block,
4363 SYNC_NO_ORDER_CHECK);
4365 if (err == Z_STREAM_END) {
4377 btr_blob_dbg_add_blob(
4378 rec, big_rec_vec->fields[i]
4379 .field_no, page_no, index,
4396 page_zip, rec, index, offsets,
4397 big_rec_vec->
fields[i].field_no, &mtr);
4400 prev_page_no = page_no;
4404 btr_blob_free(block, FALSE, &mtr);
4406 if (err == Z_STREAM_END) {
4414 if (extern_len > (UNIV_PAGE_SIZE
4418 store_len = UNIV_PAGE_SIZE
4423 store_len = extern_len;
4427 + BTR_BLOB_HDR_SIZE,
4429 big_rec_vec->fields[i].data
4430 + big_rec_vec->fields[i].len
4434 + BTR_BLOB_HDR_PART_LEN,
4437 + BTR_BLOB_HDR_NEXT_PAGE_NO,
4440 extern_len -= store_len;
4445 buf_block_dbg_add_level(rec_block,
4446 SYNC_NO_ORDER_CHECK);
4452 big_rec_vec->fields[i].len
4457 btr_blob_dbg_add_blob(
4458 rec, big_rec_vec->fields[i]
4459 .field_no, page_no, index,
4478 prev_page_no = page_no;
4482 if (extern_len == 0) {
4489 if (UNIV_LIKELY_NULL(page_zip)) {
4490 deflateEnd(&c_stream);
4494 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
4502 field_ref = btr_rec_get_field_ref(rec, offsets, i);
4518 btr_check_blob_fil_page_type(
4546 " InnoDB: FIL_PAGE_TYPE=%lu"
4547 " on BLOB %s space %lu page %lu flags %lx\n",
4548 (ulong) type, read ?
"read" :
"purge",
4549 (ulong) space_id, (ulong) page_no, (ulong) flags);
4574 const ulint* offsets,
4595 ut_ad(mtr_memo_contains_page(local_mtr, field_ref,
4596 MTR_MEMO_PAGE_X_FIX));
4598 ut_ad(!rec || field_ref == btr_rec_get_field_ref(rec, offsets, i));
4621 ext_zip_size = rec_zip_size;
4630 #ifdef UNIV_BLOB_DEBUG
4654 btr_blob_dbg_rbt_delete(index, &b,
"free");
4657 btr_blob_dbg_assert_empty(index, b.blob_page_no);
4662 #ifdef UNIV_SYNC_DEBUG
4669 #ifdef UNIV_SYNC_DEBUG
4678 buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK);
4685 & BTR_EXTERN_OWNER_FLAG)
4689 & BTR_EXTERN_INHERITED_FLAG))) {
4697 ext_block =
buf_page_get(space_id, ext_zip_size, page_no,
4699 buf_block_dbg_add_level(ext_block, SYNC_EXTERN_STORAGE);
4700 page = buf_block_get_frame(ext_block);
4716 if (UNIV_LIKELY(page_zip != NULL)) {
4734 btr_check_blob_fil_page_type(space_id, page_no, page,
4738 page + FIL_PAGE_DATA
4739 + BTR_BLOB_HDR_NEXT_PAGE_NO);
4761 btr_blob_free(ext_block, TRUE, &mtr);
4769 btr_rec_free_externally_stored_fields(
4774 const ulint* offsets,
4786 ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX));
4792 for (i = 0; i < n_fields; i++) {
4795 index, btr_rec_get_field_ref(rec, offsets, i),
4796 rec, offsets, page_zip, i, rb_ctx, mtr);
4806 btr_rec_free_updated_extern_fields(
4813 const ulint* offsets,
4814 const upd_t* update,
4823 ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX));
4829 for (i = 0; i < n_fields; i++) {
4830 const upd_field_t* ufield = upd_get_nth_field(update, i);
4834 byte* data = rec_get_nth_field(
4835 rec, offsets, ufield->
field_no, &len);
4840 rec, offsets, page_zip,
4852 btr_copy_blob_prefix(
4861 ulint copied_len = 0;
4867 const byte* blob_header;
4873 block =
buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr);
4874 buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
4875 page = buf_block_get_frame(block);
4877 btr_check_blob_fil_page_type(space_id, page_no, page, TRUE);
4879 blob_header = page + offset;
4880 part_len = btr_blob_get_part_len(blob_header);
4881 copy_len =
ut_min(part_len, len - copied_len);
4883 memcpy(buf + copied_len,
4884 blob_header + BTR_BLOB_HDR_SIZE, copy_len);
4885 copied_len += copy_len;
4887 page_no = btr_blob_get_next_page_no(blob_header);
4891 if (page_no ==
FIL_NULL || copy_len != part_len) {
4892 UNIV_MEM_ASSERT_RW(buf, copied_len);
4901 ut_ad(copied_len <= len);
4911 btr_copy_zblob_prefix(
4926 d_stream.next_out = buf;
4927 d_stream.avail_out = len;
4928 d_stream.next_in = Z_NULL;
4929 d_stream.avail_in = 0;
4938 ut_ad(zip_size <= UNIV_PAGE_SIZE);
4941 err = inflateInit(&d_stream);
4954 if (UNIV_UNLIKELY(!bpage)) {
4957 " InnoDB: Cannot load"
4959 " page %lu space %lu\n",
4960 (ulong) page_no, (ulong) space_id);
4968 " InnoDB: Unexpected type %lu of"
4970 " page %lu space %lu\n",
4972 (ulong) page_no, (ulong) space_id);
4987 d_stream.next_in = bpage->
zip.
data + offset;
4988 d_stream.avail_in = zip_size - offset;
4990 err = inflate(&d_stream, Z_NO_FLUSH);
4993 if (!d_stream.avail_out) {
5006 " InnoDB: inflate() of"
5008 " page %lu space %lu returned %d (%s)\n",
5009 (ulong) page_no, (ulong) space_id,
5016 if (!d_stream.avail_in) {
5019 " InnoDB: unexpected end of"
5021 " page %lu space %lu\n",
5025 err = inflate(&d_stream, Z_FINISH);
5045 page_no = next_page_no;
5051 inflateEnd(&d_stream);
5053 UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
5054 return(d_stream.total_out);
5064 btr_copy_externally_stored_field_prefix_low(
5075 if (UNIV_UNLIKELY(len == 0)) {
5079 if (UNIV_UNLIKELY(zip_size)) {
5080 return(btr_copy_zblob_prefix(buf, len, zip_size,
5081 space_id, page_no, offset));
5083 return(btr_copy_blob_prefix(buf, len, space_id,
5115 if (UNIV_UNLIKELY(local_len >= len)) {
5116 memcpy(buf, data, len);
5120 memcpy(buf, data, local_len);
5140 + btr_copy_externally_stored_field_prefix_low(buf + local_len,
5153 btr_copy_externally_stored_field(
5186 buf = (
unsigned char *)
mem_heap_alloc(heap, local_len + extern_len);
5188 memcpy(buf, data, local_len);
5190 + btr_copy_externally_stored_field_prefix_low(buf + local_len,
5208 const ulint* offsets,
5229 data = rec_get_nth_field(rec, offsets, no, &local_len);
5243 return(btr_copy_externally_stored_field(len, data,
5244 zip_size, local_len, heap));
#define FIL_PAGE_DATA_END
UNIV_INLINE rec_t * page_cur_tuple_insert(page_cur_t *cursor, const dtuple_t *tuple, dict_index_t *index, ulint n_ext, mtr_t *mtr)
#define buf_page_get_with_no_latch(SP, ZS, OF, MTR)
UNIV_INTERN void btr_estimate_number_of_different_key_vals(dict_index_t *index)
UNIV_INLINE void buf_page_release_zip(buf_page_t *bpage)
#define buf_pool_mutex_enter(b)
UNIV_INLINE ulint page_is_comp(const page_t *page)
ulint btr_cur_n_non_sea_old
UNIV_INTERN void page_zip_write_blob_ptr(page_zip_des_t *page_zip, const byte *rec, dict_index_t *index, const ulint *offsets, ulint n, mtr_t *mtr) __attribute__((nonnull(1
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 void ibuf_update_free_bits_zip(buf_block_t *block, mtr_t *mtr)
UNIV_INTERN void btr_node_ptr_delete(dict_index_t *index, buf_block_t *block, mtr_t *mtr)
UNIV_INTERN void lock_update_insert(const buf_block_t *block, const rec_t *rec)
UNIV_INLINE ulint page_get_space_id(const page_t *page)
UNIV_INTERN void dtuple_convert_back_big_rec(dict_index_t *index, dtuple_t *entry, big_rec_t *vector)
UNIV_INTERN ibool btr_page_get_split_rec_to_left(btr_cur_t *cursor, rec_t **split_rec)
UNIV_INTERN void btr_search_update_hash_on_delete(btr_cur_t *cursor)
UNIV_INLINE ulint dict_index_is_sec_or_ibuf(const dict_index_t *index) __attribute__((pure))
UNIV_INTERN ibool btr_search_guess_on_hash(dict_index_t *index, btr_search_t *info, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_cur_t *cursor, ulint has_search_latch, mtr_t *mtr)
UNIV_INTERN dtuple_t * dict_index_build_node_ptr(const dict_index_t *index, const rec_t *rec, ulint page_no, mem_heap_t *heap, ulint level)
#define BTR_CUR_PAGE_COMPRESS_LIMIT
UNIV_INTERN ibool trx_is_recv(const trx_t *trx)
UNIV_INTERN void page_cur_search_with_match(const buf_block_t *block, const dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint *iup_matched_fields, ulint *iup_matched_bytes, ulint *ilow_matched_fields, ulint *ilow_matched_bytes, page_cur_t *cursor)
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_INLINE page_t * page_align(const void *ptr) __attribute__((const ))
UNIV_INTERN void row_upd_rec_sys_fields_in_recovery(rec_t *rec, page_zip_des_t *page_zip, const ulint *offsets, ulint pos, trx_id_t trx_id, roll_ptr_t roll_ptr)
UNIV_INLINE void mach_write_to_4(byte *b, ulint n)
UNIV_INLINE void ibuf_update_free_bits_if_full(buf_block_t *block, ulint max_ins_size, ulint increase)
UNIV_INTERN ibool btr_cur_optimistic_delete(btr_cur_t *cursor, mtr_t *mtr)
UNIV_INTERN ibool page_zip_compress(page_zip_des_t *page_zip, const page_t *page, dict_index_t *index, mtr_t *mtr) __attribute__((nonnull(1
UNIV_INLINE ulint dict_index_get_n_fields(const dict_index_t *index)
UNIV_INLINE ulint page_get_page_no(const page_t *page)
UNIV_INLINE ulint page_cur_search(const buf_block_t *block, const dict_index_t *index, const dtuple_t *tuple, ulint mode, page_cur_t *cursor)
UNIV_INLINE ulint buf_block_get_zip_size(const buf_block_t *block) __attribute__((pure))
#define mtr_s_lock(B, MTR)
UNIV_INTERN buf_page_t * buf_page_get_zip(ulint space, ulint zip_size, ulint offset)
purge_node_t * purge_node
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)
#define BUF_GET_IF_IN_POOL
UNIV_INLINE ulint rec_offs_any_extern(const ulint *offsets)
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_INLINE ibool page_zip_available(const page_zip_des_t *page_zip, ibool is_clust, ulint length, ulint create) __attribute__((nonnull
UNIV_INLINE ulint page_get_n_recs(const page_t *page)
UNIV_INTERN ulint btr_copy_externally_stored_field_prefix(byte *buf, ulint len, ulint zip_size, const byte *data, ulint local_len)
UNIV_INLINE ulint dfield_is_ext(const dfield_t *field)
UNIV_INTERN void page_cur_delete_rec(page_cur_t *cursor, dict_index_t *index, const ulint *offsets, mtr_t *mtr)
UNIV_INTERN void page_zip_set_alloc(void *stream, mem_heap_t *heap)
UNIV_INLINE ibool ibuf_inside(const mtr_t *mtr) __attribute__((nonnull
UNIV_INLINE ulint page_get_data_size(const page_t *page)
#define FIL_PAGE_TYPE_BLOB
#define FIL_PAGE_TYPE_ZBLOB2
UNIV_INLINE void mlog_close(mtr_t *mtr, byte *ptr)
UNIV_INTERN void mlog_write_string(byte *ptr, const byte *str, ulint len, mtr_t *mtr)
UNIV_INLINE ibool dict_table_is_comp(const dict_table_t *table)
UNIV_INLINE ulint rec_offs_nth_extern(const ulint *offsets, ulint n)
UNIV_INTERN rec_t * btr_root_raise_and_insert(btr_cur_t *cursor, const dtuple_t *tuple, ulint n_ext, 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 void rec_print_new(FILE *file, const rec_t *rec, const ulint *offsets)
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 void mlog_write_ulint(byte *ptr, ulint val, byte type, mtr_t *mtr)
UNIV_INTERN rec_t * btr_page_split_and_insert(btr_cur_t *cursor, const dtuple_t *tuple, ulint n_ext, mtr_t *mtr)
UNIV_INLINE ibool page_cur_is_before_first(const page_cur_t *cur)
UNIV_INTERN ulint rec_get_converted_size_comp_prefix(const dict_index_t *index, const dfield_t *fields, ulint n_fields, ulint *extra)
UNIV_INTERN ibool row_purge_poss_sec(purge_node_t *node, dict_index_t *index, const dtuple_t *entry)
UNIV_INTERN void row_upd_index_write_log(const upd_t *update, byte *log_ptr, mtr_t *mtr)
#define DICT_TF_FORMAT_51
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 void page_cur_open_on_rnd_user_rec(buf_block_t *block, page_cur_t *cursor)
UNIV_INTERN ulint fil_space_get_zip_size(ulint id)
UNIV_INTERN void UNIV_INTERN ulint btr_store_big_rec_extern_fields_func(dict_index_t *index, buf_block_t *rec_block, rec_t *rec, const ulint *offsets, const big_rec_t *big_rec_vec) __attribute__((nonnull))
UNIV_INLINE rec_t * page_rec_get_next(rec_t *rec)
UNIV_INLINE btr_search_t * btr_search_get_info(dict_index_t *index)
UNIV_INLINE void page_cur_set_before_first(const buf_block_t *block, page_cur_t *cur)
UNIV_INLINE ulint btr_page_get_level_low(const page_t *page)
#define FIL_PAGE_FILE_FLUSH_LSN
UNIV_INTERN byte * mlog_open_and_write_index(mtr_t *mtr, const byte *rec, dict_index_t *index, byte type, ulint size)
UNIV_INTERN void rec_print(FILE *file, const rec_t *rec, const dict_index_t *index)
#define mem_heap_free(heap)
#define btr_block_get(space, zip_size, page_no, mode, mtr)
UNIV_INLINE ulint btr_page_get_prev(const page_t *page, mtr_t *mtr)
#define MLOG_COMP_REC_CLUST_DELETE_MARK
UNIV_INLINE page_t * btr_cur_get_page(btr_cur_t *cursor)
UNIV_INLINE ulint rw_lock_get_writer(const rw_lock_t *lock)
ibool check_index_page_at_flush
UNIV_INLINE ulint dict_index_get_page(const dict_index_t *tree)
UNIV_INLINE ibool page_zip_rec_needs_ext(ulint rec_size, ulint comp, ulint n_fields, ulint zip_size) __attribute__((const ))
UNIV_INTERN void dtuple_print(FILE *f, const dtuple_t *tuple)
#define MLOG_REC_UPDATE_IN_PLACE
UNIV_INLINE ulint btr_page_get_level(const page_t *page, mtr_t *mtr)
UNIV_INLINE ulint dtuple_get_n_fields(const dtuple_t *tuple)
#define PAGE_ZIP_MIN_SIZE
UNIV_INTERN byte * row_upd_parse_sys_vals(byte *ptr, byte *end_ptr, ulint *pos, trx_id_t *trx_id, roll_ptr_t *roll_ptr)
UNIV_INLINE void rec_set_deleted_flag_new(rec_t *rec, page_zip_des_t *page_zip, ulint flag)
UNIV_INLINE ulint btr_page_get_next(const page_t *page, mtr_t *mtr)
UNIV_INTERN byte * row_upd_index_parse(byte *ptr, byte *end_ptr, mem_heap_t *heap, upd_t **update_out)
UNIV_INTERN ibool fsp_reserve_free_extents(ulint *n_reserved, ulint space, ulint n_ext, ulint alloc_type, mtr_t *mtr)
UNIV_INTERN void row_upd_rec_in_place(rec_t *rec, dict_index_t *index, const ulint *offsets, const upd_t *update, page_zip_des_t *page_zip)
#define BTR_EXTERN_OFFSET
UNIV_INTERN big_rec_t * dtuple_convert_big_rec(dict_index_t *index, dtuple_t *entry, ulint *n_ext)
UNIV_INLINE ulint dict_index_get_space(const dict_index_t *index)
UNIV_INTERN ulint lock_clust_rec_modify_check_and_lock(ulint flags, const buf_block_t *block, const rec_t *rec, dict_index_t *index, const ulint *offsets, que_thr_t *thr)
The buffer pool structure.
UNIV_INLINE ulint ut_min(ulint n1, ulint n2)
UNIV_INLINE ulint dict_index_get_n_unique_in_tree(const dict_index_t *index)
UNIV_INTERN enum buf_lru_free_block_status buf_LRU_free_block(buf_page_t *bpage, ibool zip) __attribute__((nonnull))
UNIV_INTERN ibool ibuf_insert(ibuf_op_t op, const dtuple_t *entry, dict_index_t *index, ulint space, ulint zip_size, ulint page_no, que_thr_t *thr)
UNIV_INLINE ulint rec_get_deleted_flag(const rec_t *rec, ulint comp)
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_INLINE void page_update_max_trx_id(buf_block_t *block, page_zip_des_t *page_zip, trx_id_t trx_id, mtr_t *mtr)
UNIV_INTERN void btr_discard_page(btr_cur_t *cursor, mtr_t *mtr)
UNIV_INTERN ulint ibuf_rec_get_counter(const rec_t *rec)
UNIV_INTERN ibool row_upd_changes_field_size_or_external(dict_index_t *index, const ulint *offsets, const upd_t *update)
UNIV_INLINE ulint buf_block_get_page_no(const buf_block_t *block) __attribute__((pure))
UNIV_INLINE ulint rec_get_nth_field_offs(const ulint *offsets, ulint n, ulint *len)
UNIV_INTERN void mtr_commit(mtr_t *mtr) __attribute__((nonnull))
UNIV_INLINE index_id_t btr_page_get_index_id(const page_t *page)
UNIV_INLINE void dfield_set_data(dfield_t *field, const void *data, ulint len)
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_INLINE ulint dict_table_zip_size(const dict_table_t *table)
#define MLOG_REC_SEC_DELETE_MARK
UNIV_INLINE byte * mlog_write_initial_log_record_fast(const byte *ptr, byte type, byte *log_ptr, mtr_t *mtr)
UNIV_INLINE ulint dfield_get_len(const dfield_t *field)
UNIV_INTERN int cmp_rec_rec_with_match(const rec_t *rec1, const rec_t *rec2, const ulint *offsets1, const ulint *offsets2, dict_index_t *index, ibool nulls_unequal, ulint *matched_fields, ulint *matched_bytes)
UNIV_INTERN void lock_update_delete(const buf_block_t *block, const rec_t *rec)
UNIV_INTERN ibool btr_page_get_split_rec_to_right(btr_cur_t *cursor, rec_t **split_rec)
UNIV_INLINE ulint page_rec_is_comp(const rec_t *rec)
#define BTR_IGNORE_SEC_UNIQUE
UNIV_INLINE enum buf_page_state buf_block_get_state(const buf_block_t *block) __attribute__((pure))
UNIV_INLINE ulint rec_offs_comp(const ulint *offsets)
UNIV_INTERN ibool btr_cur_compress_if_useful(btr_cur_t *cursor, 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_INLINE ulint page_get_max_insert_size(const page_t *page, ulint n_recs)
UNIV_INLINE ibool page_is_leaf(const page_t *page) __attribute__((nonnull
UNIV_INLINE ulint page_get_max_insert_size_after_reorganize(const page_t *page, ulint n_recs)
UNIV_INTERN void btr_cur_set_deleted_flag_for_ibuf(rec_t *rec, page_zip_des_t *page_zip, ibool val, mtr_t *mtr)
#define btr_page_get(space, zip_size, page_no, mode, mtr)
UNIV_INTERN ibool btr_compress(btr_cur_t *cursor, mtr_t *mtr)
ib_int64_t * stat_n_diff_key_vals
#define FIL_PAGE_TYPE_ZBLOB
UNIV_INTERN ulint fil_space_get_flags(ulint id)
UNIV_INLINE ulint dict_index_is_clust(const dict_index_t *index) __attribute__((pure))
UNIV_INTERN void btr_cur_disown_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) __attribute__((nonnull(2
UNIV_INTERN void lock_rec_store_on_page_infimum(const buf_block_t *block, const rec_t *rec)
UNIV_INTERN void row_upd_index_entry_sys_field(dtuple_t *entry, dict_index_t *index, ulint type, ib_uint64_t val)
UNIV_INTERN ibool dtuple_check_typed(const dtuple_t *tuple)
UNIV_INLINE ulint page_offset(const void *ptr) __attribute__((const ))
UNIV_INTERN ulint trx_undo_report_row_operation(ulint flags, ulint op_type, que_thr_t *thr, dict_index_t *index, const dtuple_t *clust_entry, const upd_t *update, ulint cmpl_info, const rec_t *rec, roll_ptr_t *roll_ptr)
UNIV_INTERN ulint btr_cur_del_mark_set_clust_rec(ulint flags, buf_block_t *block, rec_t *rec, dict_index_t *index, const ulint *offsets, ibool val, que_thr_t *thr, mtr_t *mtr) __attribute__((nonnull))
UNIV_INLINE rw_lock_t * dict_index_get_lock(dict_index_t *index)
UNIV_INTERN void lock_rec_restore_from_page_infimum(const buf_block_t *block, const rec_t *rec, const buf_block_t *donator)
UNIV_INLINE rec_t * btr_cur_get_rec(btr_cur_t *cursor)
#define buf_block_get_page_zip(block)
#define MLOG_REC_CLUST_DELETE_MARK
UNIV_INLINE void page_cur_move_to_next(page_cur_t *cur)
UNIV_INTERN void btr_search_update_hash_on_insert(btr_cur_t *cursor)
UNIV_INLINE void * mem_heap_alloc(mem_heap_t *heap, ulint n)
#define mem_heap_create(N)
UNIV_INLINE ibool page_rec_is_supremum(const rec_t *rec) __attribute__((const ))
UNIV_INLINE void * mem_heap_zalloc(mem_heap_t *heap, ulint n)
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 fil_page_get_type(const byte *page)
UNIV_INTERN ibool btr_page_reorganize(buf_block_t *block, dict_index_t *index, mtr_t *mtr)
UNIV_INLINE void mach_write_to_1(byte *b, ulint n)
#define BTR_PATH_ARRAY_N_SLOTS
UNIV_INTERN buf_block_t * buf_page_get_gen(ulint space, ulint zip_size, ulint offset, ulint rw_latch, buf_block_t *guess, ulint mode, const char *file, ulint line, mtr_t *mtr)
UNIV_INLINE ulint rec_offs_n_fields(const ulint *offsets)
UNIV_INLINE byte * mlog_open(mtr_t *mtr, ulint size)
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 void btr_page_free_low(dict_index_t *index, buf_block_t *block, ulint level, mtr_t *mtr)
#define BTR_EXTERN_INHERITED_FLAG
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)
#define rw_lock_s_lock(M)
#define BTR_EXTERN_SPACE_ID
#define MLOG_COMP_REC_UPDATE_IN_PLACE
UNIV_INLINE void btr_search_info_update(dict_index_t *index, btr_cur_t *cursor)
UNIV_INLINE dict_index_t * btr_cur_get_index(btr_cur_t *cursor)
UNIV_INTERN void ibuf_reset_free_bits(buf_block_t *block)
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)
#define mtr_x_lock(B, MTR)
UNIV_INTERN ulint lock_rec_insert_check_and_lock(ulint flags, const rec_t *rec, buf_block_t *block, dict_index_t *index, que_thr_t *thr, mtr_t *mtr, ibool *inherit)
UNIV_INTERN void btr_set_min_rec_mark(rec_t *rec, mtr_t *mtr)
UNIV_INTERN void fil_space_release_free_extents(ulint id, ulint n_reserved)
UNIV_INLINE ulint rec_get_converted_size(dict_index_t *index, const dtuple_t *dtuple, ulint n_ext)
UNIV_INLINE const upd_field_t * upd_get_field_by_field_no(const upd_t *update, ulint no) __attribute__((nonnull
UNIV_INTERN ulint btr_push_update_extern_fields(dtuple_t *tuple, const upd_t *update, mem_heap_t *heap) __attribute__((nonnull))
#define BTR_EXTERN_FIELD_REF_SIZE
UNIV_INTERN ulint lock_sec_rec_modify_check_and_lock(ulint flags, buf_block_t *block, const rec_t *rec, dict_index_t *index, que_thr_t *thr, mtr_t *mtr)
UNIV_INLINE ibool rec_get_node_ptr_flag(const rec_t *rec)
UNIV_INLINE ulint dict_index_get_n_unique(const dict_index_t *index)
UNIV_INLINE ulint mtr_set_savepoint(mtr_t *mtr)
UNIV_INLINE ulint buf_block_get_space(const buf_block_t *block) __attribute__((pure))
#define BTR_EXTERN_OWNER_FLAG
UNIV_INTERN buf_block_t * btr_page_alloc(dict_index_t *index, ulint hint_page_no, byte file_direction, ulint level, mtr_t *mtr)
UNIV_INTERN ibool dtuple_check_typed_no_assert(const dtuple_t *tuple)
UNIV_INTERN void btr_search_update_hash_node_on_insert(btr_cur_t *cursor)
UNIV_INLINE ulint mach_read_from_4(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint dict_index_get_space_reserve(void)
#define ut_calc_align(n, m)
#define BUF_GET_IF_IN_POOL_OR_WATCH
UNIV_INTERN void ibuf_update_free_bits_low(const buf_block_t *block, ulint max_ins_size, mtr_t *mtr)
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 void ut_print_timestamp(FILE *file)
UNIV_INTERN ulint page_zip_empty_size(ulint n_fields, ulint zip_size) __attribute__((const ))
UNIV_INLINE void mach_write_to_2(byte *b, ulint n)
UNIV_INLINE trx_t * thr_get_trx(que_thr_t *thr)
UNIV_INLINE buf_block_t * btr_cur_get_block(btr_cur_t *cursor)
UNIV_INLINE buf_pool_t * buf_pool_from_block(const buf_block_t *block)
UNIV_INTERN void buf_pool_watch_unset(ulint space, ulint offset)
UNIV_INLINE void row_upd_rec_sys_fields(rec_t *rec, page_zip_des_t *page_zip, dict_index_t *index, const ulint *offsets, trx_t *trx, roll_ptr_t roll_ptr)
#define BTR_EXTERN_PAGE_NO
UNIV_INTERN void row_upd_index_replace_new_col_vals_index_pos(dtuple_t *entry, dict_index_t *index, const upd_t *update, ibool order_only, mem_heap_t *heap) __attribute__((nonnull))
UNIV_INTERN void lock_rec_reset_and_inherit_gap_locks(const buf_block_t *heir_block, const buf_block_t *block, ulint heir_heap_no, ulint heap_no)
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_INLINE void page_cur_set_after_last(const buf_block_t *block, page_cur_t *cur)
UNIV_INLINE ibool ibuf_should_try(dict_index_t *index, ulint ignore_sec_unique)
UNIV_INLINE void mtr_start(mtr_t *mtr) __attribute__((nonnull))
UNIV_INLINE void rec_set_deleted_flag_old(rec_t *rec, ulint flag)
UNIV_INLINE ulint rec_get_info_bits(const rec_t *rec, ulint comp)
UNIV_INLINE ulint mach_read_from_1(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint upd_get_n_fields(const upd_t *update)
UNIV_INTERN dtuple_t * row_rec_to_index_entry(ulint type, const rec_t *rec, const dict_index_t *index, ulint *offsets, ulint *n_ext, mem_heap_t *heap)
UNIV_INLINE ulint rec_offs_size(const ulint *offsets)
UNIV_INLINE ulint mach_read_from_2(const byte *b) __attribute__((nonnull
UNIV_INLINE ulint page_get_free_space_of_empty(ulint comp) __attribute__((const ))
UNIV_INLINE void page_cur_move_to_prev(page_cur_t *cur)
UNIV_INTERN ulint page_rec_get_n_recs_before(const rec_t *rec)
UNIV_INLINE void dfield_set_ext(dfield_t *field)
const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE]
UNIV_INLINE ulint page_rec_get_heap_no(const rec_t *rec)
UNIV_INTERN void dict_index_name_print(FILE *file, trx_t *trx, const dict_index_t *index)
UNIV_INLINE void mtr_release_s_latch_at_savepoint(mtr_t *mtr, ulint savepoint, rw_lock_t *lock)
UNIV_INTERN void mlog_log_string(byte *ptr, ulint len, mtr_t *mtr)
#define buf_pool_mutex_exit(b)
UNIV_INLINE ulint dict_index_is_ibuf(const dict_index_t *index) __attribute__((pure))
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_INLINE ulint page_zip_get_size(const page_zip_des_t *page_zip) __attribute__((nonnull
UNIV_INLINE ulint btr_node_ptr_get_child_page_no(const rec_t *rec, const ulint *offsets)
UNIV_INTERN byte * row_upd_write_sys_vals_to_log(dict_index_t *index, trx_t *trx, roll_ptr_t roll_ptr, byte *log_ptr, mtr_t *mtr)
UNIV_INLINE ibool rec_offs_validate(const rec_t *rec, const dict_index_t *index, const ulint *offsets)
#define buf_page_get(SP, ZS, OF, LA, MTR)