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;
87 UNIV_INTERN ulint btr_cur_n_non_sea = 0;
90 UNIV_INTERN ulint btr_cur_n_sea = 0;
94 UNIV_INTERN ulint btr_cur_n_non_sea_old = 0;
98 UNIV_INTERN ulint btr_cur_n_sea_old = 0;
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
343 btr_cur_search_to_nth_level(
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
481 && UNIV_LIKELY(btr_search_enabled)
482 && btr_search_guess_on_hash(index, info, tuple, mode,
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
586 block = buf_page_get_gen(
587 space, zip_size, page_no, rw_latch, guess, buf_mode,
599 case BTR_INSERT_IGNORE_UNIQUE_OP:
602 if (ibuf_insert(IBUF_OP_INSERT, tuple, index,
603 space, zip_size, page_no,
615 if (ibuf_insert(IBUF_OP_DELETE_MARK, tuple,
616 index, space, zip_size,
617 page_no, cursor->
thr)) {
634 }
else if (ibuf_insert(IBUF_OP_DELETE, tuple,
635 index, space, zip_size,
643 buf_pool_watch_unset(space, page_no);
647 buf_pool_watch_unset(space, page_no);
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;
753 = ibuf_rec_get_counter(node_ptr);
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);
785 if (UNIV_LIKELY(btr_search_enabled)) {
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) {
814 btr_cur_open_at_index_side_func(
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;
865 block = buf_page_get_gen(space, zip_size, page_no,
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)) {
946 btr_cur_open_at_rnd_pos_func(
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;
985 block = buf_page_get_gen(space, zip_size, page_no,
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)) {
1062 if (btr_page_reorganize(block, cursor->
index, mtr)) {
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 ",
1150 dict_index_name_print(stderr, trx, index);
1164 btr_cur_optimistic_insert(
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);
1212 if (!dtuple_check_typed_no_assert(entry)) {
1213 fputs(
"InnoDB: Error in a tuple to insert into ", stderr);
1214 dict_index_name_print(stderr,
thr_get_trx(thr), index);
1217 if (btr_cur_print_record_ops && thr) {
1218 btr_cur_trx_report(
thr_get_trx(thr), index,
"insert into ");
1219 dtuple_print(stderr, entry);
1223 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
1235 big_rec_vec = dtuple_convert_big_rec(index, entry, &n_ext);
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)) {
1272 dtuple_convert_back_big_rec(
1273 index, entry, big_rec_vec);
1276 return(DB_TOO_BIG_RECORD);
1286 && UNIV_LIKELY(leaf)
1288 && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
1289 || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
1295 dtuple_convert_back_big_rec(index, entry, big_rec_vec);
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)) {
1336 if (UNIV_UNLIKELY(!btr_page_reorganize(block, index, mtr))) {
1352 if (UNIV_UNLIKELY(!*rec)) {
1353 if (UNIV_LIKELY(zip_size != 0)) {
1358 fputs(
"InnoDB: Error: cannot insert tuple ", stderr);
1359 dtuple_print(stderr, entry);
1360 fputs(
" into ", stderr);
1361 dict_index_name_print(stderr,
thr_get_trx(thr), index);
1362 fprintf(stderr,
"\nInnoDB: max insert size %lu\n",
1368 #ifdef BTR_CUR_HASH_ADAPT
1370 btr_search_update_hash_node_on_insert(cursor);
1372 btr_search_update_hash_on_insert(cursor);
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);
1403 ibuf_update_free_bits_zip(block, mtr);
1409 rec_size + PAGE_DIR_SLOT_SIZE);
1413 *big_rec = big_rec_vec;
1426 btr_cur_pessimistic_insert(
1453 ulint n_extents = 0;
1460 ut_ad(mtr_memo_contains(mtr,
1464 MTR_MEMO_PAGE_X_FIX));
1471 err = btr_cur_optimistic_insert(flags, cursor, entry, rec,
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)) {
1496 success = fsp_reserve_free_extents(&n_reserved, index->
space,
1497 n_extents, FSP_NORMAL, mtr);
1499 return(DB_OUT_OF_FILE_SPACE);
1510 if (UNIV_LIKELY_NULL(big_rec_vec)) {
1514 dtuple_convert_back_big_rec(index, entry, big_rec_vec);
1517 big_rec_vec = dtuple_convert_big_rec(index, entry, &n_ext);
1519 if (big_rec_vec == NULL) {
1521 if (n_extents > 0) {
1522 fil_space_release_free_extents(index->
space,
1525 return(DB_TOO_BIG_RECORD);
1533 *rec = btr_root_raise_and_insert(cursor, entry, n_ext, mtr);
1535 *rec = btr_page_split_and_insert(cursor, entry, n_ext, mtr);
1538 if (UNIV_LIKELY_NULL(heap)) {
1544 #ifdef BTR_CUR_ADAPT
1545 btr_search_update_hash_on_insert(cursor);
1547 if (!(flags & BTR_NO_LOCKING_FLAG)) {
1552 if (n_extents > 0) {
1553 fil_space_release_free_extents(index->
space, n_reserved);
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);
1681 btr_cur_parse_update_in_place(
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
1761 btr_cur_update_alloc_zip(
1807 ibuf_reset_free_bits(block);
1821 btr_cur_update_in_place(
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)
1867 && !btr_cur_update_alloc_zip(page_zip, block, index,
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,
1893 btr_search_update_hash_on_delete(cursor);
1899 if (!(flags & BTR_KEEP_SYS_FLAG)) {
1901 index, offsets, trx, roll_ptr);
1916 ibuf_update_free_bits_zip(block, mtr);
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)) {
1949 btr_cur_optimistic_update(
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 ");
2008 return(btr_cur_update_in_place(flags, cursor, 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)
2049 && !btr_cur_update_alloc_zip(page_zip, block, index,
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) {
2102 btr_search_update_hash_on_delete(cursor);
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);
2130 ibuf_update_free_bits_zip(block, 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,
2202 btr_cur_pessimistic_update(
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));
2255 optim_err = btr_cur_optimistic_update(flags, cursor, update,
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;
2290 if (!fsp_reserve_free_extents(&n_reserved, index->
space,
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);
2346 n_ext += btr_push_update_extern_fields(new_entry, update, *heap);
2348 if (UNIV_LIKELY_NULL(page_zip)) {
2362 big_rec_vec = dtuple_convert_big_rec(index, new_entry, &n_ext);
2363 if (UNIV_UNLIKELY(big_rec_vec == NULL)) {
2365 err = DB_TOO_BIG_RECORD;
2366 goto return_after_reservations;
2381 btr_search_update_hash_on_delete(cursor);
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);
2408 btr_cur_compress_if_useful(cursor, mtr);
2413 ibuf_update_free_bits_zip(block, mtr);
2417 goto return_after_reservations;
2419 ut_a(optim_err != DB_UNDERFLOW);
2424 ibuf_reset_free_bits(block);
2435 err = btr_cur_pessimistic_insert(BTR_NO_UNDO_LOG_FLAG
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) {
2493 fil_space_release_free_extents(index->
space, n_reserved);
2496 *big_rec = big_rec_vec;
2508 btr_cur_del_mark_set_clust_rec_log(
2528 1 + 1 + DATA_ROLL_PTR_LEN
2556 btr_cur_parse_del_mark_set_clust_rec(
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
2639 btr_cur_del_mark_set_clust_rec(
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(
2753 btr_cur_parse_del_mark_set_sec_rec(
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
2796 btr_cur_del_mark_set_sec_rec(
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);
2850 btr_cur_set_deleted_flag_for_ibuf(
2863 btr_rec_set_deleted_flag(rec, page_zip, val);
2865 btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
2879 btr_cur_compress_if_useful(
2886 ut_ad(mtr_memo_contains(mtr,
2890 MTR_MEMO_PAGE_X_FIX));
2892 return(btr_cur_compress_recommendation(cursor, mtr)
2893 && btr_compress(cursor, mtr));
2903 btr_cur_optimistic_delete(
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);
2946 btr_search_update_hash_on_delete(cursor);
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) {
2969 ibuf_update_free_bits_zip(block, mtr);
2971 ibuf_update_free_bits_low(block, max_ins, mtr);
2975 if (UNIV_LIKELY_NULL(heap)) {
2979 return(no_compress_needed);
2992 btr_cur_pessimistic_delete(
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) {
3038 success = fsp_reserve_free_extents(&n_reserved,
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));
3074 btr_discard_page(cursor, mtr);
3079 goto return_after_reservations;
3087 page_get_infimum_rec(page)))) {
3102 btr_set_min_rec_mark(next_rec, mtr);
3109 btr_node_ptr_delete(index, block, mtr);
3111 node_ptr = dict_index_build_node_ptr(
3115 btr_insert_on_non_leaf_level(index,
3116 level + 1, node_ptr, mtr);
3120 btr_search_update_hash_on_delete(cursor);
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:
3135 ret = btr_cur_compress_if_useful(cursor, mtr);
3138 if (n_extents > 0) {
3139 fil_space_release_free_extents(index->
space, n_reserved);
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;
3249 zip_size = fil_space_get_zip_size(space);
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;
3339 btr_estimate_n_rows_in_range(
3354 ulint divergence_level;
3356 ibool is_n_rows_exact;
3366 btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
3369 __FILE__, __LINE__, &mtr);
3371 btr_cur_open_at_index_side(TRUE, index,
3384 btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
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) {
3544 btr_estimate_number_of_different_key_vals(
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);
3955 btr_push_update_extern_fields(
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);
4087 buf_LRU_free_block(&block->
page, FALSE);
4092 mutex_exit(&block->
mutex);
4103 btr_store_big_rec_extern_fields_func(
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
4188 || !memcmp(field_ref, field_ref_zero,
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
4200 ut_a(!memcmp(field_ref, field_ref_zero,
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;
4231 block = btr_page_alloc(index, hint_page_no,
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);
4505 ut_a(0 != memcmp(field_ref, field_ref_zero,
4518 btr_check_blob_fil_page_type(
4525 ulint type = fil_page_get_type(page);
4531 ulint flags = fil_space_get_flags(space_id);
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);
4561 btr_free_externally_stored_field(
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));
4600 if (UNIV_UNLIKELY(!memcmp(field_ref, field_ref_zero,
4612 ext_zip_size = fil_space_get_zip_size(space_id);
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);
4705 switch (fil_page_get_type(page)) {
4714 btr_page_free_low(index, ext_block, 0, &mtr);
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);
4745 btr_page_free_low(index, ext_block, 0, &mtr);
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++) {
4794 btr_free_externally_stored_field(
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);
4838 btr_free_externally_stored_field(
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);
4952 bpage = buf_page_get_zip(space_id, zip_size, page_no);
4954 if (UNIV_UNLIKELY(!bpage)) {
4957 " InnoDB: Cannot load"
4959 " page %lu space %lu\n",
4960 (ulong) page_no, (ulong) space_id);
4965 (fil_page_get_type(bpage->
zip.
data) != page_type)) {
4968 " InnoDB: Unexpected type %lu of"
4970 " page %lu space %lu\n",
4971 (ulong) fil_page_get_type(bpage->
zip.
data),
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,
5095 btr_copy_externally_stored_field_prefix(
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,
5204 btr_rec_copy_externally_stored_field(
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));