mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
branches/zip: Remove some more buf_block_align() calls.
btr_cur_t: Move page_block to page_cur_t::block. page_cur_get_block(), page_cur_get_page_zip(): New functions. page_cur_position(): Add parameter block. Remove many page_zip parameters, now that there is page_cur_get_page_zip(). Replace some page, page_zip parameters with block. Add some const qualifiers to function parameters and remove casts. PAGE_HEAP_NO_INFIMUM, PAGE_HEAP_NO_SUPREMUM, PAGE_HEAP_NO_USER_LOW: New constants. Replace some cursor code in low-level diagnostic functions with direct management of rec, because buf_block_t::buf_fix_count may be 0 when the functions are called, and debug assertions would fail.
This commit is contained in:
parent
bb9b1b0c48
commit
b6e26f24d7
23 changed files with 572 additions and 522 deletions
167
btr/btr0btr.c
167
btr/btr0btr.c
|
@ -516,7 +516,7 @@ buf_block_t*
|
|||
btr_node_ptr_get_child(
|
||||
/*===================*/
|
||||
/* out: child page, x-latched */
|
||||
rec_t* node_ptr,/* in: node pointer */
|
||||
const rec_t* node_ptr,/* in: node pointer */
|
||||
const ulint* offsets,/* in: array returned by rec_get_offsets() */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ btr_node_ptr_get_child(
|
|||
ulint space;
|
||||
|
||||
ut_ad(rec_offs_validate(node_ptr, NULL, offsets));
|
||||
space = page_get_space_id(page_align(node_ptr));
|
||||
space = page_get_space_id(page_align((rec_t*) node_ptr));
|
||||
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
|
||||
|
||||
return(btr_block_get(space, page_no, RW_X_LATCH, mtr));
|
||||
|
@ -911,7 +911,7 @@ btr_page_reorganize_low(
|
|||
/* Copy the records from the temporary space to the recreated page;
|
||||
do not copy the lock bits yet */
|
||||
|
||||
page_copy_rec_list_end_no_locks(page,
|
||||
page_copy_rec_list_end_no_locks(block, temp_block,
|
||||
page_get_infimum_rec(temp_page),
|
||||
index, mtr);
|
||||
/* Copy max trx id to recreated page */
|
||||
|
@ -1107,7 +1107,7 @@ btr_root_raise_and_insert(
|
|||
/* Copy the records from root to the new page one by one. */
|
||||
|
||||
if (UNIV_UNLIKELY
|
||||
(!page_copy_rec_list_end(new_block,
|
||||
(!page_copy_rec_list_end(new_block, root_block,
|
||||
page_get_infimum_rec(root),
|
||||
index, mtr))) {
|
||||
ut_a(new_page_zip);
|
||||
|
@ -1164,11 +1164,10 @@ btr_root_raise_and_insert(
|
|||
|
||||
/* Insert node pointer to the root */
|
||||
|
||||
ut_ad(buf_block_get_frame(btr_cur_get_block(cursor)) == root);
|
||||
page_cur_set_before_first(root, page_cursor);
|
||||
page_cur_set_before_first(root_block, page_cursor);
|
||||
|
||||
node_ptr_rec = page_cur_tuple_insert(page_cursor, root_page_zip,
|
||||
node_ptr, index, NULL, 0, mtr);
|
||||
node_ptr_rec = page_cur_tuple_insert(page_cursor, node_ptr,
|
||||
index, NULL, 0, mtr);
|
||||
|
||||
/* The root page should only contain the node pointer
|
||||
to new_page at this point. Thus, the data should fit. */
|
||||
|
@ -1186,8 +1185,7 @@ btr_root_raise_and_insert(
|
|||
|
||||
ibuf_reset_free_bits_with_type(index->type, new_block);
|
||||
/* Reposition the cursor to the child node */
|
||||
cursor->page_block = new_block;
|
||||
page_cur_search(new_page, index, tuple,
|
||||
page_cur_search(new_block, index, tuple,
|
||||
PAGE_CUR_LE, page_cursor);
|
||||
|
||||
/* Split the child and insert tuple */
|
||||
|
@ -1716,7 +1714,6 @@ btr_page_split_and_insert(
|
|||
buf_block_t* right_block;
|
||||
buf_block_t* insert_block;
|
||||
page_t* insert_page;
|
||||
page_zip_des_t* insert_page_zip;
|
||||
page_cur_t* page_cursor;
|
||||
rec_t* first_rec;
|
||||
byte* buf = 0; /* remove warning */
|
||||
|
@ -1833,7 +1830,7 @@ func_start:
|
|||
/* fputs("Split left\n", stderr); */
|
||||
|
||||
if (UNIV_UNLIKELY
|
||||
(!page_move_rec_list_start(new_block, move_limit, page_zip,
|
||||
(!page_move_rec_list_start(new_block, block, move_limit,
|
||||
cursor->index, mtr))) {
|
||||
/* For some reason, compressing new_page failed,
|
||||
even though it should contain fewer records than
|
||||
|
@ -1844,13 +1841,12 @@ func_start:
|
|||
|
||||
page_zip_copy(new_page_zip, new_page,
|
||||
page_zip, page, cursor->index, mtr);
|
||||
page_delete_rec_list_end(move_limit - page
|
||||
+ new_page, cursor->index,
|
||||
page_delete_rec_list_end(move_limit - page + new_page,
|
||||
new_block, cursor->index,
|
||||
ULINT_UNDEFINED,
|
||||
ULINT_UNDEFINED,
|
||||
new_page_zip, mtr);
|
||||
page_delete_rec_list_start(move_limit, cursor->index,
|
||||
page_zip, mtr);
|
||||
ULINT_UNDEFINED, mtr);
|
||||
page_delete_rec_list_start(move_limit, block,
|
||||
cursor->index, mtr);
|
||||
}
|
||||
|
||||
left_block = new_block;
|
||||
|
@ -1861,7 +1857,7 @@ func_start:
|
|||
/* fputs("Split right\n", stderr); */
|
||||
|
||||
if (UNIV_UNLIKELY
|
||||
(!page_move_rec_list_end(new_block, move_limit, page_zip,
|
||||
(!page_move_rec_list_end(new_block, block, move_limit,
|
||||
cursor->index, mtr))) {
|
||||
/* For some reason, compressing new_page failed,
|
||||
even though it should contain fewer records than
|
||||
|
@ -1873,12 +1869,12 @@ func_start:
|
|||
page_zip_copy(new_page_zip, new_page,
|
||||
page_zip, page, cursor->index, mtr);
|
||||
page_delete_rec_list_start(move_limit - page
|
||||
+ new_page, cursor->index,
|
||||
new_page_zip, mtr);
|
||||
page_delete_rec_list_end(move_limit, cursor->index,
|
||||
+ new_page, new_block,
|
||||
cursor->index, mtr);
|
||||
page_delete_rec_list_end(move_limit, block,
|
||||
cursor->index,
|
||||
ULINT_UNDEFINED,
|
||||
ULINT_UNDEFINED,
|
||||
page_zip, mtr);
|
||||
ULINT_UNDEFINED, mtr);
|
||||
}
|
||||
|
||||
left_block = block;
|
||||
|
@ -1907,21 +1903,23 @@ func_start:
|
|||
}
|
||||
|
||||
insert_page = buf_block_get_frame(insert_block);
|
||||
insert_page_zip = buf_block_get_page_zip(insert_block);
|
||||
|
||||
/* 7. Reposition the cursor for insert and try insertion */
|
||||
page_cursor = btr_cur_get_page_cur(cursor);
|
||||
|
||||
cursor->page_block = insert_block;
|
||||
page_cur_search(insert_page, cursor->index, tuple,
|
||||
page_cur_search(insert_block, cursor->index, tuple,
|
||||
PAGE_CUR_LE, page_cursor);
|
||||
|
||||
rec = page_cur_tuple_insert(page_cursor, insert_page_zip,
|
||||
tuple, cursor->index, ext, n_ext, mtr);
|
||||
rec = page_cur_tuple_insert(page_cursor, tuple,
|
||||
cursor->index, ext, n_ext, mtr);
|
||||
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!insert_page_zip
|
||||
|| page_zip_validate(insert_page_zip, insert_page));
|
||||
{
|
||||
page_zip_des_t* insert_page_zip
|
||||
= buf_block_get_page_zip(insert_block);
|
||||
ut_a(!insert_page_zip
|
||||
|| page_zip_validate(insert_page_zip, insert_page));
|
||||
}
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
if (UNIV_LIKELY(rec != NULL)) {
|
||||
|
@ -1946,11 +1944,10 @@ func_start:
|
|||
goto insert_failed;
|
||||
}
|
||||
|
||||
ut_ad(cursor->page_block == insert_block);
|
||||
page_cur_search(insert_page, cursor->index, tuple,
|
||||
page_cur_search(insert_block, cursor->index, tuple,
|
||||
PAGE_CUR_LE, page_cursor);
|
||||
rec = page_cur_tuple_insert(page_cursor, insert_page_zip,
|
||||
tuple, cursor->index, ext, n_ext, mtr);
|
||||
rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index,
|
||||
ext, n_ext, mtr);
|
||||
|
||||
if (UNIV_UNLIKELY(rec == NULL)) {
|
||||
/* The insert did not fit on the page: loop back to the
|
||||
|
@ -1962,8 +1959,10 @@ insert_failed:
|
|||
/* fprintf(stderr, "Split second round %lu\n",
|
||||
page_get_page_no(page)); */
|
||||
n_iterations++;
|
||||
ut_ad(n_iterations < 2 || insert_page_zip);
|
||||
ut_ad(!insert_will_fit || insert_page_zip);
|
||||
ut_ad(n_iterations < 2
|
||||
|| buf_block_get_page_zip(insert_block));
|
||||
ut_ad(!insert_will_fit
|
||||
|| buf_block_get_page_zip(insert_block));
|
||||
|
||||
goto func_start;
|
||||
}
|
||||
|
@ -1980,7 +1979,7 @@ insert_failed:
|
|||
#endif
|
||||
|
||||
ut_ad(page_validate(buf_block_get_frame(left_block), cursor->index));
|
||||
ut_ad(page_validate(buf_block_get_frame(left_block), cursor->index));
|
||||
ut_ad(page_validate(buf_block_get_frame(right_block), cursor->index));
|
||||
|
||||
mem_heap_free(heap);
|
||||
return(rec);
|
||||
|
@ -2188,7 +2187,7 @@ btr_lift_page_up(
|
|||
|
||||
/* Copy the records to the father page one by one. */
|
||||
if (UNIV_UNLIKELY
|
||||
(!page_copy_rec_list_end(father_block,
|
||||
(!page_copy_rec_list_end(father_block, block,
|
||||
page_get_infimum_rec(page),
|
||||
index, mtr))) {
|
||||
ut_a(father_page_zip);
|
||||
|
@ -2250,7 +2249,7 @@ btr_compress(
|
|||
ulint level;
|
||||
|
||||
block = btr_cur_get_block(cursor);
|
||||
page = buf_block_get_frame(block);
|
||||
page = btr_cur_get_page(cursor);
|
||||
index = btr_cur_get_index(cursor);
|
||||
ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table));
|
||||
|
||||
|
@ -2356,7 +2355,8 @@ err_exit:
|
|||
/* Move records to the merge page */
|
||||
if (is_left) {
|
||||
rec_t* orig_pred = page_copy_rec_list_start(
|
||||
merge_block, page_get_supremum_rec(page), index, mtr);
|
||||
merge_block, block, page_get_supremum_rec(page),
|
||||
index, mtr);
|
||||
|
||||
if (UNIV_UNLIKELY(!orig_pred)) {
|
||||
goto err_exit;
|
||||
|
@ -2389,7 +2389,7 @@ err_exit:
|
|||
memset(merge_page + FIL_PAGE_PREV, 0xff, 4);
|
||||
}
|
||||
|
||||
orig_succ = page_copy_rec_list_end(merge_block,
|
||||
orig_succ = page_copy_rec_list_end(merge_block, block,
|
||||
page_get_infimum_rec(page),
|
||||
cursor->index, mtr);
|
||||
|
||||
|
@ -2643,30 +2643,29 @@ void
|
|||
btr_print_recursive(
|
||||
/*================*/
|
||||
dict_index_t* index, /* in: index tree */
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
ulint width, /* in: print this many entries from start
|
||||
and end */
|
||||
mem_heap_t** heap, /* in/out: heap for rec_get_offsets() */
|
||||
ulint** offsets,/* in/out: buffer for rec_get_offsets() */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
const page_t* page = buf_block_get_frame(block);
|
||||
page_cur_t cursor;
|
||||
ulint n_recs;
|
||||
ulint i = 0;
|
||||
mtr_t mtr2;
|
||||
rec_t* node_ptr;
|
||||
page_t* child;
|
||||
|
||||
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
fprintf(stderr, "NODE ON LEVEL %lu page number %lu\n",
|
||||
(ulong) btr_page_get_level(page, mtr),
|
||||
(ulong) page_get_page_no(page));
|
||||
|
||||
page_print(page, index, width, width);
|
||||
page_print(block, index, width, width);
|
||||
|
||||
n_recs = page_get_n_recs(page);
|
||||
|
||||
page_cur_set_before_first(page, &cursor);
|
||||
page_cur_set_before_first(block, &cursor);
|
||||
page_cur_move_to_next(&cursor);
|
||||
|
||||
while (!page_cur_is_after_last(&cursor)) {
|
||||
|
@ -2677,17 +2676,19 @@ btr_print_recursive(
|
|||
|
||||
} else if ((i <= width) || (i >= n_recs - width)) {
|
||||
|
||||
const rec_t* node_ptr;
|
||||
|
||||
mtr_start(&mtr2);
|
||||
|
||||
node_ptr = page_cur_get_rec(&cursor);
|
||||
|
||||
*offsets = rec_get_offsets(node_ptr, index, *offsets,
|
||||
ULINT_UNDEFINED, heap);
|
||||
child = buf_block_get_frame(
|
||||
btr_node_ptr_get_child(node_ptr,
|
||||
*offsets, &mtr2));
|
||||
btr_print_recursive(index, child, width,
|
||||
heap, offsets, &mtr2);
|
||||
btr_print_recursive(index,
|
||||
btr_node_ptr_get_child(node_ptr,
|
||||
*offsets,
|
||||
&mtr2),
|
||||
width, heap, offsets, &mtr2);
|
||||
mtr_commit(&mtr2);
|
||||
}
|
||||
|
||||
|
@ -2707,7 +2708,7 @@ btr_print_index(
|
|||
and end */
|
||||
{
|
||||
mtr_t mtr;
|
||||
page_t* root;
|
||||
buf_block_t* root;
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||
ulint* offsets = offsets_;
|
||||
|
@ -2718,7 +2719,7 @@ btr_print_index(
|
|||
|
||||
mtr_start(&mtr);
|
||||
|
||||
root = btr_root_get(index, &mtr);
|
||||
root = btr_root_block_get(index, &mtr);
|
||||
|
||||
btr_print_recursive(index, root, width, &heap, &offsets, &mtr);
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
|
@ -2906,13 +2907,13 @@ ibool
|
|||
btr_index_page_validate(
|
||||
/*====================*/
|
||||
/* out: TRUE if ok */
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
dict_index_t* index) /* in: index */
|
||||
{
|
||||
page_cur_t cur;
|
||||
ibool ret = TRUE;
|
||||
|
||||
page_cur_set_before_first(page, &cur);
|
||||
page_cur_set_before_first(block, &cur);
|
||||
page_cur_move_to_next(&cur);
|
||||
|
||||
for (;;) {
|
||||
|
@ -2938,13 +2939,13 @@ static
|
|||
void
|
||||
btr_validate_report1(
|
||||
/*=================*/
|
||||
/* out: TRUE if ok */
|
||||
dict_index_t* index, /* in: index */
|
||||
ulint level, /* in: B-tree level */
|
||||
page_t* page) /* in: index page */
|
||||
/* out: TRUE if ok */
|
||||
dict_index_t* index, /* in: index */
|
||||
ulint level, /* in: B-tree level */
|
||||
const buf_block_t* block) /* in: index page */
|
||||
{
|
||||
fprintf(stderr, "InnoDB: Error in page %lu of ",
|
||||
page_get_page_no(page));
|
||||
buf_block_get_page_no(block));
|
||||
dict_index_name_print(stderr, NULL, index);
|
||||
if (level) {
|
||||
fprintf(stderr, ", index tree level %lu", level);
|
||||
|
@ -2958,15 +2959,15 @@ static
|
|||
void
|
||||
btr_validate_report2(
|
||||
/*=================*/
|
||||
/* out: TRUE if ok */
|
||||
dict_index_t* index, /* in: index */
|
||||
ulint level, /* in: B-tree level */
|
||||
page_t* page1, /* in: first index page */
|
||||
page_t* page2) /* in: second index page */
|
||||
/* out: TRUE if ok */
|
||||
const dict_index_t* index, /* in: index */
|
||||
ulint level, /* in: B-tree level */
|
||||
const buf_block_t* block1, /* in: first index page */
|
||||
const buf_block_t* block2) /* in: second index page */
|
||||
{
|
||||
fprintf(stderr, "InnoDB: Error in pages %lu and %lu of ",
|
||||
page_get_page_no(page1),
|
||||
page_get_page_no(page2));
|
||||
buf_block_get_page_no(block1),
|
||||
buf_block_get_page_no(block2));
|
||||
dict_index_name_print(stderr, NULL, index);
|
||||
if (level) {
|
||||
fprintf(stderr, ", index tree level %lu", level);
|
||||
|
@ -3017,7 +3018,7 @@ btr_validate_level(
|
|||
space = page_get_space_id(page);
|
||||
|
||||
while (level != btr_page_get_level(page, &mtr)) {
|
||||
rec_t* node_ptr;
|
||||
const rec_t* node_ptr;
|
||||
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
@ -3025,7 +3026,7 @@ btr_validate_level(
|
|||
#endif /* UNIV_ZIP_DEBUG */
|
||||
ut_a(!page_is_leaf(page));
|
||||
|
||||
page_cur_set_before_first(page, &cursor);
|
||||
page_cur_set_before_first(block, &cursor);
|
||||
page_cur_move_to_next(&cursor);
|
||||
|
||||
node_ptr = page_cur_get_rec(&cursor);
|
||||
|
@ -3055,14 +3056,14 @@ loop:
|
|||
/* Check ordering etc. of records */
|
||||
|
||||
if (!page_validate(page, index)) {
|
||||
btr_validate_report1(index, level, page);
|
||||
btr_validate_report1(index, level, block);
|
||||
|
||||
ret = FALSE;
|
||||
} else if (level == 0) {
|
||||
/* We are on level 0. Check that the records have the right
|
||||
number of fields, and field lengths are right. */
|
||||
|
||||
if (!btr_index_page_validate(page, index)) {
|
||||
if (!btr_index_page_validate(block, index)) {
|
||||
|
||||
ret = FALSE;
|
||||
}
|
||||
|
@ -3078,13 +3079,13 @@ loop:
|
|||
== dict_index_get_page(index)));
|
||||
|
||||
if (right_page_no != FIL_NULL) {
|
||||
rec_t* right_rec;
|
||||
const rec_t* right_rec;
|
||||
right_block = btr_block_get(space, right_page_no, RW_X_LATCH,
|
||||
&mtr);
|
||||
right_page = buf_block_get_frame(right_block);
|
||||
if (UNIV_UNLIKELY(btr_page_get_prev(right_page, &mtr)
|
||||
!= page_get_page_no(page))) {
|
||||
btr_validate_report2(index, level, page, right_page);
|
||||
btr_validate_report2(index, level, block, right_block);
|
||||
fputs("InnoDB: broken FIL_PAGE_NEXT"
|
||||
" or FIL_PAGE_PREV links\n", stderr);
|
||||
buf_page_print(page, 0);
|
||||
|
@ -3095,7 +3096,7 @@ loop:
|
|||
|
||||
if (UNIV_UNLIKELY(page_is_comp(right_page)
|
||||
!= page_is_comp(page))) {
|
||||
btr_validate_report2(index, level, page, right_page);
|
||||
btr_validate_report2(index, level, block, right_block);
|
||||
fputs("InnoDB: 'compact' flag mismatch\n", stderr);
|
||||
buf_page_print(page, 0);
|
||||
buf_page_print(right_page, 0);
|
||||
|
@ -3116,7 +3117,7 @@ loop:
|
|||
offsets, offsets2,
|
||||
index) >= 0)) {
|
||||
|
||||
btr_validate_report2(index, level, page, right_page);
|
||||
btr_validate_report2(index, level, block, right_block);
|
||||
|
||||
fputs("InnoDB: records in wrong order"
|
||||
" on adjacent pages\n", stderr);
|
||||
|
@ -3166,7 +3167,7 @@ loop:
|
|||
offsets)
|
||||
!= buf_block_get_page_no(block))) {
|
||||
|
||||
btr_validate_report1(index, level, page);
|
||||
btr_validate_report1(index, level, block);
|
||||
|
||||
fputs("InnoDB: node pointer to the page is wrong\n",
|
||||
stderr);
|
||||
|
@ -3199,10 +3200,10 @@ loop:
|
|||
|
||||
if (cmp_dtuple_rec(node_ptr_tuple, node_ptr,
|
||||
offsets)) {
|
||||
rec_t* first_rec = page_rec_get_next(
|
||||
const rec_t* first_rec = page_rec_get_next(
|
||||
page_get_infimum_rec(page));
|
||||
|
||||
btr_validate_report1(index, level, page);
|
||||
btr_validate_report1(index, level, block);
|
||||
|
||||
buf_page_print(father_page, 0);
|
||||
buf_page_print(page, 0);
|
||||
|
@ -3245,7 +3246,7 @@ loop:
|
|||
stderr);
|
||||
|
||||
btr_validate_report1(index, level,
|
||||
page);
|
||||
block);
|
||||
|
||||
buf_page_print(father_page, 0);
|
||||
buf_page_print(page, 0);
|
||||
|
@ -3265,7 +3266,7 @@ loop:
|
|||
stderr);
|
||||
|
||||
btr_validate_report1(index, level,
|
||||
page);
|
||||
block);
|
||||
|
||||
buf_page_print(father_page, 0);
|
||||
buf_page_print(right_father_page, 0);
|
||||
|
@ -3282,7 +3283,7 @@ loop:
|
|||
stderr);
|
||||
|
||||
btr_validate_report1(index, level,
|
||||
page);
|
||||
block);
|
||||
|
||||
buf_page_print(father_page, 0);
|
||||
buf_page_print(right_father_page, 0);
|
||||
|
|
|
@ -539,8 +539,7 @@ retry_page_get:
|
|||
page_mode = mode;
|
||||
}
|
||||
|
||||
cursor->page_block = block;
|
||||
page_cur_search_with_match(page, index, tuple, page_mode,
|
||||
page_cur_search_with_match(block, index, tuple, page_mode,
|
||||
&up_match, &up_bytes,
|
||||
&low_match, &low_bytes,
|
||||
page_cursor);
|
||||
|
@ -685,7 +684,6 @@ btr_cur_open_at_index_side(
|
|||
btr_page_get_index_id(page)));
|
||||
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
cursor->page_block = block;
|
||||
|
||||
if (height == ULINT_UNDEFINED) {
|
||||
/* We are in the root node */
|
||||
|
@ -715,11 +713,10 @@ btr_cur_open_at_index_side(
|
|||
}
|
||||
}
|
||||
|
||||
ut_ad(buf_block_get_frame(cursor->page_block) == page);
|
||||
if (from_left) {
|
||||
page_cur_set_before_first(page, page_cursor);
|
||||
page_cur_set_before_first(block, page_cursor);
|
||||
} else {
|
||||
page_cur_set_after_last(page, page_cursor);
|
||||
page_cur_set_after_last(block, page_cursor);
|
||||
}
|
||||
|
||||
if (height == 0) {
|
||||
|
@ -815,8 +812,7 @@ btr_cur_open_at_rnd_pos(
|
|||
latch_mode, cursor, mtr);
|
||||
}
|
||||
|
||||
cursor->page_block = block;
|
||||
page_cur_open_on_rnd_user_rec(page, page_cursor);
|
||||
page_cur_open_on_rnd_user_rec(block, page_cursor);
|
||||
|
||||
if (height == 0) {
|
||||
|
||||
|
@ -854,7 +850,6 @@ btr_cur_insert_if_possible(
|
|||
else NULL */
|
||||
btr_cur_t* cursor, /* in: cursor on page after which to insert;
|
||||
cursor stays valid */
|
||||
page_zip_des_t* page_zip,/* in: compressed page of cursor */
|
||||
const dtuple_t* tuple, /* in: tuple to insert; the size info need not
|
||||
have been stored to tuple */
|
||||
const ulint* ext, /* in: array of extern field numbers */
|
||||
|
@ -873,20 +868,19 @@ btr_cur_insert_if_possible(
|
|||
page_cursor = btr_cur_get_page_cur(cursor);
|
||||
|
||||
/* Now, try the insert */
|
||||
rec = page_cur_tuple_insert(page_cursor, page_zip,
|
||||
tuple, cursor->index, ext, n_ext, mtr);
|
||||
rec = page_cur_tuple_insert(page_cursor, tuple,
|
||||
cursor->index, ext, n_ext, mtr);
|
||||
|
||||
if (UNIV_UNLIKELY(!rec)) {
|
||||
/* If record did not fit, reorganize */
|
||||
|
||||
if (btr_page_reorganize(block, cursor->index, mtr)) {
|
||||
|
||||
page_cur_search(buf_block_get_frame(block),
|
||||
cursor->index, tuple,
|
||||
page_cur_search(block, cursor->index, tuple,
|
||||
PAGE_CUR_LE, page_cursor);
|
||||
|
||||
rec = page_cur_tuple_insert(page_cursor, page_zip,
|
||||
tuple, cursor->index,
|
||||
rec = page_cur_tuple_insert(page_cursor, tuple,
|
||||
cursor->index,
|
||||
ext, n_ext, mtr);
|
||||
}
|
||||
}
|
||||
|
@ -1146,8 +1140,8 @@ fail:
|
|||
|
||||
/* Now, try the insert */
|
||||
|
||||
*rec = page_cur_tuple_insert(page_cursor, page_zip,
|
||||
entry, index, ext, n_ext, mtr);
|
||||
*rec = page_cur_tuple_insert(page_cursor, entry, index,
|
||||
ext, n_ext, mtr);
|
||||
if (UNIV_UNLIKELY(!(*rec))) {
|
||||
/* If the record did not fit, reorganize */
|
||||
if (UNIV_UNLIKELY(!btr_page_reorganize(block, index, mtr))) {
|
||||
|
@ -1160,10 +1154,10 @@ fail:
|
|||
|
||||
reorg = TRUE;
|
||||
|
||||
page_cur_search(page, index, entry, PAGE_CUR_LE, page_cursor);
|
||||
page_cur_search(block, index, entry, PAGE_CUR_LE, page_cursor);
|
||||
|
||||
*rec = page_cur_tuple_insert(page_cursor, page_zip,
|
||||
entry, index, ext, n_ext, mtr);
|
||||
*rec = page_cur_tuple_insert(page_cursor, entry, index,
|
||||
ext, n_ext, mtr);
|
||||
|
||||
if (UNIV_UNLIKELY(!*rec)) {
|
||||
if (UNIV_LIKELY(page_zip != NULL)) {
|
||||
|
@ -1353,11 +1347,11 @@ btr_cur_pessimistic_insert(
|
|||
rec_t* temp_rec;
|
||||
|
||||
page_cur_position(temp_page + PAGE_NEW_INFIMUM,
|
||||
&temp_cursor);
|
||||
temp_block, &temp_cursor);
|
||||
|
||||
temp_rec = page_cur_tuple_insert(
|
||||
&temp_cursor, &temp_block->page_zip,
|
||||
entry, index, ext, n_ext, NULL);
|
||||
temp_rec = page_cur_tuple_insert(&temp_cursor,
|
||||
entry, index,
|
||||
ext, n_ext, NULL);
|
||||
buf_block_free(temp_block);
|
||||
|
||||
if (UNIV_UNLIKELY(!temp_rec)) {
|
||||
|
@ -1883,7 +1877,7 @@ btr_cur_optimistic_update(
|
|||
|
||||
btr_search_update_hash_on_delete(cursor);
|
||||
|
||||
page_cur_delete_rec(page_cursor, index, offsets, page_zip, mtr);
|
||||
page_cur_delete_rec(page_cursor, index, offsets, mtr);
|
||||
|
||||
page_cur_move_to_prev(page_cursor);
|
||||
|
||||
|
@ -1897,8 +1891,7 @@ btr_cur_optimistic_update(
|
|||
}
|
||||
|
||||
/* There are no externally stored columns in new_entry */
|
||||
rec = btr_cur_insert_if_possible(cursor, page_zip, new_entry,
|
||||
NULL, 0, mtr);
|
||||
rec = btr_cur_insert_if_possible(cursor, new_entry, NULL, 0, mtr);
|
||||
ut_a(rec); /* <- We calculated above the insert would fit */
|
||||
|
||||
if (!rec_get_deleted_flag(rec, page_is_comp(page))) {
|
||||
|
@ -2143,11 +2136,11 @@ btr_cur_pessimistic_update(
|
|||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
page_cur_delete_rec(page_cursor, index, offsets, page_zip, mtr);
|
||||
page_cur_delete_rec(page_cursor, index, offsets, mtr);
|
||||
|
||||
page_cur_move_to_prev(page_cursor);
|
||||
|
||||
rec = btr_cur_insert_if_possible(cursor, page_zip, new_entry,
|
||||
rec = btr_cur_insert_if_possible(cursor, new_entry,
|
||||
ext_vect, n_ext_vect, mtr);
|
||||
ut_a(rec || optim_err != DB_UNDERFLOW);
|
||||
|
||||
|
@ -2663,7 +2656,9 @@ btr_cur_optimistic_delete(
|
|||
if (no_compress_needed) {
|
||||
|
||||
page_t* page = buf_block_get_frame(block);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
page_zip_des_t* page_zip= buf_block_get_page_zip(block);
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
lock_update_delete(rec);
|
||||
|
||||
|
@ -2675,7 +2670,7 @@ btr_cur_optimistic_delete(
|
|||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
page_cur_delete_rec(btr_cur_get_page_cur(cursor),
|
||||
cursor->index, offsets, page_zip, mtr);
|
||||
cursor->index, offsets, mtr);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
@ -2836,8 +2831,7 @@ btr_cur_pessimistic_delete(
|
|||
|
||||
btr_search_update_hash_on_delete(cursor);
|
||||
|
||||
page_cur_delete_rec(btr_cur_get_page_cur(cursor), index,
|
||||
offsets, page_zip, mtr);
|
||||
page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
|
|
@ -408,8 +408,7 @@ btr_pcur_move_to_next_page(
|
|||
btr_leaf_page_release(btr_pcur_get_block(cursor),
|
||||
cursor->latch_mode, mtr);
|
||||
|
||||
btr_pcur_get_btr_cur(cursor)->page_block = next_block;
|
||||
page_cur_set_before_first(next_page, btr_pcur_get_page_cur(cursor));
|
||||
page_cur_set_before_first(next_block, btr_pcur_get_page_cur(cursor));
|
||||
|
||||
page_check_dir(next_page);
|
||||
}
|
||||
|
@ -478,8 +477,7 @@ btr_pcur_move_backward_from_page(
|
|||
btr_leaf_page_release(btr_pcur_get_block(cursor),
|
||||
latch_mode, mtr);
|
||||
|
||||
btr_pcur_get_btr_cur(cursor)->page_block = prev_block;
|
||||
page_cur_set_after_last(buf_block_get_frame(prev_block),
|
||||
page_cur_set_after_last(prev_block,
|
||||
btr_pcur_get_page_cur(cursor));
|
||||
} else {
|
||||
|
||||
|
|
|
@ -1276,23 +1276,17 @@ parameters as page (this often happens when a page is split). */
|
|||
void
|
||||
btr_search_move_or_delete_hash_entries(
|
||||
/*===================================*/
|
||||
page_t* new_page, /* in: records are copied
|
||||
buf_block_t* new_block, /* in: records are copied
|
||||
to this page */
|
||||
page_t* page, /* in: index page from which
|
||||
buf_block_t* block, /* in: index page from which
|
||||
records were copied, and the
|
||||
copied records will be deleted
|
||||
from this page */
|
||||
dict_index_t* index) /* in: record descriptor */
|
||||
{
|
||||
buf_block_t* block;
|
||||
buf_block_t* new_block;
|
||||
ulint n_fields;
|
||||
ulint n_bytes;
|
||||
ibool left_side;
|
||||
|
||||
block = buf_block_align(page);
|
||||
new_block = buf_block_align(new_page);
|
||||
ut_a(page_is_comp(page) == page_is_comp(new_page));
|
||||
ulint n_fields;
|
||||
ulint n_bytes;
|
||||
ibool left_side;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||
|
@ -1328,11 +1322,9 @@ btr_search_move_or_delete_hash_entries(
|
|||
|
||||
btr_search_build_page_hash_index(index, new_block, n_fields,
|
||||
n_bytes, left_side);
|
||||
#if 1 /* TODO: safe to remove? */
|
||||
ut_a(n_fields == block->curr_n_fields);
|
||||
ut_a(n_bytes == block->curr_n_bytes);
|
||||
ut_a(left_side == block->curr_left_side);
|
||||
#endif
|
||||
ut_ad(n_fields == block->curr_n_fields);
|
||||
ut_ad(n_bytes == block->curr_n_bytes);
|
||||
ut_ad(left_side == block->curr_left_side);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2917,7 +2917,7 @@ dump:
|
|||
return;
|
||||
}
|
||||
|
||||
low_match = page_cur_search(page, index, entry,
|
||||
low_match = page_cur_search(block, index, entry,
|
||||
PAGE_CUR_LE, &page_cur);
|
||||
|
||||
if (low_match == dtuple_get_n_fields(entry)) {
|
||||
|
@ -2925,23 +2925,21 @@ dump:
|
|||
|
||||
btr_cur_del_unmark_for_ibuf(rec, mtr);
|
||||
} else {
|
||||
rec = page_cur_tuple_insert(&page_cur,
|
||||
buf_block_get_page_zip(block),
|
||||
entry, index, NULL, 0, mtr);
|
||||
rec = page_cur_tuple_insert(&page_cur, entry, index,
|
||||
NULL, 0, mtr);
|
||||
|
||||
if (UNIV_UNLIKELY(rec == NULL)) {
|
||||
/* If the record did not fit, reorganize */
|
||||
|
||||
btr_page_reorganize(block, index, mtr);
|
||||
|
||||
page_cur_search(page, index, entry,
|
||||
page_cur_search(block, index, entry,
|
||||
PAGE_CUR_LE, &page_cur);
|
||||
|
||||
/* This time the record must fit */
|
||||
if (UNIV_UNLIKELY
|
||||
(!page_cur_tuple_insert(
|
||||
&page_cur, buf_block_get_page_zip(block),
|
||||
entry, index, NULL, 0, mtr))) {
|
||||
(!page_cur_tuple_insert(&page_cur, entry, index,
|
||||
NULL, 0, mtr))) {
|
||||
|
||||
ulint space;
|
||||
ulint page_no;
|
||||
|
|
|
@ -81,42 +81,42 @@ dulint
|
|||
btr_page_get_index_id(
|
||||
/*==================*/
|
||||
/* out: index id */
|
||||
page_t* page); /* in: index page */
|
||||
const page_t* page); /* in: index page */
|
||||
/************************************************************
|
||||
Gets the node level field in an index page. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
btr_page_get_level_low(
|
||||
/*===================*/
|
||||
/* out: level, leaf level == 0 */
|
||||
page_t* page); /* in: index page */
|
||||
/* out: level, leaf level == 0 */
|
||||
const page_t* page); /* in: index page */
|
||||
/************************************************************
|
||||
Gets the node level field in an index page. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
btr_page_get_level(
|
||||
/*===============*/
|
||||
/* out: level, leaf level == 0 */
|
||||
page_t* page, /* in: index page */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/* out: level, leaf level == 0 */
|
||||
const page_t* page, /* in: index page */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/************************************************************
|
||||
Gets the next index page number. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
btr_page_get_next(
|
||||
/*==============*/
|
||||
/* out: next page number */
|
||||
page_t* page, /* in: index page */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/* out: next page number */
|
||||
const page_t* page, /* in: index page */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/************************************************************
|
||||
Gets the previous index page number. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
btr_page_get_prev(
|
||||
/*==============*/
|
||||
/* out: prev page number */
|
||||
page_t* page, /* in: index page */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/* out: prev page number */
|
||||
const page_t* page, /* in: index page */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/*****************************************************************
|
||||
Gets pointer to the previous user record in the tree. It is assumed
|
||||
that the caller has appropriate latches on the page and its neighbor. */
|
||||
|
|
|
@ -80,7 +80,7 @@ dulint
|
|||
btr_page_get_index_id(
|
||||
/*==================*/
|
||||
/* out: index id */
|
||||
page_t* page) /* in: index page */
|
||||
const page_t* page) /* in: index page */
|
||||
{
|
||||
return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID));
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ UNIV_INLINE
|
|||
ulint
|
||||
btr_page_get_level_low(
|
||||
/*===================*/
|
||||
/* out: level, leaf level == 0 */
|
||||
page_t* page) /* in: index page */
|
||||
/* out: level, leaf level == 0 */
|
||||
const page_t* page) /* in: index page */
|
||||
{
|
||||
ulint level;
|
||||
|
||||
|
@ -111,9 +111,10 @@ UNIV_INLINE
|
|||
ulint
|
||||
btr_page_get_level(
|
||||
/*===============*/
|
||||
/* out: level, leaf level == 0 */
|
||||
page_t* page, /* in: index page */
|
||||
mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */
|
||||
/* out: level, leaf level == 0 */
|
||||
const page_t* page, /* in: index page */
|
||||
mtr_t* mtr __attribute__((unused)))
|
||||
/* in: mini-transaction handle */
|
||||
{
|
||||
ut_ad(page && mtr);
|
||||
|
||||
|
@ -152,9 +153,10 @@ UNIV_INLINE
|
|||
ulint
|
||||
btr_page_get_next(
|
||||
/*==============*/
|
||||
/* out: next page number */
|
||||
page_t* page, /* in: index page */
|
||||
mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */
|
||||
/* out: next page number */
|
||||
const page_t* page, /* in: index page */
|
||||
mtr_t* mtr __attribute__((unused)))
|
||||
/* in: mini-transaction handle */
|
||||
{
|
||||
ut_ad(page && mtr);
|
||||
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)
|
||||
|
@ -191,8 +193,8 @@ UNIV_INLINE
|
|||
ulint
|
||||
btr_page_get_prev(
|
||||
/*==============*/
|
||||
/* out: prev page number */
|
||||
page_t* page, /* in: index page */
|
||||
/* out: prev page number */
|
||||
const page_t* page, /* in: index page */
|
||||
mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */
|
||||
{
|
||||
ut_ad(page && mtr);
|
||||
|
|
|
@ -595,9 +595,6 @@ to know struct size! */
|
|||
struct btr_cur_struct {
|
||||
dict_index_t* index; /* index where positioned */
|
||||
page_cur_t page_cur; /* page cursor */
|
||||
buf_block_t* page_block; /* buffer pool block were
|
||||
cursor is positioned; needed
|
||||
to avoid buf_block_align() */
|
||||
buf_block_t* left_block; /* this field is used to store
|
||||
a pointer to the left neighbor
|
||||
page, in the cases
|
||||
|
|
|
@ -28,8 +28,7 @@ btr_cur_get_block(
|
|||
/* out: pointer to buffer block */
|
||||
btr_cur_t* cursor) /* in: tree cursor */
|
||||
{
|
||||
ut_ad(page_align(cursor->page_cur.rec) == cursor->page_block->frame);
|
||||
return(cursor->page_block);
|
||||
return(page_cur_get_block(btr_cur_get_page_cur(cursor)));
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
@ -41,7 +40,6 @@ btr_cur_get_rec(
|
|||
/* out: pointer to record */
|
||||
btr_cur_t* cursor) /* in: tree cursor */
|
||||
{
|
||||
ut_ad(page_align(cursor->page_cur.rec) == cursor->page_block->frame);
|
||||
return(page_cur_get_rec(&(cursor->page_cur)));
|
||||
}
|
||||
|
||||
|
@ -67,7 +65,6 @@ btr_cur_invalidate(
|
|||
btr_cur_t* cursor) /* in: tree cursor */
|
||||
{
|
||||
page_cur_invalidate(&(cursor->page_cur));
|
||||
cursor->page_block = NULL;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
@ -107,8 +104,7 @@ btr_cur_position(
|
|||
{
|
||||
ut_ad(page_align(rec) == buf_block_get_frame(block));
|
||||
|
||||
page_cur_position(rec, btr_cur_get_page_cur(cursor));
|
||||
cursor->page_block = block;
|
||||
page_cur_position(rec, block, btr_cur_get_page_cur(cursor));
|
||||
|
||||
cursor->index = index;
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ btr_pcur_move_to_last_on_page(
|
|||
UT_NOT_USED(mtr);
|
||||
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
|
||||
|
||||
page_cur_set_after_last(btr_pcur_get_page(cursor),
|
||||
page_cur_set_after_last(btr_pcur_get_block(cursor),
|
||||
btr_pcur_get_page_cur(cursor));
|
||||
|
||||
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
|
||||
|
@ -633,8 +633,8 @@ btr_pcur_close(
|
|||
cursor->old_rec_buf = NULL;
|
||||
}
|
||||
|
||||
cursor->btr_cur.page_block = NULL;
|
||||
cursor->btr_cur.page_cur.rec = NULL;
|
||||
cursor->btr_cur.page_cur.block = NULL;
|
||||
cursor->old_rec = NULL;
|
||||
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
|
||||
|
||||
|
|
|
@ -77,9 +77,12 @@ parameters as page (this often happens when a page is split). */
|
|||
void
|
||||
btr_search_move_or_delete_hash_entries(
|
||||
/*===================================*/
|
||||
page_t* new_page, /* in: records are copied
|
||||
buf_block_t* new_block, /* in: records are copied
|
||||
to this page */
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page from which
|
||||
records were copied, and the
|
||||
copied records will be deleted
|
||||
from this page */
|
||||
dict_index_t* index); /* in: record descriptor */
|
||||
/************************************************************************
|
||||
Drops a page hash index. */
|
||||
|
|
|
@ -581,16 +581,18 @@ UNIV_INLINE
|
|||
ulint
|
||||
buf_block_get_space(
|
||||
/*================*/
|
||||
/* out: space id */
|
||||
buf_block_t* block); /* in: pointer to the control block */
|
||||
/* out: space id */
|
||||
const buf_block_t* block) /* in: pointer to the control block */
|
||||
__attribute((const));
|
||||
/*************************************************************************
|
||||
Gets the page number of a block. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_block_get_page_no(
|
||||
/*==================*/
|
||||
/* out: page number */
|
||||
buf_block_t* block); /* in: pointer to the control block */
|
||||
/* out: page number */
|
||||
const buf_block_t* block) /* in: pointer to the control block */
|
||||
__attribute((const));
|
||||
/*************************************************************************
|
||||
Gets the compressed page size of a block. */
|
||||
UNIV_INLINE
|
||||
|
|
|
@ -162,8 +162,8 @@ UNIV_INLINE
|
|||
ulint
|
||||
buf_block_get_space(
|
||||
/*================*/
|
||||
/* out: space id */
|
||||
buf_block_t* block) /* in: pointer to the control block */
|
||||
/* out: space id */
|
||||
const buf_block_t* block) /* in: pointer to the control block */
|
||||
{
|
||||
ut_ad(block);
|
||||
ut_ad(block >= buf_pool->blocks);
|
||||
|
@ -180,8 +180,8 @@ UNIV_INLINE
|
|||
ulint
|
||||
buf_block_get_page_no(
|
||||
/*==================*/
|
||||
/* out: page number */
|
||||
buf_block_t* block) /* in: pointer to the control block */
|
||||
/* out: page number */
|
||||
const buf_block_t* block) /* in: pointer to the control block */
|
||||
{
|
||||
ut_ad(block);
|
||||
ut_ad(block >= buf_pool->blocks);
|
||||
|
|
|
@ -293,10 +293,10 @@ Checks if memo contains the given page. */
|
|||
ibool
|
||||
mtr_memo_contains_page(
|
||||
/*===================*/
|
||||
/* out: TRUE if contains */
|
||||
mtr_t* mtr, /* in: mtr */
|
||||
byte* ptr, /* in: pointer to buffer frame */
|
||||
ulint type); /* in: type of object */
|
||||
/* out: TRUE if contains */
|
||||
mtr_t* mtr, /* in: mtr */
|
||||
const byte* ptr, /* in: pointer to buffer frame */
|
||||
ulint type); /* in: type of object */
|
||||
/*************************************************************
|
||||
Prints info of an mtr handle. */
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ Created 10/4/1994 Heikki Tuuri
|
|||
|
||||
#include "univ.i"
|
||||
|
||||
#include "page0types.h"
|
||||
#include "buf0types.h"
|
||||
#include "page0page.h"
|
||||
#include "rem0rec.h"
|
||||
#include "data0data.h"
|
||||
|
@ -49,6 +49,22 @@ page_cur_get_page(
|
|||
/* out: page */
|
||||
page_cur_t* cur); /* in: page cursor */
|
||||
/*************************************************************
|
||||
Gets pointer to the buffer block where the cursor is positioned. */
|
||||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
page_cur_get_block(
|
||||
/*===============*/
|
||||
/* out: page */
|
||||
page_cur_t* cur); /* in: page cursor */
|
||||
/*************************************************************
|
||||
Gets pointer to the page frame where the cursor is positioned. */
|
||||
UNIV_INLINE
|
||||
page_zip_des_t*
|
||||
page_cur_get_page_zip(
|
||||
/*==================*/
|
||||
/* out: page */
|
||||
page_cur_t* cur); /* in: page cursor */
|
||||
/*************************************************************
|
||||
Gets the record where the cursor is positioned. */
|
||||
UNIV_INLINE
|
||||
rec_t*
|
||||
|
@ -63,7 +79,7 @@ UNIV_INLINE
|
|||
void
|
||||
page_cur_set_before_first(
|
||||
/*======================*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
page_cur_t* cur); /* in: cursor */
|
||||
/*************************************************************
|
||||
Sets the cursor object to point after the last user record on
|
||||
|
@ -72,7 +88,7 @@ UNIV_INLINE
|
|||
void
|
||||
page_cur_set_after_last(
|
||||
/*====================*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
page_cur_t* cur); /* in: cursor */
|
||||
/*************************************************************
|
||||
Returns TRUE if the cursor is before first user record on page. */
|
||||
|
@ -97,7 +113,8 @@ void
|
|||
page_cur_position(
|
||||
/*==============*/
|
||||
rec_t* rec, /* in: record on a page */
|
||||
page_cur_t* cur); /* in: page cursor */
|
||||
buf_block_t* block, /* in: buffer block containing the record */
|
||||
page_cur_t* cur); /* out: page cursor */
|
||||
/**************************************************************
|
||||
Invalidates a page cursor by setting the record pointer NULL. */
|
||||
UNIV_INLINE
|
||||
|
@ -130,7 +147,6 @@ page_cur_tuple_insert(
|
|||
/* out: pointer to record if succeed, NULL
|
||||
otherwise */
|
||||
page_cur_t* cursor, /* in: a page cursor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
const dtuple_t* tuple, /* in: pointer to a data tuple */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const ulint* ext, /* in: array of extern field numbers */
|
||||
|
@ -147,7 +163,6 @@ page_cur_rec_insert(
|
|||
/* out: pointer to record if succeed, NULL
|
||||
otherwise */
|
||||
page_cur_t* cursor, /* in: a page cursor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
rec_t* rec, /* in: record to insert */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
|
||||
|
@ -163,8 +178,9 @@ page_cur_insert_rec_low(
|
|||
/*====================*/
|
||||
/* out: pointer to record if succeed, NULL
|
||||
otherwise */
|
||||
page_cur_t* cursor, /* in: a page cursor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
rec_t* current_rec,/* in: current record after which the
|
||||
new record is inserted */
|
||||
page_zip_des_t* page_zip,/* in: compressed page, or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
rec_t* rec, /* in: pointer to a physical record */
|
||||
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
|
||||
|
@ -190,7 +206,6 @@ page_cur_delete_rec(
|
|||
page_cur_t* cursor, /* in/out: a page cursor */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed, or NULL */
|
||||
mtr_t* mtr); /* in: mini-transaction handle */
|
||||
/********************************************************************
|
||||
Searches the right position for a page cursor. */
|
||||
|
@ -199,7 +214,7 @@ ulint
|
|||
page_cur_search(
|
||||
/*============*/
|
||||
/* out: number of matched fields on the left */
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: buffer block */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const dtuple_t* tuple, /* in: data tuple */
|
||||
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
|
||||
|
@ -211,7 +226,7 @@ Searches the right position for a page cursor. */
|
|||
void
|
||||
page_cur_search_with_match(
|
||||
/*=======================*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: buffer block */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const dtuple_t* tuple, /* in: data tuple */
|
||||
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
|
||||
|
@ -236,8 +251,8 @@ are no user records, sets the cursor on the infimum record. */
|
|||
void
|
||||
page_cur_open_on_rnd_user_rec(
|
||||
/*==========================*/
|
||||
page_t* page, /* in: page */
|
||||
page_cur_t* cursor);/* in/out: page cursor */
|
||||
buf_block_t* block, /* in: page */
|
||||
page_cur_t* cursor);/* out: page cursor */
|
||||
/***************************************************************
|
||||
Parses a log record of a record insert on a page. */
|
||||
|
||||
|
@ -248,9 +263,8 @@ page_cur_parse_insert_rec(
|
|||
ibool is_short,/* in: TRUE if short inserts */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in: page or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr); /* in: mtr or NULL */
|
||||
/**************************************************************
|
||||
Parses a log record of copying a record list end to a new created page. */
|
||||
|
@ -261,9 +275,8 @@ page_parse_copy_rec_list_to_created_page(
|
|||
/* out: end of log record or NULL */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in: page or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page or NULL */
|
||||
mtr_t* mtr); /* in: mtr or NULL */
|
||||
/***************************************************************
|
||||
Parses log record of a record delete on a page. */
|
||||
|
@ -274,15 +287,15 @@ page_cur_parse_delete_rec(
|
|||
/* out: pointer to record end or NULL */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in: page or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr); /* in: mtr or NULL */
|
||||
|
||||
/* Index page cursor */
|
||||
|
||||
struct page_cur_struct{
|
||||
byte* rec; /* pointer to a record on page */
|
||||
byte* rec; /* pointer to a record on page */
|
||||
buf_block_t* block; /* pointer to the block containing rec */
|
||||
};
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
|
|
|
@ -7,6 +7,7 @@ Created 10/4/1994 Heikki Tuuri
|
|||
*************************************************************************/
|
||||
|
||||
#include "page0page.h"
|
||||
#include "buf0types.h"
|
||||
|
||||
|
||||
/*************************************************************
|
||||
|
@ -23,6 +24,32 @@ page_cur_get_page(
|
|||
return(page_align(cur->rec));
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
Gets pointer to the buffer block where the cursor is positioned. */
|
||||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
page_cur_get_block(
|
||||
/*===============*/
|
||||
/* out: page */
|
||||
page_cur_t* cur) /* in: page cursor */
|
||||
{
|
||||
ut_ad(cur);
|
||||
ut_ad(page_align(cur->rec) == cur->block->frame);
|
||||
return(cur->block);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
Gets pointer to the page frame where the cursor is positioned. */
|
||||
UNIV_INLINE
|
||||
page_zip_des_t*
|
||||
page_cur_get_page_zip(
|
||||
/*==================*/
|
||||
/* out: page */
|
||||
page_cur_t* cur) /* in: page cursor */
|
||||
{
|
||||
return(buf_block_get_page_zip(page_cur_get_block(cur)));
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
Gets the record where the cursor is positioned. */
|
||||
UNIV_INLINE
|
||||
|
@ -33,6 +60,7 @@ page_cur_get_rec(
|
|||
page_cur_t* cur) /* in: page cursor */
|
||||
{
|
||||
ut_ad(cur);
|
||||
ut_ad(page_align(cur->rec) == cur->block->frame);
|
||||
|
||||
return(cur->rec);
|
||||
}
|
||||
|
@ -44,10 +72,11 @@ UNIV_INLINE
|
|||
void
|
||||
page_cur_set_before_first(
|
||||
/*======================*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
page_cur_t* cur) /* in: cursor */
|
||||
{
|
||||
cur->rec = page_get_infimum_rec(page);
|
||||
cur->rec = page_get_infimum_rec(buf_block_get_frame(block));
|
||||
cur->block = block;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
@ -57,10 +86,11 @@ UNIV_INLINE
|
|||
void
|
||||
page_cur_set_after_last(
|
||||
/*====================*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
page_cur_t* cur) /* in: cursor */
|
||||
{
|
||||
cur->rec = page_get_supremum_rec(page);
|
||||
cur->rec = page_get_supremum_rec(buf_block_get_frame(block));
|
||||
cur->block = block;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
@ -94,11 +124,14 @@ void
|
|||
page_cur_position(
|
||||
/*==============*/
|
||||
rec_t* rec, /* in: record on a page */
|
||||
page_cur_t* cur) /* in: page cursor */
|
||||
buf_block_t* block, /* in: buffer block containing the record */
|
||||
page_cur_t* cur) /* out: page cursor */
|
||||
{
|
||||
ut_ad(rec && cur);
|
||||
ut_ad(rec && block && cur);
|
||||
ut_ad(page_align(rec) == block->frame);
|
||||
|
||||
cur->rec = rec;
|
||||
cur->block = block;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
|
@ -112,6 +145,7 @@ page_cur_invalidate(
|
|||
ut_ad(cur);
|
||||
|
||||
cur->rec = NULL;
|
||||
cur->block = NULL;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
|
@ -147,7 +181,7 @@ ulint
|
|||
page_cur_search(
|
||||
/*============*/
|
||||
/* out: number of matched fields on the left */
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: buffer block */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const dtuple_t* tuple, /* in: data tuple */
|
||||
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
|
||||
|
@ -161,7 +195,7 @@ page_cur_search(
|
|||
|
||||
ut_ad(dtuple_check_typed(tuple));
|
||||
|
||||
page_cur_search_with_match(page, index, tuple, mode,
|
||||
page_cur_search_with_match(block, index, tuple, mode,
|
||||
&up_matched_fields,
|
||||
&up_matched_bytes,
|
||||
&low_matched_fields,
|
||||
|
@ -181,7 +215,6 @@ page_cur_tuple_insert(
|
|||
/* out: pointer to record if succeed, NULL
|
||||
otherwise */
|
||||
page_cur_t* cursor, /* in: a page cursor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
const dtuple_t* tuple, /* in: pointer to a data tuple */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const ulint* ext, /* in: array of extern field numbers */
|
||||
|
@ -202,7 +235,8 @@ page_cur_tuple_insert(
|
|||
index, tuple, ext, n_ext);
|
||||
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
|
||||
|
||||
rec = page_cur_insert_rec_low(cursor, page_zip,
|
||||
rec = page_cur_insert_rec_low(cursor->rec,
|
||||
buf_block_get_page_zip(cursor->block),
|
||||
index, rec, offsets, mtr);
|
||||
mem_heap_free(heap);
|
||||
return(rec);
|
||||
|
@ -219,13 +253,13 @@ page_cur_rec_insert(
|
|||
/* out: pointer to record if succeed, NULL
|
||||
otherwise */
|
||||
page_cur_t* cursor, /* in: a page cursor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
rec_t* rec, /* in: record to insert */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
|
||||
mtr_t* mtr) /* in: mini-transaction handle, or NULL */
|
||||
{
|
||||
return(page_cur_insert_rec_low(cursor, page_zip,
|
||||
return(page_cur_insert_rec_low(cursor->rec,
|
||||
buf_block_get_page_zip(cursor->block),
|
||||
index, rec, offsets, mtr));
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,14 @@ typedef byte page_header_t;
|
|||
a new-style compact page */
|
||||
/*-----------------------------*/
|
||||
|
||||
/* Heap numbers */
|
||||
#define PAGE_HEAP_NO_INFIMUM 0 /* page infimum */
|
||||
#define PAGE_HEAP_NO_SUPREMUM 1 /* page supremum */
|
||||
#define PAGE_HEAP_NO_USER_LOW 2 /* first user record in
|
||||
creation (insertion) order,
|
||||
not necessarily collation order;
|
||||
this record may have been deleted */
|
||||
|
||||
/* Directions of cursor movement */
|
||||
#define PAGE_LEFT 1
|
||||
#define PAGE_RIGHT 2
|
||||
|
@ -681,7 +689,8 @@ touch the lock table and max trx id on page or compress the page. */
|
|||
void
|
||||
page_copy_rec_list_end_no_locks(
|
||||
/*============================*/
|
||||
page_t* new_page, /* in: index page to copy to */
|
||||
buf_block_t* new_block, /* in: index page to copy to */
|
||||
buf_block_t* block, /* in: index page of rec */
|
||||
rec_t* rec, /* in: record on page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
|
@ -696,9 +705,9 @@ page_copy_rec_list_end(
|
|||
/* out: pointer to the original
|
||||
successor of the infimum record
|
||||
on new_page, or NULL on zip overflow
|
||||
(new_page will be decompressed
|
||||
from new_page_zip) */
|
||||
(new_block will be decompressed) */
|
||||
buf_block_t* new_block, /* in/out: index page to copy to */
|
||||
buf_block_t* block, /* in: index page containing rec */
|
||||
rec_t* rec, /* in: record on page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
|
@ -714,9 +723,9 @@ page_copy_rec_list_start(
|
|||
/* out: pointer to the original
|
||||
predecessor of the supremum record
|
||||
on new_page, or NULL on zip overflow
|
||||
(new_page will be decompressed
|
||||
from new_page_zip) */
|
||||
(new_block will be decompressed) */
|
||||
buf_block_t* new_block, /* in/out: index page to copy to */
|
||||
buf_block_t* block, /* in: index page containing rec */
|
||||
rec_t* rec, /* in: record on page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
|
@ -729,15 +738,15 @@ void
|
|||
page_delete_rec_list_end(
|
||||
/*=====================*/
|
||||
rec_t* rec, /* in: pointer to record on page */
|
||||
buf_block_t* block, /* in: buffer block of the page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
ulint n_recs, /* in: number of records to delete,
|
||||
or ULINT_UNDEFINED if not known */
|
||||
ulint size, /* in: the sum of the sizes of the
|
||||
records in the end of the chain to
|
||||
delete, or ULINT_UNDEFINED if not known */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
__attribute__((nonnull(1, 2, 6)));
|
||||
__attribute__((nonnull));
|
||||
/*****************************************************************
|
||||
Deletes records from page, up to the given record, NOT including
|
||||
that record. Infimum and supremum records are not deleted. */
|
||||
|
@ -746,10 +755,10 @@ void
|
|||
page_delete_rec_list_start(
|
||||
/*=======================*/
|
||||
rec_t* rec, /* in: record on page */
|
||||
buf_block_t* block, /* in: buffer block of the page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page of rec, or NULL */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
__attribute__((nonnull(1, 2, 4)));
|
||||
__attribute__((nonnull));
|
||||
/*****************************************************************
|
||||
Moves record list end to another page. Moved records include
|
||||
split_rec. */
|
||||
|
@ -758,12 +767,11 @@ ibool
|
|||
page_move_rec_list_end(
|
||||
/*===================*/
|
||||
/* out: TRUE on success; FALSE on
|
||||
compression failure (new_page will
|
||||
be decompressed from new_page_zip) */
|
||||
compression failure
|
||||
(new_block will be decompressed) */
|
||||
buf_block_t* new_block, /* in/out: index page where to move */
|
||||
buf_block_t* block, /* in: index page from where to move */
|
||||
rec_t* split_rec, /* in: first record to move */
|
||||
page_zip_des_t* page_zip, /* in/out: compressed page of
|
||||
split_rec, or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
__attribute__((nonnull(1, 2, 4, 5)));
|
||||
|
@ -777,9 +785,8 @@ page_move_rec_list_start(
|
|||
/* out: TRUE on success; FALSE on
|
||||
compression failure */
|
||||
buf_block_t* new_block, /* in/out: index page where to move */
|
||||
buf_block_t* block, /* in/out: page containing split_rec */
|
||||
rec_t* split_rec, /* in: first record not to move */
|
||||
page_zip_des_t* page_zip, /* in/out: compressed page of
|
||||
split_rec, or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
__attribute__((nonnull(1, 2, 4, 5)));
|
||||
|
@ -820,9 +827,8 @@ page_parse_delete_rec_list(
|
|||
MLOG_COMP_LIST_START_DELETE */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in/out: buffer block or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page or NULL */
|
||||
mtr_t* mtr); /* in: mtr or NULL */
|
||||
/***************************************************************
|
||||
Parses a redo log record of creating a page. */
|
||||
|
@ -874,7 +880,7 @@ debugging purposes. */
|
|||
void
|
||||
page_print_list(
|
||||
/*============*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
dict_index_t* index, /* in: dictionary index of the page */
|
||||
ulint pr_n); /* in: print n first and n last entries */
|
||||
/*******************************************************************
|
||||
|
@ -883,7 +889,7 @@ Prints the info in a page header. */
|
|||
void
|
||||
page_header_print(
|
||||
/*==============*/
|
||||
page_t* page);
|
||||
const page_t* page);
|
||||
/*******************************************************************
|
||||
This is used to print the contents of the page for
|
||||
debugging purposes. */
|
||||
|
@ -891,7 +897,7 @@ debugging purposes. */
|
|||
void
|
||||
page_print(
|
||||
/*=======*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
dict_index_t* index, /* in: dictionary index of the page */
|
||||
ulint dn, /* in: print dn first and last entries
|
||||
in directory */
|
||||
|
@ -936,7 +942,7 @@ ibool
|
|||
page_simple_validate_new(
|
||||
/*=====================*/
|
||||
/* out: TRUE if ok */
|
||||
page_t* page); /* in: new-style index page */
|
||||
page_t* block); /* in: new-style index page */
|
||||
/*******************************************************************
|
||||
This function checks the consistency of an index page. */
|
||||
|
||||
|
@ -950,12 +956,12 @@ page_validate(
|
|||
/*******************************************************************
|
||||
Looks in the page record list for a record with the given heap number. */
|
||||
|
||||
rec_t*
|
||||
const rec_t*
|
||||
page_find_rec_with_heap_no(
|
||||
/*=======================*/
|
||||
/* out: record, NULL if not found */
|
||||
page_t* page, /* in: index page */
|
||||
ulint heap_no);/* in: heap number */
|
||||
/* out: record, NULL if not found */
|
||||
const page_t* page, /* in: index page */
|
||||
ulint heap_no);/* in: heap number */
|
||||
|
||||
#ifdef UNIV_MATERIALIZE
|
||||
#undef UNIV_INLINE
|
||||
|
|
|
@ -2702,8 +2702,8 @@ lock_move_reorganize_page(
|
|||
update of a record is occurring on the page, and its locks
|
||||
were temporarily stored on the infimum */
|
||||
|
||||
page_cur_set_before_first(page, &cur1);
|
||||
page_cur_set_before_first(old_page, &cur2);
|
||||
page_cur_set_before_first(buf_block_align(page), &cur1);
|
||||
page_cur_set_before_first(buf_block_align(old_page), &cur2);
|
||||
|
||||
/* Set locks according to old locks */
|
||||
for (;;) {
|
||||
|
@ -2798,13 +2798,13 @@ lock_move_rec_list_end(
|
|||
|
||||
while (lock != NULL) {
|
||||
|
||||
page_cur_position(rec, &cur1);
|
||||
page_cur_position(rec, buf_block_align(rec), &cur1);
|
||||
|
||||
if (page_cur_is_before_first(&cur1)) {
|
||||
page_cur_move_to_next(&cur1);
|
||||
}
|
||||
|
||||
page_cur_set_before_first(new_page, &cur2);
|
||||
page_cur_set_before_first(buf_block_align(new_page), &cur2);
|
||||
page_cur_move_to_next(&cur2);
|
||||
|
||||
/* Copy lock requests on user records to new page and
|
||||
|
@ -2894,10 +2894,10 @@ lock_move_rec_list_start(
|
|||
|
||||
while (lock != NULL) {
|
||||
|
||||
page_cur_set_before_first(page, &cur1);
|
||||
page_cur_set_before_first(buf_block_align(page), &cur1);
|
||||
page_cur_move_to_next(&cur1);
|
||||
|
||||
page_cur_position(old_end, &cur2);
|
||||
page_cur_position(old_end, buf_block_align(old_end), &cur2);
|
||||
page_cur_move_to_next(&cur2);
|
||||
|
||||
/* Copy lock requests on user records to new page and
|
||||
|
@ -4302,7 +4302,7 @@ lock_rec_print(
|
|||
fprintf(file, "Record lock, heap no %lu ", (ulong) i);
|
||||
|
||||
if (block) {
|
||||
rec_t* rec
|
||||
const rec_t* rec
|
||||
= page_find_rec_with_heap_no(
|
||||
buf_block_get_frame(block), i);
|
||||
offsets = rec_get_offsets(
|
||||
|
|
|
@ -803,8 +803,7 @@ recv_parse_or_apply_log_rec_body(
|
|||
|| (ibool)!!page_is_comp(page)
|
||||
== dict_table_is_comp(index->table));
|
||||
ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr,
|
||||
index,
|
||||
page, page_zip, mtr);
|
||||
block, index, mtr);
|
||||
}
|
||||
break;
|
||||
case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK:
|
||||
|
@ -856,8 +855,7 @@ recv_parse_or_apply_log_rec_body(
|
|||
|| (ibool)!!page_is_comp(page)
|
||||
== dict_table_is_comp(index->table));
|
||||
ptr = page_parse_delete_rec_list(type, ptr, end_ptr,
|
||||
index, page,
|
||||
page_zip, mtr);
|
||||
block, index, mtr);
|
||||
}
|
||||
break;
|
||||
case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED:
|
||||
|
@ -869,7 +867,7 @@ recv_parse_or_apply_log_rec_body(
|
|||
|| (ibool)!!page_is_comp(page)
|
||||
== dict_table_is_comp(index->table));
|
||||
ptr = page_parse_copy_rec_list_to_created_page(
|
||||
ptr, end_ptr, index, page, page_zip, mtr);
|
||||
ptr, end_ptr, block, index, mtr);
|
||||
}
|
||||
break;
|
||||
case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE:
|
||||
|
@ -925,8 +923,8 @@ recv_parse_or_apply_log_rec_body(
|
|||
ut_a(!page
|
||||
|| (ibool)!!page_is_comp(page)
|
||||
== dict_table_is_comp(index->table));
|
||||
ptr = page_cur_parse_delete_rec(ptr, end_ptr, index,
|
||||
page, page_zip, mtr);
|
||||
ptr = page_cur_parse_delete_rec(ptr, end_ptr,
|
||||
block, index, mtr);
|
||||
}
|
||||
break;
|
||||
case MLOG_IBUF_BITMAP_INIT:
|
||||
|
|
|
@ -317,12 +317,12 @@ Checks if memo contains the given page. */
|
|||
ibool
|
||||
mtr_memo_contains_page(
|
||||
/*===================*/
|
||||
/* out: TRUE if contains */
|
||||
mtr_t* mtr, /* in: mtr */
|
||||
byte* ptr, /* in: pointer to buffer frame */
|
||||
ulint type) /* in: type of object */
|
||||
/* out: TRUE if contains */
|
||||
mtr_t* mtr, /* in: mtr */
|
||||
const byte* ptr, /* in: pointer to buffer frame */
|
||||
ulint type) /* in: type of object */
|
||||
{
|
||||
return(mtr_memo_contains(mtr, buf_block_align(ptr), type));
|
||||
return(mtr_memo_contains(mtr, buf_block_align((byte*) ptr), type));
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
|
139
page/page0cur.c
139
page/page0cur.c
|
@ -31,7 +31,7 @@ ibool
|
|||
page_cur_try_search_shortcut(
|
||||
/*=========================*/
|
||||
/* out: TRUE on success */
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const dtuple_t* tuple, /* in: data tuple */
|
||||
ulint* iup_matched_fields,
|
||||
|
@ -48,16 +48,17 @@ page_cur_try_search_shortcut(
|
|||
not yet completely matched */
|
||||
page_cur_t* cursor) /* out: page cursor */
|
||||
{
|
||||
rec_t* rec;
|
||||
rec_t* next_rec;
|
||||
ulint low_match;
|
||||
ulint low_bytes;
|
||||
ulint up_match;
|
||||
ulint up_bytes;
|
||||
rec_t* rec;
|
||||
const rec_t* next_rec;
|
||||
ulint low_match;
|
||||
ulint low_bytes;
|
||||
ulint up_match;
|
||||
ulint up_bytes;
|
||||
#ifdef UNIV_SEARCH_DEBUG
|
||||
page_cur_t cursor2;
|
||||
page_cur_t cursor2;
|
||||
#endif
|
||||
ibool success = FALSE;
|
||||
page_t* page = buf_block_get_frame(block);
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||
ulint* offsets = offsets_;
|
||||
|
@ -93,10 +94,10 @@ page_cur_try_search_shortcut(
|
|||
goto exit_func;
|
||||
}
|
||||
|
||||
cursor->rec = rec;
|
||||
page_cur_position(rec, block, cursor);
|
||||
|
||||
#ifdef UNIV_SEARCH_DEBUG
|
||||
page_cur_search_with_match(page, index, tuple, PAGE_CUR_DBG,
|
||||
page_cur_search_with_match(block, index, tuple, PAGE_CUR_DBG,
|
||||
iup_matched_fields,
|
||||
iup_matched_bytes,
|
||||
ilow_matched_fields,
|
||||
|
@ -104,7 +105,7 @@ page_cur_try_search_shortcut(
|
|||
&cursor2);
|
||||
ut_a(cursor2.rec == cursor->rec);
|
||||
|
||||
if (next_rec != page_get_supremum_rec(page)) {
|
||||
if (!page_rec_is_supremum(next_rec)) {
|
||||
|
||||
ut_a(*iup_matched_fields == up_match);
|
||||
ut_a(*iup_matched_bytes == up_bytes);
|
||||
|
@ -193,7 +194,7 @@ Searches the right position for a page cursor. */
|
|||
void
|
||||
page_cur_search_with_match(
|
||||
/*=======================*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: buffer block */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const dtuple_t* tuple, /* in: data tuple */
|
||||
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
|
||||
|
@ -215,6 +216,7 @@ page_cur_search_with_match(
|
|||
ulint up;
|
||||
ulint low;
|
||||
ulint mid;
|
||||
page_t* page;
|
||||
page_dir_slot_t* slot;
|
||||
rec_t* up_rec;
|
||||
rec_t* low_rec;
|
||||
|
@ -236,10 +238,9 @@ page_cur_search_with_match(
|
|||
ulint* offsets = offsets_;
|
||||
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||
|
||||
ut_ad(page && tuple && iup_matched_fields && iup_matched_bytes
|
||||
ut_ad(block && tuple && iup_matched_fields && iup_matched_bytes
|
||||
&& ilow_matched_fields && ilow_matched_bytes && cursor);
|
||||
ut_ad(dtuple_validate(tuple));
|
||||
ut_ad(dtuple_check_typed(tuple));
|
||||
#ifdef UNIV_DEBUG
|
||||
# ifdef PAGE_CUR_DBG
|
||||
if (mode != PAGE_CUR_DBG)
|
||||
|
@ -250,8 +251,9 @@ page_cur_search_with_match(
|
|||
ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE
|
||||
|| mode == PAGE_CUR_G || mode == PAGE_CUR_GE);
|
||||
#endif /* UNIV_DEBUG */
|
||||
page = buf_block_get_frame(block);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
page_zip_des_t* page_zip = buf_frame_get_page_zip(page);
|
||||
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
|
@ -265,7 +267,7 @@ page_cur_search_with_match(
|
|||
&& (page_header_get_field(page, PAGE_DIRECTION) == PAGE_RIGHT)) {
|
||||
|
||||
if (page_cur_try_search_shortcut(
|
||||
page, index, tuple,
|
||||
block, index, tuple,
|
||||
iup_matched_fields, iup_matched_bytes,
|
||||
ilow_matched_fields, ilow_matched_bytes,
|
||||
cursor)) {
|
||||
|
@ -465,9 +467,9 @@ up_rec_match:
|
|||
}
|
||||
#endif
|
||||
if (mode <= PAGE_CUR_GE) {
|
||||
cursor->rec = up_rec;
|
||||
page_cur_position(up_rec, block, cursor);
|
||||
} else {
|
||||
cursor->rec = low_rec;
|
||||
page_cur_position(low_rec, block, cursor);
|
||||
}
|
||||
|
||||
*iup_matched_fields = up_matched_fields;
|
||||
|
@ -486,33 +488,26 @@ are no user records, sets the cursor on the infimum record. */
|
|||
void
|
||||
page_cur_open_on_rnd_user_rec(
|
||||
/*==========================*/
|
||||
page_t* page, /* in: page */
|
||||
page_cur_t* cursor) /* in/out: page cursor */
|
||||
buf_block_t* block, /* in: page */
|
||||
page_cur_t* cursor) /* out: page cursor */
|
||||
{
|
||||
ulint rnd;
|
||||
rec_t* rec;
|
||||
ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
|
||||
|
||||
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
|
||||
page_cur_position(page_get_infimum_rec(page), cursor);
|
||||
page_cur_set_before_first(block, cursor);
|
||||
|
||||
if (UNIV_UNLIKELY(n_recs == 0)) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
page_rnd += 87584577;
|
||||
|
||||
rnd = page_rnd % page_get_n_recs(page);
|
||||
rnd = page_rnd % n_recs;
|
||||
|
||||
rec = page_get_infimum_rec(page);
|
||||
|
||||
rec = page_rec_get_next(rec);
|
||||
|
||||
while (rnd > 0) {
|
||||
rec = page_rec_get_next(rec);
|
||||
|
||||
rnd--;
|
||||
}
|
||||
|
||||
page_cur_position(rec, cursor);
|
||||
do {
|
||||
page_cur_move_to_next(cursor);
|
||||
} while (rnd--);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
|
@ -707,18 +702,18 @@ page_cur_parse_insert_rec(
|
|||
ibool is_short,/* in: TRUE if short inserts */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in: page or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr) /* in: mtr or NULL */
|
||||
{
|
||||
ulint origin_offset;
|
||||
ulint end_seg_len;
|
||||
ulint mismatch_index;
|
||||
page_t* page;
|
||||
rec_t* cursor_rec;
|
||||
byte buf1[1024];
|
||||
byte* buf;
|
||||
byte* ptr2 = ptr;
|
||||
byte* ptr2 = ptr;
|
||||
ulint info_and_status_bits = 0; /* remove warning */
|
||||
page_cur_t cursor;
|
||||
mem_heap_t* heap = NULL;
|
||||
|
@ -726,6 +721,8 @@ page_cur_parse_insert_rec(
|
|||
ulint* offsets = offsets_;
|
||||
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||
|
||||
page = block ? buf_block_get_frame(block) : NULL;
|
||||
|
||||
if (is_short) {
|
||||
cursor_rec = page_rec_get_prev(page_get_supremum_rec(page));
|
||||
} else {
|
||||
|
@ -799,13 +796,13 @@ page_cur_parse_insert_rec(
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
if (page == NULL) {
|
||||
if (!block) {
|
||||
|
||||
return(ptr + (end_seg_len >> 1));
|
||||
}
|
||||
|
||||
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
|
||||
ut_ad(!page_zip || page_is_comp(page));
|
||||
ut_ad(!buf_block_get_page_zip(block) || page_is_comp(page));
|
||||
|
||||
/* Read from the log the inserted index record end segment which
|
||||
differs from the cursor record */
|
||||
|
@ -861,11 +858,11 @@ page_cur_parse_insert_rec(
|
|||
info_and_status_bits);
|
||||
}
|
||||
|
||||
page_cur_position(cursor_rec, &cursor);
|
||||
page_cur_position(cursor_rec, block, &cursor);
|
||||
|
||||
offsets = rec_get_offsets(buf + origin_offset, index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
if (UNIV_UNLIKELY(!page_cur_rec_insert(&cursor, page_zip,
|
||||
if (UNIV_UNLIKELY(!page_cur_rec_insert(&cursor,
|
||||
buf + origin_offset,
|
||||
index, offsets, mtr))) {
|
||||
/* The redo log record should only have been written
|
||||
|
@ -896,8 +893,9 @@ page_cur_insert_rec_low(
|
|||
/*====================*/
|
||||
/* out: pointer to record if succeed, NULL
|
||||
otherwise */
|
||||
page_cur_t* cursor, /* in: a page cursor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
rec_t* current_rec,/* in: current record after which the
|
||||
new record is inserted */
|
||||
page_zip_des_t* page_zip,/* in: compressed page, or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
rec_t* rec, /* in: pointer to a physical record */
|
||||
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
|
||||
|
@ -905,7 +903,7 @@ page_cur_insert_rec_low(
|
|||
{
|
||||
byte* insert_buf = NULL;
|
||||
ulint rec_size;
|
||||
byte* page; /* the relevant page */
|
||||
page_t* page; /* the relevant page */
|
||||
rec_t* last_insert; /* cursor position at previous
|
||||
insert */
|
||||
rec_t* free_rec; /* a free record that was reused,
|
||||
|
@ -913,18 +911,15 @@ page_cur_insert_rec_low(
|
|||
rec_t* insert_rec; /* inserted record */
|
||||
ulint heap_no; /* heap number of the inserted
|
||||
record */
|
||||
rec_t* current_rec; /* current record after which the
|
||||
new record is inserted */
|
||||
page_zip_des_t* page_zip_orig = page_zip;
|
||||
|
||||
ut_ad(cursor);
|
||||
ut_ad(rec_offs_validate(rec, index, offsets));
|
||||
|
||||
page = page_cur_get_page(cursor);
|
||||
page = page_align(current_rec);
|
||||
ut_ad(dict_table_is_comp(index->table)
|
||||
== (ibool) !!page_is_comp(page));
|
||||
== (ibool) !!page_is_comp(page));
|
||||
|
||||
ut_ad(!page_rec_is_supremum(cursor->rec));
|
||||
ut_ad(!page_rec_is_supremum(current_rec));
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
@ -1023,7 +1018,6 @@ use_heap:
|
|||
rec_offs_make_valid(insert_rec, index, offsets);
|
||||
|
||||
/* 4. Insert the record in the linked list of records */
|
||||
current_rec = cursor->rec;
|
||||
ut_ad(current_rec != insert_rec);
|
||||
|
||||
{
|
||||
|
@ -1207,13 +1201,14 @@ page_parse_copy_rec_list_to_created_page(
|
|||
/* out: end of log record or NULL */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in: page or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page or NULL */
|
||||
mtr_t* mtr) /* in: mtr or NULL */
|
||||
{
|
||||
byte* rec_end;
|
||||
ulint log_data_len;
|
||||
byte* rec_end;
|
||||
ulint log_data_len;
|
||||
page_t* page;
|
||||
page_zip_des_t* page_zip;
|
||||
|
||||
if (ptr + 4 > end_ptr) {
|
||||
|
||||
|
@ -1230,18 +1225,21 @@ page_parse_copy_rec_list_to_created_page(
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
if (!page) {
|
||||
if (!block) {
|
||||
|
||||
return(rec_end);
|
||||
}
|
||||
|
||||
while (ptr < rec_end) {
|
||||
ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr,
|
||||
index, page, page_zip, mtr);
|
||||
block, index, mtr);
|
||||
}
|
||||
|
||||
ut_a(ptr == rec_end);
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
||||
page_header_set_ptr(page, page_zip, PAGE_LAST_INSERT, NULL);
|
||||
page_header_set_field(page, page_zip, PAGE_DIRECTION,
|
||||
PAGE_NO_DIRECTION);
|
||||
|
@ -1278,7 +1276,7 @@ page_copy_rec_list_end_to_created_page(
|
|||
ulint* offsets = offsets_;
|
||||
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||
|
||||
ut_ad(page_dir_get_n_heap(new_page) == 2);
|
||||
ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW);
|
||||
ut_ad(page_align(rec) != new_page);
|
||||
ut_ad(page_rec_is_comp(rec) == page_is_comp(new_page));
|
||||
|
||||
|
@ -1329,13 +1327,15 @@ page_copy_rec_list_end_to_created_page(
|
|||
page_offset(insert_rec));
|
||||
|
||||
rec_set_n_owned_new(insert_rec, NULL, 0);
|
||||
rec_set_heap_no_new(insert_rec, 2 + n_recs);
|
||||
rec_set_heap_no_new(insert_rec,
|
||||
PAGE_HEAP_NO_USER_LOW + n_recs);
|
||||
} else {
|
||||
rec_set_next_offs_old(prev_rec,
|
||||
page_offset(insert_rec));
|
||||
|
||||
rec_set_n_owned_old(insert_rec, 0);
|
||||
rec_set_heap_no_old(insert_rec, 2 + n_recs);
|
||||
rec_set_heap_no_old(insert_rec,
|
||||
PAGE_HEAP_NO_USER_LOW + n_recs);
|
||||
}
|
||||
|
||||
count++;
|
||||
|
@ -1408,7 +1408,7 @@ page_copy_rec_list_end_to_created_page(
|
|||
|
||||
page_dir_set_n_slots(new_page, NULL, 2 + slot_index);
|
||||
page_header_set_ptr(new_page, NULL, PAGE_HEAP_TOP, heap_top);
|
||||
page_dir_set_n_heap(new_page, NULL, 2 + n_recs);
|
||||
page_dir_set_n_heap(new_page, NULL, PAGE_HEAP_NO_USER_LOW + n_recs);
|
||||
page_header_set_field(new_page, NULL, PAGE_N_RECS, n_recs);
|
||||
|
||||
page_header_set_ptr(new_page, NULL, PAGE_LAST_INSERT, NULL);
|
||||
|
@ -1461,9 +1461,8 @@ page_cur_parse_delete_rec(
|
|||
/* out: pointer to record end or NULL */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in: page or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr) /* in: mtr or NULL */
|
||||
{
|
||||
ulint offset;
|
||||
|
@ -1480,19 +1479,20 @@ page_cur_parse_delete_rec(
|
|||
|
||||
ut_a(offset <= UNIV_PAGE_SIZE);
|
||||
|
||||
if (page) {
|
||||
if (block) {
|
||||
page_t* page = buf_block_get_frame(block);
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||
rec_t* rec = page + offset;
|
||||
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||
|
||||
page_cur_position(rec, &cursor);
|
||||
ut_ad(!page_zip || page_is_comp(page));
|
||||
page_cur_position(rec, block, &cursor);
|
||||
ut_ad(!buf_block_get_page_zip(block) || page_is_comp(page));
|
||||
|
||||
page_cur_delete_rec(&cursor, index,
|
||||
rec_get_offsets(rec, index, offsets_,
|
||||
ULINT_UNDEFINED, &heap),
|
||||
page_zip, mtr);
|
||||
mtr);
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
|
@ -1511,12 +1511,12 @@ page_cur_delete_rec(
|
|||
page_cur_t* cursor, /* in/out: a page cursor */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr) /* in: mini-transaction handle */
|
||||
{
|
||||
page_dir_slot_t* cur_dir_slot;
|
||||
page_dir_slot_t* prev_slot;
|
||||
page_t* page;
|
||||
page_zip_des_t* page_zip;
|
||||
rec_t* current_rec;
|
||||
rec_t* prev_rec = NULL;
|
||||
rec_t* next_rec;
|
||||
|
@ -1527,6 +1527,7 @@ page_cur_delete_rec(
|
|||
ut_ad(cursor && mtr);
|
||||
|
||||
page = page_cur_get_page(cursor);
|
||||
page_zip = page_cur_get_page_zip(cursor);
|
||||
/* page_zip_validate() may fail here when
|
||||
btr_cur_pessimistic_delete() invokes btr_set_min_rec_mark(). */
|
||||
current_rec = cursor->rec;
|
||||
|
|
290
page/page0page.c
290
page/page0page.c
|
@ -418,7 +418,9 @@ page_create_low(
|
|||
|
||||
page_header_set_field(page, NULL, PAGE_N_DIR_SLOTS, 2);
|
||||
page_header_set_ptr(page, NULL, PAGE_HEAP_TOP, heap_top);
|
||||
page_header_set_field(page, NULL, PAGE_N_HEAP, comp ? 0x8002 : 2);
|
||||
page_header_set_field(page, NULL, PAGE_N_HEAP, comp
|
||||
? 0x8000 | PAGE_HEAP_NO_USER_LOW
|
||||
: PAGE_HEAP_NO_USER_LOW);
|
||||
page_header_set_ptr(page, NULL, PAGE_FREE, NULL);
|
||||
page_header_set_field(page, NULL, PAGE_GARBAGE, 0);
|
||||
page_header_set_ptr(page, NULL, PAGE_LAST_INSERT, NULL);
|
||||
|
@ -427,7 +429,7 @@ page_create_low(
|
|||
page_header_set_field(page, NULL, PAGE_N_RECS, 0);
|
||||
page_set_max_trx_id(page, NULL, ut_dulint_zero);
|
||||
memset(heap_top, 0, UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START
|
||||
- (heap_top - page));
|
||||
- page_offset(heap_top));
|
||||
|
||||
/* 5. SET POINTERS IN RECORDS AND DIR SLOTS */
|
||||
|
||||
|
@ -506,19 +508,21 @@ touch the lock table and max trx id on page or compress the page. */
|
|||
void
|
||||
page_copy_rec_list_end_no_locks(
|
||||
/*============================*/
|
||||
page_t* new_page, /* in: index page to copy to */
|
||||
buf_block_t* new_block, /* in: index page to copy to */
|
||||
buf_block_t* block, /* in: index page of rec */
|
||||
rec_t* rec, /* in: record on page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* new_page = buf_block_get_frame(new_block);
|
||||
page_cur_t cur1;
|
||||
page_cur_t cur2;
|
||||
rec_t* cur2;
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||
ulint* offsets = offsets_;
|
||||
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||
|
||||
page_cur_position(rec, &cur1);
|
||||
page_cur_position(rec, block, &cur1);
|
||||
|
||||
if (page_cur_is_before_first(&cur1)) {
|
||||
|
||||
|
@ -531,16 +535,18 @@ page_copy_rec_list_end_no_locks(
|
|||
ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint)
|
||||
(page_is_comp(new_page) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
|
||||
|
||||
page_cur_set_before_first(new_page, &cur2);
|
||||
cur2 = page_get_infimum_rec(buf_block_get_frame(new_block));
|
||||
|
||||
/* Copy records from the original page to the new page */
|
||||
|
||||
while (!page_cur_is_after_last(&cur1)) {
|
||||
rec_t* cur1_rec = page_cur_get_rec(&cur1);
|
||||
rec_t* ins_rec;
|
||||
offsets = rec_get_offsets(cur1_rec, index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
if (UNIV_UNLIKELY(!page_cur_rec_insert(&cur2, NULL, cur1_rec,
|
||||
index, offsets, mtr))) {
|
||||
ins_rec = page_cur_insert_rec_low(cur2, NULL, index,
|
||||
cur1_rec, offsets, mtr);
|
||||
if (UNIV_UNLIKELY(!ins_rec)) {
|
||||
/* Track an assertion failure reported on the mailing
|
||||
list on June 18th, 2003 */
|
||||
|
||||
|
@ -553,12 +559,12 @@ page_copy_rec_list_end_no_locks(
|
|||
" cur2 offset %lu\n",
|
||||
(ulong) page_offset(rec),
|
||||
(ulong) page_offset(page_cur_get_rec(&cur1)),
|
||||
(ulong) page_offset(page_cur_get_rec(&cur2)));
|
||||
(ulong) page_offset(cur2));
|
||||
ut_error;
|
||||
}
|
||||
|
||||
page_cur_move_to_next(&cur1);
|
||||
page_cur_move_to_next(&cur2);
|
||||
cur2 = ins_rec;
|
||||
}
|
||||
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
|
@ -577,9 +583,9 @@ page_copy_rec_list_end(
|
|||
/* out: pointer to the original
|
||||
successor of the infimum record
|
||||
on new_page, or NULL on zip overflow
|
||||
(new_page will be decompressed
|
||||
from new_page_zip) */
|
||||
(new_block will be decompressed) */
|
||||
buf_block_t* new_block, /* in/out: index page to copy to */
|
||||
buf_block_t* block, /* in: index page containing rec */
|
||||
rec_t* rec, /* in: record on page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
|
@ -593,6 +599,7 @@ page_copy_rec_list_end(
|
|||
|
||||
/* page_zip_validate() will fail here if btr_compress()
|
||||
sets FIL_PAGE_PREV to FIL_NULL */
|
||||
ut_ad(buf_block_get_frame(block) == page);
|
||||
ut_ad(page_is_leaf(page) == page_is_leaf(new_page));
|
||||
ut_ad(page_is_comp(page) == page_is_comp(new_page));
|
||||
|
||||
|
@ -600,11 +607,12 @@ page_copy_rec_list_end(
|
|||
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
|
||||
}
|
||||
|
||||
if (page_dir_get_n_heap(new_page) == 2) {
|
||||
if (page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW) {
|
||||
page_copy_rec_list_end_to_created_page(new_page, rec,
|
||||
index, mtr);
|
||||
} else {
|
||||
page_copy_rec_list_end_no_locks(new_page, rec, index, mtr);
|
||||
page_copy_rec_list_end_no_locks(new_block, block, rec,
|
||||
index, mtr);
|
||||
}
|
||||
|
||||
if (UNIV_LIKELY_NULL(new_page_zip)) {
|
||||
|
@ -646,7 +654,7 @@ page_copy_rec_list_end(
|
|||
page_update_max_trx_id(new_page, new_page_zip,
|
||||
page_get_max_trx_id(page));
|
||||
|
||||
btr_search_move_or_delete_hash_entries(new_page, page, index);
|
||||
btr_search_move_or_delete_hash_entries(new_block, block, index);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
@ -662,9 +670,9 @@ page_copy_rec_list_start(
|
|||
/* out: pointer to the original
|
||||
predecessor of the supremum record
|
||||
on new_page, or NULL on zip overflow
|
||||
(new_page will be decompressed
|
||||
from new_page_zip) */
|
||||
(new_block will be decompressed) */
|
||||
buf_block_t* new_block, /* in/out: index page to copy to */
|
||||
buf_block_t* block, /* in: index page containing rec */
|
||||
rec_t* rec, /* in: record on page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
|
@ -672,8 +680,7 @@ page_copy_rec_list_start(
|
|||
page_t* new_page = buf_block_get_frame(new_block);
|
||||
page_zip_des_t* new_page_zip = buf_block_get_page_zip(new_block);
|
||||
page_cur_t cur1;
|
||||
page_cur_t cur2;
|
||||
page_t* page;
|
||||
rec_t* cur2;
|
||||
ulint log_mode = 0 /* remove warning */;
|
||||
mem_heap_t* heap = NULL;
|
||||
rec_t* ret
|
||||
|
@ -691,26 +698,22 @@ page_copy_rec_list_start(
|
|||
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
|
||||
}
|
||||
|
||||
page = page_align(rec);
|
||||
|
||||
page_cur_set_before_first(page, &cur1);
|
||||
page_cur_set_before_first(block, &cur1);
|
||||
page_cur_move_to_next(&cur1);
|
||||
|
||||
page_cur_position(ret, &cur2);
|
||||
cur2 = ret;
|
||||
|
||||
/* Copy records from the original page to the new page */
|
||||
|
||||
while (page_cur_get_rec(&cur1) != rec) {
|
||||
rec_t* ins_rec;
|
||||
rec_t* cur1_rec = page_cur_get_rec(&cur1);
|
||||
offsets = rec_get_offsets(cur1_rec, index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
ins_rec = page_cur_rec_insert(&cur2, NULL, cur1_rec,
|
||||
index, offsets, mtr);
|
||||
ut_a(ins_rec);
|
||||
cur2 = page_cur_insert_rec_low(cur2, NULL, index,
|
||||
cur1_rec, offsets, mtr);
|
||||
ut_a(cur2);
|
||||
|
||||
page_cur_move_to_next(&cur1);
|
||||
page_cur_move_to_next(&cur2);
|
||||
}
|
||||
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
|
@ -752,11 +755,11 @@ page_copy_rec_list_start(
|
|||
/* Update MAX_TRX_ID, the lock table, and possible hash index */
|
||||
|
||||
page_update_max_trx_id(new_page, new_page_zip,
|
||||
page_get_max_trx_id(page));
|
||||
page_get_max_trx_id(page_align(rec)));
|
||||
|
||||
lock_move_rec_list_start(new_page, page, rec, ret);
|
||||
lock_move_rec_list_start(new_page, page_align(rec), rec, ret);
|
||||
|
||||
btr_search_move_or_delete_hash_entries(new_page, page, index);
|
||||
btr_search_move_or_delete_hash_entries(new_block, block, index);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
@ -800,12 +803,12 @@ page_parse_delete_rec_list(
|
|||
MLOG_COMP_LIST_START_DELETE */
|
||||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
buf_block_t* block, /* in/out: buffer block or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_t* page, /* in/out: page or NULL */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page or NULL */
|
||||
mtr_t* mtr) /* in: mtr or NULL */
|
||||
{
|
||||
ulint offset;
|
||||
page_t* page;
|
||||
ulint offset;
|
||||
|
||||
ut_ad(type == MLOG_LIST_END_DELETE
|
||||
|| type == MLOG_LIST_START_DELETE
|
||||
|
@ -822,21 +825,22 @@ page_parse_delete_rec_list(
|
|||
offset = mach_read_from_2(ptr);
|
||||
ptr += 2;
|
||||
|
||||
if (!page) {
|
||||
if (!block) {
|
||||
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
|
||||
|
||||
if (type == MLOG_LIST_END_DELETE
|
||||
|| type == MLOG_COMP_LIST_END_DELETE) {
|
||||
page_delete_rec_list_end(page + offset, index,
|
||||
page_delete_rec_list_end(page + offset, block, index,
|
||||
ULINT_UNDEFINED, ULINT_UNDEFINED,
|
||||
page_zip, mtr);
|
||||
mtr);
|
||||
} else {
|
||||
page_delete_rec_list_start(page + offset, index,
|
||||
page_zip, mtr);
|
||||
page_delete_rec_list_start(page + offset, block, index, mtr);
|
||||
}
|
||||
|
||||
return(ptr);
|
||||
|
@ -850,13 +854,13 @@ void
|
|||
page_delete_rec_list_end(
|
||||
/*=====================*/
|
||||
rec_t* rec, /* in: pointer to record on page */
|
||||
buf_block_t* block, /* in: buffer block of the page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
ulint n_recs, /* in: number of records to delete,
|
||||
or ULINT_UNDEFINED if not known */
|
||||
ulint size, /* in: the sum of the sizes of the
|
||||
records in the end of the chain to
|
||||
delete, or ULINT_UNDEFINED if not known */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_dir_slot_t*slot;
|
||||
|
@ -864,6 +868,7 @@ page_delete_rec_list_end(
|
|||
rec_t* last_rec;
|
||||
rec_t* prev_rec;
|
||||
ulint n_owned;
|
||||
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
|
||||
page_t* page = page_align(rec);
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||
|
@ -893,7 +898,7 @@ page_delete_rec_list_end(
|
|||
/* The page gets invalid for optimistic searches: increment the
|
||||
frame modify clock */
|
||||
|
||||
buf_block_modify_clock_inc(buf_block_align(page)/*TODO*/);
|
||||
buf_block_modify_clock_inc(block);
|
||||
|
||||
page_delete_rec_list_write_log(rec, index, page_is_comp(page)
|
||||
? MLOG_COMP_LIST_END_DELETE
|
||||
|
@ -909,7 +914,7 @@ page_delete_rec_list_end(
|
|||
|
||||
do {
|
||||
page_cur_t cur;
|
||||
page_cur_position(rec, &cur);
|
||||
page_cur_position(rec, block, &cur);
|
||||
|
||||
offsets = rec_get_offsets(rec, index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
|
@ -917,8 +922,7 @@ page_delete_rec_list_end(
|
|||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
page_cur_delete_rec(&cur, index, offsets,
|
||||
page_zip, mtr);
|
||||
page_cur_delete_rec(&cur, index, offsets, mtr);
|
||||
} while (page_offset(rec) != PAGE_NEW_SUPREMUM);
|
||||
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
|
@ -1026,8 +1030,8 @@ void
|
|||
page_delete_rec_list_start(
|
||||
/*=======================*/
|
||||
rec_t* rec, /* in: record on page */
|
||||
buf_block_t* block, /* in: buffer block of the page */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
page_zip_des_t* page_zip,/* in/out: compressed page of rec, or NULL */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_cur_t cur1;
|
||||
|
@ -1059,7 +1063,7 @@ page_delete_rec_list_start(
|
|||
|
||||
page_delete_rec_list_write_log(rec, index, type, mtr);
|
||||
|
||||
page_cur_set_before_first(page_align(rec), &cur1);
|
||||
page_cur_set_before_first(block, &cur1);
|
||||
page_cur_move_to_next(&cur1);
|
||||
|
||||
/* Individual deletes are not logged */
|
||||
|
@ -1069,7 +1073,7 @@ page_delete_rec_list_start(
|
|||
while (page_cur_get_rec(&cur1) != rec) {
|
||||
offsets = rec_get_offsets(page_cur_get_rec(&cur1), index,
|
||||
offsets, ULINT_UNDEFINED, &heap);
|
||||
page_cur_delete_rec(&cur1, index, offsets, page_zip, mtr);
|
||||
page_cur_delete_rec(&cur1, index, offsets, mtr);
|
||||
}
|
||||
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
|
@ -1089,19 +1093,15 @@ ibool
|
|||
page_move_rec_list_end(
|
||||
/*===================*/
|
||||
/* out: TRUE on success; FALSE on
|
||||
compression failure (new_page will
|
||||
be decompressed from new_page_zip) */
|
||||
compression failure
|
||||
(new_block will be decompressed) */
|
||||
buf_block_t* new_block, /* in/out: index page where to move */
|
||||
buf_block_t* block, /* in: index page from where to move */
|
||||
rec_t* split_rec, /* in: first record to move */
|
||||
page_zip_des_t* page_zip, /* in/out: compressed page of
|
||||
split_rec, or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* new_page = buf_block_get_frame(new_block);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
page_zip_des_t* new_page_zip = buf_block_get_page_zip(new_block);
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
ulint old_data_size;
|
||||
ulint new_data_size;
|
||||
ulint old_n_recs;
|
||||
|
@ -1110,12 +1110,21 @@ page_move_rec_list_end(
|
|||
old_data_size = page_get_data_size(new_page);
|
||||
old_n_recs = page_get_n_recs(new_page);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!new_page_zip || page_zip_validate(new_page_zip, new_page));
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page_align(split_rec)));
|
||||
{
|
||||
page_zip_des_t* new_page_zip
|
||||
= buf_block_get_page_zip(new_block);
|
||||
page_zip_des_t* page_zip
|
||||
= buf_block_get_page_zip(block);
|
||||
ut_a(!new_page_zip == !page_zip);
|
||||
ut_a(!new_page_zip
|
||||
|| page_zip_validate(new_page_zip, new_page));
|
||||
ut_a(!page_zip
|
||||
|| page_zip_validate(page_zip, page_align(split_rec)));
|
||||
}
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
if (UNIV_UNLIKELY(!page_copy_rec_list_end(new_block, split_rec,
|
||||
index, mtr))) {
|
||||
if (UNIV_UNLIKELY(!page_copy_rec_list_end(new_block, block,
|
||||
split_rec, index, mtr))) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
@ -1124,10 +1133,9 @@ page_move_rec_list_end(
|
|||
|
||||
ut_ad(new_data_size >= old_data_size);
|
||||
|
||||
page_delete_rec_list_end(split_rec, index,
|
||||
page_delete_rec_list_end(split_rec, block, index,
|
||||
new_n_recs - old_n_recs,
|
||||
new_data_size - old_data_size,
|
||||
page_zip, mtr);
|
||||
new_data_size - old_data_size, mtr);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -1142,18 +1150,17 @@ page_move_rec_list_start(
|
|||
/* out: TRUE on success; FALSE on
|
||||
compression failure */
|
||||
buf_block_t* new_block, /* in/out: index page where to move */
|
||||
buf_block_t* block, /* in/out: page containing split_rec */
|
||||
rec_t* split_rec, /* in: first record not to move */
|
||||
page_zip_des_t* page_zip, /* in/out: compressed page of
|
||||
split_rec, or NULL */
|
||||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
if (UNIV_UNLIKELY(!page_copy_rec_list_start(new_block, split_rec,
|
||||
index, mtr))) {
|
||||
if (UNIV_UNLIKELY(!page_copy_rec_list_start(new_block, block,
|
||||
split_rec, index, mtr))) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
page_delete_rec_list_start(split_rec, index, page_zip, mtr);
|
||||
page_delete_rec_list_start(split_rec, block, index, mtr);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -1408,7 +1415,7 @@ page_get_middle_rec(
|
|||
rec_t* rec;
|
||||
|
||||
/* This many records we must leave behind */
|
||||
middle = (page_get_n_recs(page) + 2) / 2;
|
||||
middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
|
||||
|
||||
count = 0;
|
||||
|
||||
|
@ -1552,7 +1559,7 @@ page_dir_print(
|
|||
"PAGE DIRECTORY\n"
|
||||
"Page address %p\n"
|
||||
"Directory stack top at offs: %lu; number of slots: %lu\n",
|
||||
page, (ulong)(page_dir_get_nth_slot(page, n - 1) - page),
|
||||
page, (ulong) page_offset(page_dir_get_nth_slot(page, n - 1)),
|
||||
(ulong) n);
|
||||
for (i = 0; i < n; i++) {
|
||||
slot = page_dir_get_nth_slot(page, i);
|
||||
|
@ -1565,12 +1572,13 @@ page_dir_print(
|
|||
" rec offs: %lu\n",
|
||||
(ulong) i,
|
||||
(ulong) page_dir_slot_get_n_owned(slot),
|
||||
(ulong)(page_dir_slot_get_rec(slot) - page));
|
||||
(ulong)
|
||||
page_offset(page_dir_slot_get_rec(slot)));
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "Total of %lu records\n"
|
||||
"--------------------------------\n",
|
||||
(ulong) (2 + page_get_n_recs(page)));
|
||||
(ulong) (PAGE_HEAP_NO_USER_LOW + page_get_n_recs(page)));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -1580,10 +1588,11 @@ debugging purposes. */
|
|||
void
|
||||
page_print_list(
|
||||
/*============*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
dict_index_t* index, /* in: dictionary index of the page */
|
||||
ulint pr_n) /* in: print n first and n last entries */
|
||||
{
|
||||
page_t* page = block->frame;
|
||||
page_cur_t cur;
|
||||
ulint count;
|
||||
ulint n_recs;
|
||||
|
@ -1601,7 +1610,7 @@ page_print_list(
|
|||
|
||||
n_recs = page_get_n_recs(page);
|
||||
|
||||
page_cur_set_before_first(page, &cur);
|
||||
page_cur_set_before_first(block, &cur);
|
||||
count = 0;
|
||||
for (;;) {
|
||||
offsets = rec_get_offsets(cur.rec, index, offsets,
|
||||
|
@ -1649,7 +1658,7 @@ Prints the info in a page header. */
|
|||
void
|
||||
page_header_print(
|
||||
/*==============*/
|
||||
page_t* page)
|
||||
const page_t* page)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"--------------------------------\n"
|
||||
|
@ -1677,16 +1686,18 @@ debugging purposes. */
|
|||
void
|
||||
page_print(
|
||||
/*=======*/
|
||||
page_t* page, /* in: index page */
|
||||
buf_block_t* block, /* in: index page */
|
||||
dict_index_t* index, /* in: dictionary index of the page */
|
||||
ulint dn, /* in: print dn first and last entries
|
||||
in directory */
|
||||
ulint rn) /* in: print rn first and last records
|
||||
in directory */
|
||||
{
|
||||
page_t* page = block->frame;
|
||||
|
||||
page_header_print(page);
|
||||
page_dir_print(page, dn);
|
||||
page_print_list(page, index, rn);
|
||||
page_print_list(block, index, rn);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -1722,14 +1733,14 @@ page_rec_validate(
|
|||
if (UNIV_UNLIKELY(!(n_owned <= PAGE_DIR_SLOT_MAX_N_OWNED))) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Dir slot of rec %lu, n owned too big %lu\n",
|
||||
(ulong)(rec - page), (ulong) n_owned);
|
||||
(ulong) page_offset(rec), (ulong) n_owned);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(!(heap_no < page_dir_get_n_heap(page)))) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Heap no of rec %lu too big %lu %lu\n",
|
||||
(ulong)(rec - page), (ulong) heap_no,
|
||||
(ulong) page_offset(rec), (ulong) heap_no,
|
||||
(ulong) page_dir_get_n_heap(page));
|
||||
return(FALSE);
|
||||
}
|
||||
|
@ -1782,7 +1793,6 @@ page_simple_validate_old(
|
|||
/* out: TRUE if ok */
|
||||
page_t* page) /* in: old-style index page */
|
||||
{
|
||||
page_cur_t cur;
|
||||
page_dir_slot_t* slot;
|
||||
ulint slot_no;
|
||||
ulint n_slots;
|
||||
|
@ -1815,10 +1825,9 @@ page_simple_validate_old(
|
|||
fprintf(stderr,
|
||||
"InnoDB: Record heap and dir overlap on a page,"
|
||||
" heap top %lu, dir %lu\n",
|
||||
(ulong) page_header_get_field(page, PAGE_HEAP_TOP),
|
||||
(ulong)
|
||||
(page_header_get_ptr(page, PAGE_HEAP_TOP) - page),
|
||||
(ulong)
|
||||
(page_dir_get_nth_slot(page, n_slots - 1) - page));
|
||||
page_offset(page_dir_get_nth_slot(page, n_slots - 1)));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -1831,11 +1840,9 @@ page_simple_validate_old(
|
|||
slot_no = 0;
|
||||
slot = page_dir_get_nth_slot(page, slot_no);
|
||||
|
||||
page_cur_set_before_first(page, &cur);
|
||||
rec = page_get_infimum_rec(page);
|
||||
|
||||
for (;;) {
|
||||
rec = (&cur)->rec;
|
||||
|
||||
if (UNIV_UNLIKELY(rec > rec_heap_top)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Record %lu is above"
|
||||
|
@ -1873,13 +1880,13 @@ page_simple_validate_old(
|
|||
|
||||
own_count = 0;
|
||||
|
||||
if (!page_cur_is_after_last(&cur)) {
|
||||
if (!page_rec_is_supremum(rec)) {
|
||||
slot_no++;
|
||||
slot = page_dir_get_nth_slot(page, slot_no);
|
||||
}
|
||||
}
|
||||
|
||||
if (page_cur_is_after_last(&cur)) {
|
||||
if (page_rec_is_supremum(rec)) {
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1906,7 +1913,7 @@ page_simple_validate_old(
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
page_cur_move_to_next(&cur);
|
||||
rec = page_rec_get_next(rec);
|
||||
own_count++;
|
||||
}
|
||||
|
||||
|
@ -1922,10 +1929,12 @@ page_simple_validate_old(
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(page_header_get_field(page, PAGE_N_RECS) + 2
|
||||
if (UNIV_UNLIKELY(page_header_get_field(page, PAGE_N_RECS)
|
||||
+ PAGE_HEAP_NO_USER_LOW
|
||||
!= count + 1)) {
|
||||
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
|
||||
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
|
||||
(ulong) page_header_get_field(page, PAGE_N_RECS)
|
||||
+ PAGE_HEAP_NO_USER_LOW,
|
||||
(ulong) (count + 1));
|
||||
|
||||
goto func_exit;
|
||||
|
@ -1994,7 +2003,6 @@ page_simple_validate_new(
|
|||
/* out: TRUE if ok */
|
||||
page_t* page) /* in: new-style index page */
|
||||
{
|
||||
page_cur_t cur;
|
||||
page_dir_slot_t* slot;
|
||||
ulint slot_no;
|
||||
ulint n_slots;
|
||||
|
@ -2027,10 +2035,9 @@ page_simple_validate_new(
|
|||
fprintf(stderr,
|
||||
"InnoDB: Record heap and dir overlap on a page,"
|
||||
" heap top %lu, dir %lu\n",
|
||||
(ulong) page_header_get_field(page, PAGE_HEAP_TOP),
|
||||
(ulong)
|
||||
(page_header_get_ptr(page, PAGE_HEAP_TOP) - page),
|
||||
(ulong)
|
||||
(page_dir_get_nth_slot(page, n_slots - 1) - page));
|
||||
page_offset(page_dir_get_nth_slot(page, n_slots - 1)));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2043,17 +2050,15 @@ page_simple_validate_new(
|
|||
slot_no = 0;
|
||||
slot = page_dir_get_nth_slot(page, slot_no);
|
||||
|
||||
page_cur_set_before_first(page, &cur);
|
||||
rec = page_get_infimum_rec(page);
|
||||
|
||||
for (;;) {
|
||||
rec = (&cur)->rec;
|
||||
|
||||
if (UNIV_UNLIKELY(rec > rec_heap_top)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Record %lu is above rec"
|
||||
" heap top %lu\n",
|
||||
(ulong) (rec - page),
|
||||
(ulong) (rec_heap_top - page));
|
||||
(ulong) page_offset(rec),
|
||||
(ulong) page_offset(rec_heap_top));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2068,7 +2073,7 @@ page_simple_validate_new(
|
|||
" rec %lu\n",
|
||||
(ulong) rec_get_n_owned_new(rec),
|
||||
(ulong) own_count,
|
||||
(ulong)(rec - page));
|
||||
(ulong) page_offset(rec));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2078,20 +2083,20 @@ page_simple_validate_new(
|
|||
fprintf(stderr,
|
||||
"InnoDB: Dir slot does not point"
|
||||
" to right rec %lu\n",
|
||||
(ulong)(rec - page));
|
||||
(ulong) page_offset(rec));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
own_count = 0;
|
||||
|
||||
if (!page_cur_is_after_last(&cur)) {
|
||||
if (!page_rec_is_supremum(rec)) {
|
||||
slot_no++;
|
||||
slot = page_dir_get_nth_slot(page, slot_no);
|
||||
}
|
||||
}
|
||||
|
||||
if (page_cur_is_after_last(&cur)) {
|
||||
if (page_rec_is_supremum(rec)) {
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -2103,7 +2108,7 @@ page_simple_validate_new(
|
|||
"InnoDB: Next record offset nonsensical %lu"
|
||||
" for rec %lu\n",
|
||||
(ulong) rec_get_next_offs(rec, TRUE),
|
||||
(ulong)(rec - page));
|
||||
(ulong) page_offset(rec));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2118,7 +2123,7 @@ page_simple_validate_new(
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
page_cur_move_to_next(&cur);
|
||||
rec = page_rec_get_next(rec);
|
||||
own_count++;
|
||||
}
|
||||
|
||||
|
@ -2135,10 +2140,12 @@ page_simple_validate_new(
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(page_header_get_field(page, PAGE_N_RECS) + 2
|
||||
if (UNIV_UNLIKELY(page_header_get_field(page, PAGE_N_RECS)
|
||||
+ PAGE_HEAP_NO_USER_LOW
|
||||
!= count + 1)) {
|
||||
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
|
||||
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
|
||||
(ulong) page_header_get_field(page, PAGE_N_RECS)
|
||||
+ PAGE_HEAP_NO_USER_LOW,
|
||||
(ulong) (count + 1));
|
||||
|
||||
goto func_exit;
|
||||
|
@ -2153,7 +2160,7 @@ page_simple_validate_new(
|
|||
fprintf(stderr,
|
||||
"InnoDB: Free list record has"
|
||||
" a nonsensical offset %lu\n",
|
||||
(ulong) (rec - page));
|
||||
(ulong) page_offset(rec));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2162,8 +2169,8 @@ page_simple_validate_new(
|
|||
fprintf(stderr,
|
||||
"InnoDB: Free list record %lu"
|
||||
" is above rec heap top %lu\n",
|
||||
(ulong) (rec - page),
|
||||
(ulong) (rec_heap_top - page));
|
||||
(ulong) page_offset(rec),
|
||||
(ulong) page_offset(rec_heap_top));
|
||||
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2207,9 +2214,8 @@ page_validate(
|
|||
dict_index_t* index) /* in: data dictionary index containing
|
||||
the page record type definition */
|
||||
{
|
||||
page_dir_slot_t* slot;
|
||||
page_dir_slot_t*slot;
|
||||
mem_heap_t* heap;
|
||||
page_cur_t cur;
|
||||
byte* buf;
|
||||
ulint count;
|
||||
ulint own_count;
|
||||
|
@ -2274,10 +2280,9 @@ page_validate(
|
|||
slot_no = 0;
|
||||
slot = page_dir_get_nth_slot(page, slot_no);
|
||||
|
||||
page_cur_set_before_first(page, &cur);
|
||||
rec = page_get_infimum_rec(page);
|
||||
|
||||
for (;;) {
|
||||
rec = cur.rec;
|
||||
offsets = rec_get_offsets(rec, index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
|
||||
|
@ -2293,8 +2298,8 @@ page_validate(
|
|||
}
|
||||
|
||||
/* Check that the records are in the ascending order */
|
||||
if (UNIV_LIKELY(count >= 2)
|
||||
&& (!page_cur_is_after_last(&cur))) {
|
||||
if (UNIV_LIKELY(count >= PAGE_HEAP_NO_USER_LOW)
|
||||
&& !page_rec_is_supremum(rec)) {
|
||||
if (UNIV_UNLIKELY
|
||||
(1 != cmp_rec_rec(rec, old_rec,
|
||||
offsets, old_offsets, index))) {
|
||||
|
@ -2318,7 +2323,7 @@ page_validate(
|
|||
data_size += rec_offs_size(offsets);
|
||||
}
|
||||
|
||||
offs = rec_get_start(rec, offsets) - page;
|
||||
offs = page_offset(rec_get_start(rec, offsets));
|
||||
|
||||
for (i = rec_offs_size(offsets); i--; ) {
|
||||
if (UNIV_UNLIKELY(buf[offs + i])) {
|
||||
|
@ -2358,20 +2363,21 @@ page_validate(
|
|||
page_dir_slot_check(slot);
|
||||
|
||||
own_count = 0;
|
||||
if (!page_cur_is_after_last(&cur)) {
|
||||
if (!page_rec_is_supremum(rec)) {
|
||||
slot_no++;
|
||||
slot = page_dir_get_nth_slot(page, slot_no);
|
||||
}
|
||||
}
|
||||
|
||||
if (page_cur_is_after_last(&cur)) {
|
||||
if (page_rec_is_supremum(rec)) {
|
||||
break;
|
||||
}
|
||||
|
||||
count++;
|
||||
page_cur_move_to_next(&cur);
|
||||
own_count++;
|
||||
old_rec = rec;
|
||||
rec = page_rec_get_next(rec);
|
||||
|
||||
/* set old_offsets to offsets; recycle offsets */
|
||||
{
|
||||
ulint* offs = old_offsets;
|
||||
|
@ -2397,10 +2403,12 @@ n_owned_zero:
|
|||
goto func_exit;
|
||||
}
|
||||
|
||||
if (UNIV_UNLIKELY(page_header_get_field(page, PAGE_N_RECS) + 2
|
||||
if (UNIV_UNLIKELY(page_header_get_field(page, PAGE_N_RECS)
|
||||
+ PAGE_HEAP_NO_USER_LOW
|
||||
!= count + 1)) {
|
||||
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
|
||||
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
|
||||
(ulong) page_header_get_field(page, PAGE_N_RECS)
|
||||
+ PAGE_HEAP_NO_USER_LOW,
|
||||
(ulong) (count + 1));
|
||||
goto func_exit;
|
||||
}
|
||||
|
@ -2424,7 +2432,7 @@ n_owned_zero:
|
|||
}
|
||||
|
||||
count++;
|
||||
offs = rec_get_start(rec, offsets) - page;
|
||||
offs = page_offset(rec_get_start(rec, offsets));
|
||||
|
||||
for (i = rec_offs_size(offsets); i--; ) {
|
||||
|
||||
|
@ -2467,44 +2475,46 @@ func_exit2:
|
|||
/*******************************************************************
|
||||
Looks in the page record list for a record with the given heap number. */
|
||||
|
||||
rec_t*
|
||||
const rec_t*
|
||||
page_find_rec_with_heap_no(
|
||||
/*=======================*/
|
||||
/* out: record, NULL if not found */
|
||||
page_t* page, /* in: index page */
|
||||
ulint heap_no)/* in: heap number */
|
||||
/* out: record, NULL if not found */
|
||||
const page_t* page, /* in: index page */
|
||||
ulint heap_no)/* in: heap number */
|
||||
{
|
||||
page_cur_t cur;
|
||||
|
||||
page_cur_set_before_first(page, &cur);
|
||||
const rec_t* rec;
|
||||
|
||||
if (page_is_comp(page)) {
|
||||
for (;;) {
|
||||
if (rec_get_heap_no_new(cur.rec) == heap_no) {
|
||||
rec = page + PAGE_NEW_INFIMUM;
|
||||
|
||||
return(cur.rec);
|
||||
}
|
||||
for(;;) {
|
||||
ulint rec_heap_no = rec_get_heap_no_new(rec);
|
||||
|
||||
if (page_cur_is_after_last(&cur)) {
|
||||
if (rec_heap_no == heap_no) {
|
||||
|
||||
return(rec);
|
||||
} else if (rec_heap_no == PAGE_HEAP_NO_SUPREMUM) {
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
page_cur_move_to_next(&cur);
|
||||
rec = page + rec_get_next_offs(rec, TRUE);
|
||||
}
|
||||
} else {
|
||||
rec = page + PAGE_OLD_INFIMUM;
|
||||
|
||||
for (;;) {
|
||||
if (rec_get_heap_no_old(cur.rec) == heap_no) {
|
||||
ulint rec_heap_no = rec_get_heap_no_old(rec);
|
||||
|
||||
return(cur.rec);
|
||||
}
|
||||
if (rec_heap_no == heap_no) {
|
||||
|
||||
if (page_cur_is_after_last(&cur)) {
|
||||
return(rec);
|
||||
} else if (rec_heap_no == PAGE_HEAP_NO_SUPREMUM) {
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
page_cur_move_to_next(&cur);
|
||||
rec = page + rec_get_next_offs(rec, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@ page_zip_dir_size(
|
|||
{
|
||||
/* Exclude the page infimum and supremum from the record count. */
|
||||
ulint size = PAGE_ZIP_DIR_SLOT_SIZE
|
||||
* (page_dir_get_n_heap(page_zip->data) - 2);
|
||||
* (page_dir_get_n_heap(page_zip->data)
|
||||
- PAGE_HEAP_NO_USER_LOW);
|
||||
return(size);
|
||||
}
|
||||
|
||||
|
@ -217,9 +218,9 @@ page_zip_compress_write_log(
|
|||
return;
|
||||
}
|
||||
|
||||
/* Read the number of user records.
|
||||
Subtract 2 for the infimum and supremum records. */
|
||||
trailer_size = page_dir_get_n_heap(page_zip->data) - 2;
|
||||
/* Read the number of user records. */
|
||||
trailer_size = page_dir_get_n_heap(page_zip->data)
|
||||
- PAGE_HEAP_NO_USER_LOW;
|
||||
/* Multiply by uncompressed of size stored per record */
|
||||
if (!page_is_leaf(page)) {
|
||||
trailer_size *= PAGE_ZIP_DIR_SLOT_SIZE + REC_NODE_PTR_SIZE;
|
||||
|
@ -284,8 +285,8 @@ page_zip_get_n_prev_extern(
|
|||
ut_ad(dict_index_is_clust(index));
|
||||
|
||||
heap_no = rec_get_heap_no_new(rec);
|
||||
ut_ad(heap_no >= 2); /* exclude infimum and supremum */
|
||||
left = heap_no - 2;
|
||||
ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW);
|
||||
left = heap_no - PAGE_HEAP_NO_USER_LOW;
|
||||
if (UNIV_UNLIKELY(!left)) {
|
||||
return(0);
|
||||
}
|
||||
|
@ -512,7 +513,7 @@ page_zip_dir_encode(
|
|||
}
|
||||
rec = page + offs;
|
||||
heap_no = rec_get_heap_no_new(rec);
|
||||
ut_a(heap_no >= 2); /* not infimum or supremum */
|
||||
ut_a(heap_no >= PAGE_HEAP_NO_USER_LOW);
|
||||
ut_a(heap_no < n_heap);
|
||||
ut_a(offs < UNIV_PAGE_SIZE - PAGE_DIR);
|
||||
ut_a(offs >= PAGE_ZIP_START);
|
||||
|
@ -537,9 +538,9 @@ page_zip_dir_encode(
|
|||
|
||||
if (UNIV_LIKELY_NULL(recs)) {
|
||||
/* Ensure that each heap_no occurs at most once. */
|
||||
ut_a(!recs[heap_no - 2]);
|
||||
ut_a(!recs[heap_no - PAGE_HEAP_NO_USER_LOW]);
|
||||
/* exclude infimum and supremum */
|
||||
recs[heap_no - 2] = rec;
|
||||
recs[heap_no - PAGE_HEAP_NO_USER_LOW] = rec;
|
||||
}
|
||||
|
||||
ut_a(rec_get_status(rec) == status);
|
||||
|
@ -553,7 +554,7 @@ page_zip_dir_encode(
|
|||
rec = page + offs;
|
||||
|
||||
heap_no = rec_get_heap_no_new(rec);
|
||||
ut_a(heap_no >= 2); /* not infimum or supremum */
|
||||
ut_a(heap_no >= PAGE_HEAP_NO_USER_LOW);
|
||||
ut_a(heap_no < n_heap);
|
||||
|
||||
ut_a(!rec[-REC_N_NEW_EXTRA_BYTES]); /* info_bits and n_owned */
|
||||
|
@ -563,16 +564,16 @@ page_zip_dir_encode(
|
|||
|
||||
if (UNIV_LIKELY_NULL(recs)) {
|
||||
/* Ensure that each heap_no occurs at most once. */
|
||||
ut_a(!recs[heap_no - 2]);
|
||||
ut_a(!recs[heap_no - PAGE_HEAP_NO_USER_LOW]);
|
||||
/* exclude infimum and supremum */
|
||||
recs[heap_no - 2] = rec;
|
||||
recs[heap_no - PAGE_HEAP_NO_USER_LOW] = rec;
|
||||
}
|
||||
|
||||
offs = rec_get_next_offs(rec, TRUE);
|
||||
}
|
||||
|
||||
/* Ensure that each heap no occurs at least once. */
|
||||
ut_a(i + 2/* infimum and supremum */ == n_heap);
|
||||
ut_a(i + PAGE_HEAP_NO_USER_LOW == n_heap);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -963,7 +964,7 @@ page_zip_compress(
|
|||
}
|
||||
|
||||
/* The dense directory excludes the infimum and supremum records. */
|
||||
n_dense = page_dir_get_n_heap(page) - 2;
|
||||
n_dense = page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW;
|
||||
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
|
||||
if (UNIV_UNLIKELY(page_zip_compress_dbg)) {
|
||||
fprintf(stderr, "compress %p %p %lu %lu %lu\n",
|
||||
|
@ -1421,7 +1422,7 @@ page_zip_set_extra_bytes(
|
|||
page[PAGE_NEW_SUPREMUM - REC_N_NEW_EXTRA_BYTES] = n_owned;
|
||||
|
||||
/* The dense directory excludes the infimum and supremum records. */
|
||||
n = page_dir_get_n_heap(page) - 2;
|
||||
n = page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW;
|
||||
|
||||
if (i >= n) {
|
||||
|
||||
|
@ -1467,7 +1468,8 @@ page_zip_apply_log(
|
|||
const byte* data, /* in: modification log */
|
||||
ulint size, /* in: maximum length of the log, in bytes */
|
||||
rec_t** recs, /* in: dense page directory,
|
||||
sorted by address (indexed by heap_no - 2) */
|
||||
sorted by address (indexed by
|
||||
heap_no - PAGE_HEAP_NO_USER_LOW) */
|
||||
ulint n_dense,/* in: size of recs[] */
|
||||
ulint trx_id_col,/* in: column number of trx_id in the index,
|
||||
or ULINT_UNDEFINED if none */
|
||||
|
@ -1646,7 +1648,7 @@ page_zip_decompress_node_ptrs(
|
|||
mem_heap_t* heap) /* in: temporary memory heap */
|
||||
{
|
||||
ulint heap_status = REC_STATUS_NODE_PTR
|
||||
| 2 << REC_HEAP_NO_SHIFT;
|
||||
| PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT;
|
||||
ulint slot;
|
||||
const byte* storage;
|
||||
|
||||
|
@ -1811,7 +1813,8 @@ page_zip_decompress_sec(
|
|||
dict_index_t* index, /* in: the index of the page */
|
||||
ulint* offsets) /* in/out: temporary offsets */
|
||||
{
|
||||
ulint heap_status = REC_STATUS_ORDINARY | 2 << REC_HEAP_NO_SHIFT;
|
||||
ulint heap_status = REC_STATUS_ORDINARY
|
||||
| PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT;
|
||||
ulint slot;
|
||||
|
||||
/* Subtract the space reserved for uncompressed data. */
|
||||
|
@ -1935,7 +1938,7 @@ page_zip_decompress_clust(
|
|||
int err;
|
||||
ulint slot;
|
||||
ulint heap_status = REC_STATUS_ORDINARY
|
||||
| 2 << REC_HEAP_NO_SHIFT;
|
||||
| PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT;
|
||||
const byte* storage;
|
||||
const byte* externs;
|
||||
|
||||
|
@ -2225,7 +2228,7 @@ page_zip_decompress(
|
|||
ut_ad(page_zip_simple_validate(page_zip));
|
||||
|
||||
/* The dense directory excludes the infimum and supremum records. */
|
||||
n_dense = page_dir_get_n_heap(page_zip->data) - 2;
|
||||
n_dense = page_dir_get_n_heap(page_zip->data) - PAGE_HEAP_NO_USER_LOW;
|
||||
if (UNIV_UNLIKELY(n_dense * PAGE_ZIP_DIR_SLOT_SIZE
|
||||
>= page_zip->size)) {
|
||||
return(FALSE);
|
||||
|
@ -2508,7 +2511,7 @@ page_zip_write_rec(
|
|||
* page_dir_get_n_slots(page));
|
||||
|
||||
heap_no = rec_get_heap_no_new(rec);
|
||||
ut_ad(heap_no >= 2); /* not infimum or supremum */
|
||||
ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW); /* not infimum or supremum */
|
||||
ut_ad(heap_no < page_dir_get_n_heap(page));
|
||||
|
||||
/* Append to the modification log. */
|
||||
|
@ -2542,7 +2545,7 @@ page_zip_write_rec(
|
|||
|
||||
/* Write the data bytes. Store the uncompressed bytes separately. */
|
||||
storage = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW)
|
||||
* PAGE_ZIP_DIR_SLOT_SIZE;
|
||||
|
||||
if (page_is_leaf(page)) {
|
||||
|
@ -2560,7 +2563,8 @@ page_zip_write_rec(
|
|||
ut_ad(trx_id_col != ULINT_UNDEFINED);
|
||||
|
||||
externs -= (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)
|
||||
* (page_dir_get_n_heap(page) - 2);
|
||||
* (page_dir_get_n_heap(page)
|
||||
- PAGE_HEAP_NO_USER_LOW);
|
||||
|
||||
/* Note that this will not take into account
|
||||
the BLOB columns of rec if create==TRUE */
|
||||
|
@ -2681,7 +2685,7 @@ page_zip_write_rec(
|
|||
/* Copy the data bytes, except node_ptr. */
|
||||
len = rec_offs_data_size(offsets) - REC_NODE_PTR_SIZE;
|
||||
ut_ad(data + len < storage - REC_NODE_PTR_SIZE
|
||||
* (page_dir_get_n_heap(page) - 2));
|
||||
* (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW));
|
||||
ut_ad(!memcmp(data, zero, ut_min(len, sizeof zero)));
|
||||
memcpy(data, rec, len);
|
||||
data += len;
|
||||
|
@ -2801,9 +2805,8 @@ page_zip_write_blob_ptr(
|
|||
+ rec_get_n_extern_new(rec, index, n);
|
||||
ut_a(blob_no < page_zip->n_blobs);
|
||||
|
||||
/* The heap number of the first user record is 2. */
|
||||
externs = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW)
|
||||
* (PAGE_ZIP_DIR_SLOT_SIZE
|
||||
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
|
||||
|
||||
|
@ -2891,13 +2894,13 @@ corrupt:
|
|||
storage = page_zip->data + z_offset;
|
||||
|
||||
storage_end = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW)
|
||||
* PAGE_ZIP_DIR_SLOT_SIZE;
|
||||
|
||||
heap_no = 1 + (storage_end - storage) / REC_NODE_PTR_SIZE;
|
||||
|
||||
if (UNIV_UNLIKELY((storage_end - storage) % REC_NODE_PTR_SIZE)
|
||||
|| UNIV_UNLIKELY(heap_no < 2)
|
||||
|| UNIV_UNLIKELY(heap_no < PAGE_HEAP_NO_USER_LOW)
|
||||
|| UNIV_UNLIKELY(heap_no >= page_dir_get_n_heap(page))) {
|
||||
|
||||
goto corrupt;
|
||||
|
@ -2941,9 +2944,8 @@ page_zip_write_node_ptr(
|
|||
|
||||
ut_ad(!page_is_leaf(page));
|
||||
|
||||
/* The heap number of the first user record is 2. */
|
||||
storage = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW)
|
||||
* PAGE_ZIP_DIR_SLOT_SIZE
|
||||
- (rec_get_heap_no_new(rec) - 1) * REC_NODE_PTR_SIZE;
|
||||
field = rec + size - REC_NODE_PTR_SIZE;
|
||||
|
@ -3006,9 +3008,8 @@ page_zip_write_trx_id_and_roll_ptr(
|
|||
|
||||
ut_ad(page_is_leaf(page));
|
||||
|
||||
/* The heap number of the first user record is 2. */
|
||||
storage = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW)
|
||||
* PAGE_ZIP_DIR_SLOT_SIZE
|
||||
- (rec_get_heap_no_new(rec) - 1)
|
||||
* (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
|
||||
|
@ -3065,7 +3066,7 @@ page_zip_clear_rec(
|
|||
ut_ad(page_zip_header_cmp(page_zip, page));
|
||||
|
||||
heap_no = rec_get_heap_no_new(rec);
|
||||
ut_ad(heap_no >= 2); /* exclude infimum and supremum */
|
||||
ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW);
|
||||
|
||||
if (
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
|
@ -3084,7 +3085,8 @@ page_zip_clear_rec(
|
|||
if (!page_is_leaf(page)) {
|
||||
/* Clear node_ptr on the compressed page. */
|
||||
byte* storage = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page)
|
||||
- PAGE_HEAP_NO_USER_LOW)
|
||||
* PAGE_ZIP_DIR_SLOT_SIZE;
|
||||
|
||||
memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE,
|
||||
|
@ -3092,7 +3094,8 @@ page_zip_clear_rec(
|
|||
} else if (dict_index_is_clust(index)) {
|
||||
/* Clear trx_id and roll_ptr on the compressed page. */
|
||||
byte* storage = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page)
|
||||
- PAGE_HEAP_NO_USER_LOW)
|
||||
* PAGE_ZIP_DIR_SLOT_SIZE;
|
||||
|
||||
memset(storage - (heap_no - 1)
|
||||
|
@ -3214,9 +3217,9 @@ page_zip_dir_insert(
|
|||
ut_a(slot_rec);
|
||||
}
|
||||
|
||||
/* Read the old n_dense (n_heap may have been incremented).
|
||||
Subtract 2 for the infimum and supremum records. */
|
||||
n_dense = page_dir_get_n_heap(page_zip->data) - 3;
|
||||
/* Read the old n_dense (n_heap may have been incremented). */
|
||||
n_dense = page_dir_get_n_heap(page_zip->data)
|
||||
- (PAGE_HEAP_NO_USER_LOW + 1);
|
||||
|
||||
if (UNIV_LIKELY_NULL(free_rec)) {
|
||||
/* The record was allocated from the free list.
|
||||
|
@ -3225,7 +3228,7 @@ page_zip_dir_insert(
|
|||
off by one, because page_cur_insert_rec_low()
|
||||
did not increment n_heap. */
|
||||
ut_ad(rec_get_heap_no_new(rec) < n_dense + 1
|
||||
+ 2/* infimum and supremum */);
|
||||
+ PAGE_HEAP_NO_USER_LOW);
|
||||
ut_ad(rec >= free_rec);
|
||||
slot_free = page_zip_dir_find(page_zip, page_offset(free_rec));
|
||||
ut_ad(slot_free);
|
||||
|
@ -3234,7 +3237,7 @@ page_zip_dir_insert(
|
|||
/* The record was allocated from the heap.
|
||||
Shift the entire dense directory. */
|
||||
ut_ad(rec_get_heap_no_new(rec) == n_dense
|
||||
+ 2/* infimum and supremum */);
|
||||
+ PAGE_HEAP_NO_USER_LOW);
|
||||
|
||||
/* Shift to the end of the dense page directory. */
|
||||
slot_free = page_zip->data + page_zip->size
|
||||
|
@ -3283,7 +3286,8 @@ page_zip_dir_delete(
|
|||
/* Make the last slot the start of the free list. */
|
||||
slot_free = page_zip->data + page_zip->size
|
||||
- PAGE_ZIP_DIR_SLOT_SIZE
|
||||
* (page_dir_get_n_heap(page_zip->data) - 2);
|
||||
* (page_dir_get_n_heap(page_zip->data)
|
||||
- PAGE_HEAP_NO_USER_LOW);
|
||||
} else {
|
||||
slot_free = page_zip_dir_find_free(page_zip,
|
||||
page_offset(free));
|
||||
|
@ -3318,7 +3322,7 @@ page_zip_dir_delete(
|
|||
ut_a(blob_no + n_ext <= page_zip->n_blobs);
|
||||
|
||||
externs = page_zip->data + page_zip->size
|
||||
- (page_dir_get_n_heap(page) - 2)
|
||||
- (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW)
|
||||
* (PAGE_ZIP_DIR_SLOT_SIZE
|
||||
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
|
||||
|
||||
|
@ -3358,9 +3362,9 @@ page_zip_dir_add_slot(
|
|||
|
||||
ut_ad(page_is_comp(page_zip->data));
|
||||
|
||||
/* Read the old n_dense (n_heap has already been incremented).
|
||||
Subtract 2 for the infimum and supremum records. */
|
||||
n_dense = page_dir_get_n_heap(page_zip->data) - 3;
|
||||
/* Read the old n_dense (n_heap has already been incremented). */
|
||||
n_dense = page_dir_get_n_heap(page_zip->data)
|
||||
- (PAGE_HEAP_NO_USER_LOW + 1);
|
||||
|
||||
dir = page_zip->data + page_zip->size
|
||||
- PAGE_ZIP_DIR_SLOT_SIZE * n_dense;
|
||||
|
@ -3536,7 +3540,8 @@ page_zip_reorganize(
|
|||
/* Copy the records from the temporary space to the recreated page;
|
||||
do not copy the lock bits yet */
|
||||
|
||||
page_copy_rec_list_end_no_locks(page, page_get_infimum_rec(temp_page),
|
||||
page_copy_rec_list_end_no_locks(block, temp_block,
|
||||
page_get_infimum_rec(temp_page),
|
||||
index, mtr);
|
||||
/* Copy max trx id to recreated page */
|
||||
page_set_max_trx_id(page, NULL, page_get_max_trx_id(temp_page));
|
||||
|
|
Loading…
Reference in a new issue