Commit 469a27ac authored by marko's avatar marko

branches/zip: Replace buf_frame_align() with page_align(), page_offset(),

ut_align_down(), or ut_align_offset().
parent d3741832
...@@ -151,7 +151,7 @@ btr_get_prev_user_rec( ...@@ -151,7 +151,7 @@ btr_get_prev_user_rec(
} }
} }
page = buf_frame_align(rec); page = page_align(rec);
prev_page_no = btr_page_get_prev(page, mtr); prev_page_no = btr_page_get_prev(page, mtr);
space = buf_frame_get_space_id(page); space = buf_frame_get_space_id(page);
...@@ -203,7 +203,7 @@ btr_get_next_user_rec( ...@@ -203,7 +203,7 @@ btr_get_next_user_rec(
} }
} }
page = buf_frame_align(rec); page = page_align(rec);
next_page_no = btr_page_get_next(page, mtr); next_page_no = btr_page_get_next(page, mtr);
space = buf_frame_get_space_id(page); space = buf_frame_get_space_id(page);
...@@ -501,7 +501,7 @@ btr_node_ptr_set_child_page_no( ...@@ -501,7 +501,7 @@ btr_node_ptr_set_child_page_no(
ulint len; ulint len;
ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(!page_is_leaf(buf_frame_align(rec))); ut_ad(!page_is_leaf(page_align(rec)));
ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec)); ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec));
/* The child address is in the last field */ /* The child address is in the last field */
...@@ -593,9 +593,9 @@ btr_page_get_father_for_rec( ...@@ -593,9 +593,9 @@ btr_page_get_father_for_rec(
!= buf_frame_get_page_no(page))) { != buf_frame_get_page_no(page))) {
rec_t* print_rec; rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr); fputs("InnoDB: Dump of the child page:\n", stderr);
buf_page_print(buf_frame_align(page), 0); buf_page_print(page_align(page), 0);
fputs("InnoDB: Dump of the parent page:\n", stderr); fputs("InnoDB: Dump of the parent page:\n", stderr);
buf_page_print(buf_frame_align(node_ptr), 0); buf_page_print(page_align(node_ptr), 0);
fputs("InnoDB: Corruption of an index tree: table ", stderr); fputs("InnoDB: Corruption of an index tree: table ", stderr);
ut_print_name(stderr, NULL, TRUE, index->table_name); ut_print_name(stderr, NULL, TRUE, index->table_name);
...@@ -2143,7 +2143,7 @@ btr_lift_page_up( ...@@ -2143,7 +2143,7 @@ btr_lift_page_up(
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
father_page = buf_frame_align( father_page = page_align(
btr_page_get_father_node_ptr(index, page, mtr)); btr_page_get_father_node_ptr(index, page, mtr));
father_page_zip = buf_frame_get_page_zip(father_page); father_page_zip = buf_frame_get_page_zip(father_page);
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
...@@ -2442,8 +2442,8 @@ btr_discard_only_page_on_level( ...@@ -2442,8 +2442,8 @@ btr_discard_only_page_on_level(
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(page); btr_search_drop_page_hash_index(page);
father_page = buf_frame_align(btr_page_get_father_node_ptr(index, father_page = page_align(
page, mtr)); btr_page_get_father_node_ptr(index, page, mtr));
page_level = btr_page_get_level(page, mtr); page_level = btr_page_get_level(page, mtr);
...@@ -2793,7 +2793,7 @@ btr_index_rec_validate( ...@@ -2793,7 +2793,7 @@ btr_index_rec_validate(
ulint* offsets = offsets_; ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
page = buf_frame_align(rec); page = page_align(rec);
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) { if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
/* The insert buffer index tree can contain records from any /* The insert buffer index tree can contain records from any
...@@ -3121,7 +3121,7 @@ loop: ...@@ -3121,7 +3121,7 @@ loop:
/* Check father node pointers */ /* Check father node pointers */
node_ptr = btr_page_get_father_node_ptr(index, page, &mtr); node_ptr = btr_page_get_father_node_ptr(index, page, &mtr);
father_page = buf_frame_align(node_ptr); father_page = page_align(node_ptr);
offsets = rec_get_offsets(node_ptr, index, offsets = rec_get_offsets(node_ptr, index,
offsets, ULINT_UNDEFINED, &heap); offsets, ULINT_UNDEFINED, &heap);
...@@ -3224,8 +3224,7 @@ loop: ...@@ -3224,8 +3224,7 @@ loop:
buf_page_print(right_page, 0); buf_page_print(right_page, 0);
} }
} else { } else {
right_father_page = buf_frame_align( right_father_page = page_align(right_node_ptr);
right_node_ptr);
if (right_node_ptr != page_rec_get_next( if (right_node_ptr != page_rec_get_next(
page_get_infimum_rec( page_get_infimum_rec(
......
...@@ -1939,7 +1939,7 @@ btr_cur_pess_upd_restore_supremum( ...@@ -1939,7 +1939,7 @@ btr_cur_pess_upd_restore_supremum(
ulint space; ulint space;
ulint prev_page_no; ulint prev_page_no;
page = buf_frame_align(rec); page = page_align(rec);
if (page_rec_get_next(page_get_infimum_rec(page)) != rec) { if (page_rec_get_next(page_get_infimum_rec(page)) != rec) {
/* Updated record is not the first user record on its page */ /* Updated record is not the first user record on its page */
...@@ -2133,7 +2133,7 @@ btr_cur_pessimistic_update( ...@@ -2133,7 +2133,7 @@ btr_cur_pessimistic_update(
delete the lock structs set on the root page even if the root delete the lock structs set on the root page even if the root
page carries just node pointers. */ page carries just node pointers. */
lock_rec_store_on_page_infimum(buf_frame_align(rec), rec); lock_rec_store_on_page_infimum(page_align(rec), rec);
btr_search_update_hash_on_delete(cursor); btr_search_update_hash_on_delete(cursor);
...@@ -2897,7 +2897,7 @@ btr_cur_add_path_info( ...@@ -2897,7 +2897,7 @@ btr_cur_add_path_info(
slot = cursor->path_arr + (root_height - height); slot = cursor->path_arr + (root_height - height);
slot->nth_rec = page_rec_get_n_recs_before(rec); slot->nth_rec = page_rec_get_n_recs_before(rec);
slot->n_recs = page_get_n_recs(buf_frame_align(rec)); slot->n_recs = page_get_n_recs(page_align(rec));
} }
/*********************************************************************** /***********************************************************************
......
...@@ -615,8 +615,8 @@ btr_search_check_guess( ...@@ -615,8 +615,8 @@ btr_search_check_guess(
prev_rec = page_rec_get_prev(rec); prev_rec = page_rec_get_prev(rec);
if (page_rec_is_infimum(prev_rec)) { if (page_rec_is_infimum(prev_rec)) {
success = btr_page_get_prev( success = btr_page_get_prev(page_align(prev_rec), mtr)
buf_frame_align(prev_rec), mtr) == FIL_NULL; == FIL_NULL;
goto exit_func; goto exit_func;
} }
...@@ -640,8 +640,7 @@ btr_search_check_guess( ...@@ -640,8 +640,7 @@ btr_search_check_guess(
next_rec = page_rec_get_next(rec); next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) { if (page_rec_is_supremum(next_rec)) {
if (btr_page_get_next( if (btr_page_get_next(page_align(next_rec), mtr)
buf_frame_align(next_rec), mtr)
== FIL_NULL) { == FIL_NULL) {
cursor->up_match = 0; cursor->up_match = 0;
...@@ -757,7 +756,7 @@ btr_search_guess_on_hash( ...@@ -757,7 +756,7 @@ btr_search_guess_on_hash(
goto failure_unlock; goto failure_unlock;
} }
page = buf_frame_align(rec); page = page_align(rec);
if (UNIV_LIKELY(!has_search_latch)) { if (UNIV_LIKELY(!has_search_latch)) {
...@@ -1632,7 +1631,7 @@ btr_search_validate(void) ...@@ -1632,7 +1631,7 @@ btr_search_validate(void)
while (node != NULL) { while (node != NULL) {
block = buf_block_align(node->data); block = buf_block_align(node->data);
page = buf_frame_align(node->data); page = page_align(node->data);
offsets = rec_get_offsets((rec_t*) node->data, offsets = rec_get_offsets((rec_t*) node->data,
block->index, offsets, block->index, offsets,
block->curr_n_fields block->curr_n_fields
......
...@@ -712,7 +712,7 @@ xdes_get_descriptor_with_space_hdr( ...@@ -712,7 +712,7 @@ xdes_get_descriptor_with_space_hdr(
if (descr_page_no == 0) { if (descr_page_no == 0) {
/* It is on the space header page */ /* It is on the space header page */
descr_page = buf_frame_align(sp_header); descr_page = page_align(sp_header);
} else { } else {
descr_page = buf_page_get(space, descr_page_no, RW_X_LATCH, descr_page = buf_page_get(space, descr_page_no, RW_X_LATCH,
mtr); mtr);
...@@ -812,8 +812,7 @@ xdes_get_offset( ...@@ -812,8 +812,7 @@ xdes_get_offset(
ut_ad(descr); ut_ad(descr);
return(buf_frame_get_page_no(descr) return(buf_frame_get_page_no(descr)
+ ((descr - buf_frame_align(descr) - XDES_ARR_OFFSET) + ((page_offset(descr) - XDES_ARR_OFFSET) / XDES_SIZE)
/ XDES_SIZE)
* FSP_EXTENT_SIZE); * FSP_EXTENT_SIZE);
} }
...@@ -1936,7 +1935,7 @@ fsp_free_seg_inode( ...@@ -1936,7 +1935,7 @@ fsp_free_seg_inode(
fsp_header_t* space_header; fsp_header_t* space_header;
ulint zip_size; ulint zip_size;
page = buf_frame_align(inode); page = page_align(inode);
space_header = fsp_get_space_header(space, mtr); space_header = fsp_get_space_header(space, mtr);
zip_size = mach_read_from_4(space_header + FSP_PAGE_ZIP_SIZE); zip_size = mach_read_from_4(space_header + FSP_PAGE_ZIP_SIZE);
...@@ -2228,14 +2227,14 @@ fseg_create_general( ...@@ -2228,14 +2227,14 @@ fseg_create_general(
} }
mlog_write_ulint(header + FSEG_HDR_OFFSET, mlog_write_ulint(header + FSEG_HDR_OFFSET,
inode - buf_frame_align(inode), MLOG_2BYTES, mtr); page_offset(inode), MLOG_2BYTES, mtr);
mlog_write_ulint(header + FSEG_HDR_PAGE_NO, mlog_write_ulint(header + FSEG_HDR_PAGE_NO,
buf_frame_get_page_no(inode), MLOG_4BYTES, mtr); buf_frame_get_page_no(inode), MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSEG_HDR_SPACE, space, MLOG_4BYTES, mtr); mlog_write_ulint(header + FSEG_HDR_SPACE, space, MLOG_4BYTES, mtr);
ret = buf_frame_align(header); ret = page_align(header);
funct_exit: funct_exit:
if (!has_done_reservation) { if (!has_done_reservation) {
......
...@@ -13,7 +13,7 @@ Created 11/28/1995 Heikki Tuuri ...@@ -13,7 +13,7 @@ Created 11/28/1995 Heikki Tuuri
#endif #endif
#include "buf0buf.h" #include "buf0buf.h"
#include "page0page.h"
/************************************************************************ /************************************************************************
Adds a node to an empty list. */ Adds a node to an empty list. */
...@@ -83,7 +83,7 @@ flst_add_last( ...@@ -83,7 +83,7 @@ flst_add_last(
/* If the list is not empty, call flst_insert_after */ /* If the list is not empty, call flst_insert_after */
if (len != 0) { if (len != 0) {
if (last_addr.page == node_addr.page) { if (last_addr.page == node_addr.page) {
last_node = buf_frame_align(node) + last_addr.boffset; last_node = page_align(node) + last_addr.boffset;
} else { } else {
last_node = fut_get_ptr(space, last_addr, RW_X_LATCH, last_node = fut_get_ptr(space, last_addr, RW_X_LATCH,
mtr); mtr);
...@@ -126,8 +126,7 @@ flst_add_first( ...@@ -126,8 +126,7 @@ flst_add_first(
/* If the list is not empty, call flst_insert_before */ /* If the list is not empty, call flst_insert_before */
if (len != 0) { if (len != 0) {
if (first_addr.page == node_addr.page) { if (first_addr.page == node_addr.page) {
first_node = buf_frame_align(node) first_node = page_align(node) + first_addr.boffset;
+ first_addr.boffset;
} else { } else {
first_node = fut_get_ptr(space, first_addr, first_node = fut_get_ptr(space, first_addr,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
...@@ -285,7 +284,7 @@ flst_remove( ...@@ -285,7 +284,7 @@ flst_remove(
if (node1_addr.page == node2_addr.page) { if (node1_addr.page == node2_addr.page) {
node1 = buf_frame_align(node2) + node1_addr.boffset; node1 = page_align(node2) + node1_addr.boffset;
} else { } else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH, node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
mtr); mtr);
...@@ -304,7 +303,7 @@ flst_remove( ...@@ -304,7 +303,7 @@ flst_remove(
if (node3_addr.page == node2_addr.page) { if (node3_addr.page == node2_addr.page) {
node3 = buf_frame_align(node2) + node3_addr.boffset; node3 = page_align(node2) + node3_addr.boffset;
} else { } else {
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH, node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH,
mtr); mtr);
...@@ -362,7 +361,7 @@ flst_cut_end( ...@@ -362,7 +361,7 @@ flst_cut_end(
if (node1_addr.page == node2_addr.page) { if (node1_addr.page == node2_addr.page) {
node1 = buf_frame_align(node2) + node1_addr.boffset; node1 = page_align(node2) + node1_addr.boffset;
} else { } else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH, node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
mtr); mtr);
...@@ -505,7 +504,7 @@ flst_print( ...@@ -505,7 +504,7 @@ flst_print(
ut_ad(base && mtr); ut_ad(base && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base), ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
frame = buf_frame_align(base); frame = page_align(base);
len = flst_get_len(base, mtr); len = flst_get_len(base, mtr);
......
...@@ -12,6 +12,7 @@ Created 8/22/1994 Heikki Tuuri ...@@ -12,6 +12,7 @@ Created 8/22/1994 Heikki Tuuri
#endif #endif
#include "buf0buf.h" #include "buf0buf.h"
#include "page0page.h"
/***************************************************************** /*****************************************************************
Creates a hash table with >= n array cells. The actual number of cells is Creates a hash table with >= n array cells. The actual number of cells is
...@@ -252,7 +253,7 @@ ha_remove_all_nodes_to_page( ...@@ -252,7 +253,7 @@ ha_remove_all_nodes_to_page(
node = ha_chain_get_first(table, fold); node = ha_chain_get_first(table, fold);
while (node) { while (node) {
if (buf_frame_align(ha_node_get_data(node)) == page) { if (page_align(ha_node_get_data(node)) == page) {
/* Remove the hash node */ /* Remove the hash node */
...@@ -273,7 +274,7 @@ ha_remove_all_nodes_to_page( ...@@ -273,7 +274,7 @@ ha_remove_all_nodes_to_page(
node = ha_chain_get_first(table, fold); node = ha_chain_get_first(table, fold);
while (node) { while (node) {
ut_a(buf_frame_align(ha_node_get_data(node)) != page); ut_a(page_align(ha_node_get_data(node)) != page);
node = ha_chain_get_next(node); node = ha_chain_get_next(node);
} }
......
...@@ -2366,7 +2366,7 @@ ibuf_get_volume_buffered( ...@@ -2366,7 +2366,7 @@ ibuf_get_volume_buffered(
rec = btr_pcur_get_rec(pcur); rec = btr_pcur_get_rec(pcur);
page = buf_frame_align(rec); page = page_align(rec);
if (page_rec_is_supremum(rec)) { if (page_rec_is_supremum(rec)) {
rec = page_rec_get_prev(rec); rec = page_rec_get_prev(rec);
...@@ -2739,7 +2739,7 @@ ibuf_insert_low( ...@@ -2739,7 +2739,7 @@ ibuf_insert_low(
thr, &mtr); thr, &mtr);
if (err == DB_SUCCESS) { if (err == DB_SUCCESS) {
/* Update the page max trx id field */ /* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(ins_rec), NULL, page_update_max_trx_id(page_align(ins_rec), NULL,
thr_get_trx(thr)->id); thr_get_trx(thr)->id);
} }
} else { } else {
...@@ -2760,7 +2760,7 @@ ibuf_insert_low( ...@@ -2760,7 +2760,7 @@ ibuf_insert_low(
thr, &mtr); thr, &mtr);
if (err == DB_SUCCESS) { if (err == DB_SUCCESS) {
/* Update the page max trx id field */ /* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(ins_rec), NULL, page_update_max_trx_id(page_align(ins_rec), NULL,
thr_get_trx(thr)->id); thr_get_trx(thr)->id);
} }
...@@ -3332,13 +3332,14 @@ loop: ...@@ -3332,13 +3332,14 @@ loop:
insertion is finished! */ insertion is finished! */
dict_index_t* dummy_index; dict_index_t* dummy_index;
dulint max_trx_id = page_get_max_trx_id( dulint max_trx_id = page_get_max_trx_id(
buf_frame_align(ibuf_rec)); page_align(ibuf_rec));
page_update_max_trx_id(page, page_zip, max_trx_id); page_update_max_trx_id(page, page_zip, max_trx_id);
entry = ibuf_build_entry_from_ibuf_rec( entry = ibuf_build_entry_from_ibuf_rec(
ibuf_rec, heap, &dummy_index); ibuf_rec, heap, &dummy_index);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
volume += rec_get_converted_size(dummy_index, entry) volume += rec_get_converted_size(dummy_index, entry,
NULL, 0)
+ page_dir_calc_reserved_space(1); + page_dir_calc_reserved_space(1);
ut_a(volume <= 4 * UNIV_PAGE_SIZE ut_a(volume <= 4 * UNIV_PAGE_SIZE
/ IBUF_PAGE_SIZE_PER_FREE_SPACE); / IBUF_PAGE_SIZE_PER_FREE_SPACE);
......
...@@ -239,7 +239,7 @@ btr_node_ptr_get_child_page_no( ...@@ -239,7 +239,7 @@ btr_node_ptr_get_child_page_no(
"InnoDB: a nonsensical page number 0" "InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n", " in a node ptr record at offset %lu\n",
(ulong) page_offset(rec)); (ulong) page_offset(rec));
buf_page_print(buf_frame_align(rec), 0); buf_page_print(page_align(rec), 0);
} }
return(page_no); return(page_no);
......
...@@ -52,7 +52,7 @@ btr_cur_get_page( ...@@ -52,7 +52,7 @@ btr_cur_get_page(
/* out: pointer to page */ /* out: pointer to page */
btr_cur_t* cursor) /* in: tree cursor */ btr_cur_t* cursor) /* in: tree cursor */
{ {
return(buf_frame_align(page_cur_get_rec(&(cursor->page_cur)))); return(page_align(page_cur_get_rec(&(cursor->page_cur))));
} }
/************************************************************* /*************************************************************
......
...@@ -296,7 +296,7 @@ btr_pcur_move_to_last_on_page( ...@@ -296,7 +296,7 @@ btr_pcur_move_to_last_on_page(
UT_NOT_USED(mtr); UT_NOT_USED(mtr);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
page_cur_set_after_last(buf_frame_align(btr_pcur_get_rec(cursor)), page_cur_set_after_last(page_align(btr_pcur_get_rec(cursor)),
btr_pcur_get_page_cur(cursor)); btr_pcur_get_page_cur(cursor));
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
......
...@@ -492,14 +492,6 @@ buf_frame_get_lock_mutex( ...@@ -492,14 +492,6 @@ buf_frame_get_lock_mutex(
/* out: mutex */ /* out: mutex */
byte* ptr); /* in: pointer to within a buffer frame */ byte* ptr); /* in: pointer to within a buffer frame */
/*********************************************************************** /***********************************************************************
Gets the frame the pointer is pointing to. */
UNIV_INLINE
buf_frame_t*
buf_frame_align(
/*============*/
/* out: pointer to frame */
byte* ptr); /* in: pointer to a frame */
/***********************************************************************
Checks if a pointer points to the block array of the buffer pool (blocks, not Checks if a pointer points to the block array of the buffer pool (blocks, not
the frames). */ the frames). */
UNIV_INLINE UNIV_INLINE
......
...@@ -251,43 +251,6 @@ buf_block_align( ...@@ -251,43 +251,6 @@ buf_block_align(
return(block); return(block);
} }
/***********************************************************************
Gets the frame the pointer is pointing to. */
UNIV_INLINE
buf_frame_t*
buf_frame_align(
/*============*/
/* out: pointer to frame */
byte* ptr) /* in: pointer to a frame */
{
buf_frame_t* frame;
ut_ad(ptr);
frame = ut_align_down(ptr, UNIV_PAGE_SIZE);
if (UNIV_UNLIKELY((ulint)frame < (ulint)(buf_pool->frame_zero))
|| UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, end at %p\n"
"InnoDB: Probable reason is database corruption"
" or memory\n"
"InnoDB: corruption. If this happens in an"
" InnoDB database recovery, see\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html\n"
"InnoDB: how to force recovery.\n",
ptr, buf_pool->frame_zero,
buf_pool->high_end);
ut_error;
}
return(frame);
}
/************************************************************************** /**************************************************************************
Gets the page number of a pointer pointing within a buffer frame containing Gets the page number of a pointer pointing within a buffer frame containing
a file page. */ a file page. */
...@@ -331,7 +294,7 @@ buf_ptr_get_fsp_addr( ...@@ -331,7 +294,7 @@ buf_ptr_get_fsp_addr(
*space = buf_block_get_space(block); *space = buf_block_get_space(block);
addr->page = buf_block_get_page_no(block); addr->page = buf_block_get_page_no(block);
addr->boffset = ptr - buf_frame_align(ptr); addr->boffset = ut_align_offset(ptr, UNIV_PAGE_SIZE);
} }
/************************************************************************** /**************************************************************************
......
...@@ -20,7 +20,7 @@ page_cur_get_page( ...@@ -20,7 +20,7 @@ page_cur_get_page(
{ {
ut_ad(cur); ut_ad(cur);
return(buf_frame_align(cur->rec)); return(page_align(cur->rec));
} }
/************************************************************* /*************************************************************
......
...@@ -76,8 +76,8 @@ trx_undo_rec_copy( ...@@ -76,8 +76,8 @@ trx_undo_rec_copy(
ulint len; ulint len;
trx_undo_rec_t* rec_copy; trx_undo_rec_t* rec_copy;
len = mach_read_from_2(undo_rec) + buf_frame_align(undo_rec) len = mach_read_from_2(undo_rec)
- undo_rec; - ut_align_offset(undo_rec, UNIV_PAGE_SIZE);
rec_copy = mem_heap_alloc(heap, len); rec_copy = mem_heap_alloc(heap, len);
ut_memcpy(rec_copy, undo_rec, len); ut_memcpy(rec_copy, undo_rec, len);
......
...@@ -236,7 +236,7 @@ trx_undo_page_get_prev_rec( ...@@ -236,7 +236,7 @@ trx_undo_page_get_prev_rec(
page_t* undo_page; page_t* undo_page;
ulint start; ulint start;
undo_page = buf_frame_align(rec); undo_page = ut_align_down(rec, UNIV_PAGE_SIZE);
start = trx_undo_page_get_start(undo_page, page_no, offset); start = trx_undo_page_get_start(undo_page, page_no, offset);
...@@ -264,7 +264,7 @@ trx_undo_page_get_next_rec( ...@@ -264,7 +264,7 @@ trx_undo_page_get_next_rec(
ulint end; ulint end;
ulint next; ulint next;
undo_page = buf_frame_align(rec); undo_page = ut_align_down(rec, UNIV_PAGE_SIZE);
end = trx_undo_page_get_end(undo_page, page_no, offset); end = trx_undo_page_get_end(undo_page, page_no, offset);
......
...@@ -566,7 +566,7 @@ lock_sec_rec_cons_read_sees( ...@@ -566,7 +566,7 @@ lock_sec_rec_cons_read_sees(
return(FALSE); return(FALSE);
} }
max_trx_id = page_get_max_trx_id(buf_frame_align(rec)); max_trx_id = page_get_max_trx_id(page_align(rec));
if (ut_dulint_cmp(max_trx_id, view->up_limit_id) >= 0) { if (ut_dulint_cmp(max_trx_id, view->up_limit_id) >= 0) {
...@@ -1675,7 +1675,7 @@ lock_sec_rec_some_has_impl_off_kernel( ...@@ -1675,7 +1675,7 @@ lock_sec_rec_some_has_impl_off_kernel(
ut_ad(page_rec_is_user_rec(rec)); ut_ad(page_rec_is_user_rec(rec));
ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_validate(rec, index, offsets));
page = buf_frame_align(rec); page = page_align(rec);
/* Some transaction may have an implicit x-lock on the record only /* Some transaction may have an implicit x-lock on the record only
if the max trx id for the page >= min trx id for the trx list, or if the max trx id for the page >= min trx id for the trx list, or
...@@ -1767,7 +1767,7 @@ lock_rec_create( ...@@ -1767,7 +1767,7 @@ lock_rec_create(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
page = buf_frame_align(rec); page = page_align(rec);
space = buf_frame_get_space_id(page); space = buf_frame_get_space_id(page);
page_no = buf_frame_get_page_no(page); page_no = buf_frame_get_page_no(page);
...@@ -2787,7 +2787,7 @@ lock_move_rec_list_end( ...@@ -2787,7 +2787,7 @@ lock_move_rec_list_end(
ulint heap_no; ulint heap_no;
ulint type_mode; ulint type_mode;
ut_ad(page_is_comp(page) == page_is_comp(new_page)); ut_ad(page_is_comp(page) == page_is_comp(new_page));
ut_ad(page == buf_frame_align(rec)); ut_ad(page == page_align(rec));
lock_mutex_enter_kernel(); lock_mutex_enter_kernel();
...@@ -2893,7 +2893,7 @@ lock_move_rec_list_start( ...@@ -2893,7 +2893,7 @@ lock_move_rec_list_start(
lock = lock_rec_get_first_on_page(page); lock = lock_rec_get_first_on_page(page);
ut_ad(page_is_comp(page) == page_is_comp(new_page)); ut_ad(page_is_comp(page) == page_is_comp(new_page));
ut_ad(page == buf_frame_align(rec)); ut_ad(page == page_align(rec));
while (lock != NULL) { while (lock != NULL) {
...@@ -3108,7 +3108,7 @@ lock_update_merge_left( ...@@ -3108,7 +3108,7 @@ lock_update_merge_left(
lock_mutex_enter_kernel(); lock_mutex_enter_kernel();
comp = page_is_comp(left_page); comp = page_is_comp(left_page);
ut_ad(comp == page_is_comp(right_page)); ut_ad(comp == page_is_comp(right_page));
ut_ad(left_page == buf_frame_align(orig_pred)); ut_ad(left_page == page_align(orig_pred));
left_next_rec = page_rec_get_next(orig_pred); left_next_rec = page_rec_get_next(orig_pred);
left_supremum = page_get_supremum_rec(left_page); left_supremum = page_get_supremum_rec(left_page);
...@@ -3256,7 +3256,7 @@ lock_rec_store_on_page_infimum( ...@@ -3256,7 +3256,7 @@ lock_rec_store_on_page_infimum(
on the infimum record of the same page; lock on the infimum record of the same page; lock
bits are reset on the record */ bits are reset on the record */
{ {
ut_ad(page == buf_frame_align(rec)); ut_ad(page == page_align(rec));
lock_mutex_enter_kernel(); lock_mutex_enter_kernel();
...@@ -5240,7 +5240,7 @@ lock_sec_rec_read_check_and_lock( ...@@ -5240,7 +5240,7 @@ lock_sec_rec_read_check_and_lock(
if the max trx id for the page >= min trx id for the trx list or a if the max trx id for the page >= min trx id for the trx list or a
database recovery is running. */ database recovery is running. */
if (((ut_dulint_cmp(page_get_max_trx_id(buf_frame_align(rec)), if (((ut_dulint_cmp(page_get_max_trx_id(page_align(rec)),
trx_list_get_min_trx_id()) >= 0) trx_list_get_min_trx_id()) >= 0)
|| recv_recovery_is_on()) || recv_recovery_is_on())
&& !page_rec_is_supremum(rec)) { && !page_rec_is_supremum(rec)) {
......
...@@ -1595,10 +1595,8 @@ recv_apply_log_recs_for_backup(void) ...@@ -1595,10 +1595,8 @@ recv_apply_log_recs_for_backup(void)
} }
/* We simulate a page read made by the buffer pool, to /* We simulate a page read made by the buffer pool, to
make sure the recovery apparatus works ok, for make sure the recovery apparatus works ok. We must init
example, the buf_frame_align() function. We must init the block. */
the block corresponding to buf_pool->frame_zero
(== page). */
buf_page_init_for_backup_restore( buf_page_init_for_backup_restore(
recv_addr->space, recv_addr->page_no, recv_addr->space, recv_addr->page_no,
......
...@@ -316,7 +316,7 @@ mlog_write_dulint( ...@@ -316,7 +316,7 @@ mlog_write_dulint(
log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_8BYTES, log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_8BYTES,
log_ptr, mtr); log_ptr, mtr);
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr)); mach_write_to_2(log_ptr, page_offset(ptr));
log_ptr += 2; log_ptr += 2;
log_ptr += mach_dulint_write_compressed(log_ptr, val); log_ptr += mach_dulint_write_compressed(log_ptr, val);
......
...@@ -251,8 +251,7 @@ page_cur_search_with_match( ...@@ -251,8 +251,7 @@ page_cur_search_with_match(
|| mode == PAGE_CUR_G || mode == PAGE_CUR_GE); || mode == PAGE_CUR_G || mode == PAGE_CUR_GE);
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
page_zip_des_t* page_zip page_zip_des_t* page_zip = buf_frame_get_page_zip(page);
= buf_block_get_page_zip(buf_block_align(page));
ut_a(!page_zip || page_zip_validate(page_zip, page)); ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
...@@ -538,7 +537,7 @@ page_cur_insert_rec_write_log( ...@@ -538,7 +537,7 @@ page_cur_insert_rec_write_log(
ulint i; ulint i;
ut_a(rec_size < UNIV_PAGE_SIZE); ut_a(rec_size < UNIV_PAGE_SIZE);
ut_ad(buf_frame_align(insert_rec) == buf_frame_align(cursor_rec)); ut_ad(page_align(insert_rec) == page_align(cursor_rec));
ut_ad(!page_rec_is_comp(insert_rec) ut_ad(!page_rec_is_comp(insert_rec)
== !dict_table_is_comp(index->table)); == !dict_table_is_comp(index->table));
......
...@@ -81,7 +81,7 @@ page_dir_find_owner_slot( ...@@ -81,7 +81,7 @@ page_dir_find_owner_slot(
ut_ad(page_rec_check(rec)); ut_ad(page_rec_check(rec));
page = buf_frame_align(rec); page = page_align(rec);
first_slot = page_dir_get_nth_slot(page, 0); first_slot = page_dir_get_nth_slot(page, 0);
slot = page_dir_get_nth_slot(page, page_dir_get_n_slots(page) - 1); slot = page_dir_get_nth_slot(page, page_dir_get_n_slots(page) - 1);
...@@ -1453,7 +1453,7 @@ page_rec_get_n_recs_before( ...@@ -1453,7 +1453,7 @@ page_rec_get_n_recs_before(
ut_ad(page_rec_check(rec)); ut_ad(page_rec_check(rec));
page = buf_frame_align(rec); page = page_align(rec);
if (page_is_comp(page)) { if (page_is_comp(page)) {
while (rec_get_n_owned_new(rec) == 0) { while (rec_get_n_owned_new(rec) == 0) {
......
...@@ -2930,7 +2930,7 @@ page_zip_write_node_ptr( ...@@ -2930,7 +2930,7 @@ page_zip_write_node_ptr(
{ {
byte* field; byte* field;
byte* storage; byte* storage;
page_t* page = buf_frame_align(rec); page_t* page = page_align(rec);
ut_ad(buf_frame_get_page_zip(rec) == page_zip); ut_ad(buf_frame_get_page_zip(rec) == page_zip);
ut_ad(page_simple_validate_new(page)); ut_ad(page_simple_validate_new(page));
......
...@@ -1342,11 +1342,9 @@ run_again: ...@@ -1342,11 +1342,9 @@ run_again:
/* Scan index records and check if there is a matching record */ /* Scan index records and check if there is a matching record */
for (;;) { for (;;) {
page_t* page;
rec = btr_pcur_get_rec(&pcur); rec = btr_pcur_get_rec(&pcur);
page = buf_frame_align(rec);
if (rec == page_get_infimum_rec(page)) { if (page_rec_is_infimum(rec)) {
goto next_rec; goto next_rec;
} }
...@@ -1354,7 +1352,7 @@ run_again: ...@@ -1354,7 +1352,7 @@ run_again:
offsets = rec_get_offsets(rec, check_index, offsets = rec_get_offsets(rec, check_index,
offsets, ULINT_UNDEFINED, &heap); offsets, ULINT_UNDEFINED, &heap);
if (rec == page_get_supremum_rec(page)) { if (page_rec_is_supremum(rec)) {
err = row_ins_set_shared_rec_lock( err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY, rec, check_index, offsets, thr); LOCK_ORDINARY, rec, check_index, offsets, thr);
...@@ -1694,7 +1692,7 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1694,7 +1692,7 @@ row_ins_scan_sec_index_for_duplicate(
for (;;) { for (;;) {
rec = btr_pcur_get_rec(&pcur); rec = btr_pcur_get_rec(&pcur);
if (rec == page_get_infimum_rec(buf_frame_align(rec))) { if (page_rec_is_infimum(rec)) {
goto next_rec; goto next_rec;
} }
......
...@@ -448,7 +448,7 @@ skip_secondaries: ...@@ -448,7 +448,7 @@ skip_secondaries:
+ offset + internal_offset; + offset + internal_offset;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(buf_frame_align(data_field), buf_page_dbg_add_level(page_align(data_field),
SYNC_TRX_UNDO_PAGE); SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(ufield->new_val.len >= BTR_EXTERN_FIELD_REF_SIZE); ut_a(ufield->new_val.len >= BTR_EXTERN_FIELD_REF_SIZE);
......
...@@ -3709,7 +3709,7 @@ rec_loop: ...@@ -3709,7 +3709,7 @@ rec_loop:
fputs("Using ", stderr); fputs("Using ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, index);
fprintf(stderr, " cnt %lu ; Page no %lu\n", cnt, fprintf(stderr, " cnt %lu ; Page no %lu\n", cnt,
buf_frame_get_page_no(buf_frame_align(rec))); buf_frame_get_page_no(page_align(rec)));
rec_print(rec); rec_print(rec);
*/ */
#endif /* UNIV_SEARCH_DEBUG */ #endif /* UNIV_SEARCH_DEBUG */
...@@ -3777,7 +3777,7 @@ rec_loop: ...@@ -3777,7 +3777,7 @@ rec_loop:
wrong_offs: wrong_offs:
if (srv_force_recovery == 0 || moves_up == FALSE) { if (srv_force_recovery == 0 || moves_up == FALSE) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
buf_page_print(buf_frame_align(rec), 0); buf_page_print(page_align(rec), 0);
fprintf(stderr, fprintf(stderr,
"\nInnoDB: rec address %p, first" "\nInnoDB: rec address %p, first"
" buffer frame %p\n" " buffer frame %p\n"
......
...@@ -789,7 +789,7 @@ trx_purge_choose_next_log(void) ...@@ -789,7 +789,7 @@ trx_purge_choose_next_log(void)
purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec); purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec);
purge_sys->page_no = buf_frame_get_page_no(rec); purge_sys->page_no = buf_frame_get_page_no(rec);
purge_sys->offset = rec - buf_frame_align(rec); purge_sys->offset = page_offset(rec);
} }
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -897,7 +897,7 @@ trx_purge_get_next_rec( ...@@ -897,7 +897,7 @@ trx_purge_get_next_rec(
rec = undo_page + offset; rec = undo_page + offset;
} else { } else {
page = buf_frame_align(rec2); page = page_align(rec2);
purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec2); purge_sys->purge_undo_no = trx_undo_rec_get_undo_no(rec2);
purge_sys->page_no = buf_frame_get_page_no(page); purge_sys->page_no = buf_frame_get_page_no(page);
......
...@@ -832,7 +832,7 @@ trx_roll_pop_top_rec( ...@@ -832,7 +832,7 @@ trx_roll_pop_top_rec(
undo->empty = TRUE; undo->empty = TRUE;
} else { } else {
prev_rec_page = buf_frame_align(prev_rec); prev_rec_page = page_align(prev_rec);
if (prev_rec_page != undo_page) { if (prev_rec_page != undo_page) {
......
...@@ -142,7 +142,7 @@ trx_undo_get_prev_rec_from_prev_page( ...@@ -142,7 +142,7 @@ trx_undo_get_prev_rec_from_prev_page(
page_t* prev_page; page_t* prev_page;
page_t* undo_page; page_t* undo_page;
undo_page = buf_frame_align(rec); undo_page = page_align(rec);
prev_page_no = flst_get_prev_addr(undo_page + TRX_UNDO_PAGE_HDR prev_page_no = flst_get_prev_addr(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_NODE, mtr) + TRX_UNDO_PAGE_NODE, mtr)
...@@ -261,7 +261,7 @@ trx_undo_get_next_rec( ...@@ -261,7 +261,7 @@ trx_undo_get_next_rec(
return(next_rec); return(next_rec);
} }
return(trx_undo_get_next_rec_from_next_page(buf_frame_align(rec), return(trx_undo_get_next_rec_from_next_page(page_align(rec),
page_no, offset, page_no, offset,
RW_S_LATCH, mtr)); RW_S_LATCH, mtr));
} }
...@@ -1117,7 +1117,7 @@ loop: ...@@ -1117,7 +1117,7 @@ loop:
return; return;
} }
undo_page = buf_frame_align(rec); undo_page = page_align(rec);
last_rec = trx_undo_page_get_last_rec(undo_page, hdr_page_no, last_rec = trx_undo_page_get_last_rec(undo_page, hdr_page_no,
hdr_offset); hdr_offset);
......
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