Commit e5b6c394 authored by marko's avatar marko

branches/zip: Remove some more buf_block_align() calls.

Replace buf_frame_modify_clock_inc() with buf_block_modify_clock_inc().
Replace buf_frame_get_lock_hash_val() with buf_block_get_lock_hash_val().
Replace buf_frame_get_lock_mutex() with buf_block_get_lock_mutex().

page_create_zip(), page_create(), page_create_low(), btr_page_free(),
btr_page_free_low(): Replace page_t with buf_block_t.
parent 47e6669d
...@@ -240,9 +240,9 @@ btr_page_create( ...@@ -240,9 +240,9 @@ btr_page_create(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
page_create_zip(page, page_zip, index, level, mtr); page_create_zip(block, index, level, mtr);
} else { } else {
page_create(page, mtr, dict_table_is_comp(index->table)); page_create(block, mtr, dict_table_is_comp(index->table));
/* Set the level of the new index page */ /* Set the level of the new index page */
btr_page_set_level(page, NULL, level, mtr); btr_page_set_level(page, NULL, level, mtr);
} }
...@@ -397,16 +397,17 @@ void ...@@ -397,16 +397,17 @@ void
btr_page_free_for_ibuf( btr_page_free_for_ibuf(
/*===================*/ /*===================*/
dict_index_t* index, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ buf_block_t* block, /* in: block to be freed, x-latched */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
page_t* root; page_t* root;
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));
root = btr_root_get(index, mtr); root = btr_root_get(index, mtr);
flst_add_first(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, flst_add_first(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); buf_block_get_frame(block)
+ PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr);
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
mtr)); mtr));
...@@ -421,24 +422,22 @@ void ...@@ -421,24 +422,22 @@ void
btr_page_free_low( btr_page_free_low(
/*==============*/ /*==============*/
dict_index_t* index, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ buf_block_t* block, /* in: block to be freed, x-latched */
ulint space, /* in: space */
ulint page_no,/* in: page number */
ulint level, /* in: page level */ ulint level, /* in: page level */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
fseg_header_t* seg_header; fseg_header_t* seg_header;
page_t* root; page_t* root;
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));
/* The page gets invalid for optimistic searches: increment the frame /* The page gets invalid for optimistic searches: increment the frame
modify clock */ modify clock */
buf_frame_modify_clock_inc(page); buf_block_modify_clock_inc(block);
if (index->type & DICT_IBUF) { if (index->type & DICT_IBUF) {
btr_page_free_for_ibuf(index, page, mtr); btr_page_free_for_ibuf(index, block, mtr);
return; return;
} }
...@@ -451,7 +450,9 @@ btr_page_free_low( ...@@ -451,7 +450,9 @@ btr_page_free_low(
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP; seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_TOP;
} }
fseg_free_page(seg_header, space, page_no, mtr); fseg_free_page(seg_header,
buf_block_get_space(block),
buf_block_get_page_no(block), mtr);
} }
/****************************************************************** /******************************************************************
...@@ -462,20 +463,14 @@ void ...@@ -462,20 +463,14 @@ void
btr_page_free( btr_page_free(
/*==========*/ /*==========*/
dict_index_t* index, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ buf_block_t* block, /* in: block to be freed, x-latched */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint level; ulint level;
ulint space;
ulint page_no;
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
level = btr_page_get_level(page, mtr);
space = page_get_space_id(page); level = btr_page_get_level(buf_block_get_frame(block), mtr);
page_no = page_get_page_no(page);
btr_page_free_low(index, page, space, page_no, level, mtr); btr_page_free_low(index, block, level, mtr);
} }
/****************************************************************** /******************************************************************
...@@ -726,9 +721,9 @@ btr_create( ...@@ -726,9 +721,9 @@ btr_create(
page_zip = buf_block_get_page_zip(block); page_zip = buf_block_get_page_zip(block);
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
page = page_create_zip(frame, page_zip, index, 0, mtr); page = page_create_zip(block, index, 0, mtr);
} else { } else {
page = page_create(frame, mtr, page = page_create(block, mtr,
dict_table_is_comp(index->table)); dict_table_is_comp(index->table));
/* Set the level of the new index page */ /* Set the level of the new index page */
btr_page_set_level(page, NULL, 0, mtr); btr_page_set_level(page, NULL, 0, mtr);
...@@ -882,7 +877,7 @@ btr_page_reorganize_low( ...@@ -882,7 +877,7 @@ btr_page_reorganize_low(
/* Recreate the page: note that global data on page (possible /* Recreate the page: note that global data on page (possible
segment headers, next page-field, etc.) is preserved intact */ segment headers, next page-field, etc.) is preserved intact */
page_create(page, mtr, dict_table_is_comp(index->table)); page_create(block, mtr, dict_table_is_comp(index->table));
block->check_index_page_at_flush = TRUE; block->check_index_page_at_flush = TRUE;
/* Copy the records from the temporary space to the recreated page; /* Copy the records from the temporary space to the recreated page;
...@@ -1008,10 +1003,10 @@ btr_page_empty( ...@@ -1008,10 +1003,10 @@ btr_page_empty(
segment headers, next page-field, etc.) is preserved intact */ segment headers, next page-field, etc.) is preserved intact */
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
page_create_zip(page, page_zip, index, page_create_zip(block, index,
btr_page_get_level(page, mtr), mtr); btr_page_get_level(page, mtr), mtr);
} else { } else {
page_create(page, mtr, dict_table_is_comp(index->table)); page_create(block, mtr, dict_table_is_comp(index->table));
} }
block->check_index_page_at_flush = TRUE; block->check_index_page_at_flush = TRUE;
...@@ -1124,10 +1119,9 @@ btr_root_raise_and_insert( ...@@ -1124,10 +1119,9 @@ btr_root_raise_and_insert(
/* Rebuild the root page to get free space */ /* Rebuild the root page to get free space */
if (UNIV_LIKELY_NULL(root_page_zip)) { if (UNIV_LIKELY_NULL(root_page_zip)) {
page_create_zip(root, root_page_zip, index, page_create_zip(root_block, index, level + 1, mtr);
level + 1, mtr);
} else { } else {
page_create(root, mtr, dict_table_is_comp(index->table)); page_create(root_block, mtr, dict_table_is_comp(index->table));
btr_page_set_level(root, NULL, level + 1, mtr); btr_page_set_level(root, NULL, level + 1, mtr);
} }
...@@ -2136,7 +2130,7 @@ void ...@@ -2136,7 +2130,7 @@ void
btr_lift_page_up( btr_lift_page_up(
/*=============*/ /*=============*/
dict_index_t* index, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page which is the only on its level; buf_block_t* block, /* in: page which is the only on its level;
must not be empty: use must not be empty: use
btr_discard_only_page_on_level if the last btr_discard_only_page_on_level if the last
record from the page should be removed */ record from the page should be removed */
...@@ -2146,7 +2140,7 @@ btr_lift_page_up( ...@@ -2146,7 +2140,7 @@ btr_lift_page_up(
page_t* father_page; page_t* father_page;
ulint page_level; ulint page_level;
page_zip_des_t* father_page_zip; page_zip_des_t* father_page_zip;
buf_block_t* block = buf_block_align(page); page_t* page = buf_block_get_frame(block);
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL); ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL); ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
...@@ -2187,7 +2181,7 @@ btr_lift_page_up( ...@@ -2187,7 +2181,7 @@ btr_lift_page_up(
lock_update_copy_and_discard(father_page, page); lock_update_copy_and_discard(father_page, page);
/* Free the file page */ /* Free the file page */
btr_page_free(index, page, mtr); btr_page_free(index, block, mtr);
/* We play safe and reset the free bits for the father */ /* We play safe and reset the free bits for the father */
ibuf_reset_free_bits_with_type(index->type, father_block); ibuf_reset_free_bits_with_type(index->type, father_block);
...@@ -2223,6 +2217,7 @@ btr_compress( ...@@ -2223,6 +2217,7 @@ btr_compress(
page_t* merge_page; page_t* merge_page;
page_zip_des_t* merge_page_zip; page_zip_des_t* merge_page_zip;
ibool is_left; ibool is_left;
buf_block_t* block;
page_t* page; page_t* page;
rec_t* node_ptr; rec_t* node_ptr;
ulint data_size; ulint data_size;
...@@ -2231,7 +2226,8 @@ btr_compress( ...@@ -2231,7 +2226,8 @@ btr_compress(
ulint max_ins_size_reorg; ulint max_ins_size_reorg;
ulint level; ulint level;
page = btr_cur_get_page(cursor); block = buf_block_align(btr_cur_get_rec(cursor));
page = buf_block_get_frame(block);
index = btr_cur_get_index(cursor); index = btr_cur_get_index(cursor);
ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table)); ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table));
...@@ -2280,7 +2276,7 @@ btr_compress( ...@@ -2280,7 +2276,7 @@ btr_compress(
} else { } else {
/* The page is the only one on the level, lift the records /* The page is the only one on the level, lift the records
to the father */ to the father */
btr_lift_page_up(index, page, mtr); btr_lift_page_up(index, block, mtr);
return(TRUE); return(TRUE);
} }
...@@ -2428,7 +2424,7 @@ btr_compress( ...@@ -2428,7 +2424,7 @@ btr_compress(
ut_ad(page_validate(merge_page, index)); ut_ad(page_validate(merge_page, index));
/* Free the file page */ /* Free the file page */
btr_page_free(index, page, mtr); btr_page_free(index, block, mtr);
ut_ad(btr_check_node_ptr(index, merge_page, mtr)); ut_ad(btr_check_node_ptr(index, merge_page, mtr));
return(TRUE); return(TRUE);
...@@ -2466,7 +2462,7 @@ btr_discard_only_page_on_level( ...@@ -2466,7 +2462,7 @@ btr_discard_only_page_on_level(
page_level, mtr); page_level, mtr);
/* Free the file page */ /* Free the file page */
btr_page_free(index, page, mtr); btr_page_free(index, block, mtr);
if (UNIV_LIKELY(page_get_page_no(father_page) if (UNIV_LIKELY(page_get_page_no(father_page)
== dict_index_get_page(index))) { == dict_index_get_page(index))) {
...@@ -2582,7 +2578,7 @@ btr_discard_page( ...@@ -2582,7 +2578,7 @@ btr_discard_page(
} }
/* Free the file page */ /* Free the file page */
btr_page_free(index, page, mtr); btr_page_free(index, block, mtr);
ut_ad(btr_check_node_ptr(index, merge_page, mtr)); ut_ad(btr_check_node_ptr(index, merge_page, mtr));
} }
......
...@@ -1329,10 +1329,10 @@ btr_cur_pessimistic_insert( ...@@ -1329,10 +1329,10 @@ btr_cur_pessimistic_insert(
> free_space_zip)) { > free_space_zip)) {
/* Try to insert the record by itself on a new page. /* Try to insert the record by itself on a new page.
If it fails, no amount of splitting will help. */ If it fails, no amount of splitting will help. */
buf_block_t* temp_block = buf_block_alloc(zip_size); buf_block_t* temp_block
page_t* temp_page = page_create_zip( = buf_block_alloc(zip_size);
temp_block->frame, &temp_block->page_zip, page_t* temp_page
index, 0, NULL); = page_create_zip(temp_block, index, 0, NULL);
page_cur_t temp_cursor; page_cur_t temp_cursor;
rec_t* temp_rec; rec_t* temp_rec;
...@@ -3977,8 +3977,7 @@ btr_free_externally_stored_field( ...@@ -3977,8 +3977,7 @@ btr_free_externally_stored_field(
in row_purge_upd_exist_or_extern(). */ in row_purge_upd_exist_or_extern(). */
next_page_no = mach_read_from_4(page + FIL_PAGE_NEXT); next_page_no = mach_read_from_4(page + FIL_PAGE_NEXT);
btr_page_free_low(index, page, btr_page_free_low(index, ext_block, 0, &mtr);
space_id, page_no, 0, &mtr);
if (UNIV_LIKELY(page_zip != NULL)) { if (UNIV_LIKELY(page_zip != NULL)) {
mach_write_to_4(field_ref + BTR_EXTERN_PAGE_NO, mach_write_to_4(field_ref + BTR_EXTERN_PAGE_NO,
...@@ -4016,8 +4015,7 @@ btr_free_externally_stored_field( ...@@ -4016,8 +4015,7 @@ btr_free_externally_stored_field(
ut_a(space_id == page_get_space_id(page)); ut_a(space_id == page_get_space_id(page));
ut_a(page_no == page_get_page_no(page)); ut_a(page_no == page_get_page_no(page));
btr_page_free_low(index, page, btr_page_free_low(index, ext_block, 0, &mtr);
space_id, page_no, 0, &mtr);
mlog_write_ulint(field_ref + BTR_EXTERN_PAGE_NO, mlog_write_ulint(field_ref + BTR_EXTERN_PAGE_NO,
next_page_no, next_page_no,
......
...@@ -393,7 +393,7 @@ void ...@@ -393,7 +393,7 @@ void
btr_page_free( btr_page_free(
/*==========*/ /*==========*/
dict_index_t* index, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ buf_block_t* block, /* in: block to be freed, x-latched */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/****************************************************************** /******************************************************************
Frees a file page used in an index tree. Can be used also to BLOB Frees a file page used in an index tree. Can be used also to BLOB
...@@ -404,9 +404,7 @@ void ...@@ -404,9 +404,7 @@ void
btr_page_free_low( btr_page_free_low(
/*==============*/ /*==============*/
dict_index_t* index, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ buf_block_t* block, /* in: block to be freed, x-latched */
ulint space, /* in: space */
ulint page_no,/* in: page number */
ulint level, /* in: page level */ ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
#ifdef UNIV_BTR_PRINT #ifdef UNIV_BTR_PRINT
......
...@@ -371,23 +371,12 @@ buf_block_get_newest_modification( ...@@ -371,23 +371,12 @@ buf_block_get_newest_modification(
buf_block_t* block); /* in: block containing the page frame */ buf_block_t* block); /* in: block containing the page frame */
/************************************************************************ /************************************************************************
Increments the modify clock of a frame by 1. The caller must (1) own the Increments the modify clock of a frame by 1. The caller must (1) own the
pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
on the block. */
UNIV_INLINE
dulint
buf_frame_modify_clock_inc(
/*=======================*/
/* out: new value */
buf_frame_t* frame); /* in: pointer to a frame */
/************************************************************************
Increments the modify clock of a frame by 1. The caller must (1) own the
buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
on the block. */ on the block. */
UNIV_INLINE UNIV_INLINE
dulint void
buf_block_modify_clock_inc( buf_block_modify_clock_inc(
/*=======================*/ /*=======================*/
/* out: new value */
buf_block_t* block); /* in: block */ buf_block_t* block); /* in: block */
/************************************************************************ /************************************************************************
Returns the value of the modify clock. The caller must have an s-lock Returns the value of the modify clock. The caller must have an s-lock
...@@ -442,23 +431,25 @@ buf_ptr_get_fsp_addr( ...@@ -442,23 +431,25 @@ buf_ptr_get_fsp_addr(
ulint* space, /* out: space id */ ulint* space, /* out: space id */
fil_addr_t* addr); /* out: page offset and byte offset */ fil_addr_t* addr); /* out: page offset and byte offset */
/************************************************************************** /**************************************************************************
Gets the hash value of the page the pointer is pointing to. This can be used Gets the hash value of a block. This can be used in searches in the
in searches in the lock hash table. */ lock hash table. */
UNIV_INLINE UNIV_INLINE
ulint ulint
buf_frame_get_lock_hash_val( buf_block_get_lock_hash_val(
/*========================*/ /*========================*/
/* out: lock hash value */ /* out: lock hash value */
byte* ptr); /* in: pointer to within a buffer frame */ const buf_block_t* block) /* in: block */
__attribute__((const));
/************************************************************************** /**************************************************************************
Gets the mutex number protecting the page record lock hash chain in the lock Gets the mutex number protecting the page record lock hash chain in the lock
table. */ table. */
UNIV_INLINE UNIV_INLINE
mutex_t* mutex_t*
buf_frame_get_lock_mutex( buf_block_get_lock_mutex(
/*=====================*/ /*=====================*/
/* out: mutex */ /* out: mutex */
byte* ptr); /* in: pointer to within a buffer frame */ buf_block_t* block) /* in: block */
__attribute__((const));
/*********************************************************************** /***********************************************************************
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). */
......
...@@ -299,15 +299,11 @@ Gets the hash value of the page the pointer is pointing to. This can be used ...@@ -299,15 +299,11 @@ Gets the hash value of the page the pointer is pointing to. This can be used
in searches in the lock hash table. */ in searches in the lock hash table. */
UNIV_INLINE UNIV_INLINE
ulint ulint
buf_frame_get_lock_hash_val( buf_block_get_lock_hash_val(
/*========================*/ /*========================*/
/* out: lock hash value */ /* out: lock hash value */
byte* ptr) /* in: pointer to within a buffer frame */ const buf_block_t* block) /* in: block */
{ {
buf_block_t* block;
block = buf_block_align(ptr);
return(block->lock_hash_val); return(block->lock_hash_val);
} }
...@@ -319,12 +315,8 @@ mutex_t* ...@@ -319,12 +315,8 @@ mutex_t*
buf_frame_get_lock_mutex( buf_frame_get_lock_mutex(
/*=====================*/ /*=====================*/
/* out: mutex */ /* out: mutex */
byte* ptr) /* in: pointer to within a buffer frame */ buf_block_t* block) /* in: block */
{ {
buf_block_t* block;
block = buf_block_align(ptr);
return(block->lock_mutex); return(block->lock_mutex);
} }
...@@ -451,37 +443,9 @@ Increments the modify clock of a frame by 1. The caller must (1) own the ...@@ -451,37 +443,9 @@ Increments the modify clock of a frame by 1. The caller must (1) own the
buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
on the block. */ on the block. */
UNIV_INLINE UNIV_INLINE
dulint void
buf_frame_modify_clock_inc(
/*=======================*/
/* out: new value */
buf_frame_t* frame) /* in: pointer to a frame */
{
buf_block_t* block;
ut_ad(frame);
block = buf_block_align(frame);
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /*UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
return(block->modify_clock);
}
/************************************************************************
Increments the modify clock of a frame by 1. The caller must (1) own the
buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
on the block. */
UNIV_INLINE
dulint
buf_block_modify_clock_inc( buf_block_modify_clock_inc(
/*=======================*/ /*=======================*/
/* out: new value */
buf_block_t* block) /* in: block */ buf_block_t* block) /* in: block */
{ {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -490,8 +454,6 @@ buf_block_modify_clock_inc( ...@@ -490,8 +454,6 @@ buf_block_modify_clock_inc(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock); UT_DULINT_INC(block->modify_clock);
return(block->modify_clock);
} }
/************************************************************************ /************************************************************************
......
...@@ -657,7 +657,7 @@ page_t* ...@@ -657,7 +657,7 @@ page_t*
page_create( page_create(
/*========*/ /*========*/
/* out: pointer to the page */ /* out: pointer to the page */
buf_frame_t* frame, /* in/out: a buffer frame where the buf_block_t* block, /* in: a buffer block where the
page is created */ page is created */
mtr_t* mtr, /* in: mini-transaction handle */ mtr_t* mtr, /* in: mini-transaction handle */
ulint comp); /* in: nonzero=compact page format */ ulint comp); /* in: nonzero=compact page format */
...@@ -668,9 +668,8 @@ page_t* ...@@ -668,9 +668,8 @@ page_t*
page_create_zip( page_create_zip(
/*============*/ /*============*/
/* out: pointer to the page */ /* out: pointer to the page */
buf_frame_t* frame, /* in/out: a buffer frame where the buf_block_t* block, /* in/out: a buffer frame where the
page is created */ page is created */
page_zip_des_t* page_zip, /* in/out: compressed page, or NULL */
dict_index_t* index, /* in: the index of the page */ dict_index_t* index, /* in: the index of the page */
ulint level, /* in: the B-tree level of the page */ ulint level, /* in: the B-tree level of the page */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
...@@ -841,7 +840,7 @@ page_parse_create( ...@@ -841,7 +840,7 @@ page_parse_create(
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
ulint comp, /* in: nonzero=compact page format */ ulint comp, /* in: nonzero=compact page format */
page_t* page, /* in: page or NULL */ buf_block_t* block, /* in: block or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/*************************************************************** /***************************************************************
Parses a redo log record of creating a compressed page. */ Parses a redo log record of creating a compressed page. */
......
...@@ -1265,7 +1265,7 @@ lock_rec_get_first_on_page( ...@@ -1265,7 +1265,7 @@ lock_rec_get_first_on_page(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
hash = buf_frame_get_lock_hash_val(ptr); hash = buf_block_get_lock_hash_val(buf_block_align(ptr));
lock = HASH_GET_FIRST(lock_sys->rec_hash, hash); lock = HASH_GET_FIRST(lock_sys->rec_hash, hash);
......
...@@ -764,19 +764,31 @@ static ...@@ -764,19 +764,31 @@ static
byte* byte*
recv_parse_or_apply_log_rec_body( recv_parse_or_apply_log_rec_body(
/*=============================*/ /*=============================*/
/* out: log record end, NULL if not a complete /* out: log record end, NULL if not a
record */ complete record */
byte type, /* in: type */ byte type, /* in: type */
byte* ptr, /* in: pointer to a buffer */ byte* ptr, /* in: pointer to a buffer */
byte* end_ptr,/* in: pointer to the buffer end */ byte* end_ptr,/* in: pointer to the buffer end */
page_t* page, /* in/out: buffer page or NULL; if not NULL, then the buf_block_t* block, /* in/out: buffer block or NULL; if
log record is applied to the page, and the log record not NULL, then the log record is
should be complete then */ applied to the page, and the log
page_zip_des_t* page_zip,/* in/out: compressed page or NULL */ record should be complete then */
mtr_t* mtr) /* in: mtr or NULL; should be non-NULL if and only if mtr_t* mtr) /* in: mtr or NULL; should be non-NULL
page is non-NULL */ if and only if block is non-NULL */
{ {
dict_index_t* index = NULL; dict_index_t* index = NULL;
page_t* page;
page_zip_des_t* page_zip;
ut_ad(!block == !mtr);
if (block) {
page = block->frame;
page_zip = buf_block_get_page_zip(block);
} else {
page = NULL;
page_zip = NULL;
}
switch (type) { switch (type) {
case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES: case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES:
...@@ -876,7 +888,7 @@ recv_parse_or_apply_log_rec_body( ...@@ -876,7 +888,7 @@ recv_parse_or_apply_log_rec_body(
ut_a(!page_zip); ut_a(!page_zip);
ptr = page_parse_create(ptr, end_ptr, ptr = page_parse_create(ptr, end_ptr,
type == MLOG_COMP_PAGE_CREATE, type == MLOG_COMP_PAGE_CREATE,
page, mtr); block, mtr);
break; break;
case MLOG_UNDO_INSERT: case MLOG_UNDO_INSERT:
ptr = trx_undo_parse_add_undo_rec(ptr, end_ptr, page); ptr = trx_undo_parse_add_undo_rec(ptr, end_ptr, page);
...@@ -1155,7 +1167,6 @@ recv_recover_page( ...@@ -1155,7 +1167,6 @@ recv_recover_page(
buf_block_t* block) /* in: buffer block */ buf_block_t* block) /* in: buffer block */
{ {
page_t* page; page_t* page;
page_zip_des_t* page_zip;
recv_addr_t* recv_addr; recv_addr_t* recv_addr;
recv_t* recv; recv_t* recv;
byte* buf; byte* buf;
...@@ -1202,7 +1213,6 @@ recv_recover_page( ...@@ -1202,7 +1213,6 @@ recv_recover_page(
mtr_set_log_mode(&mtr, MTR_LOG_NONE); mtr_set_log_mode(&mtr, MTR_LOG_NONE);
page = block->frame; page = block->frame;
page_zip = buf_block_get_page_zip(block);
if (!recover_backup) { if (!recover_backup) {
if (just_read_in) { if (just_read_in) {
...@@ -1296,7 +1306,7 @@ recv_recover_page( ...@@ -1296,7 +1306,7 @@ recv_recover_page(
recv_parse_or_apply_log_rec_body(recv->type, buf, recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len, buf + recv->len,
page, page_zip, &mtr); block, &mtr);
mach_write_to_8(page + UNIV_PAGE_SIZE mach_write_to_8(page + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM, - FIL_PAGE_END_LSN_OLD_CHKSUM,
ut_dulint_add(recv->start_lsn, ut_dulint_add(recv->start_lsn,
...@@ -1743,7 +1753,7 @@ recv_parse_log_rec( ...@@ -1743,7 +1753,7 @@ recv_parse_log_rec(
} }
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr, new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
NULL, NULL, NULL); NULL, NULL);
if (UNIV_UNLIKELY(new_ptr == NULL)) { if (UNIV_UNLIKELY(new_ptr == NULL)) {
return(0); return(0);
......
...@@ -1549,7 +1549,7 @@ page_cur_delete_rec( ...@@ -1549,7 +1549,7 @@ page_cur_delete_rec(
/* The page gets invalid for optimistic searches: increment the /* The page gets invalid for optimistic searches: increment the
frame modify clock */ frame modify clock */
buf_frame_modify_clock_inc(page); buf_block_modify_clock_inc(buf_block_align(page)/*TODO*/);
/* 2. Find the next and the previous record. Note that the cursor is /* 2. Find the next and the previous record. Note that the cursor is
left at the next record. */ left at the next record. */
......
...@@ -285,15 +285,15 @@ page_parse_create( ...@@ -285,15 +285,15 @@ page_parse_create(
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr __attribute__((unused)), /* in: buffer end */ byte* end_ptr __attribute__((unused)), /* in: buffer end */
ulint comp, /* in: nonzero=compact page format */ ulint comp, /* in: nonzero=compact page format */
page_t* page, /* in: page or NULL */ buf_block_t* block, /* in: block or NULL */
mtr_t* mtr) /* in: mtr or NULL */ mtr_t* mtr) /* in: mtr or NULL */
{ {
ut_ad(ptr && end_ptr); ut_ad(ptr && end_ptr);
/* The record is empty, except for the record initial part */ /* The record is empty, except for the record initial part */
if (page) { if (block) {
page_create(page, mtr, comp); page_create(block, mtr, comp);
} }
return(ptr); return(ptr);
...@@ -306,7 +306,7 @@ page_t* ...@@ -306,7 +306,7 @@ page_t*
page_create_low( page_create_low(
/*============*/ /*============*/
/* out: pointer to the page */ /* out: pointer to the page */
buf_frame_t* frame, /* in/out: a buffer frame where the buf_block_t* block, /* in: a buffer block where the
page is created */ page is created */
ulint comp) /* in: nonzero=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
...@@ -321,7 +321,7 @@ page_create_low( ...@@ -321,7 +321,7 @@ page_create_low(
dict_index_t* index; dict_index_t* index;
ulint* offsets; ulint* offsets;
ut_ad(frame); ut_ad(block);
#if PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA #if PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA
# error "PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA" # error "PAGE_BTR_IBUF_FREE_LIST + FLST_BASE_NODE_SIZE > PAGE_DATA"
#endif #endif
...@@ -337,9 +337,9 @@ page_create_low( ...@@ -337,9 +337,9 @@ page_create_low(
} }
/* 1. INCREMENT MODIFY CLOCK */ /* 1. INCREMENT MODIFY CLOCK */
buf_frame_modify_clock_inc(frame); buf_block_modify_clock_inc(block);
page = frame; page = buf_block_get_frame(block);
fil_page_set_type(page, FIL_PAGE_INDEX); fil_page_set_type(page, FIL_PAGE_INDEX);
...@@ -459,13 +459,13 @@ page_t* ...@@ -459,13 +459,13 @@ page_t*
page_create( page_create(
/*========*/ /*========*/
/* out: pointer to the page */ /* out: pointer to the page */
buf_frame_t* frame, /* in/out: a buffer frame where the buf_block_t* block, /* in: a buffer block where the
page is created */ page is created */
mtr_t* mtr, /* in: mini-transaction handle */ mtr_t* mtr, /* in: mini-transaction handle */
ulint comp) /* in: nonzero=compact page format */ ulint comp) /* in: nonzero=compact page format */
{ {
page_create_write_log(frame, mtr, comp); page_create_write_log(buf_block_get_frame(block), mtr, comp);
return(page_create_low(frame, comp)); return(page_create_low(block, comp));
} }
/************************************************************** /**************************************************************
...@@ -475,26 +475,28 @@ page_t* ...@@ -475,26 +475,28 @@ page_t*
page_create_zip( page_create_zip(
/*============*/ /*============*/
/* out: pointer to the page */ /* out: pointer to the page */
buf_frame_t* frame, /* in/out: a buffer frame where the buf_block_t* block, /* in/out: a buffer frame where the
page is created */ page is created */
page_zip_des_t* page_zip, /* in/out: compressed page, or NULL */
dict_index_t* index, /* in: the index of the page */ dict_index_t* index, /* in: the index of the page */
ulint level, /* in: the B-tree level of the page */ ulint level, /* in: the B-tree level of the page */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
ut_ad(frame && page_zip && index); page_t* page;
ut_ad(block && buf_block_get_page_zip(block) && index);
ut_ad(dict_table_is_comp(index->table)); ut_ad(dict_table_is_comp(index->table));
page_create_low(frame, TRUE); page = page_create_low(block, TRUE);
mach_write_to_2(frame + PAGE_HEADER + PAGE_LEVEL, level); mach_write_to_2(page + PAGE_HEADER + PAGE_LEVEL, level);
if (UNIV_UNLIKELY(!page_zip_compress(page_zip, frame, index, mtr))) { if (UNIV_UNLIKELY(!page_zip_compress(buf_block_get_page_zip(block),
page, index, mtr))) {
/* The compression of a newly created page /* The compression of a newly created page
should always succeed. */ should always succeed. */
ut_error; ut_error;
} }
return(frame); return(page);
} }
/***************************************************************** /*****************************************************************
...@@ -890,7 +892,7 @@ page_delete_rec_list_end( ...@@ -890,7 +892,7 @@ page_delete_rec_list_end(
/* The page gets invalid for optimistic searches: increment the /* The page gets invalid for optimistic searches: increment the
frame modify clock */ frame modify clock */
buf_frame_modify_clock_inc(page); buf_block_modify_clock_inc(buf_block_align(page)/*TODO*/);
page_delete_rec_list_write_log(rec, index, page_is_comp(page) page_delete_rec_list_write_log(rec, index, page_is_comp(page)
? MLOG_COMP_LIST_END_DELETE ? MLOG_COMP_LIST_END_DELETE
......
...@@ -3531,8 +3531,8 @@ page_zip_reorganize( ...@@ -3531,8 +3531,8 @@ page_zip_reorganize(
/* Recreate the page: note that global data on page (possible /* Recreate the page: note that global data on page (possible
segment headers, next page-field, etc.) is preserved intact */ segment headers, next page-field, etc.) is preserved intact */
page_create(page, mtr, dict_table_is_comp(index->table));
block = buf_block_align(page); block = buf_block_align(page);
page_create(block, mtr, dict_table_is_comp(index->table));
block->check_index_page_at_flush = TRUE; block->check_index_page_at_flush = TRUE;
/* Copy the records from the temporary space to the recreated page; /* Copy the records from the temporary space to the recreated page;
......
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