1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

branches/zip: Eliminate many buf_block_align() calls.

Replace page_t* or page_zip_des_t* parameters in some functions with
buf_block_t*.

buf_frame_get_page_zip(): Disable unless #ifdef UNIV_DEBUG || UNIV_ZIP_DEBUG.

btr_cur_t: Add buf_block_t* page_block.

btr_pcur_get_block(), btr_cur_get_block(), btr_cur_get_page_zip():
New functions.

btr_cur_position(): Add the parameter block.
This commit is contained in:
marko
2006-10-18 11:39:31 +00:00
parent 8f07794024
commit d583b1803c
24 changed files with 544 additions and 419 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -532,10 +532,12 @@ retry_page_get:
page_mode = mode;
}
cursor->page_block = block;
page_cur_search_with_match(page, index, tuple, page_mode,
&up_match, &up_bytes,
&low_match, &low_bytes,
page_cursor);
if (estimate) {
btr_cur_add_path_info(cursor, height, root_height);
}
@@ -676,6 +678,7 @@ 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 */
@@ -705,6 +708,7 @@ btr_cur_open_at_index_side(
}
}
ut_ad(buf_block_get_frame(btr_cur_get_block(cursor)) == page);
if (from_left) {
page_cur_set_before_first(page, page_cursor);
} else {
@@ -804,6 +808,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);
if (height == 0) {
@@ -850,14 +855,14 @@ btr_cur_insert_if_possible(
mtr_t* mtr) /* in: mtr */
{
page_cur_t* page_cursor;
page_t* page;
buf_block_t* block;
rec_t* rec;
ut_ad(dtuple_check_typed(tuple));
page = btr_cur_get_page(cursor);
block = btr_cur_get_block(cursor);
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));
page_cursor = btr_cur_get_page_cur(cursor);
/* Now, try the insert */
@@ -867,9 +872,10 @@ btr_cur_insert_if_possible(
if (UNIV_UNLIKELY(!rec)) {
/* If record did not fit, reorganize */
if (btr_page_reorganize(page, cursor->index, mtr)) {
if (btr_page_reorganize(block, cursor->index, mtr)) {
page_cur_search(page, cursor->index, tuple,
page_cur_search(buf_block_get_frame(block),
cursor->index, tuple,
PAGE_CUR_LE, page_cursor);
rec = page_cur_tuple_insert(page_cursor, page_zip,
@@ -910,7 +916,9 @@ btr_cur_ins_lock_and_undo(
rec = btr_cur_get_rec(cursor);
index = cursor->index;
err = lock_rec_insert_check_and_lock(flags, rec, index, thr, inherit);
err = lock_rec_insert_check_and_lock(flags, rec,
btr_cur_get_block(cursor),
index, thr, inherit);
if (err != DB_SUCCESS) {
@@ -1045,7 +1053,7 @@ btr_cur_optimistic_insert(
*big_rec = NULL;
block = buf_block_align(btr_cur_get_rec(cursor));
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
index = cursor->index;
page_zip = buf_block_get_page_zip(block);
@@ -1135,7 +1143,7 @@ fail:
entry, index, ext, n_ext, mtr);
if (UNIV_UNLIKELY(!(*rec))) {
/* If the record did not fit, reorganize */
if (UNIV_UNLIKELY(!btr_page_reorganize(page, index, mtr))) {
if (UNIV_UNLIKELY(!btr_page_reorganize(block, index, mtr))) {
ut_a(page_zip);
goto fail;
@@ -1233,7 +1241,7 @@ btr_cur_pessimistic_insert(
ulint zip_size = dict_table_zip_size(index->table);
big_rec_t* big_rec_vec = NULL;
mem_heap_t* heap = NULL;
page_t* page;
buf_block_t* block;
ulint err;
ibool dummy_inh;
ibool success;
@@ -1244,12 +1252,12 @@ btr_cur_pessimistic_insert(
*big_rec = NULL;
page = btr_cur_get_page(cursor);
block = btr_cur_get_block(cursor);
ut_ad(mtr_memo_contains(mtr,
dict_index_get_lock(btr_cur_get_index(cursor)),
MTR_MEMO_X_LOCK));
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));
/* Try first an optimistic insert; reset the cursor flag: we do not
assume anything of how it was positioned */
@@ -1291,7 +1299,8 @@ btr_cur_pessimistic_insert(
if (page_zip_rec_needs_ext(rec_get_converted_size(index, entry,
ext, n_ext),
page_is_comp(page), zip_size)) {
dict_table_is_comp(index->table),
zip_size)) {
/* The record is so big that we have to store some fields
externally on separate database pages */
@@ -1359,7 +1368,7 @@ btr_cur_pessimistic_insert(
}
}
if (dict_index_get_page(index) == page_get_page_no(page)) {
if (dict_index_get_page(index) == buf_block_get_page_no(block)) {
/* The page is the root page */
*rec = btr_root_raise_and_insert(cursor, entry,
@@ -1373,7 +1382,7 @@ btr_cur_pessimistic_insert(
mem_heap_free(heap);
}
btr_cur_position(index, page_rec_get_prev(*rec), cursor);
btr_cur_position(index, page_rec_get_prev(*rec), block, cursor);
#ifdef BTR_CUR_ADAPT
btr_search_update_hash_on_insert(cursor);
@@ -1424,8 +1433,9 @@ btr_cur_upd_lock_and_undo(
if (!dict_index_is_clust(index)) {
/* We do undo logging only when we update a clustered index
record */
return(lock_sec_rec_modify_check_and_lock(flags, rec, index,
thr));
return(lock_sec_rec_modify_check_and_lock(
flags, rec, btr_cur_get_block(cursor),
index, thr));
}
/* Check if we have to wait for a lock: enqueue an explicit lock
@@ -1628,7 +1638,7 @@ btr_cur_update_in_place(
}
#endif /* UNIV_DEBUG */
block = buf_block_align(rec);
block = btr_cur_get_block(cursor);
/* Check that enough space is available on the compressed page. */
page_zip = buf_block_get_page_zip(block);
@@ -1728,6 +1738,7 @@ btr_cur_optimistic_update(
dict_index_t* index;
page_cur_t* page_cursor;
ulint err;
buf_block_t* block;
page_t* page;
page_zip_des_t* page_zip;
rec_t* rec;
@@ -1742,10 +1753,12 @@ btr_cur_optimistic_update(
ulint i;
ulint* offsets;
page = btr_cur_get_page(cursor);
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
orig_rec = rec = btr_cur_get_rec(cursor);
index = cursor->index;
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
heap = mem_heap_create(1024);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
@@ -1757,7 +1770,6 @@ btr_cur_optimistic_update(
}
#endif /* UNIV_DEBUG */
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
if (!row_upd_changes_field_size_or_external(index, offsets, update)) {
/* The simplest and the most common case: the update does not
@@ -1798,7 +1810,7 @@ btr_cur_optimistic_update(
old_rec_size = rec_offs_size(offsets);
new_rec_size = rec_get_converted_size(index, new_entry, NULL, 0);
page_zip = buf_frame_get_page_zip(page);
page_zip = buf_block_get_page_zip(block);
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
@@ -1975,6 +1987,7 @@ btr_cur_pessimistic_update(
big_rec_t* big_rec_vec = NULL;
big_rec_t* dummy_big_rec;
dict_index_t* index;
buf_block_t* block;
page_t* page;
page_zip_des_t* page_zip;
rec_t* rec;
@@ -1994,14 +2007,15 @@ btr_cur_pessimistic_update(
*big_rec = NULL;
page = btr_cur_get_page(cursor);
page_zip = buf_frame_get_page_zip(page);
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
page_zip = buf_block_get_page_zip(block);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
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));
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
@@ -2374,8 +2388,6 @@ btr_cur_del_mark_set_clust_rec(
ut_ad(dict_index_is_clust(index));
ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
page_zip = buf_frame_get_page_zip(rec);
err = lock_clust_rec_modify_check_and_lock(flags,
rec, index, offsets, thr);
@@ -2392,12 +2404,14 @@ btr_cur_del_mark_set_clust_rec(
goto func_exit;
}
block = buf_block_align(rec);
block = btr_cur_get_block(cursor);
if (block->is_hashed) {
rw_lock_x_lock(&btr_search_latch);
}
page_zip = buf_block_get_page_zip(block);
btr_rec_set_deleted_flag(rec, page_zip, val);
trx = thr_get_trx(thr);
@@ -2512,10 +2526,10 @@ btr_cur_del_mark_set_sec_rec(
mtr_t* mtr) /* in: mtr */
{
buf_block_t* block;
page_zip_des_t* page_zip;
rec_t* rec;
ulint err;
block = btr_cur_get_block(cursor);
rec = btr_cur_get_rec(cursor);
#ifdef UNIV_DEBUG
@@ -2526,23 +2540,22 @@ btr_cur_del_mark_set_sec_rec(
}
#endif /* UNIV_DEBUG */
err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index,
thr);
err = lock_sec_rec_modify_check_and_lock(flags, rec,
btr_cur_get_block(cursor),
cursor->index, thr);
if (err != DB_SUCCESS) {
return(err);
}
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
ut_ad(!!page_rec_is_comp(rec)
== dict_table_is_comp(cursor->index->table));
page_zip = buf_frame_get_page_zip(rec);
if (block->is_hashed) {
rw_lock_x_lock(&btr_search_latch);
}
btr_rec_set_deleted_flag(rec, page_zip, val);
btr_rec_set_deleted_flag(rec, buf_block_get_page_zip(block), val);
if (block->is_hashed) {
rw_lock_x_unlock(&btr_search_latch);
@@ -2566,9 +2579,6 @@ btr_cur_del_unmark_for_ibuf(
/* We do not need to reserve btr_search_latch, as the page has just
been read to the buffer pool and there cannot be a hash index to it. */
/* The insert buffer is not used on compressed pages. */
ut_ad(!buf_frame_get_page_zip(rec));
btr_rec_set_deleted_flag(rec, NULL, FALSE);
btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr);
@@ -2595,8 +2605,8 @@ btr_cur_compress_if_useful(
ut_ad(mtr_memo_contains(mtr,
dict_index_get_lock(btr_cur_get_index(cursor)),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains_page(mtr, btr_cur_get_rec(cursor),
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX));
return(btr_cur_compress_recommendation(cursor, mtr)
&& btr_compress(cursor, mtr));
@@ -2627,11 +2637,11 @@ btr_cur_optimistic_delete(
ibool no_compress_needed;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(mtr_memo_contains_page(mtr, btr_cur_get_rec(cursor),
MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX));
/* This is intended only for leaf page deletions */
block = buf_block_align(btr_cur_get_rec(cursor));
block = btr_cur_get_block(cursor);
ut_ad(page_is_leaf(buf_block_get_frame(block)));
@@ -2702,6 +2712,7 @@ btr_cur_pessimistic_delete(
ibool in_rollback,/* in: TRUE if called in rollback */
mtr_t* mtr) /* in: mtr */
{
buf_block_t* block;
page_t* page;
page_zip_des_t* page_zip;
dict_index_t* index;
@@ -2715,12 +2726,13 @@ btr_cur_pessimistic_delete(
mem_heap_t* heap;
ulint* offsets;
page = btr_cur_get_page(cursor);
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
index = btr_cur_get_index(cursor);
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
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));
if (!has_reserved_extents) {
/* First reserve enough free space for the file segments
of the index tree, so that the node pointer updates will
@@ -2741,7 +2753,7 @@ btr_cur_pessimistic_delete(
heap = mem_heap_create(1024);
rec = btr_cur_get_rec(cursor);
page_zip = buf_frame_get_page_zip(page);
page_zip = buf_block_get_page_zip(block);
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
@@ -2764,7 +2776,7 @@ btr_cur_pessimistic_delete(
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
&& UNIV_UNLIKELY(dict_index_get_page(btr_cur_get_index(cursor))
!= page_get_page_no(page))) {
!= buf_block_get_page_no(block))) {
/* If there is only one record, drop the whole page in
btr_discard_page, if this is not the root page */
@@ -2804,7 +2816,7 @@ btr_cur_pessimistic_delete(
so that it is equal to the new leftmost node pointer
on the page */
btr_node_ptr_delete(index, page, mtr);
btr_node_ptr_delete(index, block, mtr);
node_ptr = dict_index_build_node_ptr(
index, next_rec, page_get_page_no(page),
@@ -3593,11 +3605,12 @@ btr_store_big_rec_extern_fields(
ut_ad(mtr_memo_contains_page(local_mtr, rec, MTR_MEMO_PAGE_X_FIX));
ut_a(dict_index_is_clust(index));
space_id = page_get_space_id(page_align(rec));
page_zip = buf_frame_get_page_zip(rec);
rec_block = buf_block_align(rec);
page_zip = buf_block_get_page_zip(rec_block);
ut_a(dict_table_zip_size(index->table)
== (page_zip ? page_zip->size : 0));
== buf_block_get_zip_size(rec_block));
space_id = buf_block_get_space(rec_block);
if (UNIV_LIKELY_NULL(page_zip)) {
int err;
@@ -3685,8 +3698,8 @@ btr_store_big_rec_extern_fields(
mlog_write_ulint(
prev_page + FIL_PAGE_NEXT,
page_no, MLOG_4BYTES, &mtr);
memcpy(buf_frame_get_page_zip(
prev_page)
memcpy(buf_block_get_page_zip(
prev_block)
->data + FIL_PAGE_NEXT,
prev_page + FIL_PAGE_NEXT, 4);
} else {
@@ -3914,14 +3927,12 @@ btr_free_externally_stored_field(
mtr_t mtr;
#ifdef UNIV_DEBUG
buf_block_t* block = buf_block_align(field_ref);
#endif /* UNIV_DEBUG */
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(!rec || rec_offs_validate(rec, index, offsets));
#ifdef UNIV_DEBUG
if (rec) {
ulint local_len;
byte* f = rec_get_nth_field(rec, offsets, i, &local_len);

View File

@@ -75,6 +75,7 @@ btr_pcur_store_position(
mtr_t* mtr) /* in: mtr */
{
page_cur_t* page_cursor;
buf_block_t* block;
rec_t* rec;
dict_index_t* index;
page_t* page;
@@ -83,6 +84,7 @@ btr_pcur_store_position(
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
block = btr_pcur_get_block(cursor);
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
page_cursor = btr_pcur_get_page_cur(cursor);
@@ -91,8 +93,8 @@ btr_pcur_store_position(
page = page_align(rec);
offs = page_offset(rec);
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_a(cursor->latch_mode != BTR_NO_LATCHES);
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
@@ -135,9 +137,8 @@ btr_pcur_store_position(
index, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
cursor->block_when_stored = block;
cursor->modify_clock = buf_block_get_modify_clock(block);
}
/******************************************************************
@@ -215,9 +216,9 @@ btr_pcur_restore_position(
ut_error;
}
if (UNIV_UNLIKELY(
cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
if (UNIV_UNLIKELY
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration,
but always do a search */
@@ -226,8 +227,7 @@ btr_pcur_restore_position(
cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored
= buf_block_align(btr_pcur_get_page(cursor));
cursor->block_when_stored = btr_pcur_get_block(cursor);
return(FALSE);
}
@@ -235,7 +235,7 @@ btr_pcur_restore_position(
ut_a(cursor->old_rec);
ut_a(cursor->old_n_fields);
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
page = btr_pcur_get_page(cursor);
if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF)
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
@@ -247,7 +247,7 @@ btr_pcur_restore_position(
cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(buf_block_align(page),
buf_block_dbg_add_level(btr_pcur_get_block(cursor),
SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
if (cursor->rel_pos == BTR_PCUR_ON) {
@@ -316,8 +316,7 @@ btr_pcur_restore_position(
the cursor can now be on a different page! But we can retain
the value of old_rec */
cursor->block_when_stored = buf_block_align(
btr_pcur_get_page(cursor));
cursor->block_when_stored = btr_pcur_get_block(cursor);
cursor->modify_clock = buf_block_get_modify_clock(
cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED;
@@ -356,7 +355,7 @@ btr_pcur_release_leaf(
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
block = buf_block_align(btr_cur_get_rec(btr_pcur_get_btr_cur(cursor)));
block = btr_pcur_get_block(cursor);
btr_leaf_page_release(block, cursor->latch_mode, mtr);
@@ -391,9 +390,8 @@ btr_pcur_move_to_next_page(
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
page = btr_pcur_get_page(cursor);
next_page_no = btr_page_get_next(page, mtr);
space = page_get_space_id(page);
space = buf_block_get_space(btr_pcur_get_block(cursor));
ut_ad(next_page_no != FIL_NULL);
@@ -402,12 +400,15 @@ btr_pcur_move_to_next_page(
next_page = buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr) == page_get_page_no(page));
ut_a(btr_page_get_prev(next_page, mtr)
== buf_block_get_page_no(btr_pcur_get_block(cursor)));
#endif /* UNIV_BTR_DEBUG */
next_block->check_index_page_at_flush = TRUE;
btr_leaf_page_release(buf_block_align(page), cursor->latch_mode, mtr);
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_check_dir(next_page);
@@ -467,18 +468,21 @@ btr_pcur_move_backward_from_page(
page = btr_pcur_get_page(cursor);
prev_page_no = btr_page_get_prev(page, mtr);
space = page_get_space_id(page);
space = buf_block_get_space(btr_pcur_get_block(cursor));
if (btr_pcur_is_before_first_on_page(cursor, mtr)
&& (prev_page_no != FIL_NULL)) {
if (prev_page_no == FIL_NULL) {
} else if (btr_pcur_is_before_first_on_page(cursor, mtr)) {
prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
btr_leaf_page_release(buf_block_align(page), latch_mode, mtr);
btr_leaf_page_release(btr_pcur_get_block(cursor),
latch_mode, mtr);
btr_pcur_get_btr_cur(cursor)->page_block
= buf_block_align(prev_page);
page_cur_set_after_last(prev_page,
btr_pcur_get_page_cur(cursor));
} else if (prev_page_no != FIL_NULL) {
} else {
/* The repositioned cursor did not end on an infimum record on
a page. Cursor repositioning acquired a latch also on the

View File

@@ -464,7 +464,7 @@ btr_search_info_update_slow(
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
block = buf_block_align(btr_cur_get_rec(cursor));
block = btr_cur_get_block(cursor);
/* NOTE that the following two function calls do NOT protect
info or block->n_fields etc. with any semaphore, to save CPU time!
@@ -789,7 +789,7 @@ btr_search_guess_on_hash(
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad(page_rec_is_user_rec(rec));
btr_cur_position(index, rec, cursor);
btr_cur_position(index, rec, block, cursor);
/* Check the validity of the guess within the page */

View File

@@ -2875,14 +2875,14 @@ void
ibuf_insert_to_index_page(
/*======================*/
dtuple_t* entry, /* in: buffered entry to insert */
page_t* page, /* in/out: index page where the buffered entry
buf_block_t* block, /* in/out: index page where the buffered entry
should be placed */
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */
{
page_cur_t page_cur;
ulint low_match;
page_t* page = buf_block_get_frame(block);
rec_t* rec;
page_t* bitmap_page;
ulint old_bits;
@@ -2931,21 +2931,23 @@ dump:
btr_cur_del_unmark_for_ibuf(rec, mtr);
} else {
rec = page_cur_tuple_insert(&page_cur, page_zip,
rec = page_cur_tuple_insert(&page_cur,
buf_block_get_page_zip(block),
entry, index, NULL, 0, mtr);
if (UNIV_UNLIKELY(rec == NULL)) {
/* If the record did not fit, reorganize */
btr_page_reorganize(page, index, mtr);
btr_page_reorganize(block, index, mtr);
page_cur_search(page, index, entry,
PAGE_CUR_LE, &page_cur);
/* This time the record must fit */
if (UNIV_UNLIKELY
(!page_cur_tuple_insert(&page_cur, page_zip, entry,
index, NULL, 0, mtr))) {
(!page_cur_tuple_insert(
&page_cur, buf_block_get_page_zip(block),
entry, index, NULL, 0, mtr))) {
ulint space;
ulint page_no;
@@ -3345,7 +3347,7 @@ loop:
ut_a(volume <= 4 * UNIV_PAGE_SIZE
/ IBUF_PAGE_SIZE_PER_FREE_SPACE);
#endif
ibuf_insert_to_index_page(entry, page, page_zip,
ibuf_insert_to_index_page(entry, block,
dummy_index, &mtr);
ibuf_dummy_index_free(dummy_index);
}

View File

@@ -156,7 +156,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
/* out: child node address */
rec_t* rec, /* in: node pointer record */
const rec_t* rec, /* in: node pointer record */
const ulint* offsets);/* in: array returned by rec_get_offsets() */
/****************************************************************
Creates the root node for a new index tree. */
@@ -216,7 +216,7 @@ ibool
btr_page_reorganize(
/*================*/
/* out: TRUE on success, FALSE on failure */
page_t* page, /* in: page to be reorganized */
buf_block_t* block, /* in: page to be reorganized */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mtr */
/*****************************************************************
@@ -290,7 +290,7 @@ void
btr_node_ptr_delete(
/*================*/
dict_index_t* index, /* in: index tree */
page_t* page, /* in: page whose node pointer is deleted */
buf_block_t* block, /* in: page whose node pointer is deleted */
mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG
/****************************************************************
@@ -357,8 +357,7 @@ btr_parse_page_reorganize(
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: record descriptor */
page_t* page, /* in/out: page to be reorganized, or NULL */
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
buf_block_t* block, /* in: page to be reorganized, or NULL */
mtr_t* mtr); /* in: mtr or NULL */
/******************************************************************
Gets the number of pages in a B-tree. */

View File

@@ -229,17 +229,17 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
/* out: child node address */
rec_t* rec, /* in: node pointer record */
const rec_t* rec, /* in: node pointer record */
const ulint* offsets)/* in: array returned by rec_get_offsets() */
{
byte* field;
ulint len;
ulint page_no;
const byte* field;
ulint len;
ulint page_no;
ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec));
/* The child address is in the last field */
field = rec_get_nth_field(rec, offsets,
field = rec_get_nth_field((rec_t*) rec, offsets,
rec_offs_n_fields(offsets) - 1, &len);
ut_ad(len == 4);
@@ -251,7 +251,7 @@ btr_node_ptr_get_child_page_no(
"InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n",
(ulong) page_offset(rec));
buf_page_print(page_align(rec), 0);
buf_page_print(page_align((rec_t*) rec), 0);
}
return(page_no);

View File

@@ -36,6 +36,14 @@ btr_cur_get_page_cur(
/* out: pointer to page cursor component */
btr_cur_t* cursor);/* in: tree cursor */
/*************************************************************
Returns the buffer block on which the tree cursor is positioned. */
UNIV_INLINE
buf_block_t*
btr_cur_get_block(
/*==============*/
/* out: pointer to buffer block */
btr_cur_t* cursor);/* in: tree cursor */
/*************************************************************
Returns the record pointer of a tree cursor. */
UNIV_INLINE
rec_t*
@@ -44,6 +52,15 @@ btr_cur_get_rec(
/* out: pointer to record */
btr_cur_t* cursor);/* in: tree cursor */
/*************************************************************
Returns the compressed page on which the tree cursor is positioned. */
UNIV_INLINE
page_zip_des_t*
btr_cur_get_page_zip(
/*=================*/
/* out: pointer to compressed page,
or NULL if the page is not compressed */
btr_cur_t* cursor);/* in: tree cursor */
/*************************************************************
Invalidates a tree cursor by setting record pointer to NULL. */
UNIV_INLINE
void
@@ -74,6 +91,7 @@ btr_cur_position(
/*=============*/
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in tree */
buf_block_t* block, /* in: buffer block of rec */
btr_cur_t* cursor);/* in: cursor */
/************************************************************************
Searches an index tree and positions a tree cursor on a given level.
@@ -577,6 +595,9 @@ 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() */
page_t* left_page; /* this field is used to store
a pointer to the left neighbor
page, in the cases

View File

@@ -19,6 +19,18 @@ btr_cur_get_page_cur(
{
return(&(cursor->page_cur));
}
/*************************************************************
Returns the buffer block on which the tree cursor is positioned. */
UNIV_INLINE
buf_block_t*
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);
}
/*************************************************************
Returns the record pointer of a tree cursor. */
@@ -29,9 +41,23 @@ 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)));
}
/*************************************************************
Returns the compressed page on which the tree cursor is positioned. */
UNIV_INLINE
page_zip_des_t*
btr_cur_get_page_zip(
/*=================*/
/* out: pointer to compressed page,
or NULL if the page is not compressed */
btr_cur_t* cursor) /* in: tree cursor */
{
return(buf_block_get_page_zip(btr_cur_get_block(cursor)));
}
/*************************************************************
Invalidates a tree cursor by setting record pointer to NULL. */
UNIV_INLINE
@@ -41,6 +67,7 @@ btr_cur_invalidate(
btr_cur_t* cursor) /* in: tree cursor */
{
page_cur_invalidate(&(cursor->page_cur));
cursor->page_block = NULL;
}
/*************************************************************
@@ -75,9 +102,13 @@ btr_cur_position(
/*=============*/
dict_index_t* index, /* in: index */
rec_t* rec, /* in: record in tree */
btr_cur_t* cursor) /* in: cursor */
buf_block_t* block, /* in: buffer block of rec */
btr_cur_t* cursor) /* out: cursor */
{
ut_ad(page_align(rec) == buf_block_get_frame(block));
page_cur_position(rec, btr_cur_get_page_cur(cursor));
cursor->page_block = block;
cursor->index = index;
}

View File

@@ -371,6 +371,14 @@ btr_pcur_get_page(
/* out: pointer to the page */
btr_pcur_t* cursor);/* in: persistent cursor */
/*************************************************************
Returns the buffer block of a persistent cursor. */
UNIV_INLINE
buf_block_t*
btr_pcur_get_block(
/*===============*/
/* out: pointer to the block */
btr_pcur_t* cursor);/* in: persistent cursor */
/*************************************************************
Returns the record of a persistent cursor. */
UNIV_INLINE
rec_t*

View File

@@ -88,7 +88,21 @@ btr_pcur_get_page(
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
return(page_cur_get_page(btr_pcur_get_page_cur(cursor)));
return(btr_cur_get_page(btr_pcur_get_btr_cur(cursor)));
}
/*************************************************************
Returns the buffer block of a persistent cursor. */
UNIV_INLINE
buf_block_t*
btr_pcur_get_block(
/*===============*/
/* out: pointer to the block */
btr_pcur_t* cursor) /* in: persistent cursor */
{
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
return(btr_cur_get_block(btr_pcur_get_btr_cur(cursor)));
}
/*************************************************************
@@ -103,7 +117,7 @@ btr_pcur_get_rec(
ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
return(page_cur_get_rec(btr_pcur_get_page_cur(cursor)));
return(btr_cur_get_rec(btr_pcur_get_btr_cur(cursor)));
}
/******************************************************************
@@ -296,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(page_align(btr_pcur_get_rec(cursor)),
page_cur_set_after_last(btr_pcur_get_page(cursor),
btr_pcur_get_page_cur(cursor));
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
@@ -619,6 +633,7 @@ btr_pcur_close(
cursor->old_rec_buf = NULL;
}
cursor->btr_cur.page_block = NULL;
cursor->btr_cur.page_cur.rec = NULL;
cursor->old_rec = NULL;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;

View File

@@ -132,9 +132,9 @@ UNIV_INLINE
byte*
buf_frame_copy(
/*===========*/
/* out: buf */
byte* buf, /* in: buffer to copy to */
buf_frame_t* frame); /* in: buffer frame */
/* out: buf */
byte* buf, /* in: buffer to copy to */
const buf_frame_t* frame); /* in: buffer frame */
/******************************************************************
NOTE! The following macros should be used instead of buf_page_get_gen,
to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
@@ -618,6 +618,7 @@ buf_block_align(
/*============*/
/* out: pointer to block */
byte* ptr); /* in: pointer to a frame */
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
@@ -628,6 +629,7 @@ buf_frame_get_page_zip(
/* out: compressed page descriptor, or NULL */
byte* ptr) /* in: pointer to the page */
__attribute((const));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/************************************************************************
This function is used to get info if there is an io operation
going on on a buffer page. */

View File

@@ -261,6 +261,7 @@ buf_block_align(
return(block);
}
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
@@ -273,6 +274,7 @@ buf_frame_get_page_zip(
{
return(buf_block_get_page_zip(buf_block_align(ptr)));
}
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/**************************************************************************
Gets the space id, page offset, and byte offset within page of a
@@ -286,7 +288,7 @@ buf_ptr_get_fsp_addr(
fil_addr_t* addr) /* out: page offset and byte offset */
{
const page_t* page = ut_align_down((void*) ptr, UNIV_PAGE_SIZE);
ut_ad(buf_block_align(ptr));
ut_ad(buf_block_align((byte*) ptr));
*space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
addr->page = mach_read_from_4(page + FIL_PAGE_OFFSET);
@@ -361,9 +363,9 @@ UNIV_INLINE
byte*
buf_frame_copy(
/*===========*/
/* out: buf */
byte* buf, /* in: buffer to copy to */
buf_frame_t* frame) /* in: buffer frame */
/* out: buf */
byte* buf, /* in: buffer to copy to */
const buf_frame_t* frame) /* in: buffer frame */
{
ut_ad(buf && frame);

View File

@@ -10,6 +10,7 @@ Created 5/7/1996 Heikki Tuuri
#define lock0lock_h
#include "univ.i"
#include "buf0types.h"
#include "trx0types.h"
#include "rem0types.h"
#include "dict0types.h"
@@ -250,6 +251,7 @@ lock_rec_insert_check_and_lock(
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */
rec_t* rec, /* in: record after which to insert */
buf_block_t* block, /* in: buffer block of rec */
dict_index_t* index, /* in: index */
que_thr_t* thr, /* in: query thread */
ibool* inherit);/* out: set to TRUE if the new inserted
@@ -289,6 +291,7 @@ lock_sec_rec_modify_check_and_lock(
NOTE: as this is a secondary index, we
always have to modify the clustered index
record first: see the comment below */
buf_block_t* block, /* in: buffer block of rec */
dict_index_t* index, /* in: secondary index */
que_thr_t* thr); /* in: query thread */
/*************************************************************************

View File

@@ -698,12 +698,11 @@ page_copy_rec_list_end(
on new_page, or NULL on zip overflow
(new_page will be decompressed
from new_page_zip) */
page_t* new_page, /* in/out: index page to copy to */
page_zip_des_t* new_page_zip, /* in/out: compressed page, or NULL */
buf_block_t* new_block, /* in/out: index page to copy to */
rec_t* rec, /* in: record on page */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */
__attribute__((warn_unused_result, nonnull(1, 3, 4, 5)));
__attribute__((warn_unused_result, nonnull));
/*****************************************************************
Copies records from page to new_page, up to the given record, NOT
including that record. Infimum and supremum records are not copied.
@@ -717,12 +716,11 @@ page_copy_rec_list_start(
on new_page, or NULL on zip overflow
(new_page will be decompressed
from new_page_zip) */
page_t* new_page, /* in/out: index page to copy to */
page_zip_des_t* new_page_zip, /* in/out: compressed page, or NULL */
buf_block_t* new_block, /* in/out: index page to copy to */
rec_t* rec, /* in: record on page */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */
__attribute__((warn_unused_result, nonnull(1, 3, 4, 5)));
__attribute__((warn_unused_result, nonnull));
/*****************************************************************
Deletes records from a page from a given record onward, including that record.
The infimum and supremum records are not deleted. */
@@ -762,15 +760,13 @@ page_move_rec_list_end(
/* out: TRUE on success; FALSE on
compression failure (new_page will
be decompressed from new_page_zip) */
page_t* new_page, /* in: index page where to move */
page_zip_des_t* new_page_zip, /* in/out: compressed page of
new_page, or NULL */
buf_block_t* new_block, /* in/out: index page 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, 3, 5, 6)));
__attribute__((nonnull(1, 2, 4, 5)));
/*****************************************************************
Moves record list start to another page. Moved records do not include
split_rec. */
@@ -780,15 +776,13 @@ page_move_rec_list_start(
/*=====================*/
/* out: TRUE on success; FALSE on
compression failure */
page_t* new_page, /* in: index page where to move */
page_zip_des_t* new_page_zip, /* in/out: compressed page of
new_page, or NULL */
buf_block_t* new_block, /* in/out: index page where to move */
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, 3, 5, 6)));
__attribute__((nonnull(1, 2, 4, 5)));
/********************************************************************
Splits a directory slot which owns too many records. */

View File

@@ -16,6 +16,7 @@ Created June 2005 by Marko Makela
#include "mtr0types.h"
#include "page0types.h"
#include "buf0types.h"
#include "dict0types.h"
#include "ut0byte.h"
@@ -335,9 +336,9 @@ page_zip_reorganize(
/* out: TRUE on success, FALSE on failure;
page and page_zip will be left intact
on failure. */
page_zip_des_t* page_zip,/* in: size; out: data, n_blobs,
m_start, m_end */
page_t* page, /* in/out: uncompressed page */
buf_block_t* block, /* in/out: page with compressed page;
on the compressed page, in: size;
out: data, n_blobs, m_start, m_end */
dict_index_t* index, /* in: index of the B-tree node */
mtr_t* mtr) /* in: mini-transaction */
__attribute__((warn_unused_result, nonnull));

View File

@@ -4926,6 +4926,7 @@ lock_rec_insert_check_and_lock(
ulint flags, /* in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */
rec_t* rec, /* in: record after which to insert */
buf_block_t* block, /* in: buffer block of rec */
dict_index_t* index, /* in: index */
que_thr_t* thr, /* in: query thread */
ibool* inherit)/* out: set to TRUE if the new inserted
@@ -4968,7 +4969,7 @@ lock_rec_insert_check_and_lock(
if (!dict_index_is_clust(index)) {
/* Update the page max trx id field */
page_update_max_trx_id(page_align(rec),
buf_frame_get_page_zip(rec),
buf_block_get_page_zip(block),
thr_get_trx(thr)->id);
}
@@ -5006,7 +5007,7 @@ lock_rec_insert_check_and_lock(
if ((err == DB_SUCCESS) && !dict_index_is_clust(index)) {
/* Update the page max trx id field */
page_update_max_trx_id(page_align(rec),
buf_frame_get_page_zip(rec),
buf_block_get_page_zip(block),
thr_get_trx(thr)->id);
}
@@ -5142,6 +5143,7 @@ lock_sec_rec_modify_check_and_lock(
NOTE: as this is a secondary index, we
always have to modify the clustered index
record first: see the comment below */
buf_block_t* block, /* in: buffer block of rec */
dict_index_t* index, /* in: secondary index */
que_thr_t* thr) /* in: query thread */
{
@@ -5186,7 +5188,7 @@ lock_sec_rec_modify_check_and_lock(
if (err == DB_SUCCESS) {
/* Update the page max trx id field */
page_update_max_trx_id(page_align(rec),
buf_frame_get_page_zip(rec),
buf_block_get_page_zip(block),
thr_get_trx(thr)->id);
}

View File

@@ -881,7 +881,7 @@ recv_parse_or_apply_log_rec_body(
|| (ibool)!!page_is_comp(page)
== dict_table_is_comp(index->table));
ptr = btr_parse_page_reorganize(ptr, end_ptr, index,
page, page_zip, mtr);
block, mtr);
}
break;
case MLOG_PAGE_CREATE: case MLOG_COMP_PAGE_CREATE:

View File

@@ -1130,11 +1130,14 @@ use_heap:
(!page_zip_compress(page_zip_orig, page, index, mtr))) {
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
ulint insert_pos
ulint insert_pos
= page_rec_get_n_recs_before(insert_rec);
buf_block_t* block
= buf_block_align(page);
if (page_zip_reorganize(page_zip_orig, page,
index, mtr)) {
ut_ad(buf_block_get_page_zip(block) == page_zip_orig);
if (page_zip_reorganize(block, index, mtr)) {
/* The page was reorganized:
Seek to insert_pos to find insert_rec. */
insert_rec = page + PAGE_NEW_INFIMUM;

View File

@@ -579,15 +579,17 @@ page_copy_rec_list_end(
on new_page, or NULL on zip overflow
(new_page will be decompressed
from new_page_zip) */
page_t* new_page, /* in/out: index page to copy to */
page_zip_des_t* new_page_zip, /* in/out: compressed page, or NULL */
buf_block_t* new_block, /* in/out: index page to copy to */
rec_t* rec, /* in: record on page */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */
{
page_t* page = page_align(rec);
rec_t* ret = page_rec_get_next(page_get_infimum_rec(new_page));
ulint log_mode= 0; /* remove warning */
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_t* page = page_align(rec);
rec_t* ret = page_rec_get_next(
page_get_infimum_rec(new_page));
ulint log_mode = 0; /* remove warning */
/* page_zip_validate() will fail here if btr_compress()
sets FIL_PAGE_PREV to FIL_NULL */
@@ -616,8 +618,7 @@ page_copy_rec_list_end(
= page_rec_get_n_recs_before(ret);
if (UNIV_UNLIKELY
(!page_zip_reorganize(new_page_zip, new_page,
index, mtr))) {
(!page_zip_reorganize(new_block, index, mtr))) {
if (UNIV_UNLIKELY
(!page_zip_decompress(new_page_zip,
@@ -663,12 +664,13 @@ page_copy_rec_list_start(
on new_page, or NULL on zip overflow
(new_page will be decompressed
from new_page_zip) */
page_t* new_page, /* in/out: index page to copy to */
page_zip_des_t* new_page_zip, /* in/out: compressed page, or NULL */
buf_block_t* new_block, /* in/out: index page to copy to */
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_zip_des_t* new_page_zip = buf_block_get_page_zip(new_block);
page_cur_t cur1;
page_cur_t cur2;
page_t* page;
@@ -726,8 +728,7 @@ page_copy_rec_list_start(
= page_rec_get_n_recs_before(ret);
if (UNIV_UNLIKELY
(!page_zip_reorganize(new_page_zip, new_page,
index, mtr))) {
(!page_zip_reorganize(new_block, index, mtr))) {
if (UNIV_UNLIKELY
(!page_zip_decompress(new_page_zip,
@@ -1090,19 +1091,21 @@ page_move_rec_list_end(
/* out: TRUE on success; FALSE on
compression failure (new_page will
be decompressed from new_page_zip) */
page_t* new_page, /* in: index page where to move */
page_zip_des_t* new_page_zip, /* in/out: compressed page of
new_page, or NULL */
buf_block_t* new_block, /* in/out: index page 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 */
{
ulint old_data_size;
ulint new_data_size;
ulint old_n_recs;
ulint new_n_recs;
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;
ulint new_n_recs;
old_data_size = page_get_data_size(new_page);
old_n_recs = page_get_n_recs(new_page);
@@ -1111,8 +1114,8 @@ page_move_rec_list_end(
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_page, new_page_zip,
split_rec, index, mtr))) {
if (UNIV_UNLIKELY(!page_copy_rec_list_end(new_block, split_rec,
index, mtr))) {
return(FALSE);
}
@@ -1138,17 +1141,15 @@ page_move_rec_list_start(
/*=====================*/
/* out: TRUE on success; FALSE on
compression failure */
page_t* new_page, /* in: index page where to move */
page_zip_des_t* new_page_zip, /* in/out: compressed page of
new_page, or NULL */
buf_block_t* new_block, /* in/out: index page where to move */
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_page, new_page_zip,
split_rec, index, mtr))) {
if (UNIV_UNLIKELY(!page_copy_rec_list_start(new_block, split_rec,
index, mtr))) {
return(FALSE);
}

View File

@@ -3504,13 +3504,14 @@ page_zip_reorganize(
/* out: TRUE on success, FALSE on failure;
page and page_zip will be left intact
on failure. */
page_zip_des_t* page_zip,/* in: size; out: data, n_blobs,
m_start, m_end */
page_t* page, /* in/out: uncompressed page */
buf_block_t* block, /* in/out: page with compressed page;
on the compressed page, in: size;
out: data, n_blobs, m_start, m_end */
dict_index_t* index, /* in: index of the B-tree node */
mtr_t* mtr) /* in: mini-transaction */
{
buf_block_t* block;
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = buf_block_get_frame(block);
buf_block_t* temp_block;
page_t* temp_page;
ulint log_mode;
@@ -3531,7 +3532,6 @@ page_zip_reorganize(
/* Recreate the page: note that global data on page (possible
segment headers, next page-field, etc.) is preserved intact */
block = buf_block_align(page);
page_create(block, mtr, dict_table_is_comp(index->table));
block->check_index_page_at_flush = TRUE;

View File

@@ -2084,7 +2084,8 @@ row_ins_index_entry_low(
if (modify == ROW_INS_NEXT) {
rec = page_rec_get_next(btr_cur_get_rec(&cursor));
btr_cur_position(index, rec, &cursor);
btr_cur_position(index, rec,
btr_cur_get_block(&cursor),&cursor);
}
if (dict_index_is_clust(index)) {

View File

@@ -3793,7 +3793,9 @@ wrong_offs:
" buf block fix count %lu\n",
(void*) rec, (void*) buf_pool->frame_zero,
(void*) buf_pool->high_end,
(ulong)buf_block_align(rec)->buf_fix_count);
(ulong)
btr_cur_get_block(btr_pcur_get_btr_cur(pcur))
->buf_fix_count);
fprintf(stderr,
"InnoDB: Index corruption: rec offs %lu"
" next offs %lu, page no %lu,\n"

View File

@@ -1470,7 +1470,7 @@ row_upd_clust_rec_by_insert(
index = dict_table_get_first_index(table);
btr_cur_mark_extern_inherited_fields(
buf_frame_get_page_zip(rec),
btr_cur_get_page_zip(btr_cur),
rec, index,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),