mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
branches/zip: Reduce the number of buf_block_align() calls.
btr_block_get(): New function to return buf_block_t. btr_page_alloc(), buf_page_get_release_on_io(), buf_page_get_gen(), buf_page_create(), fseg_create(), fseg_create_general(): Return buf_block_t. buf_page_get_known_nowait(): Expect buf_block_t instead of buf_frame_t. buf_frame_get_newest_modification(): Replace with buf_block_get_newest_modification(). buf_page_dbg_add_level(): Replace with buf_block_dbg_add_level(). buf_block_get_zip_size(): New function. buf_block_get_page_zip(): Reintroduce. recv_recover_page(): Replace page, space, page_no with block. ibuf_bitmap_page_init(): Replace page, zip_size with block. ibuf_parse_bitmap_init(): Remove the parameter zip_size. btr_search_drop_page_hash_index(): Replace page with block.
This commit is contained in:
parent
736a8ffb01
commit
5669dc3d2a
30 changed files with 624 additions and 508 deletions
138
btr/btr0btr.c
138
btr/btr0btr.c
|
@ -157,12 +157,15 @@ btr_get_prev_user_rec(
|
|||
|
||||
if (prev_page_no != FIL_NULL) {
|
||||
|
||||
prev_page = buf_page_get_with_no_latch(space, prev_page_no,
|
||||
buf_block_t* prev_block;
|
||||
|
||||
prev_block = buf_page_get_with_no_latch(space, prev_page_no,
|
||||
mtr);
|
||||
prev_page = buf_block_get_frame(prev_block);
|
||||
/* The caller must already have a latch to the brother */
|
||||
ut_ad(mtr_memo_contains_page(mtr, prev_page,
|
||||
ut_ad(mtr_memo_contains(mtr, prev_block,
|
||||
MTR_MEMO_PAGE_S_FIX)
|
||||
|| mtr_memo_contains_page(mtr, prev_page,
|
||||
|| mtr_memo_contains(mtr, prev_block,
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
ut_a(page_is_comp(prev_page) == page_is_comp(page));
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
|
@ -208,13 +211,14 @@ btr_get_next_user_rec(
|
|||
space = page_get_space_id(page);
|
||||
|
||||
if (next_page_no != FIL_NULL) {
|
||||
buf_block_t* next_block;
|
||||
|
||||
next_page = buf_page_get_with_no_latch(space, next_page_no,
|
||||
next_block = buf_page_get_with_no_latch(space, next_page_no,
|
||||
mtr);
|
||||
next_page = buf_block_get_frame(next_block);
|
||||
/* The caller must already have a latch to the brother */
|
||||
ut_ad(mtr_memo_contains_page(mtr, next_page,
|
||||
MTR_MEMO_PAGE_S_FIX)
|
||||
|| mtr_memo_contains_page(mtr, next_page,
|
||||
ut_ad(mtr_memo_contains(mtr, next_block, MTR_MEMO_PAGE_S_FIX)
|
||||
|| mtr_memo_contains(mtr, next_block,
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(btr_page_get_prev(next_page, mtr)
|
||||
|
@ -260,16 +264,17 @@ btr_page_create(
|
|||
Allocates a new file page to be used in an ibuf tree. Takes the page from
|
||||
the free list of the tree, which must contain pages! */
|
||||
static
|
||||
page_t*
|
||||
buf_block_t*
|
||||
btr_page_alloc_for_ibuf(
|
||||
/*====================*/
|
||||
/* out: new allocated page, x-latched */
|
||||
/* out: new allocated block, x-latched */
|
||||
dict_index_t* index, /* in: index tree */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
fil_addr_t node_addr;
|
||||
page_t* root;
|
||||
page_t* new_page;
|
||||
buf_block_t* new_block;
|
||||
|
||||
root = btr_root_get(index, mtr);
|
||||
|
||||
|
@ -277,10 +282,11 @@ btr_page_alloc_for_ibuf(
|
|||
+ PAGE_BTR_IBUF_FREE_LIST, mtr);
|
||||
ut_a(node_addr.page != FIL_NULL);
|
||||
|
||||
new_page = buf_page_get(dict_index_get_space(index), node_addr.page,
|
||||
new_block = buf_page_get(dict_index_get_space(index), node_addr.page,
|
||||
RW_X_LATCH, mtr);
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
|
||||
buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
|
||||
|
@ -289,17 +295,17 @@ btr_page_alloc_for_ibuf(
|
|||
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
|
||||
mtr));
|
||||
|
||||
return(new_page);
|
||||
return(new_block);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Allocates a new file page to be used in an index tree. NOTE: we assume
|
||||
that the caller has made the reservation for free extents! */
|
||||
|
||||
page_t*
|
||||
buf_block_t*
|
||||
btr_page_alloc(
|
||||
/*===========*/
|
||||
/* out: new allocated page, x-latched;
|
||||
/* out: new allocated block, x-latched;
|
||||
NULL if out of space */
|
||||
dict_index_t* index, /* in: index */
|
||||
ulint hint_page_no, /* in: hint of a good page */
|
||||
|
@ -311,7 +317,7 @@ btr_page_alloc(
|
|||
{
|
||||
fseg_header_t* seg_header;
|
||||
page_t* root;
|
||||
page_t* new_page;
|
||||
buf_block_t* new_block;
|
||||
ulint new_page_no;
|
||||
|
||||
if (index->type & DICT_IBUF) {
|
||||
|
@ -338,13 +344,13 @@ btr_page_alloc(
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
new_page = buf_page_get(dict_index_get_space(index), new_page_no,
|
||||
new_block = buf_page_get(dict_index_get_space(index), new_page_no,
|
||||
RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
|
||||
buf_block_dbg_add_level(new_block, SYNC_TREE_NODE_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(new_page);
|
||||
return(new_block);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -657,7 +663,7 @@ btr_create(
|
|||
mtr_t* mtr) /* in: mini-transaction handle */
|
||||
{
|
||||
ulint page_no;
|
||||
buf_frame_t* ibuf_hdr_frame;
|
||||
buf_block_t* block;
|
||||
buf_frame_t* frame;
|
||||
page_t* page;
|
||||
page_zip_des_t* page_zip;
|
||||
|
@ -669,38 +675,41 @@ btr_create(
|
|||
|
||||
if (type & DICT_IBUF) {
|
||||
/* Allocate first the ibuf header page */
|
||||
ibuf_hdr_frame = fseg_create(
|
||||
buf_block_t* ibuf_hdr_block = fseg_create(
|
||||
space, 0, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW);
|
||||
buf_block_dbg_add_level(ibuf_hdr_block, SYNC_TREE_NODE_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_ad(page_get_page_no(ibuf_hdr_frame)
|
||||
ut_ad(buf_block_get_page_no(ibuf_hdr_block)
|
||||
== IBUF_HEADER_PAGE_NO);
|
||||
/* Allocate then the next page to the segment: it will be the
|
||||
tree root page */
|
||||
|
||||
page_no = fseg_alloc_free_page(ibuf_hdr_frame + IBUF_HEADER
|
||||
page_no = fseg_alloc_free_page(buf_block_get_frame(
|
||||
ibuf_hdr_block)
|
||||
+ IBUF_HEADER
|
||||
+ IBUF_TREE_SEG_HEADER,
|
||||
IBUF_TREE_ROOT_PAGE_NO,
|
||||
FSP_UP, mtr);
|
||||
ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO);
|
||||
|
||||
frame = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
} else {
|
||||
frame = fseg_create(space, 0, PAGE_HEADER + PAGE_BTR_SEG_TOP,
|
||||
block = fseg_create(space, 0, PAGE_HEADER + PAGE_BTR_SEG_TOP,
|
||||
mtr);
|
||||
}
|
||||
|
||||
if (frame == NULL) {
|
||||
if (block == NULL) {
|
||||
|
||||
return(FIL_NULL);
|
||||
}
|
||||
|
||||
page_no = page_get_page_no(frame);
|
||||
page_no = buf_block_get_page_no(block);
|
||||
frame = buf_block_get_frame(block);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
if (type & DICT_IBUF) {
|
||||
|
@ -717,12 +726,12 @@ btr_create(
|
|||
/* The fseg create acquires a second latch on the page,
|
||||
therefore we must declare it: */
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
}
|
||||
|
||||
/* Create a new index page on the the allocated segment page */
|
||||
page_zip = buf_frame_get_page_zip(frame);
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
page = page_create_zip(frame, page_zip, index, 0, mtr);
|
||||
|
@ -813,18 +822,16 @@ btr_free_root(
|
|||
mtr_t* mtr) /* in: a mini-transaction which has already
|
||||
been started */
|
||||
{
|
||||
ibool finished;
|
||||
page_t* root;
|
||||
buf_block_t* block;
|
||||
fseg_header_t* header;
|
||||
|
||||
root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr);
|
||||
block = btr_block_get(space, root_page_no, RW_X_LATCH, mtr);
|
||||
|
||||
btr_search_drop_page_hash_index(root);
|
||||
top_loop:
|
||||
finished = fseg_free_step(root + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
|
||||
if (!finished) {
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
goto top_loop;
|
||||
}
|
||||
header = buf_block_get_frame(block) + PAGE_HEADER + PAGE_BTR_SEG_TOP;
|
||||
|
||||
while (!fseg_free_step(header, mtr));
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
@ -843,6 +850,7 @@ btr_page_reorganize_low(
|
|||
dict_index_t* index, /* in: record descriptor */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
page_t* temp_page;
|
||||
ulint log_mode;
|
||||
ulint data_size1;
|
||||
|
@ -851,7 +859,8 @@ btr_page_reorganize_low(
|
|||
ulint max_ins_size2;
|
||||
ibool success = FALSE;
|
||||
|
||||
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
|
||||
block = buf_block_align(page);
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
|
@ -873,14 +882,14 @@ btr_page_reorganize_low(
|
|||
buf_frame_copy(temp_page, page);
|
||||
|
||||
if (UNIV_LIKELY(!recovery)) {
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
}
|
||||
|
||||
/* Recreate the page: note that global data on page (possible
|
||||
segment headers, next page-field, etc.) is preserved intact */
|
||||
|
||||
page_create(page, mtr, dict_table_is_comp(index->table));
|
||||
buf_block_align(page)->check_index_page_at_flush = TRUE;
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
|
||||
/* Copy the records from the temporary space to the recreated page;
|
||||
do not copy the lock bits yet */
|
||||
|
@ -992,12 +1001,16 @@ btr_page_empty(
|
|||
mtr_t* mtr, /* in: mtr */
|
||||
dict_index_t* index) /* in: index of the page */
|
||||
{
|
||||
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
|
||||
buf_block_t* block;
|
||||
|
||||
block = buf_block_align(page);
|
||||
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!page_zip || page_zip_validate(page_zip, page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
/* Recreate the page: note that global data on page (possible
|
||||
segment headers, next page-field, etc.) is preserved intact */
|
||||
|
@ -1009,7 +1022,7 @@ btr_page_empty(
|
|||
page_create(page, mtr, dict_table_is_comp(index->table));
|
||||
}
|
||||
|
||||
buf_block_align(page)->check_index_page_at_flush = TRUE;
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
@ -1044,9 +1057,12 @@ btr_root_raise_and_insert(
|
|||
page_cur_t* page_cursor;
|
||||
page_zip_des_t* root_page_zip;
|
||||
page_zip_des_t* new_page_zip;
|
||||
buf_block_t* root_block;
|
||||
buf_block_t* new_block;
|
||||
|
||||
root = btr_cur_get_page(cursor);
|
||||
root_page_zip = buf_frame_get_page_zip(root);
|
||||
root_block = buf_block_align(root);
|
||||
root_page_zip = buf_block_get_page_zip(root_block);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(!root_page_zip || page_zip_validate(root_page_zip, root));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
@ -1055,8 +1071,8 @@ btr_root_raise_and_insert(
|
|||
ut_ad(dict_index_get_page(index) == page_get_page_no(root));
|
||||
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
|
||||
MTR_MEMO_X_LOCK));
|
||||
ut_ad(mtr_memo_contains_page(mtr, root, MTR_MEMO_PAGE_X_FIX));
|
||||
btr_search_drop_page_hash_index(root);
|
||||
ut_ad(mtr_memo_contains(mtr, root_block, MTR_MEMO_PAGE_X_FIX));
|
||||
btr_search_drop_page_hash_index(root_block);
|
||||
|
||||
/* Allocate a new page to the tree. Root splitting is done by first
|
||||
moving the root records to the new page, emptying the root, putting
|
||||
|
@ -1064,8 +1080,9 @@ 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_frame_get_page_zip(new_page);
|
||||
new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr);
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
new_page_zip = buf_block_get_page_zip(new_block);
|
||||
ut_a(!new_page_zip == !root_page_zip);
|
||||
ut_a(!new_page_zip || new_page_zip->size == root_page_zip->size);
|
||||
|
||||
|
@ -1130,7 +1147,7 @@ btr_root_raise_and_insert(
|
|||
btr_page_set_next(root, root_page_zip, FIL_NULL, mtr);
|
||||
btr_page_set_prev(root, root_page_zip, FIL_NULL, mtr);
|
||||
|
||||
buf_block_align(root)->check_index_page_at_flush = TRUE;
|
||||
root_block->check_index_page_at_flush = TRUE;
|
||||
|
||||
page_cursor = btr_cur_get_page_cur(cursor);
|
||||
|
||||
|
@ -1676,6 +1693,7 @@ btr_page_split_and_insert(
|
|||
ulint page_no;
|
||||
byte direction;
|
||||
ulint hint_page_no;
|
||||
buf_block_t* new_block;
|
||||
page_t* new_page;
|
||||
page_zip_des_t* new_page_zip;
|
||||
rec_t* split_rec;
|
||||
|
@ -1739,9 +1757,10 @@ func_start:
|
|||
}
|
||||
|
||||
/* 2. Allocate a new page to the index */
|
||||
new_page = btr_page_alloc(cursor->index, hint_page_no, direction,
|
||||
new_block = btr_page_alloc(cursor->index, hint_page_no, direction,
|
||||
btr_page_get_level(page, mtr), mtr);
|
||||
new_page_zip = buf_frame_get_page_zip(new_page);
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
new_page_zip = buf_block_get_page_zip(new_block);
|
||||
btr_page_create(new_page, new_page_zip, cursor->index,
|
||||
btr_page_get_level(page, mtr), mtr);
|
||||
|
||||
|
@ -2123,10 +2142,11 @@ btr_lift_page_up(
|
|||
page_t* father_page;
|
||||
ulint page_level;
|
||||
page_zip_des_t* father_page_zip;
|
||||
buf_block_t* block = buf_block_align(page);
|
||||
|
||||
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
|
||||
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
|
||||
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));
|
||||
father_page = page_align(
|
||||
btr_page_get_father_node_ptr(index, page, mtr));
|
||||
father_page_zip = buf_frame_get_page_zip(father_page);
|
||||
|
@ -2137,7 +2157,7 @@ btr_lift_page_up(
|
|||
|
||||
page_level = btr_page_get_level(page, mtr);
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
/* Make the father empty */
|
||||
btr_page_empty(father_page, father_page_zip, mtr, index);
|
||||
|
@ -2317,7 +2337,7 @@ btr_compress(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(buf_block_align(page));
|
||||
|
||||
/* Remove the page from the level list */
|
||||
btr_level_list_remove(page, mtr);
|
||||
|
@ -2359,7 +2379,7 @@ btr_compress(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(buf_block_align(page));
|
||||
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
if (UNIV_LIKELY_NULL(merge_page_zip)) {
|
||||
|
@ -2422,7 +2442,7 @@ btr_discard_only_page_on_level(
|
|||
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
|
||||
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
|
||||
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(buf_block_align(page));
|
||||
|
||||
father_page = page_align(
|
||||
btr_page_get_father_node_ptr(index, page, mtr));
|
||||
|
@ -2509,7 +2529,7 @@ btr_discard_page(
|
|||
}
|
||||
|
||||
ut_a(page_is_comp(merge_page) == page_is_comp(page));
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(buf_block_align(page));
|
||||
|
||||
if (left_page_no == FIL_NULL && !page_is_leaf(page)) {
|
||||
|
||||
|
|
101
btr/btr0cur.c
101
btr/btr0cur.c
|
@ -470,11 +470,11 @@ btr_cur_search_to_nth_level(
|
|||
for (;;) {
|
||||
buf_block_t* block;
|
||||
retry_page_get:
|
||||
page = buf_page_get_gen(space, page_no, rw_latch, guess,
|
||||
block = buf_page_get_gen(space, page_no, rw_latch, guess,
|
||||
buf_mode,
|
||||
__FILE__, __LINE__,
|
||||
mtr);
|
||||
if (page == NULL) {
|
||||
if (block == NULL) {
|
||||
/* This must be a search to perform an insert;
|
||||
try insert to the insert buffer */
|
||||
|
||||
|
@ -501,19 +501,19 @@ retry_page_get:
|
|||
goto retry_page_get;
|
||||
}
|
||||
|
||||
block = buf_block_align(page);
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
#ifdef UNIV_ZIP_DEBUG
|
||||
ut_a(rw_latch == RW_NO_LATCH
|
||||
|| !buf_frame_get_page_zip(page)
|
||||
|| page_zip_validate(buf_frame_get_page_zip(page), page));
|
||||
|| !buf_block_get_page_zip(block)
|
||||
|| page_zip_validate(buf_block_get_page_zip(block),
|
||||
page));
|
||||
#endif /* UNIV_ZIP_DEBUG */
|
||||
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
if (rw_latch != RW_NO_LATCH) {
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
}
|
||||
#endif
|
||||
ut_ad(0 == ut_dulint_cmp(index->id,
|
||||
|
@ -651,7 +651,6 @@ btr_cur_open_at_index_side(
|
|||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_cur_t* page_cursor;
|
||||
page_t* page;
|
||||
ulint page_no;
|
||||
ulint space;
|
||||
ulint height;
|
||||
|
@ -687,14 +686,17 @@ btr_cur_open_at_index_side(
|
|||
height = ULINT_UNDEFINED;
|
||||
|
||||
for (;;) {
|
||||
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
block = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
|
||||
BUF_GET,
|
||||
__FILE__, __LINE__,
|
||||
mtr);
|
||||
page = buf_block_get_frame(block);
|
||||
ut_ad(0 == ut_dulint_cmp(index->id,
|
||||
btr_page_get_index_id(page)));
|
||||
|
||||
buf_block_align(page)->check_index_page_at_flush = TRUE;
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
|
||||
if (height == ULINT_UNDEFINED) {
|
||||
/* We are in the root node */
|
||||
|
@ -777,7 +779,6 @@ btr_cur_open_at_rnd_pos(
|
|||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_cur_t* page_cursor;
|
||||
page_t* page;
|
||||
ulint page_no;
|
||||
ulint space;
|
||||
ulint height;
|
||||
|
@ -802,10 +803,14 @@ btr_cur_open_at_rnd_pos(
|
|||
height = ULINT_UNDEFINED;
|
||||
|
||||
for (;;) {
|
||||
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
|
||||
block = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
|
||||
BUF_GET,
|
||||
__FILE__, __LINE__,
|
||||
mtr);
|
||||
page = buf_block_get_frame(block);
|
||||
ut_ad(0 == ut_dulint_cmp(index->id,
|
||||
btr_page_get_index_id(page)));
|
||||
|
||||
|
@ -1931,6 +1936,7 @@ btr_cur_pess_upd_restore_supremum(
|
|||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
buf_block_t* prev_block;
|
||||
page_t* prev_page;
|
||||
ulint space;
|
||||
ulint prev_page_no;
|
||||
|
@ -1947,14 +1953,15 @@ btr_cur_pess_upd_restore_supremum(
|
|||
prev_page_no = btr_page_get_prev(page, mtr);
|
||||
|
||||
ut_ad(prev_page_no != FIL_NULL);
|
||||
prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr);
|
||||
prev_block = buf_page_get_with_no_latch(space, prev_page_no, mtr);
|
||||
prev_page = buf_block_get_frame(prev_block);
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(btr_page_get_next(prev_page, mtr)
|
||||
== page_get_page_no(page));
|
||||
#endif /* UNIV_BTR_DEBUG */
|
||||
|
||||
/* We must already have an x-latch to prev_page! */
|
||||
ut_ad(mtr_memo_contains_page(mtr, prev_page, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr_memo_contains(mtr, prev_block, MTR_MEMO_PAGE_X_FIX));
|
||||
|
||||
lock_rec_reset_and_inherit_gap_locks(page_get_supremum_rec(prev_page),
|
||||
rec);
|
||||
|
@ -3589,14 +3596,13 @@ btr_store_big_rec_extern_fields(
|
|||
ulint extern_len;
|
||||
ulint store_len;
|
||||
ulint page_no;
|
||||
page_t* page;
|
||||
ulint space_id;
|
||||
page_t* rec_page;
|
||||
ulint prev_page_no;
|
||||
ulint hint_page_no;
|
||||
ulint i;
|
||||
mtr_t mtr;
|
||||
page_zip_des_t* page_zip;
|
||||
buf_block_t* rec_block;
|
||||
z_stream c_stream;
|
||||
|
||||
ut_ad(rec_offs_validate(rec, index, offsets));
|
||||
|
@ -3652,6 +3658,9 @@ btr_store_big_rec_extern_fields(
|
|||
}
|
||||
|
||||
for (;;) {
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
if (prev_page_no == FIL_NULL) {
|
||||
|
@ -3661,9 +3670,9 @@ btr_store_big_rec_extern_fields(
|
|||
hint_page_no = prev_page_no + 1;
|
||||
}
|
||||
|
||||
page = btr_page_alloc(index, hint_page_no,
|
||||
block = btr_page_alloc(index, hint_page_no,
|
||||
FSP_NO_DIR, 0, &mtr);
|
||||
if (UNIV_UNLIKELY(page == NULL)) {
|
||||
if (UNIV_UNLIKELY(block == NULL)) {
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
|
@ -3674,18 +3683,21 @@ btr_store_big_rec_extern_fields(
|
|||
return(DB_OUT_OF_FILE_SPACE);
|
||||
}
|
||||
|
||||
page_no = page_get_page_no(page);
|
||||
page_no = buf_block_get_page_no(block);
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
if (prev_page_no != FIL_NULL) {
|
||||
buf_block_t* prev_block;
|
||||
page_t* prev_page;
|
||||
|
||||
prev_page = buf_page_get(space_id,
|
||||
prev_block = buf_page_get(space_id,
|
||||
prev_page_no,
|
||||
RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(prev_page,
|
||||
buf_block_dbg_add_level(prev_block,
|
||||
SYNC_EXTERN_STORAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
prev_page = buf_block_get_frame(prev_block);
|
||||
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
mlog_write_ulint(
|
||||
|
@ -3737,7 +3749,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_frame_get_page_zip(page);
|
||||
blob_page_zip = buf_block_get_page_zip(block);
|
||||
ut_ad(blob_page_zip);
|
||||
ut_ad(blob_page_zip->size == page_zip->size);
|
||||
memcpy(blob_page_zip->data, page,
|
||||
|
@ -3749,12 +3761,13 @@ btr_store_big_rec_extern_fields(
|
|||
goto next_zip_page;
|
||||
}
|
||||
|
||||
rec_page = buf_page_get(
|
||||
space_id, page_get_page_no(
|
||||
rec_block = buf_page_get(
|
||||
space_id,
|
||||
page_get_page_no(
|
||||
page_align(field_ref)),
|
||||
RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(rec_page,
|
||||
buf_block_dbg_add_level(rec_block,
|
||||
SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
if (err == Z_STREAM_END) {
|
||||
|
@ -3826,12 +3839,13 @@ next_zip_page:
|
|||
|
||||
extern_len -= store_len;
|
||||
|
||||
rec_page = buf_page_get(
|
||||
space_id, page_get_page_no(
|
||||
rec_block = buf_page_get(
|
||||
space_id,
|
||||
page_get_page_no(
|
||||
page_align(field_ref)),
|
||||
RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(rec_page,
|
||||
buf_block_dbg_add_level(rec_block,
|
||||
SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
|
@ -3912,16 +3926,17 @@ btr_free_externally_stored_field(
|
|||
X-latch to the index tree */
|
||||
{
|
||||
page_t* page;
|
||||
page_t* rec_page;
|
||||
ulint space_id;
|
||||
ulint page_no;
|
||||
ulint next_page_no;
|
||||
mtr_t mtr;
|
||||
#ifdef UNIV_DEBUG
|
||||
buf_block_t* block = buf_block_align(field_ref);
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
|
||||
MTR_MEMO_X_LOCK));
|
||||
ut_ad(mtr_memo_contains_page(local_mtr, field_ref,
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(mtr_memo_contains(local_mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(!rec || rec_offs_validate(rec, index, offsets));
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
|
@ -3936,16 +3951,20 @@ btr_free_externally_stored_field(
|
|||
#endif /* UNIV_DEBUG */
|
||||
|
||||
for (;;) {
|
||||
buf_block_t* rec_block;
|
||||
buf_block_t* ext_block;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
rec_page = buf_page_get(page_get_space_id(
|
||||
rec_block = buf_page_get(page_get_space_id(
|
||||
page_align(field_ref)),
|
||||
page_get_page_no(
|
||||
page_align(field_ref)),
|
||||
RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(rec_block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_ad(rec_block == block);
|
||||
space_id = mach_read_from_4(field_ref + BTR_EXTERN_SPACE_ID);
|
||||
|
||||
page_no = mach_read_from_4(field_ref + BTR_EXTERN_PAGE_NO);
|
||||
|
@ -3966,10 +3985,12 @@ btr_free_externally_stored_field(
|
|||
return;
|
||||
}
|
||||
|
||||
page = buf_page_get(space_id, page_no, RW_X_LATCH, &mtr);
|
||||
ext_block = buf_page_get(space_id, page_no, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
|
||||
buf_block_dbg_add_level(ext_block, SYNC_EXTERN_STORAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
page = buf_block_get_frame(ext_block);
|
||||
|
||||
if (dict_table_zip_size(index->table)) {
|
||||
/* Note that page_zip will be NULL
|
||||
in row_purge_upd_exist_or_extern(). */
|
||||
|
@ -4145,7 +4166,6 @@ btr_copy_externally_stored_field_prefix_low(
|
|||
ulint page_no,/* in: page number of the first BLOB page */
|
||||
ulint offset) /* in: offset on the first BLOB page */
|
||||
{
|
||||
page_t* page;
|
||||
ulint copied_len = 0;
|
||||
mtr_t mtr;
|
||||
z_stream d_stream;
|
||||
|
@ -4169,12 +4189,17 @@ btr_copy_externally_stored_field_prefix_low(
|
|||
}
|
||||
|
||||
for (;;) {
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
page = buf_page_get(space_id, page_no, RW_S_LATCH, &mtr);
|
||||
block = buf_page_get(space_id, page_no, RW_S_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
if (UNIV_UNLIKELY(zip_size)) {
|
||||
int err;
|
||||
ulint next_page_no;
|
||||
|
|
|
@ -247,7 +247,8 @@ btr_pcur_restore_position(
|
|||
cursor->modify_clock, mtr))) {
|
||||
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
buf_block_dbg_add_level(buf_block_align(page),
|
||||
SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
if (cursor->rel_pos == BTR_PCUR_ON) {
|
||||
#ifdef UNIV_DEBUG
|
||||
|
|
|
@ -758,11 +758,12 @@ btr_search_guess_on_hash(
|
|||
}
|
||||
|
||||
page = page_align(rec);
|
||||
block = buf_block_align(page);
|
||||
|
||||
if (UNIV_LIKELY(!has_search_latch)) {
|
||||
|
||||
if (UNIV_UNLIKELY(
|
||||
!buf_page_get_known_nowait(latch_mode, page,
|
||||
!buf_page_get_known_nowait(latch_mode, block,
|
||||
BUF_MAKE_YOUNG,
|
||||
__FILE__, __LINE__,
|
||||
mtr))) {
|
||||
|
@ -773,12 +774,10 @@ btr_search_guess_on_hash(
|
|||
can_only_compare_to_cursor_rec = FALSE;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
}
|
||||
|
||||
block = buf_block_align(page);
|
||||
|
||||
if (UNIV_UNLIKELY(block->state == BUF_BLOCK_REMOVE_HASH)) {
|
||||
if (UNIV_LIKELY(!has_search_latch)) {
|
||||
|
||||
|
@ -894,13 +893,15 @@ Drops a page hash index. */
|
|||
void
|
||||
btr_search_drop_page_hash_index(
|
||||
/*============================*/
|
||||
page_t* page) /* in: index page, s- or x-latched, or an index page
|
||||
for which we know that block->buf_fix_count == 0 */
|
||||
buf_block_t* block) /* in: block containing index page,
|
||||
s- or x-latched, or an index page
|
||||
for which we know that
|
||||
block->buf_fix_count == 0 */
|
||||
{
|
||||
hash_table_t* table;
|
||||
buf_block_t* block;
|
||||
ulint n_fields;
|
||||
ulint n_bytes;
|
||||
page_t* page;
|
||||
rec_t* rec;
|
||||
ulint fold;
|
||||
ulint prev_fold;
|
||||
|
@ -917,10 +918,10 @@ btr_search_drop_page_hash_index(
|
|||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
retry:
|
||||
rw_lock_s_lock(&btr_search_latch);
|
||||
|
||||
block = buf_block_align(page);
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
if (UNIV_LIKELY(!block->is_hashed)) {
|
||||
|
||||
|
@ -1054,13 +1055,10 @@ btr_search_drop_page_hash_when_freed(
|
|||
ulint space, /* in: space id */
|
||||
ulint page_no) /* in: page number */
|
||||
{
|
||||
ibool is_hashed;
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
mtr_t mtr;
|
||||
|
||||
is_hashed = buf_page_peek_if_search_hashed(space, page_no);
|
||||
|
||||
if (!is_hashed) {
|
||||
if (!buf_page_peek_if_search_hashed(space, page_no)) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1072,15 +1070,15 @@ btr_search_drop_page_hash_when_freed(
|
|||
get here. Therefore we can acquire the s-latch to the page without
|
||||
having to fear a deadlock. */
|
||||
|
||||
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
|
||||
block = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
|
||||
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
|
||||
&mtr);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
@ -1137,7 +1135,7 @@ btr_search_build_page_hash_index(
|
|||
|
||||
rw_lock_s_unlock(&btr_search_latch);
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
} else {
|
||||
rw_lock_s_unlock(&btr_search_latch);
|
||||
}
|
||||
|
@ -1307,7 +1305,7 @@ btr_search_move_or_delete_hash_entries(
|
|||
|
||||
rw_lock_s_unlock(&btr_search_latch);
|
||||
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1160,10 +1160,10 @@ buf_page_reset_file_page_was_freed(
|
|||
/************************************************************************
|
||||
This is the general function used to get access to a database page. */
|
||||
|
||||
buf_frame_t*
|
||||
buf_block_t*
|
||||
buf_page_get_gen(
|
||||
/*=============*/
|
||||
/* out: pointer to the frame or NULL */
|
||||
/* out: pointer to the block or NULL */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset, /* in: page number */
|
||||
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
|
||||
|
@ -1362,7 +1362,7 @@ loop:
|
|||
#ifdef UNIV_IBUF_DEBUG
|
||||
ut_a(ibuf_count_get(block->space, block->offset) == 0);
|
||||
#endif
|
||||
return(block->frame);
|
||||
return(block);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -1441,7 +1441,7 @@ exit_func:
|
|||
|
||||
if (UNIV_UNLIKELY(!UT_DULINT_EQ(modify_clock, block->modify_clock))) {
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(block->frame, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
if (rw_latch == RW_S_LATCH) {
|
||||
rw_lock_s_unlock(&(block->lock));
|
||||
|
@ -1499,13 +1499,12 @@ buf_page_get_known_nowait(
|
|||
/*======================*/
|
||||
/* out: TRUE if success */
|
||||
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
|
||||
buf_frame_t* guess, /* in: the known page frame */
|
||||
buf_block_t* block, /* in: the known page */
|
||||
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
|
||||
const char* file, /* in: file name */
|
||||
ulint line, /* in: line where called */
|
||||
mtr_t* mtr) /* in: mini-transaction */
|
||||
{
|
||||
buf_block_t* block;
|
||||
ibool success;
|
||||
ulint fix_type;
|
||||
|
||||
|
@ -1514,8 +1513,6 @@ buf_page_get_known_nowait(
|
|||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
block = buf_block_align(guess);
|
||||
|
||||
if (block->state == BUF_BLOCK_REMOVE_HASH) {
|
||||
/* Another thread is just freeing the block from the LRU list
|
||||
of the buffer pool: do not try to access this page; this
|
||||
|
@ -1821,10 +1818,10 @@ from a file even if it cannot be found in the buffer buf_pool. This is one
|
|||
of the functions which perform to a block a state transition NOT_USED =>
|
||||
FILE_PAGE (the other is buf_page_init_for_read above). */
|
||||
|
||||
buf_frame_t*
|
||||
buf_block_t*
|
||||
buf_page_create(
|
||||
/*============*/
|
||||
/* out: pointer to the frame, page bufferfixed */
|
||||
/* out: pointer to the block, page bufferfixed */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset, /* in: offset of the page within space in units of
|
||||
a page */
|
||||
|
@ -1855,9 +1852,7 @@ buf_page_create(
|
|||
|
||||
buf_block_free(free_block);
|
||||
|
||||
frame = buf_page_get_with_no_latch(space, offset, mtr);
|
||||
|
||||
return(frame);
|
||||
return(buf_page_get_with_no_latch(space, offset, mtr));
|
||||
}
|
||||
|
||||
/* If we get here, the page was not in buf_pool: init it there */
|
||||
|
@ -1921,7 +1916,7 @@ buf_page_create(
|
|||
#ifdef UNIV_IBUF_DEBUG
|
||||
ut_a(ibuf_count_get(block->space, block->offset) == 0);
|
||||
#endif
|
||||
return(frame);
|
||||
return(block);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -2068,8 +2063,7 @@ corrupt:
|
|||
}
|
||||
|
||||
if (recv_recovery_is_on()) {
|
||||
recv_recover_page(FALSE, TRUE, block->frame,
|
||||
block->space, block->offset);
|
||||
recv_recover_page(FALSE, TRUE, block);
|
||||
}
|
||||
|
||||
if (!recv_no_ibuf_operations) {
|
||||
|
|
|
@ -595,7 +595,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_frame_get_page_zip(block->frame),
|
||||
buf_block_get_page_zip(block),
|
||||
block->newest_modification);
|
||||
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
|
||||
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
|
|
|
@ -232,7 +232,7 @@ buf_LRU_search_and_free_block(
|
|||
frame at all */
|
||||
|
||||
if (block->frame) {
|
||||
btr_search_drop_page_hash_index(block->frame);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
}
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ dict_hdr_get(
|
|||
page x-latched */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
dict_hdr_t* header;
|
||||
|
||||
ut_ad(mtr);
|
||||
|
||||
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
|
||||
block = buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
|
||||
RW_X_LATCH, mtr);
|
||||
header = DICT_HDR + buf_block_get_frame(block);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
|
||||
buf_block_dbg_add_level(block, SYNC_DICT_HEADER);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
return(header);
|
||||
}
|
||||
|
@ -111,21 +111,18 @@ dict_hdr_create(
|
|||
/* out: TRUE if succeed */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
dict_hdr_t* dict_header;
|
||||
ulint hdr_page_no;
|
||||
ulint root_page_no;
|
||||
page_t* page;
|
||||
|
||||
ut_ad(mtr);
|
||||
|
||||
/* Create the dictionary header file block in a new, allocated file
|
||||
segment in the system tablespace */
|
||||
page = fseg_create(DICT_HDR_SPACE, 0,
|
||||
block = fseg_create(DICT_HDR_SPACE, 0,
|
||||
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
|
||||
|
||||
hdr_page_no = page_get_page_no(page);
|
||||
|
||||
ut_a(DICT_HDR_PAGE_NO == hdr_page_no);
|
||||
ut_a(DICT_HDR_PAGE_NO == buf_block_get_page_no(block));
|
||||
|
||||
dict_header = dict_hdr_get(mtr);
|
||||
|
||||
|
|
131
fsp/fsp0fsp.c
131
fsp/fsp0fsp.c
|
@ -325,13 +325,13 @@ fsp_get_space_header(
|
|||
ulint id, /* in: space id */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
fsp_header_t* header;
|
||||
|
||||
ut_ad(mtr);
|
||||
|
||||
header = FSP_HEADER_OFFSET + buf_page_get(id, 0, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(id, 0, RW_X_LATCH, mtr);
|
||||
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(header, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_ad(id == mach_read_from_4(FSP_SPACE_ID + header));
|
||||
return(header);
|
||||
|
@ -704,11 +704,13 @@ xdes_get_descriptor_with_space_hdr(
|
|||
|
||||
descr_page = page_align(sp_header);
|
||||
} else {
|
||||
descr_page = buf_page_get(space, descr_page_no, RW_X_LATCH,
|
||||
mtr);
|
||||
buf_block_t* block;
|
||||
|
||||
block = buf_page_get(space, descr_page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(descr_page, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
descr_page = buf_block_get_frame(block);
|
||||
}
|
||||
|
||||
return(descr_page + XDES_ARR_OFFSET
|
||||
|
@ -734,13 +736,14 @@ xdes_get_descriptor(
|
|||
we try to add new extents to the space free list */
|
||||
mtr_t* mtr) /* in: mtr handle */
|
||||
{
|
||||
buf_block_t* block;
|
||||
fsp_header_t* sp_header;
|
||||
|
||||
sp_header = FSP_HEADER_OFFSET
|
||||
+ buf_page_get(space, 0, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(space, 0, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(sp_header, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
|
||||
return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset,
|
||||
mtr));
|
||||
}
|
||||
|
@ -812,16 +815,14 @@ static
|
|||
void
|
||||
fsp_init_file_page_low(
|
||||
/*===================*/
|
||||
byte* ptr) /* in: pointer to a page */
|
||||
buf_block_t* block) /* in: pointer to a page */
|
||||
{
|
||||
buf_block_t* block = buf_block_align(ptr);
|
||||
|
||||
page_t* page = buf_block_get_frame(block);
|
||||
page_zip_des_t* page_zip;
|
||||
|
||||
block->check_index_page_at_flush = FALSE;
|
||||
|
||||
page_zip = buf_frame_get_page_zip(page);
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
memset(page, 0, UNIV_PAGE_SIZE);
|
||||
|
@ -853,12 +854,13 @@ static
|
|||
void
|
||||
fsp_init_file_page(
|
||||
/*===============*/
|
||||
page_t* page, /* in: page */
|
||||
buf_block_t* block, /* in: pointer to a page */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
fsp_init_file_page_low(page);
|
||||
fsp_init_file_page_low(block);
|
||||
|
||||
mlog_write_initial_log_record(page, MLOG_INIT_FILE_PAGE, mtr);
|
||||
mlog_write_initial_log_record(buf_block_get_frame(block),
|
||||
MLOG_INIT_FILE_PAGE, mtr);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
|
@ -875,7 +877,7 @@ fsp_parse_init_file_page(
|
|||
ut_ad(ptr && end_ptr);
|
||||
|
||||
if (page) {
|
||||
fsp_init_file_page_low(page);
|
||||
fsp_init_file_page_low(buf_block_align(page));
|
||||
}
|
||||
|
||||
return(ptr);
|
||||
|
@ -923,21 +925,23 @@ fsp_header_init(
|
|||
mtr_t* mtr) /* in: mini-transaction handle */
|
||||
{
|
||||
fsp_header_t* header;
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
|
||||
ut_ad(mtr);
|
||||
|
||||
mtr_x_lock(fil_space_get_latch(space), mtr);
|
||||
|
||||
page = buf_page_create(space, 0, zip_size, mtr);
|
||||
block = buf_page_create(space, 0, zip_size, mtr);
|
||||
buf_page_get(space, 0, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
/* The prior contents of the file page should be ignored */
|
||||
|
||||
fsp_init_file_page(page, mtr);
|
||||
fsp_init_file_page(block, mtr);
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_FSP_HDR,
|
||||
MLOG_2BYTES, mtr);
|
||||
|
@ -1283,8 +1287,6 @@ fsp_fill_free_list(
|
|||
xdes_t* descr;
|
||||
ulint count = 0;
|
||||
ulint frag_n_used;
|
||||
page_t* descr_page;
|
||||
page_t* ibuf_page;
|
||||
ulint actual_increase;
|
||||
ulint i;
|
||||
mtr_t ibuf_mtr;
|
||||
|
@ -1342,20 +1344,23 @@ fsp_fill_free_list(
|
|||
|
||||
if (UNIV_UNLIKELY(init_xdes)) {
|
||||
|
||||
buf_block_t* block;
|
||||
|
||||
/* We are going to initialize a new descriptor page
|
||||
and a new ibuf bitmap page: the prior contents of the
|
||||
pages should be ignored. */
|
||||
|
||||
if (i > 0) {
|
||||
descr_page = buf_page_create(
|
||||
block = buf_page_create(
|
||||
space, i, zip_size, mtr);
|
||||
buf_page_get(space, i, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(descr_page,
|
||||
buf_block_dbg_add_level(block,
|
||||
SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
fsp_init_file_page(descr_page, mtr);
|
||||
mlog_write_ulint(descr_page + FIL_PAGE_TYPE,
|
||||
fsp_init_file_page(block, mtr);
|
||||
mlog_write_ulint(buf_block_get_frame(block)
|
||||
+ FIL_PAGE_TYPE,
|
||||
FIL_PAGE_TYPE_XDES,
|
||||
MLOG_2BYTES, mtr);
|
||||
}
|
||||
|
@ -1367,17 +1372,17 @@ fsp_fill_free_list(
|
|||
|
||||
mtr_start(&ibuf_mtr);
|
||||
|
||||
ibuf_page = buf_page_create(space,
|
||||
block = buf_page_create(space,
|
||||
i + FSP_IBUF_BITMAP_OFFSET,
|
||||
zip_size, &ibuf_mtr);
|
||||
buf_page_get(space, i + FSP_IBUF_BITMAP_OFFSET,
|
||||
RW_X_LATCH, &ibuf_mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(ibuf_page, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
fsp_init_file_page(ibuf_page, &ibuf_mtr);
|
||||
fsp_init_file_page(block, &ibuf_mtr);
|
||||
|
||||
ibuf_bitmap_page_init(ibuf_page, zip_size, &ibuf_mtr);
|
||||
ibuf_bitmap_page_init(block, &ibuf_mtr);
|
||||
|
||||
mtr_commit(&ibuf_mtr);
|
||||
}
|
||||
|
@ -1484,7 +1489,7 @@ fsp_alloc_free_page(
|
|||
fsp_header_t* header;
|
||||
fil_addr_t first;
|
||||
xdes_t* descr;
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
ulint free;
|
||||
ulint frag_n_used;
|
||||
ulint page_no;
|
||||
|
@ -1598,13 +1603,13 @@ fsp_alloc_free_page(
|
|||
buf_page_create(space, page_no,
|
||||
mach_read_from_4(FSP_PAGE_ZIP_SIZE + header), mtr);
|
||||
|
||||
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
/* Prior contents of the page should be ignored */
|
||||
fsp_init_file_page(page, mtr);
|
||||
fsp_init_file_page(block, mtr);
|
||||
|
||||
return(page_no);
|
||||
}
|
||||
|
@ -1821,6 +1826,7 @@ fsp_alloc_seg_inode_page(
|
|||
mtr_t* mtr) /* in: mini-transaction handle */
|
||||
{
|
||||
fseg_inode_t* inode;
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
ulint page_no;
|
||||
ulint space;
|
||||
|
@ -1836,15 +1842,17 @@ fsp_alloc_seg_inode_page(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
buf_block_align(page)->check_index_page_at_flush = FALSE;
|
||||
block->check_index_page_at_flush = FALSE;
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_INODE,
|
||||
MLOG_2BYTES, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
zip_size = mtr_read_ulint(space_header + FSP_PAGE_ZIP_SIZE,
|
||||
MLOG_4BYTES, mtr);
|
||||
|
@ -1874,6 +1882,7 @@ fsp_alloc_seg_inode(
|
|||
mtr_t* mtr) /* in: mini-transaction handle */
|
||||
{
|
||||
ulint page_no;
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
fseg_inode_t* inode;
|
||||
ibool success;
|
||||
|
@ -1894,11 +1903,12 @@ fsp_alloc_seg_inode(
|
|||
page_no = flst_get_first(space_header + FSP_SEG_INODES_FREE, mtr).page;
|
||||
|
||||
zip_size = mach_read_from_4(space_header + FSP_PAGE_ZIP_SIZE);
|
||||
page = buf_page_get(page_get_space_id(page_align(space_header)),
|
||||
block = buf_page_get(page_get_space_id(page_align(space_header)),
|
||||
page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr);
|
||||
|
||||
|
@ -2114,10 +2124,10 @@ fseg_get_n_frag_pages(
|
|||
/**************************************************************************
|
||||
Creates a new segment. */
|
||||
|
||||
page_t*
|
||||
buf_block_t*
|
||||
fseg_create_general(
|
||||
/*================*/
|
||||
/* out: the page where the segment header is placed,
|
||||
/* out: the block where the segment header is placed,
|
||||
x-latched, NULL if could not create segment
|
||||
because of lack of space */
|
||||
ulint space, /* in: space id */
|
||||
|
@ -2138,18 +2148,18 @@ fseg_create_general(
|
|||
fsp_header_t* space_header;
|
||||
fseg_inode_t* inode;
|
||||
dulint seg_id;
|
||||
buf_block_t* block = 0; /* remove warning */
|
||||
fseg_header_t* header = 0; /* remove warning */
|
||||
rw_lock_t* latch;
|
||||
ibool success;
|
||||
ulint n_reserved;
|
||||
page_t* ret = NULL;
|
||||
ulint i;
|
||||
|
||||
ut_ad(mtr);
|
||||
|
||||
if (page != 0) {
|
||||
header = byte_offset + buf_page_get(space, page, RW_X_LATCH,
|
||||
mtr);
|
||||
block = buf_page_get(space, page, RW_X_LATCH, mtr);
|
||||
header = byte_offset + buf_block_get_frame(block);
|
||||
}
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
|
@ -2218,8 +2228,8 @@ fseg_create_general(
|
|||
goto funct_exit;
|
||||
}
|
||||
|
||||
header = byte_offset
|
||||
+ buf_page_get(space, page, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(space, page, RW_X_LATCH, mtr);
|
||||
header = byte_offset + buf_block_get_frame(block);
|
||||
mlog_write_ulint(header - byte_offset + FIL_PAGE_TYPE,
|
||||
FIL_PAGE_TYPE_SYS, MLOG_2BYTES, mtr);
|
||||
}
|
||||
|
@ -2233,24 +2243,22 @@ fseg_create_general(
|
|||
|
||||
mlog_write_ulint(header + FSEG_HDR_SPACE, space, MLOG_4BYTES, mtr);
|
||||
|
||||
ret = page_align(header);
|
||||
|
||||
funct_exit:
|
||||
if (!has_done_reservation) {
|
||||
|
||||
fil_space_release_free_extents(space, n_reserved);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
return(block);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Creates a new segment. */
|
||||
|
||||
page_t*
|
||||
buf_block_t*
|
||||
fseg_create(
|
||||
/*========*/
|
||||
/* out: the page where the segment header is placed,
|
||||
/* out: the block where the segment header is placed,
|
||||
x-latched, NULL if could not create segment
|
||||
because of lack of space */
|
||||
ulint space, /* in: space id */
|
||||
|
@ -2465,7 +2473,6 @@ fseg_alloc_free_page_low(
|
|||
ulint ret_page; /* the allocated page offset, FIL_NULL
|
||||
if could not be allocated */
|
||||
xdes_t* ret_descr; /* the extent of the allocated page */
|
||||
page_t* page;
|
||||
ibool frag_page_allocated = FALSE;
|
||||
ibool success;
|
||||
ulint n;
|
||||
|
@ -2647,22 +2654,18 @@ fseg_alloc_free_page_low(
|
|||
/* Initialize the allocated page to buffer pool, so that it
|
||||
can be obtained immediately with buf_page_get without need
|
||||
for a disk read */
|
||||
buf_block_t* block;
|
||||
|
||||
page = buf_page_create(space, ret_page,
|
||||
block = buf_page_create(space, ret_page,
|
||||
mach_read_from_4(FSP_PAGE_ZIP_SIZE
|
||||
+ space_header), mtr);
|
||||
|
||||
if (UNIV_UNLIKELY
|
||||
(page != buf_page_get(space, ret_page, RW_X_LATCH, mtr))) {
|
||||
ut_error;
|
||||
}
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_a(block == buf_page_get(space, ret_page, RW_X_LATCH, mtr));
|
||||
|
||||
/* The prior contents of the page should be ignored */
|
||||
fsp_init_file_page(page, mtr);
|
||||
fsp_init_file_page(block, mtr);
|
||||
|
||||
/* At this point we know the extent and the page offset.
|
||||
The extent is still in the appropriate list (FSEG_NOT_FULL
|
||||
|
|
|
@ -274,19 +274,19 @@ ibuf_header_page_get(
|
|||
ulint space, /* in: space id */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
|
||||
ut_a(space == 0);
|
||||
|
||||
ut_ad(!ibuf_inside());
|
||||
|
||||
page = buf_page_get(space, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
|
||||
block = buf_page_get(space, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_IBUF_HEADER);
|
||||
buf_block_dbg_add_level(block, SYNC_IBUF_HEADER);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(page);
|
||||
return(buf_block_get_frame(block));
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -300,20 +300,20 @@ ibuf_tree_root_get(
|
|||
ulint space, /* in: space id */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
|
||||
ut_a(space == 0);
|
||||
ut_ad(ibuf_inside());
|
||||
|
||||
mtr_x_lock(dict_index_get_lock(data->index), mtr);
|
||||
|
||||
page = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
||||
block = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
||||
mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(page);
|
||||
return(buf_block_get_frame(block));
|
||||
}
|
||||
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
|
@ -493,11 +493,14 @@ ibuf_data_init_for_space(
|
|||
|
||||
data->seg_size = n_used;
|
||||
|
||||
root = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
||||
&mtr);
|
||||
{
|
||||
buf_block_t* block = buf_page_get(
|
||||
space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(root, SYNC_TREE_NODE);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
root = buf_block_get_frame(block);
|
||||
}
|
||||
|
||||
data->size = 0;
|
||||
data->n_inserts = 0;
|
||||
|
@ -559,15 +562,16 @@ Initializes an ibuf bitmap page. */
|
|||
void
|
||||
ibuf_bitmap_page_init(
|
||||
/*==================*/
|
||||
page_t* page, /* in: bitmap page */
|
||||
ulint zip_size,/* in: compressed page size in bytes;
|
||||
0 for uncompressed pages */
|
||||
buf_block_t* block, /* in: bitmap page */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
ulint byte_offset;
|
||||
ulint zip_size = buf_block_get_zip_size(block);
|
||||
|
||||
ut_ad(ut_is_2pow(zip_size));
|
||||
ut_a(ut_is_2pow(zip_size));
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
|
||||
|
||||
/* Write all zeros to the bitmap */
|
||||
|
@ -595,14 +599,12 @@ ibuf_parse_bitmap_init(
|
|||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr __attribute__((unused)), /* in: buffer end */
|
||||
page_t* page, /* in: page or NULL */
|
||||
ulint zip_size,/* in: compressed page size in bytes;
|
||||
0 for uncompressed pages */
|
||||
mtr_t* mtr) /* in: mtr or NULL */
|
||||
{
|
||||
ut_ad(ptr && end_ptr);
|
||||
|
||||
if (page) {
|
||||
ibuf_bitmap_page_init(page, zip_size, mtr);
|
||||
ibuf_bitmap_page_init(buf_block_align(page), mtr);
|
||||
}
|
||||
|
||||
return(ptr);
|
||||
|
@ -761,15 +763,16 @@ ibuf_bitmap_get_map_page(
|
|||
0 for uncompressed pages */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
|
||||
page = buf_page_get(space, ibuf_bitmap_page_no_calc(zip_size, page_no),
|
||||
block = buf_page_get(space,
|
||||
ibuf_bitmap_page_no_calc(zip_size, page_no),
|
||||
RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_IBUF_BITMAP);
|
||||
buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(page);
|
||||
return(buf_block_get_frame(block));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1710,11 +1713,14 @@ ibuf_add_free_page(
|
|||
return(DB_STRONG_FAIL);
|
||||
}
|
||||
|
||||
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||
|
||||
{
|
||||
buf_block_t* block = buf_page_get(
|
||||
space, page_no, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_NEW);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
page = buf_block_get_frame(block);
|
||||
}
|
||||
|
||||
ibuf_enter();
|
||||
|
||||
|
@ -1837,11 +1843,14 @@ ibuf_remove_free_page(
|
|||
+ PAGE_BTR_IBUF_FREE_LIST, &mtr)
|
||||
.page);
|
||||
|
||||
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||
|
||||
{
|
||||
buf_block_t* block = buf_page_get(
|
||||
space, page_no, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
page = buf_block_get_frame(block);
|
||||
}
|
||||
|
||||
/* Remove the page from the free list and update the ibuf size data */
|
||||
|
||||
|
@ -2396,16 +2405,19 @@ ibuf_get_volume_buffered(
|
|||
goto count_later;
|
||||
}
|
||||
|
||||
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
|
||||
{
|
||||
buf_block_t* block = buf_page_get(
|
||||
0, prev_page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
prev_page = buf_block_get_frame(block);
|
||||
}
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(btr_page_get_next(prev_page, mtr)
|
||||
== page_get_page_no(page));
|
||||
#endif /* UNIV_BTR_DEBUG */
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(prev_page, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
rec = page_get_supremum_rec(prev_page);
|
||||
rec = page_rec_get_prev(rec);
|
||||
|
||||
|
@ -2463,16 +2475,19 @@ count_later:
|
|||
return(volume);
|
||||
}
|
||||
|
||||
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
|
||||
{
|
||||
buf_block_t* block = buf_page_get(
|
||||
0, next_page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
next_page = buf_block_get_frame(block);
|
||||
}
|
||||
#ifdef UNIV_BTR_DEBUG
|
||||
ut_a(btr_page_get_prev(next_page, mtr)
|
||||
== page_get_page_no(page));
|
||||
#endif /* UNIV_BTR_DEBUG */
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(next_page, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
rec = page_get_infimum_rec(next_page);
|
||||
rec = page_rec_get_next(rec);
|
||||
|
||||
|
@ -3126,7 +3141,7 @@ ibuf_merge_or_delete_for_page(
|
|||
dtuple_t* entry;
|
||||
dtuple_t* search_tuple;
|
||||
rec_t* ibuf_rec;
|
||||
buf_block_t* block;
|
||||
buf_block_t* block = NULL;
|
||||
page_t* bitmap_page;
|
||||
ibuf_data_t* ibuf_data;
|
||||
ulint n_inserts;
|
||||
|
@ -3232,7 +3247,7 @@ ibuf_merge_or_delete_for_page(
|
|||
|
||||
block = buf_block_align(page);
|
||||
rw_lock_x_lock_move_ownership(&(block->lock));
|
||||
page_zip = buf_frame_get_page_zip(page);
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
||||
if (UNIV_UNLIKELY(fil_page_get_type(page) != FIL_PAGE_INDEX)) {
|
||||
|
||||
|
@ -3283,13 +3298,13 @@ loop:
|
|||
mtr_start(&mtr);
|
||||
|
||||
if (page) {
|
||||
ibool success = buf_page_get_known_nowait(RW_X_LATCH, page,
|
||||
ibool success = buf_page_get_known_nowait(RW_X_LATCH, block,
|
||||
BUF_KEEP_OLD,
|
||||
__FILE__, __LINE__,
|
||||
&mtr);
|
||||
ut_a(success);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,16 @@ btr_root_get(
|
|||
/******************************************************************
|
||||
Gets a buffer page and declares its latching order level. */
|
||||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
btr_block_get(
|
||||
/*==========*/
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no, /* in: page number */
|
||||
ulint mode, /* in: latch mode */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
/******************************************************************
|
||||
Gets a buffer page and declares its latching order level. */
|
||||
UNIV_INLINE
|
||||
page_t*
|
||||
btr_page_get(
|
||||
/*=========*/
|
||||
|
@ -362,10 +372,10 @@ btr_get_size(
|
|||
Allocates a new file page to be used in an index tree. NOTE: we assume
|
||||
that the caller has made the reservation for free extents! */
|
||||
|
||||
page_t*
|
||||
buf_block_t*
|
||||
btr_page_alloc(
|
||||
/*===========*/
|
||||
/* out: new allocated page, x-latched;
|
||||
/* out: new allocated block, x-latched;
|
||||
NULL if out of space */
|
||||
dict_index_t* index, /* in: index tree */
|
||||
ulint hint_page_no, /* in: hint of a good page */
|
||||
|
|
|
@ -13,6 +13,29 @@ Created 6/2/1994 Heikki Tuuri
|
|||
|
||||
#define BTR_MAX_NODE_LEVEL 50 /* used in debug checking */
|
||||
|
||||
/******************************************************************
|
||||
Gets a buffer page and declares its latching order level. */
|
||||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
btr_block_get(
|
||||
/*==========*/
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no, /* in: page number */
|
||||
ulint mode, /* in: latch mode */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
|
||||
block = buf_page_get(space, page_no, mode, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
if (mode != RW_NO_LATCH) {
|
||||
|
||||
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
|
||||
}
|
||||
#endif
|
||||
return(block);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Gets a buffer page and declares its latching order level. */
|
||||
UNIV_INLINE
|
||||
|
@ -24,16 +47,7 @@ btr_page_get(
|
|||
ulint mode, /* in: latch mode */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
|
||||
page = buf_page_get(space, page_no, mode, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
if (mode != RW_NO_LATCH) {
|
||||
|
||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||
}
|
||||
#endif
|
||||
return(page);
|
||||
return(buf_block_get_frame(btr_block_get(space, page_no, mode, mtr)));
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -87,7 +87,10 @@ Drops a page hash index. */
|
|||
void
|
||||
btr_search_drop_page_hash_index(
|
||||
/*============================*/
|
||||
page_t* page); /* in: index page, s- or x-latched */
|
||||
buf_block_t* block); /* in: block containing index page,
|
||||
s- or x-latched, or an index page
|
||||
for which we know that
|
||||
block->buf_fix_count == 0 */
|
||||
/************************************************************************
|
||||
Drops a page hash index when a page is freed from a fseg to the file system.
|
||||
Drops possible hash index if the page happens to be in the buffer pool. */
|
||||
|
|
|
@ -200,10 +200,10 @@ in mtr down to the given savepoint. If io is required, this function
|
|||
retrieves the page to buffer buf_pool, but does not bufferfix it or latch
|
||||
it. */
|
||||
UNIV_INLINE
|
||||
buf_frame_t*
|
||||
buf_block_t*
|
||||
buf_page_get_release_on_io(
|
||||
/*=======================*/
|
||||
/* out: pointer to the frame, or NULL
|
||||
/* out: pointer to the block, or NULL
|
||||
if not in buffer buf_pool */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset, /* in: offset of the page within space
|
||||
|
@ -222,7 +222,7 @@ buf_page_get_known_nowait(
|
|||
/*======================*/
|
||||
/* out: TRUE if success */
|
||||
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
|
||||
buf_frame_t* guess, /* in: the known page frame */
|
||||
buf_block_t* block, /* in: the known page */
|
||||
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
|
||||
const char* file, /* in: file name */
|
||||
ulint line, /* in: line where called */
|
||||
|
@ -230,10 +230,10 @@ buf_page_get_known_nowait(
|
|||
/************************************************************************
|
||||
This is the general function used to get access to a database page. */
|
||||
|
||||
buf_frame_t*
|
||||
buf_block_t*
|
||||
buf_page_get_gen(
|
||||
/*=============*/
|
||||
/* out: pointer to the frame or NULL */
|
||||
/* out: pointer to the block or NULL */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset, /* in: page number */
|
||||
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
|
||||
|
@ -249,10 +249,10 @@ from a file even if it cannot be found in the buffer buf_pool. This is one
|
|||
of the functions which perform to a block a state transition NOT_USED =>
|
||||
FILE_PAGE (the other is buf_page_init_for_read above). */
|
||||
|
||||
buf_frame_t*
|
||||
buf_block_t*
|
||||
buf_page_create(
|
||||
/*============*/
|
||||
/* out: pointer to the frame, page bufferfixed */
|
||||
/* out: pointer to the block, page bufferfixed */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset, /* in: offset of the page within space in units of
|
||||
a page */
|
||||
|
@ -379,10 +379,10 @@ Gets the youngest modification log sequence number for a frame.
|
|||
Returns zero if not file page or no modification occurred yet. */
|
||||
UNIV_INLINE
|
||||
dulint
|
||||
buf_frame_get_newest_modification(
|
||||
buf_block_get_newest_modification(
|
||||
/*==============================*/
|
||||
/* out: newest modification to page */
|
||||
buf_frame_t* frame); /* in: pointer to a 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
|
||||
pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
|
||||
|
@ -584,10 +584,10 @@ should be called in the debug version after a successful latching of a
|
|||
page if we know the latching order level of the acquired latch. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
buf_page_dbg_add_level(
|
||||
/*===================*/
|
||||
buf_frame_t* frame, /* in: buffer page where we have acquired
|
||||
a latch */
|
||||
buf_block_dbg_add_level(
|
||||
/*====================*/
|
||||
buf_block_t* block, /* in: buffer page
|
||||
where we have acquired latch */
|
||||
ulint level); /* in: latching order level */
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
/*************************************************************************
|
||||
|
@ -615,14 +615,23 @@ buf_block_get_page_no(
|
|||
/* out: page number */
|
||||
buf_block_t* block); /* in: pointer to the control block */
|
||||
/*************************************************************************
|
||||
Gets the compressed page size of a block. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_block_get_zip_size(
|
||||
/*===================*/
|
||||
/* out: compressed page size, or 0 */
|
||||
const buf_block_t* block) /* in: pointer to the control block */
|
||||
__attribute((const));
|
||||
/*************************************************************************
|
||||
Gets the compressed page descriptor corresponding to an uncompressed page
|
||||
if applicable. */
|
||||
UNIV_INLINE
|
||||
page_zip_des_t*
|
||||
buf_frame_get_page_zip(
|
||||
buf_block_get_page_zip(
|
||||
/*===================*/
|
||||
/* out: compressed page descriptor, or NULL */
|
||||
byte* ptr) /* in: pointer to buffer frame */
|
||||
buf_block_t* block) /* in: pointer to the control block */
|
||||
__attribute((const));
|
||||
/***********************************************************************
|
||||
Gets the block to whose frame the pointer is pointing to. */
|
||||
|
@ -632,6 +641,16 @@ buf_block_align(
|
|||
/*============*/
|
||||
/* out: pointer to block */
|
||||
byte* ptr); /* in: pointer to a frame */
|
||||
/*************************************************************************
|
||||
Gets the compressed page descriptor corresponding to an uncompressed page
|
||||
if applicable. */
|
||||
UNIV_INLINE
|
||||
page_zip_des_t*
|
||||
buf_frame_get_page_zip(
|
||||
/*===================*/
|
||||
/* out: compressed page descriptor, or NULL */
|
||||
byte* ptr) /* in: pointer to the page */
|
||||
__attribute((const));
|
||||
/************************************************************************
|
||||
This function is used to get info if there is an io operation
|
||||
going on on a buffer page. */
|
||||
|
|
|
@ -192,18 +192,28 @@ buf_block_get_page_no(
|
|||
return(block->offset);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the compressed page size of a block. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_block_get_zip_size(
|
||||
/*===================*/
|
||||
/* out: compressed page size, or 0 */
|
||||
const buf_block_t* block) /* in: pointer to the control block */
|
||||
{
|
||||
return(block->page_zip.size);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the compressed page descriptor corresponding to an uncompressed page
|
||||
if applicable. */
|
||||
UNIV_INLINE
|
||||
page_zip_des_t*
|
||||
buf_frame_get_page_zip(
|
||||
buf_block_get_page_zip(
|
||||
/*===================*/
|
||||
/* out: compressed page descriptor, or NULL */
|
||||
byte* ptr) /* in: pointer to buffer frame */
|
||||
buf_block_t* block) /* in: pointer to the control block */
|
||||
{
|
||||
buf_block_t* block = buf_block_align(ptr);
|
||||
|
||||
if (UNIV_LIKELY_NULL(block->page_zip.data)) {
|
||||
return(&block->page_zip);
|
||||
}
|
||||
|
@ -251,6 +261,19 @@ buf_block_align(
|
|||
return(block);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the compressed page descriptor corresponding to an uncompressed page
|
||||
if applicable. */
|
||||
UNIV_INLINE
|
||||
page_zip_des_t*
|
||||
buf_frame_get_page_zip(
|
||||
/*===================*/
|
||||
/* out: compressed page descriptor, or NULL */
|
||||
byte* ptr) /* in: pointer to the page */
|
||||
{
|
||||
return(buf_block_get_page_zip(buf_block_align(ptr)));
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Gets the space id, page offset, and byte offset within page of a
|
||||
pointer pointing to a buffer frame containing a file page. */
|
||||
|
@ -425,18 +448,13 @@ Gets the youngest modification log sequence number for a frame. Returns zero
|
|||
if not a file page or no modification occurred yet. */
|
||||
UNIV_INLINE
|
||||
dulint
|
||||
buf_frame_get_newest_modification(
|
||||
buf_block_get_newest_modification(
|
||||
/*==============================*/
|
||||
/* out: newest modification to the page */
|
||||
buf_frame_t* frame) /* in: pointer to a frame */
|
||||
buf_block_t* block) /* in: block containing the page frame */
|
||||
{
|
||||
buf_block_t* block;
|
||||
dulint lsn;
|
||||
|
||||
ut_ad(frame);
|
||||
|
||||
block = buf_block_align(frame);
|
||||
|
||||
mutex_enter(&(buf_pool->mutex));
|
||||
|
||||
if (block->state == BUF_BLOCK_FILE_PAGE) {
|
||||
|
@ -581,10 +599,10 @@ in mtr down to the given savepoint. If io is required, this function
|
|||
retrieves the page to buffer buf_pool, but does not bufferfix it or latch
|
||||
it. */
|
||||
UNIV_INLINE
|
||||
buf_frame_t*
|
||||
buf_block_t*
|
||||
buf_page_get_release_on_io(
|
||||
/*=======================*/
|
||||
/* out: pointer to the frame, or NULL
|
||||
/* out: pointer to the block, or NULL
|
||||
if not in buffer buf_pool */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset, /* in: offset of the page within space
|
||||
|
@ -595,15 +613,15 @@ buf_page_get_release_on_io(
|
|||
ulint savepoint, /* in: mtr savepoint */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_frame_t* frame;
|
||||
buf_block_t* block;
|
||||
|
||||
frame = buf_page_get_gen(space, offset, rw_latch, guess,
|
||||
block = buf_page_get_gen(space, offset, rw_latch, guess,
|
||||
BUF_GET_IF_IN_POOL,
|
||||
__FILE__, __LINE__,
|
||||
mtr);
|
||||
if (frame != NULL) {
|
||||
if (block != NULL) {
|
||||
|
||||
return(frame);
|
||||
return(block);
|
||||
}
|
||||
|
||||
/* The page was not in the buffer buf_pool: release the latches
|
||||
|
@ -663,17 +681,15 @@ buf_page_release(
|
|||
/*************************************************************************
|
||||
Adds latch level info for the rw-lock protecting the buffer frame. This
|
||||
should be called in the debug version after a successful latching of a
|
||||
page if we know the latching order level of the acquired latch. If
|
||||
UNIV_SYNC_DEBUG is not defined, compiles to an empty function. */
|
||||
page if we know the latching order level of the acquired latch. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
buf_page_dbg_add_level(
|
||||
/*===================*/
|
||||
buf_frame_t* frame __attribute__((unused)), /* in: buffer page
|
||||
buf_block_dbg_add_level(
|
||||
/*====================*/
|
||||
buf_block_t* block, /* in: buffer page
|
||||
where we have acquired latch */
|
||||
ulint level __attribute__((unused))) /* in: latching order
|
||||
level */
|
||||
ulint level) /* in: latching order level */
|
||||
{
|
||||
sync_thread_add_level(&(buf_block_align(frame)->lock), level);
|
||||
sync_thread_add_level(&block->lock, level);
|
||||
}
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
|
|
@ -125,10 +125,10 @@ fsp_header_inc_size(
|
|||
/**************************************************************************
|
||||
Creates a new segment. */
|
||||
|
||||
page_t*
|
||||
buf_block_t*
|
||||
fseg_create(
|
||||
/*========*/
|
||||
/* out: the page where the segment header is placed,
|
||||
/* out: the block where the segment header is placed,
|
||||
x-latched, NULL if could not create segment
|
||||
because of lack of space */
|
||||
ulint space, /* in: space id */
|
||||
|
@ -142,10 +142,10 @@ fseg_create(
|
|||
/**************************************************************************
|
||||
Creates a new segment. */
|
||||
|
||||
page_t*
|
||||
buf_block_t*
|
||||
fseg_create_general(
|
||||
/*================*/
|
||||
/* out: the page where the segment header is placed,
|
||||
/* out: the block where the segment header is placed,
|
||||
x-latched, NULL if could not create segment
|
||||
because of lack of space */
|
||||
ulint space, /* in: space id */
|
||||
|
|
|
@ -22,16 +22,17 @@ fut_get_ptr(
|
|||
ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH */
|
||||
mtr_t* mtr) /* in: mtr handle */
|
||||
{
|
||||
buf_block_t* block;
|
||||
byte* ptr;
|
||||
|
||||
ut_ad(mtr);
|
||||
ut_ad(addr.boffset < UNIV_PAGE_SIZE);
|
||||
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
|
||||
|
||||
ptr = buf_page_get(space, addr.page, rw_latch, mtr) + addr.boffset;
|
||||
block = buf_page_get(space, addr.page, rw_latch, mtr);
|
||||
ptr = buf_block_get_frame(block) + addr.boffset;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(ptr, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(ptr);
|
||||
|
|
|
@ -52,9 +52,7 @@ Initializes an ibuf bitmap page. */
|
|||
void
|
||||
ibuf_bitmap_page_init(
|
||||
/*==================*/
|
||||
page_t* page, /* in: bitmap page */
|
||||
ulint zip_size,/* in: compressed page size in bytes;
|
||||
0 for uncompressed pages */
|
||||
buf_block_t* block, /* in: bitmap page */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
/****************************************************************************
|
||||
Resets the free bits of the page in the ibuf bitmap. This is done in a
|
||||
|
@ -270,8 +268,6 @@ ibuf_parse_bitmap_init(
|
|||
byte* ptr, /* in: buffer */
|
||||
byte* end_ptr,/* in: buffer end */
|
||||
page_t* page, /* in: page or NULL */
|
||||
ulint zip_size,/* in: compressed page size in bytes;
|
||||
0 for uncompressed pages */
|
||||
mtr_t* mtr); /* in: mtr or NULL */
|
||||
#ifdef UNIV_IBUF_DEBUG
|
||||
/**********************************************************************
|
||||
|
|
|
@ -11,7 +11,7 @@ Created 9/20/1997 Heikki Tuuri
|
|||
|
||||
#include "univ.i"
|
||||
#include "ut0byte.h"
|
||||
#include "page0types.h"
|
||||
#include "buf0types.h"
|
||||
#include "hash0hash.h"
|
||||
#include "log0log.h"
|
||||
|
||||
|
@ -72,15 +72,15 @@ read in, or also for a page already in the buffer pool. */
|
|||
void
|
||||
recv_recover_page(
|
||||
/*==============*/
|
||||
ibool recover_backup, /* in: TRUE if we are recovering a backup
|
||||
ibool recover_backup,
|
||||
/* in: TRUE if we are recovering a backup
|
||||
page: then we do not acquire any latches
|
||||
since the page was read in outside the
|
||||
buffer pool */
|
||||
ibool just_read_in, /* in: TRUE if the i/o-handler calls this for
|
||||
ibool just_read_in,
|
||||
/* in: TRUE if the i/o-handler calls this for
|
||||
a freshly read page */
|
||||
page_t* page, /* in: buffer page */
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no); /* in: page number */
|
||||
buf_block_t* block); /* in: buffer block */
|
||||
/************************************************************
|
||||
Recovers from a checkpoint. When this function returns, the database is able
|
||||
to start processing of new user transactions, but the function
|
||||
|
|
|
@ -20,13 +20,14 @@ trx_rsegf_get(
|
|||
ulint page_no, /* in: page number of the header */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
trx_rsegf_t* header;
|
||||
|
||||
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
|
||||
block = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER);
|
||||
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
header = TRX_RSEG + buf_block_get_frame(block);
|
||||
|
||||
return(header);
|
||||
}
|
||||
|
@ -43,13 +44,14 @@ trx_rsegf_get_new(
|
|||
ulint page_no, /* in: page number of the header */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
trx_rsegf_t* header;
|
||||
|
||||
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
|
||||
block = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER_NEW);
|
||||
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
header = TRX_RSEG + buf_block_get_frame(block);
|
||||
|
||||
return(header);
|
||||
}
|
||||
|
|
|
@ -95,16 +95,16 @@ trx_sysf_get(
|
|||
/* out: pointer to system header, page x-latched. */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
buf_block_t* block;
|
||||
trx_sysf_t* header;
|
||||
|
||||
ut_ad(mtr);
|
||||
|
||||
header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
|
||||
RW_X_LATCH, mtr);
|
||||
|
||||
block = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(header, SYNC_TRX_SYS_HEADER);
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
header = TRX_SYS + buf_block_get_frame(block);
|
||||
|
||||
return(header);
|
||||
}
|
||||
|
|
|
@ -131,15 +131,12 @@ trx_undo_page_get(
|
|||
ulint page_no, /* in: page number */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
|
||||
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
|
||||
buf_block_t* block = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(page);
|
||||
return(buf_block_get_frame(block));
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -153,15 +150,12 @@ trx_undo_page_get_s_latched(
|
|||
ulint page_no, /* in: page number */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
page_t* page;
|
||||
|
||||
page = buf_page_get(space, page_no, RW_S_LATCH, mtr);
|
||||
|
||||
buf_block_t* block = buf_page_get(space, page_no, RW_S_LATCH, mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
return(page);
|
||||
return(buf_block_get_frame(block));
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
|
@ -4215,7 +4215,7 @@ lock_rec_print(
|
|||
FILE* file, /* in: file where to print */
|
||||
lock_t* lock) /* in: record type lock */
|
||||
{
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
ulint space;
|
||||
ulint page_no;
|
||||
ulint i;
|
||||
|
@ -4273,25 +4273,25 @@ lock_rec_print(
|
|||
because we have the kernel mutex and ibuf operations would
|
||||
break the latching order */
|
||||
|
||||
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
|
||||
block = buf_page_get_gen(space, page_no, RW_NO_LATCH,
|
||||
NULL, BUF_GET_IF_IN_POOL,
|
||||
__FILE__, __LINE__, &mtr);
|
||||
if (page) {
|
||||
page = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr);
|
||||
if (block) {
|
||||
block = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr);
|
||||
|
||||
if (!page) {
|
||||
if (!block) {
|
||||
/* Let us try to get an X-latch. If the current thread
|
||||
is holding an X-latch on the page, we cannot get an
|
||||
S-latch. */
|
||||
|
||||
page = buf_page_get_nowait(space, page_no, RW_X_LATCH,
|
||||
block = buf_page_get_nowait(space, page_no, RW_X_LATCH,
|
||||
&mtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (page) {
|
||||
if (block) {
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
}
|
||||
|
||||
|
@ -4301,9 +4301,10 @@ lock_rec_print(
|
|||
|
||||
fprintf(file, "Record lock, heap no %lu ", (ulong) i);
|
||||
|
||||
if (page) {
|
||||
if (block) {
|
||||
rec_t* rec
|
||||
= page_find_rec_with_heap_no(page, i);
|
||||
= page_find_rec_with_heap_no(
|
||||
buf_block_get_frame(block), i);
|
||||
offsets = rec_get_offsets(
|
||||
rec, lock->index, offsets,
|
||||
ULINT_UNDEFINED, &heap);
|
||||
|
@ -4408,7 +4409,6 @@ lock_print_info_all_transactions(
|
|||
lock_t* lock;
|
||||
ulint space;
|
||||
ulint page_no;
|
||||
page_t* page;
|
||||
ibool load_page_first = TRUE;
|
||||
ulint nth_trx = 0;
|
||||
ulint nth_lock = 0;
|
||||
|
@ -4528,8 +4528,7 @@ loop:
|
|||
|
||||
mtr_start(&mtr);
|
||||
|
||||
page = buf_page_get_with_no_latch(
|
||||
space, page_no, &mtr);
|
||||
buf_page_get_with_no_latch(space, page_no, &mtr);
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
|
@ -4745,6 +4744,7 @@ lock_rec_validate_page(
|
|||
ulint page_no)/* in: page number */
|
||||
{
|
||||
dict_index_t* index;
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
lock_t* lock;
|
||||
rec_t* rec;
|
||||
|
@ -4763,10 +4763,11 @@ lock_rec_validate_page(
|
|||
|
||||
mtr_start(&mtr);
|
||||
|
||||
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||
block = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
lock_mutex_enter_kernel();
|
||||
loop:
|
||||
|
|
|
@ -918,9 +918,7 @@ recv_parse_or_apply_log_rec_body(
|
|||
}
|
||||
break;
|
||||
case MLOG_IBUF_BITMAP_INIT:
|
||||
ptr = ibuf_parse_bitmap_init(ptr, end_ptr, page,
|
||||
page_zip ? page_zip->size : 0,
|
||||
mtr);
|
||||
ptr = ibuf_parse_bitmap_init(ptr, end_ptr, page, mtr);
|
||||
break;
|
||||
case MLOG_INIT_FILE_PAGE:
|
||||
ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
|
||||
|
@ -1146,18 +1144,18 @@ read in, or also for a page already in the buffer pool. */
|
|||
void
|
||||
recv_recover_page(
|
||||
/*==============*/
|
||||
ibool recover_backup, /* in: TRUE if we are recovering a backup
|
||||
ibool recover_backup,
|
||||
/* in: TRUE if we are recovering a backup
|
||||
page: then we do not acquire any latches
|
||||
since the page was read in outside the
|
||||
buffer pool */
|
||||
ibool just_read_in, /* in: TRUE if the i/o-handler calls this for
|
||||
ibool just_read_in,
|
||||
/* in: TRUE if the i/o-handler calls this for
|
||||
a freshly read page */
|
||||
page_t* page, /* in: buffer page */
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no) /* in: page number */
|
||||
buf_block_t* block) /* in: buffer block */
|
||||
{
|
||||
buf_block_t* block = NULL;
|
||||
page_zip_des_t* page_zip = NULL;
|
||||
page_t* page;
|
||||
page_zip_des_t* page_zip;
|
||||
recv_addr_t* recv_addr;
|
||||
recv_t* recv;
|
||||
byte* buf;
|
||||
|
@ -1180,7 +1178,7 @@ recv_recover_page(
|
|||
return;
|
||||
}
|
||||
|
||||
recv_addr = recv_get_fil_addr_struct(space, page_no);
|
||||
recv_addr = recv_get_fil_addr_struct(block->space, block->offset);
|
||||
|
||||
if ((recv_addr == NULL)
|
||||
|| (recv_addr->state == RECV_BEING_PROCESSED)
|
||||
|
@ -1192,7 +1190,8 @@ recv_recover_page(
|
|||
}
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "Recovering space %lu, page %lu\n", space, page_no);
|
||||
fprintf(stderr, "Recovering space %lu, page %lu\n",
|
||||
block->space, block->offset);
|
||||
#endif
|
||||
|
||||
recv_addr->state = RECV_BEING_PROCESSED;
|
||||
|
@ -1202,10 +1201,10 @@ recv_recover_page(
|
|||
mtr_start(&mtr);
|
||||
mtr_set_log_mode(&mtr, MTR_LOG_NONE);
|
||||
|
||||
if (!recover_backup) {
|
||||
block = buf_block_align(page);
|
||||
page_zip = buf_frame_get_page_zip(page);
|
||||
page = block->frame;
|
||||
page_zip = buf_block_get_page_zip(block);
|
||||
|
||||
if (!recover_backup) {
|
||||
if (just_read_in) {
|
||||
/* Move the ownership of the x-latch on the
|
||||
page to this OS thread, so that we can acquire
|
||||
|
@ -1216,14 +1215,14 @@ recv_recover_page(
|
|||
rw_lock_x_lock_move_ownership(&(block->lock));
|
||||
}
|
||||
|
||||
success = buf_page_get_known_nowait(RW_X_LATCH, page,
|
||||
success = buf_page_get_known_nowait(RW_X_LATCH, block,
|
||||
BUF_KEEP_OLD,
|
||||
__FILE__, __LINE__,
|
||||
&mtr);
|
||||
ut_a(success);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
}
|
||||
|
||||
|
@ -1234,7 +1233,7 @@ recv_recover_page(
|
|||
/* It may be that the page has been modified in the buffer
|
||||
pool: read the newest modification lsn there */
|
||||
|
||||
page_newest_lsn = buf_frame_get_newest_modification(page);
|
||||
page_newest_lsn = buf_block_get_newest_modification(block);
|
||||
|
||||
if (!ut_dulint_is_zero(page_newest_lsn)) {
|
||||
|
||||
|
@ -1406,7 +1405,6 @@ recv_apply_hashed_log_recs(
|
|||
mutex */
|
||||
{
|
||||
recv_addr_t* recv_addr;
|
||||
page_t* page;
|
||||
ulint i;
|
||||
ulint space;
|
||||
ulint page_no;
|
||||
|
@ -1457,18 +1455,17 @@ loop:
|
|||
mutex_exit(&(recv_sys->mutex));
|
||||
|
||||
if (buf_page_peek(space, page_no)) {
|
||||
buf_block_t* block;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
page = buf_page_get(space, page_no,
|
||||
block = buf_page_get(space, page_no,
|
||||
RW_X_LATCH, &mtr);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(
|
||||
page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(
|
||||
block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
recv_recover_page(FALSE, FALSE, page,
|
||||
space, page_no);
|
||||
recv_recover_page(FALSE, FALSE, block);
|
||||
mtr_commit(&mtr);
|
||||
} else {
|
||||
recv_read_in_area(space, page_no);
|
||||
|
|
|
@ -3510,6 +3510,7 @@ page_zip_reorganize(
|
|||
dict_index_t* index, /* in: index of the B-tree node */
|
||||
mtr_t* mtr) /* in: mini-transaction */
|
||||
{
|
||||
buf_block_t* block;
|
||||
page_t* temp_page;
|
||||
ulint log_mode;
|
||||
|
||||
|
@ -3529,7 +3530,8 @@ page_zip_reorganize(
|
|||
segment headers, next page-field, etc.) is preserved intact */
|
||||
|
||||
page_create(page, mtr, dict_table_is_comp(index->table));
|
||||
buf_block_align(page)->check_index_page_at_flush = TRUE;
|
||||
block = buf_block_align(page);
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
|
||||
/* Copy the records from the temporary space to the recreated page;
|
||||
do not copy the lock bits yet */
|
||||
|
@ -3552,7 +3554,7 @@ page_zip_reorganize(
|
|||
}
|
||||
|
||||
lock_move_reorganize_page(page, temp_page);
|
||||
btr_search_drop_page_hash_index(page);
|
||||
btr_search_drop_page_hash_index(block);
|
||||
|
||||
buf_frame_free(temp_page);
|
||||
return(TRUE);
|
||||
|
|
|
@ -404,6 +404,7 @@ skip_secondaries:
|
|||
ufield = upd_get_nth_field(node->update, i);
|
||||
|
||||
if (UNIV_UNLIKELY(ufield->extern_storage)) {
|
||||
buf_block_t* block;
|
||||
ulint internal_offset;
|
||||
byte* data_field;
|
||||
|
||||
|
@ -444,13 +445,13 @@ skip_secondaries:
|
|||
/* We assume in purge of externally stored fields
|
||||
that the space id of the undo log record is 0! */
|
||||
|
||||
data_field = buf_page_get(0, page_no, RW_X_LATCH, &mtr)
|
||||
block = buf_page_get(0, page_no, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
data_field = buf_block_get_frame(block)
|
||||
+ offset + internal_offset;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page_align(data_field),
|
||||
SYNC_TRX_UNDO_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_a(ufield->new_val.len >= BTR_EXTERN_FIELD_REF_SIZE);
|
||||
btr_free_externally_stored_field(
|
||||
index, data_field + ufield->new_val.len
|
||||
|
|
|
@ -1093,15 +1093,16 @@ trx_undo_report_row_operation(
|
|||
mtr_start(&mtr);
|
||||
|
||||
for (;;) {
|
||||
undo_page = buf_page_get_gen(undo->space, page_no,
|
||||
RW_X_LATCH, undo->guess_page,
|
||||
buf_block_t* block = buf_page_get_gen(undo->space, page_no,
|
||||
RW_X_LATCH,
|
||||
undo->guess_page,
|
||||
BUF_GET,
|
||||
__FILE__, __LINE__,
|
||||
&mtr);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
undo_page = buf_block_get_frame(block);
|
||||
|
||||
if (op_type == TRX_UNDO_INSERT_OP) {
|
||||
offset = trx_undo_page_report_insert(
|
||||
|
|
|
@ -57,7 +57,7 @@ trx_rseg_header_create(
|
|||
trx_rsegf_t* rsegf;
|
||||
trx_sysf_t* sys_header;
|
||||
ulint i;
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
|
||||
ut_ad(mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
|
@ -75,19 +75,19 @@ trx_rseg_header_create(
|
|||
}
|
||||
|
||||
/* Allocate a new file segment for the rollback segment */
|
||||
page = fseg_create(space, 0, TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr);
|
||||
block = fseg_create(space, 0, TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr);
|
||||
|
||||
if (page == NULL) {
|
||||
if (block == NULL) {
|
||||
/* No space left */
|
||||
|
||||
return(FIL_NULL);
|
||||
}
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_RSEG_HEADER_NEW);
|
||||
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
page_no = page_get_page_no(page);
|
||||
page_no = buf_block_get_page_no(block);
|
||||
|
||||
/* Get the rollback segment file page */
|
||||
rsegf = trx_rsegf_get_new(space, page_no, mtr);
|
||||
|
|
|
@ -126,7 +126,7 @@ void
|
|||
trx_sys_mark_upgraded_to_multiple_tablespaces(void)
|
||||
/*===============================================*/
|
||||
{
|
||||
page_t* page;
|
||||
buf_block_t* block;
|
||||
byte* doublewrite;
|
||||
mtr_t mtr;
|
||||
|
||||
|
@ -136,12 +136,12 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void)
|
|||
|
||||
mtr_start(&mtr);
|
||||
|
||||
page = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
|
||||
block = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
doublewrite = page + TRX_SYS_DOUBLEWRITE;
|
||||
doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
|
||||
|
||||
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
|
||||
TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
|
||||
|
@ -162,9 +162,9 @@ void
|
|||
trx_sys_create_doublewrite_buf(void)
|
||||
/*================================*/
|
||||
{
|
||||
page_t* page;
|
||||
page_t* page2;
|
||||
page_t* new_page;
|
||||
buf_block_t* block;
|
||||
buf_block_t* block2;
|
||||
buf_block_t* new_block;
|
||||
byte* doublewrite;
|
||||
byte* fseg_header;
|
||||
ulint page_no;
|
||||
|
@ -181,12 +181,12 @@ trx_sys_create_doublewrite_buf(void)
|
|||
start_again:
|
||||
mtr_start(&mtr);
|
||||
|
||||
page = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
|
||||
block = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
doublewrite = page + TRX_SYS_DOUBLEWRITE;
|
||||
doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
|
||||
|
||||
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
|
||||
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
|
||||
|
@ -214,7 +214,7 @@ start_again:
|
|||
exit(1);
|
||||
}
|
||||
|
||||
page2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
|
||||
block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
|
||||
TRX_SYS_DOUBLEWRITE
|
||||
+ TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
|
||||
|
||||
|
@ -222,10 +222,10 @@ start_again:
|
|||
therefore we must declare it: */
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page2, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
if (page2 == NULL) {
|
||||
if (block2 == NULL) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Cannot create doublewrite buffer:"
|
||||
" you must\n"
|
||||
|
@ -238,8 +238,8 @@ start_again:
|
|||
exit(1);
|
||||
}
|
||||
|
||||
fseg_header = page + TRX_SYS_DOUBLEWRITE
|
||||
+ TRX_SYS_DOUBLEWRITE_FSEG;
|
||||
fseg_header = buf_block_get_frame(block)
|
||||
+ TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG;
|
||||
prev_page_no = 0;
|
||||
|
||||
for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
|
||||
|
@ -268,16 +268,18 @@ start_again:
|
|||
the page position in the tablespace, then the page
|
||||
has not been written to in doublewrite. */
|
||||
|
||||
new_page = buf_page_get(TRX_SYS_SPACE, page_no,
|
||||
new_block = buf_page_get(TRX_SYS_SPACE, page_no,
|
||||
RW_X_LATCH, &mtr);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(new_page, SYNC_NO_ORDER_CHECK);
|
||||
buf_block_dbg_add_level(new_block,
|
||||
SYNC_NO_ORDER_CHECK);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
/* Make a dummy change to the page to ensure it will
|
||||
be written to disk in a flush */
|
||||
|
||||
mlog_write_ulint(new_page + FIL_PAGE_DATA,
|
||||
mlog_write_ulint(buf_block_get_frame(new_block)
|
||||
+ FIL_PAGE_DATA,
|
||||
TRX_SYS_DOUBLEWRITE_MAGIC_N,
|
||||
MLOG_4BYTES, &mtr);
|
||||
|
||||
|
@ -835,6 +837,7 @@ trx_sysf_create(
|
|||
{
|
||||
trx_sysf_t* sys_header;
|
||||
ulint slot_no;
|
||||
buf_block_t* block;
|
||||
page_t* page;
|
||||
ulint page_no;
|
||||
ulint i;
|
||||
|
@ -849,13 +852,14 @@ trx_sysf_create(
|
|||
mutex_enter(&kernel_mutex);
|
||||
|
||||
/* Create the trx sys file block in a new allocated file segment */
|
||||
page = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
|
||||
block = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
|
||||
mtr);
|
||||
ut_a(page_get_page_no(page) == TRX_SYS_PAGE_NO);
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(page, SYNC_TRX_SYS_HEADER);
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
ut_a(buf_block_get_page_no(block) == TRX_SYS_PAGE_NO);
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_TRX_SYS,
|
||||
MLOG_2BYTES, mtr);
|
||||
|
|
|
@ -388,6 +388,7 @@ trx_undo_seg_create(
|
|||
{
|
||||
ulint slot_no;
|
||||
ulint space;
|
||||
buf_block_t* block;
|
||||
page_t* undo_page;
|
||||
trx_upagef_t* page_hdr;
|
||||
trx_usegf_t* seg_hdr;
|
||||
|
@ -425,21 +426,22 @@ trx_undo_seg_create(
|
|||
}
|
||||
|
||||
/* Allocate a new file segment for the undo log */
|
||||
undo_page = fseg_create_general(space, 0,
|
||||
block = fseg_create_general(space, 0,
|
||||
TRX_UNDO_SEG_HDR
|
||||
+ TRX_UNDO_FSEG_HEADER, TRUE, mtr);
|
||||
|
||||
fil_space_release_free_extents(space, n_reserved);
|
||||
|
||||
if (undo_page == NULL) {
|
||||
if (block == NULL) {
|
||||
/* No space left */
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE);
|
||||
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
undo_page = buf_block_get_frame(block);
|
||||
|
||||
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
|
||||
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
|
||||
|
|
Loading…
Add table
Reference in a new issue