Commit 1834af76 authored by marko's avatar marko

branches/zip: Minor cleanup.

page_set_max_trx_id(): Replace page_t* parameter with buf_block_t*,
to avoid a buf_block_align() call.

Replace some occurrences of page_get_page_no() with buf_block_get_page_no().

page_cur_delete_rec(): Replace buf_block_align() with page_cur_get_block().
parent 40b401a6
......@@ -915,7 +915,7 @@ btr_page_reorganize_low(
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));
page_set_max_trx_id(block, NULL, page_get_max_trx_id(temp_page));
if (UNIV_LIKELY_NULL(page_zip)
&& UNIV_UNLIKELY
......@@ -1128,7 +1128,7 @@ btr_root_raise_and_insert(
heap = mem_heap_create(100);
rec = page_rec_get_next(page_get_infimum_rec(new_page));
new_page_no = page_get_page_no(new_page);
new_page_no = buf_block_get_page_no(new_block);
/* Build the node pointer (= node key and page address) for the
child */
......@@ -1179,8 +1179,7 @@ btr_root_raise_and_insert(
/* We play safe and reset the free bits for the new page */
#if 0
fprintf(stderr, "Root raise new page no %lu\n",
page_get_page_no(new_page));
fprintf(stderr, "Root raise new page no %lu\n", new_page_no);
#endif
ibuf_reset_free_bits_with_type(index->type, new_block);
......@@ -2481,7 +2480,7 @@ btr_discard_only_page_on_level(
/* Free the file page */
btr_page_free(index, block, mtr);
if (UNIV_LIKELY(page_get_page_no(father_page)
if (UNIV_LIKELY(buf_block_get_page_no(father_block)
== dict_index_get_page(index))) {
/* The father is the root page */
......@@ -2659,7 +2658,7 @@ btr_print_recursive(
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));
(ulong) buf_block_get_page_no(block));
page_print(block, index, width, width);
......
......@@ -1195,7 +1195,7 @@ fail:
#if 0
fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" rec %lu ind type %lu\n",
page_get_page_no(page), max_size,
buf_block_get_page_no(block), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type);
#endif
if (!(type & DICT_CLUSTERED)) {
......@@ -2820,7 +2820,7 @@ btr_cur_pessimistic_delete(
btr_node_ptr_delete(index, block, mtr);
node_ptr = dict_index_build_node_ptr(
index, next_rec, page_get_page_no(page),
index, next_rec, buf_block_get_page_no(block),
heap, level);
btr_insert_on_non_leaf_level(index,
......
......@@ -2733,7 +2733,7 @@ ibuf_insert_low(
thr, &mtr);
if (err == DB_SUCCESS) {
/* Update the page max trx id field */
page_update_max_trx_id(page_align(ins_rec), NULL,
page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
thr_get_trx(thr)->id);
}
} else {
......@@ -2754,7 +2754,7 @@ ibuf_insert_low(
thr, &mtr);
if (err == DB_SUCCESS) {
/* Update the page max trx id field */
page_update_max_trx_id(page_align(ins_rec), NULL,
page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
thr_get_trx(thr)->id);
}
......@@ -3332,8 +3332,7 @@ loop:
dict_index_t* dummy_index;
dulint max_trx_id = page_get_max_trx_id(
page_align(ibuf_rec));
page_update_max_trx_id(buf_block_get_frame(block),
page_zip, max_trx_id);
page_update_max_trx_id(block, page_zip, max_trx_id);
entry = ibuf_build_entry_from_ibuf_rec(
ibuf_rec, heap, &dummy_index);
......
......@@ -171,9 +171,8 @@ Sets the max trx id field value. */
void
page_set_max_trx_id(
/*================*/
page_t* page, /* in/out: page */
page_zip_des_t* page_zip,/* in/out: compressed page whose
uncompressed part will be updated, or NULL */
buf_block_t* block, /* in/out: page */
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
dulint trx_id);/* in: transaction id */
/*****************************************************************
Sets the max trx id field value if trx_id is bigger than the previous
......@@ -182,7 +181,7 @@ UNIV_INLINE
void
page_update_max_trx_id(
/*===================*/
page_t* page, /* in/out: page */
buf_block_t* block, /* in/out: page */
page_zip_des_t* page_zip,/* in/out: compressed page whose
uncompressed part will be updated, or NULL */
dulint trx_id);/* in: transaction id */
......
......@@ -58,16 +58,17 @@ UNIV_INLINE
void
page_update_max_trx_id(
/*===================*/
page_t* page, /* in/out: page */
buf_block_t* block, /* in/out: page */
page_zip_des_t* page_zip,/* in/out: compressed page whose
uncompressed part will be updated, or NULL */
dulint trx_id) /* in: transaction id */
{
ut_ad(page);
ut_ad(block);
if (ut_dulint_cmp(page_get_max_trx_id(page), trx_id) < 0) {
if (ut_dulint_cmp(page_get_max_trx_id(buf_block_get_frame(block)),
trx_id) < 0) {
page_set_max_trx_id(page, page_zip, trx_id);
page_set_max_trx_id(block, page_zip, trx_id);
}
}
......
......@@ -4968,7 +4968,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),
page_update_max_trx_id(block,
buf_block_get_page_zip(block),
thr_get_trx(thr)->id);
}
......@@ -5006,7 +5006,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),
page_update_max_trx_id(block,
buf_block_get_page_zip(block),
thr_get_trx(thr)->id);
}
......@@ -5187,7 +5187,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),
page_update_max_trx_id(block,
buf_block_get_page_zip(block),
thr_get_trx(thr)->id);
}
......
......@@ -1553,7 +1553,7 @@ page_cur_delete_rec(
/* 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(page_cur_get_block(cursor));
/* 2. Find the next and the previous record. Note that the cursor is
left at the next record. */
......
......@@ -189,18 +189,14 @@ Sets the max trx id field value. */
void
page_set_max_trx_id(
/*================*/
page_t* page, /* in/out: page */
page_zip_des_t* page_zip,/* in/out: compressed page whose
uncompressed part will be updated, or NULL */
buf_block_t* block, /* in/out: page */
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
dulint trx_id) /* in: transaction id */
{
buf_block_t* block;
ut_ad(page);
block = buf_block_align(page);
const ibool is_hashed = block->is_hashed;
page_t* page = buf_block_get_frame(block);
if (block->is_hashed) {
if (is_hashed) {
rw_lock_x_lock(&btr_search_latch);
}
......@@ -215,7 +211,7 @@ page_set_max_trx_id(
8, NULL);
}
if (block->is_hashed) {
if (is_hashed) {
rw_lock_x_unlock(&btr_search_latch);
}
}
......@@ -427,7 +423,7 @@ page_create_low(
page_header_set_field(page, NULL, PAGE_DIRECTION, PAGE_NO_DIRECTION);
page_header_set_field(page, NULL, PAGE_N_DIRECTION, 0);
page_header_set_field(page, NULL, PAGE_N_RECS, 0);
page_set_max_trx_id(page, NULL, ut_dulint_zero);
page_set_max_trx_id(block, NULL, ut_dulint_zero);
memset(heap_top, 0, UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START
- page_offset(heap_top));
......@@ -651,7 +647,7 @@ page_copy_rec_list_end(
lock_move_rec_list_end(new_page, page, rec);
page_update_max_trx_id(new_page, new_page_zip,
page_update_max_trx_id(new_block, new_page_zip,
page_get_max_trx_id(page));
btr_search_move_or_delete_hash_entries(new_block, block, index);
......@@ -754,7 +750,7 @@ 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_update_max_trx_id(new_block, new_page_zip,
page_get_max_trx_id(page_align(rec)));
lock_move_rec_list_start(new_page, page_align(rec), rec, ret);
......
......@@ -3544,7 +3544,7 @@ page_zip_reorganize(
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));
page_set_max_trx_id(block, NULL, page_get_max_trx_id(temp_page));
/* Restore logging. */
mtr_set_log_mode(mtr, log_mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment