Commit d3741832 authored by marko's avatar marko

branches/zip: buf_block_get_page_zip(): Replace with buf_frame_get_page_zip().

parent 679d6e82
......@@ -729,7 +729,7 @@ btr_create(
}
/* Create a new index page on the the allocated segment page */
page_zip = buf_block_get_page_zip(buf_block_align(frame));
page_zip = buf_frame_get_page_zip(frame);
if (UNIV_LIKELY_NULL(page_zip)) {
page = page_create_zip(frame, page_zip, index, 0, mtr);
......@@ -959,8 +959,7 @@ btr_page_reorganize(
mtr_t* mtr) /* in: mtr */
{
return(btr_page_reorganize_low(FALSE, page,
buf_block_get_page_zip(
buf_block_align(page)),
buf_frame_get_page_zip(page),
index, mtr));
}
......@@ -1056,7 +1055,7 @@ btr_root_raise_and_insert(
page_zip_des_t* new_page_zip;
root = btr_cur_get_page(cursor);
root_page_zip = buf_block_get_page_zip(buf_block_align(root));
root_page_zip = buf_frame_get_page_zip(root);
#ifdef UNIV_ZIP_DEBUG
ut_a(!root_page_zip || page_zip_validate(root_page_zip, root));
#endif /* UNIV_ZIP_DEBUG */
......@@ -1076,7 +1075,7 @@ btr_root_raise_and_insert(
level = btr_page_get_level(root, mtr);
new_page = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr);
new_page_zip = buf_block_get_page_zip(buf_block_align(new_page));
new_page_zip = buf_frame_get_page_zip(new_page);
ut_a(!new_page_zip == !root_page_zip);
ut_a(!new_page_zip || new_page_zip->size == root_page_zip->size);
......@@ -1315,7 +1314,7 @@ btr_page_get_sure_split_rec(
insert_size = rec_get_converted_size(cursor->index, tuple, ext, n_ext);
free_space = page_get_free_space_of_empty(page_is_comp(page));
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
if (UNIV_LIKELY_NULL(page_zip)) {
/* Estimate the free space of an empty compressed page. */
ulint free_space_zip = page_zip_empty_size(
......@@ -1591,7 +1590,7 @@ btr_attach_half_pages(
btr_node_ptr_set_child_page_no(
node_ptr,
buf_block_get_page_zip(buf_block_align(node_ptr)),
buf_frame_get_page_zip(node_ptr),
rec_get_offsets(node_ptr, index, NULL,
ULINT_UNDEFINED, &heap),
lower_page_no, mtr);
......@@ -1639,8 +1638,7 @@ btr_attach_half_pages(
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page, buf_block_get_page_zip(
buf_block_align(prev_page)),
btr_page_set_next(prev_page, buf_frame_get_page_zip(prev_page),
lower_page_no, mtr);
}
......@@ -1650,8 +1648,7 @@ btr_attach_half_pages(
ut_a(page_is_comp(next_page) == page_is_comp(page));
btr_page_set_prev(next_page,
buf_block_get_page_zip(
buf_block_align(next_page)),
buf_frame_get_page_zip(next_page),
upper_page_no, mtr);
}
......@@ -1723,7 +1720,7 @@ func_start:
#endif /* UNIV_SYNC_DEBUG */
page = btr_cur_get_page(cursor);
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX));
......@@ -1757,7 +1754,7 @@ func_start:
/* 2. Allocate a new page to the index */
new_page = btr_page_alloc(cursor->index, hint_page_no, direction,
btr_page_get_level(page, mtr), mtr);
new_page_zip = buf_block_get_page_zip(buf_block_align(new_page));
new_page_zip = buf_frame_get_page_zip(new_page);
btr_page_create(new_page, new_page_zip, cursor->index,
btr_page_get_level(page, mtr), mtr);
......@@ -1888,7 +1885,7 @@ func_start:
insert_page = right_page;
}
insert_page_zip = buf_block_get_page_zip(buf_block_align(insert_page));
insert_page_zip = buf_frame_get_page_zip(insert_page);
/* 7. Reposition the cursor for insert and try insertion */
page_cursor = btr_cur_get_page_cur(cursor);
......@@ -2000,8 +1997,7 @@ btr_level_list_remove(
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page, buf_block_get_page_zip(
buf_block_align(prev_page)),
btr_page_set_next(prev_page, buf_frame_get_page_zip(prev_page),
next_page_no, mtr);
}
......@@ -2014,8 +2010,7 @@ btr_level_list_remove(
== buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_prev(next_page, buf_block_get_page_zip(
buf_block_align(next_page)),
btr_page_set_prev(next_page, buf_frame_get_page_zip(next_page),
prev_page_no, mtr);
}
}
......@@ -2150,7 +2145,7 @@ btr_lift_page_up(
MTR_MEMO_PAGE_X_FIX));
father_page = buf_frame_align(
btr_page_get_father_node_ptr(index, page, mtr));
father_page_zip = buf_block_get_page_zip(buf_block_align(father_page));
father_page_zip = buf_frame_get_page_zip(father_page);
#ifdef UNIV_ZIP_DEBUG
ut_a(!father_page_zip
|| page_zip_validate(father_page_zip, father_page));
......@@ -2176,7 +2171,7 @@ btr_lift_page_up(
/* Copy the page byte for byte. */
page_zip_copy(father_page_zip, father_page,
buf_block_get_page_zip(buf_block_align(page)),
buf_frame_get_page_zip(page),
page, index, mtr);
}
......@@ -2319,12 +2314,12 @@ btr_compress(
}
}
merge_page_zip = buf_block_get_page_zip(buf_block_align(merge_page));
merge_page_zip = buf_frame_get_page_zip(merge_page);
#ifdef UNIV_ZIP_DEBUG
if (UNIV_LIKELY_NULL(merge_page_zip)) {
ut_a(page_zip_validate(merge_page_zip, merge_page));
ut_a(page_zip_validate(
buf_block_get_page_zip(buf_block_align(page)),
buf_frame_get_page_zip(page),
page));
}
#endif /* UNIV_ZIP_DEBUG */
......@@ -2403,7 +2398,7 @@ btr_compress(
btr_node_ptr_set_child_page_no(
node_ptr,
buf_block_get_page_zip(buf_block_align(node_ptr)),
buf_frame_get_page_zip(node_ptr),
rec_get_offsets(node_ptr, index, offsets_,
ULINT_UNDEFINED, &heap),
right_page_no, mtr);
......@@ -2454,9 +2449,7 @@ btr_discard_only_page_on_level(
lock_update_discard(page_get_supremum_rec(father_page), page);
btr_page_set_level(father_page,
buf_block_get_page_zip(
buf_block_align(father_page)),
btr_page_set_level(father_page, buf_frame_get_page_zip(father_page),
page_level, mtr);
/* Free the file page */
......@@ -2467,8 +2460,7 @@ btr_discard_only_page_on_level(
/* The father is the root page */
btr_page_empty(father_page,
buf_block_get_page_zip(
buf_block_align(father_page)),
buf_frame_get_page_zip(father_page),
mtr, index);
/* We play safe and reset the free bits for the father */
......@@ -2561,7 +2553,7 @@ btr_discard_page(
#ifdef UNIV_ZIP_DEBUG
{
page_zip_des_t* merge_page_zip
= buf_block_get_page_zip(buf_block_align(merge_page));
= buf_frame_get_page_zip(merge_page);
ut_a(!merge_page_zip
|| page_zip_validate(merge_page_zip, merge_page));
}
......@@ -3002,7 +2994,7 @@ btr_validate_level(
while (level != btr_page_get_level(page, &mtr)) {
#ifdef UNIV_ZIP_DEBUG
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
ut_a(!page_is_leaf(page));
......@@ -3029,7 +3021,7 @@ loop:
mtr_x_lock(dict_index_get_lock(index), &mtr);
#ifdef UNIV_ZIP_DEBUG
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
......
......@@ -505,9 +505,8 @@ retry_page_get:
#ifdef UNIV_ZIP_DEBUG
ut_a(rw_latch == RW_NO_LATCH
|| !buf_block_get_page_zip(block)
|| page_zip_validate(buf_block_get_page_zip(block),
page));
|| !buf_frame_get_page_zip(page)
|| page_zip_validate(buf_frame_get_page_zip(page), page));
#endif /* UNIV_ZIP_DEBUG */
block->check_index_page_at_flush = TRUE;
......@@ -1064,7 +1063,7 @@ btr_cur_optimistic_insert(
page = btr_cur_get_page(cursor);
index = cursor->index;
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
if (!dtuple_check_typed_no_assert(entry)) {
fputs("InnoDB: Error in a tuple to insert into ", stderr);
......@@ -1649,7 +1648,7 @@ btr_cur_update_in_place(
block = buf_block_align(rec);
/* Check that enough space is available on the compressed page. */
page_zip = buf_block_get_page_zip(block);
page_zip = buf_frame_get_page_zip(rec);
if (UNIV_LIKELY_NULL(page_zip)
&& UNIV_UNLIKELY(!page_zip_alloc(page_zip,
buf_block_get_frame(block),
......@@ -1817,7 +1816,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_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
......@@ -2013,7 +2012,7 @@ btr_cur_pessimistic_update(
*big_rec = NULL;
page = btr_cur_get_page(cursor);
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
rec = btr_cur_get_rec(cursor);
index = cursor->index;
......@@ -2393,7 +2392,7 @@ 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_block_get_page_zip(buf_block_align(rec));
page_zip = buf_frame_get_page_zip(rec);
err = lock_clust_rec_modify_check_and_lock(flags,
rec, index, offsets, thr);
......@@ -2555,7 +2554,7 @@ btr_cur_del_mark_set_sec_rec(
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
== dict_table_is_comp(cursor->index->table));
page_zip = buf_block_get_page_zip(block);
page_zip = buf_frame_get_page_zip(rec);
if (block->is_hashed) {
rw_lock_x_lock(&btr_search_latch);
......@@ -2586,7 +2585,7 @@ btr_cur_del_unmark_for_ibuf(
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_block_get_page_zip(buf_block_align(rec)));
ut_ad(!buf_frame_get_page_zip(rec));
btr_rec_set_deleted_flag(rec, NULL, FALSE);
......@@ -2672,8 +2671,7 @@ btr_cur_optimistic_delete(
max_ins_size = page_get_max_insert_size_after_reorganize(
page, 1);
page_zip = buf_block_get_page_zip(
buf_block_align(btr_cur_get_rec(cursor)));
page_zip = buf_frame_get_page_zip(btr_cur_get_rec(cursor));
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
......@@ -2762,7 +2760,7 @@ btr_cur_pessimistic_delete(
heap = mem_heap_create(1024);
rec = btr_cur_get_rec(cursor);
page_zip = buf_block_get_page_zip(buf_block_align(page));
page_zip = buf_frame_get_page_zip(page);
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
......@@ -3617,7 +3615,7 @@ btr_store_big_rec_extern_fields(
space_id = buf_frame_get_space_id(rec);
page_zip = buf_block_get_page_zip(buf_block_align(rec));
page_zip = buf_frame_get_page_zip(rec);
ut_a(dict_table_zip_size(index->table)
== (page_zip ? page_zip->size : 0));
......@@ -3700,9 +3698,8 @@ btr_store_big_rec_extern_fields(
mlog_write_ulint(
prev_page + FIL_PAGE_NEXT,
page_no, MLOG_4BYTES, &mtr);
memcpy(buf_block_get_page_zip(
buf_block_align(
prev_page))
memcpy(buf_frame_get_page_zip(
prev_page)
->data + FIL_PAGE_NEXT,
prev_page + FIL_PAGE_NEXT, 4);
} else {
......@@ -3747,8 +3744,7 @@ btr_store_big_rec_extern_fields(
/* Copy the page to compressed storage,
because it will be flushed to disk
from there. */
blob_page_zip = buf_block_get_page_zip(
buf_block_align(page));
blob_page_zip = buf_frame_get_page_zip(page);
ut_ad(blob_page_zip);
ut_ad(blob_page_zip->size == page_zip->size);
memcpy(blob_page_zip->data, page,
......
......@@ -611,7 +611,7 @@ buf_flush_write_block_low(
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
#endif
buf_flush_init_for_writing(block->frame,
buf_block_get_page_zip(block),
buf_frame_get_page_zip(block->frame),
block->newest_modification,
block->space, block->offset);
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
......
......@@ -832,7 +832,7 @@ fsp_init_file_page_low(
block->check_index_page_at_flush = FALSE;
page_zip = buf_block_get_page_zip(block);
page_zip = buf_frame_get_page_zip(page);
if (UNIV_LIKELY_NULL(page_zip)) {
memset(page, 0, UNIV_PAGE_SIZE);
......
......@@ -3234,7 +3234,7 @@ ibuf_merge_or_delete_for_page(
block = buf_block_align(page);
rw_lock_x_lock_move_ownership(&(block->lock));
page_zip = buf_block_get_page_zip(block);
page_zip = buf_frame_get_page_zip(page);
if (UNIV_UNLIKELY(fil_page_get_type(page) != FIL_PAGE_INDEX)) {
......
......@@ -641,13 +641,15 @@ buf_block_get_page_no(
/* out: page number */
buf_block_t* block); /* in: pointer to the control block */
/*************************************************************************
Gets the compressed page descriptor of a block if applicable. */
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
UNIV_INLINE
page_zip_des_t*
buf_block_get_page_zip(
buf_frame_get_page_zip(
/*===================*/
/* out: compressed page descriptor, or NULL */
buf_block_t* block); /* in: pointer to the control block */
byte* ptr) /* in: pointer to buffer frame */
__attribute((const));
/***********************************************************************
Gets the block to whose frame the pointer is pointing to. */
UNIV_INLINE
......
......@@ -193,15 +193,16 @@ buf_block_get_page_no(
}
/*************************************************************************
Gets the compressed page descriptor of a block if applicable. */
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
UNIV_INLINE
page_zip_des_t*
buf_block_get_page_zip(
buf_frame_get_page_zip(
/*===================*/
/* out: compressed page descriptor, or NULL */
buf_block_t* block) /* in: pointer to the control block */
byte* ptr) /* in: pointer to buffer frame */
{
ut_ad(block);
buf_block_t* block = buf_block_align(ptr);
if (UNIV_LIKELY_NULL(block->page_zip.data)) {
return(&block->page_zip);
......
......@@ -314,7 +314,7 @@ page_zip_write_header(
{
ulint pos;
ut_ad(buf_block_get_page_zip(buf_block_align((byte*)str)) == page_zip);
ut_ad(buf_frame_get_page_zip((byte*)str) == page_zip);
ut_ad(page_zip_simple_validate(page_zip));
pos = page_offset(str);
......
......@@ -4968,11 +4968,9 @@ lock_rec_insert_check_and_lock(
lock_mutex_exit_kernel();
if (!dict_index_is_clust(index)) {
buf_block_t* block = buf_block_align(rec);
/* Update the page max trx id field */
page_update_max_trx_id(buf_block_get_frame(block),
buf_block_get_page_zip(block),
page_update_max_trx_id(page_align(rec),
buf_frame_get_page_zip(rec),
thr_get_trx(thr)->id);
}
......@@ -5008,11 +5006,9 @@ lock_rec_insert_check_and_lock(
lock_mutex_exit_kernel();
if ((err == DB_SUCCESS) && !dict_index_is_clust(index)) {
buf_block_t* block = buf_block_align(rec);
/* Update the page max trx id field */
page_update_max_trx_id(buf_block_get_frame(block),
buf_block_get_page_zip(block),
page_update_max_trx_id(page_align(rec),
buf_frame_get_page_zip(rec),
thr_get_trx(thr)->id);
}
......@@ -5190,11 +5186,9 @@ lock_sec_rec_modify_check_and_lock(
#endif /* UNIV_DEBUG */
if (err == DB_SUCCESS) {
buf_block_t* block = buf_block_align(rec);
/* Update the page max trx id field */
page_update_max_trx_id(buf_block_get_frame(block),
buf_block_get_page_zip(block),
page_update_max_trx_id(page_align(rec),
buf_frame_get_page_zip(rec),
thr_get_trx(thr)->id);
}
......
......@@ -1204,7 +1204,7 @@ recv_recover_page(
if (!recover_backup) {
block = buf_block_align(page);
page_zip = buf_block_get_page_zip(block);
page_zip = buf_frame_get_page_zip(page);
if (just_read_in) {
/* Move the ownership of the x-latch on the
......
......@@ -2385,8 +2385,7 @@ page_zip_validate(
page_t* temp_page;
ibool valid;
ut_a(buf_block_get_page_zip(buf_block_align((byte*)page))
== page_zip);
ut_a(buf_frame_get_page_zip((byte*) page) == page_zip);
ut_a(page_is_comp((page_t*) page));
if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
......@@ -2481,7 +2480,7 @@ page_zip_write_rec(
ulint heap_no;
byte* slot;
ut_ad(buf_block_get_page_zip(buf_block_align((byte*)rec)) == page_zip);
ut_ad(buf_frame_get_page_zip((byte*) rec) == page_zip);
ut_ad(page_zip_simple_validate(page_zip));
ut_ad(page_zip->size > PAGE_DATA + page_zip_dir_size(page_zip));
ut_ad(rec_offs_comp(offsets));
......@@ -2786,7 +2785,7 @@ page_zip_write_blob_ptr(
ulint blob_no;
ulint len;
ut_ad(buf_block_get_page_zip(buf_block_align((byte*)rec)) == page_zip);
ut_ad(buf_frame_get_page_zip((byte*) rec) == page_zip);
ut_ad(page_simple_validate_new(page));
ut_ad(page_zip_simple_validate(page_zip));
ut_ad(page_zip->size > PAGE_DATA + page_zip_dir_size(page_zip));
......@@ -2933,7 +2932,7 @@ page_zip_write_node_ptr(
byte* storage;
page_t* page = buf_frame_align(rec);
ut_ad(buf_block_get_page_zip(buf_block_align(rec)) == page_zip);
ut_ad(buf_frame_get_page_zip(rec) == page_zip);
ut_ad(page_simple_validate_new(page));
ut_ad(page_zip_simple_validate(page_zip));
ut_ad(page_zip->size > PAGE_DATA + page_zip_dir_size(page_zip));
......@@ -2997,7 +2996,7 @@ page_zip_write_trx_id_and_roll_ptr(
page_t* page = page_align(rec);
ulint len;
ut_ad(buf_block_get_page_zip(buf_block_align(rec)) == page_zip);
ut_ad(buf_frame_get_page_zip(rec) == page_zip);
ut_ad(page_simple_validate_new(page));
ut_ad(page_zip_simple_validate(page_zip));
ut_ad(page_zip->size > PAGE_DATA + page_zip_dir_size(page_zip));
......
......@@ -1468,7 +1468,7 @@ row_upd_clust_rec_by_insert(
index = dict_table_get_first_index(table);
btr_cur_mark_extern_inherited_fields(
buf_block_get_page_zip(buf_block_align(rec)),
buf_frame_get_page_zip(rec),
rec, index,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
......
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