Commit f116afa7 authored by marko's avatar marko

branches/zip: Remove the fil_space_get_zip_size() call from

buf_page_get_gen().  This saves one mutex operation per block request.

buf_page_get_gen(), various macros and functions: Add parameter zip_size.

btr_node_ptr_get_child(): Add parameter index.

fil_space_get_latch(): Add optional output parameter zip_size.

fil_space_get_zip_size(): Return 0 for space id==0, because the
system tablespace is never compressed.

fsp_header_init(): Remove the parameter zip_size.

ibuf_free_excess_pages(): Remove the parameter zip_size.

trx_rseg_t, trx_undo_t: Add field zip_size.

xdes_lst_get_next(): Remove, unused.
parent fd687bbe
This diff is collapsed.
This diff is collapsed.
...@@ -376,6 +376,7 @@ btr_pcur_move_to_next_page( ...@@ -376,6 +376,7 @@ btr_pcur_move_to_next_page(
{ {
ulint next_page_no; ulint next_page_no;
ulint space; ulint space;
ulint zip_size;
page_t* page; page_t* page;
buf_block_t* next_block; buf_block_t* next_block;
page_t* next_page; page_t* next_page;
...@@ -389,10 +390,11 @@ btr_pcur_move_to_next_page( ...@@ -389,10 +390,11 @@ btr_pcur_move_to_next_page(
page = btr_pcur_get_page(cursor); page = btr_pcur_get_page(cursor);
next_page_no = btr_page_get_next(page, mtr); next_page_no = btr_page_get_next(page, mtr);
space = buf_block_get_space(btr_pcur_get_block(cursor)); space = buf_block_get_space(btr_pcur_get_block(cursor));
zip_size = buf_block_get_zip_size(btr_pcur_get_block(cursor));
ut_ad(next_page_no != FIL_NULL); ut_ad(next_page_no != FIL_NULL);
next_block = btr_block_get(space, next_page_no, next_block = btr_block_get(space, zip_size, next_page_no,
cursor->latch_mode, mtr); cursor->latch_mode, mtr);
next_page = buf_block_get_frame(next_block); next_page = buf_block_get_frame(next_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
......
...@@ -1107,6 +1107,8 @@ void ...@@ -1107,6 +1107,8 @@ void
btr_search_drop_page_hash_when_freed( btr_search_drop_page_hash_when_freed(
/*=================================*/ /*=================================*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no) /* in: page number */ ulint page_no) /* in: page number */
{ {
buf_block_t* block; buf_block_t* block;
...@@ -1124,7 +1126,7 @@ btr_search_drop_page_hash_when_freed( ...@@ -1124,7 +1126,7 @@ btr_search_drop_page_hash_when_freed(
get here. Therefore we can acquire the s-latch to the page without get here. Therefore we can acquire the s-latch to the page without
having to fear a deadlock. */ having to fear a deadlock. */
block = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL, block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__, BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr); &mtr);
......
...@@ -1479,6 +1479,8 @@ buf_page_get_gen( ...@@ -1479,6 +1479,8 @@ buf_page_get_gen(
/*=============*/ /*=============*/
/* out: pointer to the block or NULL */ /* out: pointer to the block or NULL */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint offset, /* in: page number */ ulint offset, /* in: page number */
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
buf_block_t* guess, /* in: guessed block or NULL */ buf_block_t* guess, /* in: guessed block or NULL */
...@@ -1493,7 +1495,6 @@ buf_page_get_gen( ...@@ -1493,7 +1495,6 @@ buf_page_get_gen(
ulint fix_type; ulint fix_type;
ibool success; ibool success;
ibool must_read; ibool must_read;
const ulint zip_size = fil_space_get_zip_size(space);
ut_ad(mtr); ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH) ut_ad((rw_latch == RW_S_LATCH)
...@@ -1502,6 +1503,7 @@ buf_page_get_gen( ...@@ -1502,6 +1503,7 @@ buf_page_get_gen(
ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH)); ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL) ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT)); || (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
ut_ad(zip_size == fil_space_get_zip_size(space));
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset)); ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset));
#endif #endif
...@@ -2322,7 +2324,8 @@ buf_page_create( ...@@ -2322,7 +2324,8 @@ buf_page_create(
buf_block_free(free_block); buf_block_free(free_block);
return(buf_page_get_with_no_latch(space, offset, mtr)); return(buf_page_get_with_no_latch(space, zip_size,
offset, mtr));
} }
/* If we get here, the page was not in buf_pool: init it there */ /* If we get here, the page was not in buf_pool: init it there */
......
...@@ -139,8 +139,10 @@ scan_again: ...@@ -139,8 +139,10 @@ scan_again:
/* Note that the following call will acquire /* Note that the following call will acquire
an S-latch on the page */ an S-latch on the page */
btr_search_drop_page_hash_when_freed(id, btr_search_drop_page_hash_when_freed(
page_no); id,
buf_page_get_zip_size(bpage),
page_no);
goto scan_again; goto scan_again;
} }
......
...@@ -36,7 +36,7 @@ dict_hdr_get( ...@@ -36,7 +36,7 @@ dict_hdr_get(
buf_block_t* block; buf_block_t* block;
dict_hdr_t* header; dict_hdr_t* header;
block = buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO, block = buf_page_get(DICT_HDR_SPACE, 0, DICT_HDR_PAGE_NO,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
header = DICT_HDR + buf_block_get_frame(block); header = DICT_HDR + buf_block_get_frame(block);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -146,7 +146,7 @@ dict_hdr_create( ...@@ -146,7 +146,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_TABLES_ID, DICT_HDR_SPACE, 0, DICT_TABLES_ID,
srv_sys->dummy_ind1, mtr); srv_sys->dummy_ind1, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
...@@ -156,7 +156,7 @@ dict_hdr_create( ...@@ -156,7 +156,7 @@ dict_hdr_create(
mlog_write_ulint(dict_header + DICT_HDR_TABLES, root_page_no, mlog_write_ulint(dict_header + DICT_HDR_TABLES, root_page_no,
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE, root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE, 0,
DICT_TABLE_IDS_ID, DICT_TABLE_IDS_ID,
srv_sys->dummy_ind1, mtr); srv_sys->dummy_ind1, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
...@@ -168,7 +168,7 @@ dict_hdr_create( ...@@ -168,7 +168,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_COLUMNS_ID, DICT_HDR_SPACE, 0, DICT_COLUMNS_ID,
srv_sys->dummy_ind1, mtr); srv_sys->dummy_ind1, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
...@@ -179,7 +179,7 @@ dict_hdr_create( ...@@ -179,7 +179,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_INDEXES_ID, DICT_HDR_SPACE, 0, DICT_INDEXES_ID,
srv_sys->dummy_ind1, mtr); srv_sys->dummy_ind1, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
...@@ -190,7 +190,7 @@ dict_hdr_create( ...@@ -190,7 +190,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_FIELDS_ID, DICT_HDR_SPACE, 0, DICT_FIELDS_ID,
srv_sys->dummy_ind1, mtr); srv_sys->dummy_ind1, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
......
...@@ -272,8 +272,7 @@ dict_build_table_def_step( ...@@ -272,8 +272,7 @@ dict_build_table_def_step(
mtr_start(&mtr); mtr_start(&mtr);
fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);
dict_table_zip_size(table), &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
} else { } else {
...@@ -622,8 +621,9 @@ dict_create_index_tree_step( ...@@ -622,8 +621,9 @@ dict_create_index_tree_step(
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
node->page_no = btr_create(index->type, index->space, index->id, node->page_no = btr_create(index->type, index->space,
index, &mtr); dict_table_zip_size(index->table),
index->id, index, &mtr);
/* printf("Created a new index tree in space %lu root page %lu\n", /* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */ index->space, index->page_no); */
...@@ -653,6 +653,7 @@ dict_drop_index_tree( ...@@ -653,6 +653,7 @@ dict_drop_index_tree(
{ {
ulint root_page_no; ulint root_page_no;
ulint space; ulint space;
ulint zip_size;
const byte* ptr; const byte* ptr;
ulint len; ulint len;
...@@ -679,8 +680,9 @@ dict_drop_index_tree( ...@@ -679,8 +680,9 @@ dict_drop_index_tree(
ut_ad(len == 4); ut_ad(len == 4);
space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr);
zip_size = fil_space_get_zip_size(space);
if (!fil_tablespace_exists_in_mem(space)) { if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
/* It is a single table tablespace and the .ibd file is /* It is a single table tablespace and the .ibd file is
missing: do nothing */ missing: do nothing */
...@@ -690,7 +692,7 @@ dict_drop_index_tree( ...@@ -690,7 +692,7 @@ dict_drop_index_tree(
/* We free all the pages but the root page first; this operation /* We free all the pages but the root page first; this operation
may span several mini-transactions */ may span several mini-transactions */
btr_free_but_not_root(space, root_page_no); btr_free_but_not_root(space, zip_size, root_page_no);
/* Then we free the root page in the same mini-transaction where /* Then we free the root page in the same mini-transaction where
we write FIL_NULL to the appropriate field in the SYS_INDEXES we write FIL_NULL to the appropriate field in the SYS_INDEXES
...@@ -698,7 +700,7 @@ dict_drop_index_tree( ...@@ -698,7 +700,7 @@ dict_drop_index_tree(
/* printf("Dropping index tree in space %lu root page %lu\n", space, /* printf("Dropping index tree in space %lu root page %lu\n", space,
root_page_no); */ root_page_no); */
btr_free_root(space, root_page_no, mtr); btr_free_root(space, zip_size, root_page_no, mtr);
page_rec_write_index_page_no(rec, page_rec_write_index_page_no(rec,
DICT_SYS_INDEXES_PAGE_NO_FIELD, DICT_SYS_INDEXES_PAGE_NO_FIELD,
...@@ -724,6 +726,7 @@ dict_truncate_index_tree( ...@@ -724,6 +726,7 @@ dict_truncate_index_tree(
{ {
ulint root_page_no; ulint root_page_no;
ulint space; ulint space;
ulint zip_size;
ulint type; ulint type;
dulint index_id; dulint index_id;
rec_t* rec; rec_t* rec;
...@@ -759,8 +762,9 @@ dict_truncate_index_tree( ...@@ -759,8 +762,9 @@ dict_truncate_index_tree(
ut_ad(len == 4); ut_ad(len == 4);
space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr);
zip_size = fil_space_get_zip_size(space);
if (!fil_tablespace_exists_in_mem(space)) { if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
/* It is a single table tablespace and the .ibd file is /* It is a single table tablespace and the .ibd file is
missing: do nothing */ missing: do nothing */
...@@ -782,17 +786,17 @@ dict_truncate_index_tree( ...@@ -782,17 +786,17 @@ dict_truncate_index_tree(
/* We free all the pages but the root page first; this operation /* We free all the pages but the root page first; this operation
may span several mini-transactions */ may span several mini-transactions */
btr_free_but_not_root(space, root_page_no); btr_free_but_not_root(space, zip_size, root_page_no);
/* Then we free the root page in the same mini-transaction where /* Then we free the root page in the same mini-transaction where
we create the b-tree and write its new root page number to the we create the b-tree and write its new root page number to the
appropriate field in the SYS_INDEXES record: this mini-transaction appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */ marks the B-tree totally truncated */
comp = page_is_comp(btr_page_get(space, root_page_no, RW_X_LATCH, comp = page_is_comp(btr_page_get(space, zip_size, root_page_no,
mtr)); RW_X_LATCH, mtr));
btr_free_root(space, root_page_no, mtr); btr_free_root(space, zip_size, root_page_no, mtr);
/* We will temporarily write FIL_NULL to the PAGE_NO field /* We will temporarily write FIL_NULL to the PAGE_NO field
in SYS_INDEXES, so that the database will not get into an in SYS_INDEXES, so that the database will not get into an
inconsistent state in case it crashes between the mtr_commit() inconsistent state in case it crashes between the mtr_commit()
...@@ -818,7 +822,7 @@ dict_truncate_index_tree( ...@@ -818,7 +822,7 @@ dict_truncate_index_tree(
} }
} }
root_page_no = btr_create(type, space, index_id, index, mtr); root_page_no = btr_create(type, space, zip_size, index_id, index, mtr);
if (index) { if (index) {
index->page = root_page_no; index->page = root_page_no;
} else { } else {
......
...@@ -389,7 +389,9 @@ rw_lock_t* ...@@ -389,7 +389,9 @@ rw_lock_t*
fil_space_get_latch( fil_space_get_latch(
/*================*/ /*================*/
/* out: latch protecting storage allocation */ /* out: latch protecting storage allocation */
ulint id) /* in: space id */ ulint id, /* in: space id */
ulint* zip_size)/* out: compressed page size, or
0 for uncompressed tablespaces */
{ {
fil_system_t* system = fil_system; fil_system_t* system = fil_system;
fil_space_t* space; fil_space_t* space;
...@@ -402,6 +404,10 @@ fil_space_get_latch( ...@@ -402,6 +404,10 @@ fil_space_get_latch(
ut_a(space); ut_a(space);
if (zip_size) {
*zip_size = space->zip_size;
}
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
return(&(space->latch)); return(&(space->latch));
...@@ -1385,6 +1391,10 @@ fil_space_get_zip_size( ...@@ -1385,6 +1391,10 @@ fil_space_get_zip_size(
ut_ad(system); ut_ad(system);
if (UNIV_UNLIKELY(!id)) {
return(0);
}
fil_mutex_enter_and_prepare_for_io(id); fil_mutex_enter_and_prepare_for_io(id);
HASH_SEARCH(hash, system->spaces, id, space, space->id == id); HASH_SEARCH(hash, system->spaces, id, space, space->id == id);
......
This diff is collapsed.
...@@ -81,8 +81,10 @@ flst_add_last( ...@@ -81,8 +81,10 @@ flst_add_last(
if (last_addr.page == node_addr.page) { if (last_addr.page == node_addr.page) {
last_node = page_align(node) + last_addr.boffset; last_node = page_align(node) + last_addr.boffset;
} else { } else {
last_node = fut_get_ptr(space, last_addr, RW_X_LATCH, ulint zip_size = fil_space_get_zip_size(space);
mtr);
last_node = fut_get_ptr(space, zip_size, last_addr,
RW_X_LATCH, mtr);
} }
flst_insert_after(base, last_node, node, mtr); flst_insert_after(base, last_node, node, mtr);
...@@ -122,7 +124,9 @@ flst_add_first( ...@@ -122,7 +124,9 @@ flst_add_first(
if (first_addr.page == node_addr.page) { if (first_addr.page == node_addr.page) {
first_node = page_align(node) + first_addr.boffset; first_node = page_align(node) + first_addr.boffset;
} else { } else {
first_node = fut_get_ptr(space, first_addr, ulint zip_size = fil_space_get_zip_size(space);
first_node = fut_get_ptr(space, zip_size, first_addr,
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
} }
...@@ -170,7 +174,10 @@ flst_insert_after( ...@@ -170,7 +174,10 @@ flst_insert_after(
if (!fil_addr_is_null(node3_addr)) { if (!fil_addr_is_null(node3_addr)) {
/* Update prev field of node3 */ /* Update prev field of node3 */
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH, mtr); ulint zip_size = fil_space_get_zip_size(space);
node3 = fut_get_ptr(space, zip_size,
node3_addr, RW_X_LATCH, mtr);
flst_write_addr(node3 + FLST_PREV, node2_addr, mtr); flst_write_addr(node3 + FLST_PREV, node2_addr, mtr);
} else { } else {
/* node1 was last in list: update last field in base */ /* node1 was last in list: update last field in base */
...@@ -221,8 +228,10 @@ flst_insert_before( ...@@ -221,8 +228,10 @@ flst_insert_before(
flst_write_addr(node2 + FLST_NEXT, node3_addr, mtr); flst_write_addr(node2 + FLST_NEXT, node3_addr, mtr);
if (!fil_addr_is_null(node1_addr)) { if (!fil_addr_is_null(node1_addr)) {
ulint zip_size = fil_space_get_zip_size(space);
/* Update next field of node1 */ /* Update next field of node1 */
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH, mtr); node1 = fut_get_ptr(space, zip_size, node1_addr,
RW_X_LATCH, mtr);
flst_write_addr(node1 + FLST_NEXT, node2_addr, mtr); flst_write_addr(node1 + FLST_NEXT, node2_addr, mtr);
} else { } else {
/* node3 was first in list: update first field in base */ /* node3 was first in list: update first field in base */
...@@ -248,6 +257,7 @@ flst_remove( ...@@ -248,6 +257,7 @@ flst_remove(
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
ulint space; ulint space;
ulint zip_size;
flst_node_t* node1; flst_node_t* node1;
fil_addr_t node1_addr; fil_addr_t node1_addr;
fil_addr_t node2_addr; fil_addr_t node2_addr;
...@@ -260,6 +270,7 @@ flst_remove( ...@@ -260,6 +270,7 @@ flst_remove(
ut_ad(mtr_memo_contains_page(mtr, node2, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, node2, MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node2, &space, &node2_addr); buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
zip_size = fil_space_get_zip_size(space);
node1_addr = flst_get_prev_addr(node2, mtr); node1_addr = flst_get_prev_addr(node2, mtr);
node3_addr = flst_get_next_addr(node2, mtr); node3_addr = flst_get_next_addr(node2, mtr);
...@@ -272,8 +283,8 @@ flst_remove( ...@@ -272,8 +283,8 @@ flst_remove(
node1 = page_align(node2) + node1_addr.boffset; node1 = page_align(node2) + node1_addr.boffset;
} else { } else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH, node1 = fut_get_ptr(space, zip_size,
mtr); node1_addr, RW_X_LATCH, mtr);
} }
ut_ad(node1 != node2); ut_ad(node1 != node2);
...@@ -291,8 +302,8 @@ flst_remove( ...@@ -291,8 +302,8 @@ flst_remove(
node3 = page_align(node2) + node3_addr.boffset; node3 = page_align(node2) + node3_addr.boffset;
} else { } else {
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH, node3 = fut_get_ptr(space, zip_size,
mtr); node3_addr, RW_X_LATCH, mtr);
} }
ut_ad(node2 != node3); ut_ad(node2 != node3);
...@@ -347,8 +358,9 @@ flst_cut_end( ...@@ -347,8 +358,9 @@ flst_cut_end(
node1 = page_align(node2) + node1_addr.boffset; node1 = page_align(node2) + node1_addr.boffset;
} else { } else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH, node1 = fut_get_ptr(space,
mtr); fil_space_get_zip_size(space),
node1_addr, RW_X_LATCH, mtr);
} }
flst_write_addr(node1 + FLST_NEXT, fil_addr_null, mtr); flst_write_addr(node1 + FLST_NEXT, fil_addr_null, mtr);
...@@ -418,6 +430,7 @@ flst_validate( ...@@ -418,6 +430,7 @@ flst_validate(
mtr_t* mtr1) /* in: mtr */ mtr_t* mtr1) /* in: mtr */
{ {
ulint space; ulint space;
ulint zip_size;
const flst_node_t* node; const flst_node_t* node;
fil_addr_t node_addr; fil_addr_t node_addr;
fil_addr_t base_addr; fil_addr_t base_addr;
...@@ -437,6 +450,7 @@ flst_validate( ...@@ -437,6 +450,7 @@ flst_validate(
/* Find out the space id */ /* Find out the space id */
buf_ptr_get_fsp_addr(base, &space, &base_addr); buf_ptr_get_fsp_addr(base, &space, &base_addr);
zip_size = fil_space_get_zip_size(space);
len = flst_get_len(base, mtr1); len = flst_get_len(base, mtr1);
node_addr = flst_get_first(base, mtr1); node_addr = flst_get_first(base, mtr1);
...@@ -444,7 +458,8 @@ flst_validate( ...@@ -444,7 +458,8 @@ flst_validate(
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
mtr_start(&mtr2); mtr_start(&mtr2);
node = fut_get_ptr(space, node_addr, RW_X_LATCH, &mtr2); node = fut_get_ptr(space, zip_size,
node_addr, RW_X_LATCH, &mtr2);
node_addr = flst_get_next_addr(node, &mtr2); node_addr = flst_get_next_addr(node, &mtr2);
mtr_commit(&mtr2); /* Commit mtr2 each round to prevent buffer mtr_commit(&mtr2); /* Commit mtr2 each round to prevent buffer
...@@ -458,7 +473,8 @@ flst_validate( ...@@ -458,7 +473,8 @@ flst_validate(
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
mtr_start(&mtr2); mtr_start(&mtr2);
node = fut_get_ptr(space, node_addr, RW_X_LATCH, &mtr2); node = fut_get_ptr(space, zip_size,
node_addr, RW_X_LATCH, &mtr2);
node_addr = flst_get_prev_addr(node, &mtr2); node_addr = flst_get_prev_addr(node, &mtr2);
mtr_commit(&mtr2); /* Commit mtr2 each round to prevent buffer mtr_commit(&mtr2); /* Commit mtr2 each round to prevent buffer
......
...@@ -281,7 +281,8 @@ ibuf_header_page_get( ...@@ -281,7 +281,8 @@ ibuf_header_page_get(
ut_ad(!ibuf_inside()); ut_ad(!ibuf_inside());
block = buf_page_get(space, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr); block = buf_page_get(space, 0, FSP_IBUF_HEADER_PAGE_NO,
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_IBUF_HEADER); buf_block_dbg_add_level(block, SYNC_IBUF_HEADER);
...@@ -308,7 +309,7 @@ ibuf_tree_root_get( ...@@ -308,7 +309,7 @@ ibuf_tree_root_get(
mtr_x_lock(dict_index_get_lock(data->index), mtr); mtr_x_lock(dict_index_get_lock(data->index), mtr);
block = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH, block = buf_page_get(space, 0, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
mtr); mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
...@@ -482,7 +483,7 @@ ibuf_data_init_for_space( ...@@ -482,7 +483,7 @@ ibuf_data_init_for_space(
mutex_enter(&ibuf_mutex); mutex_enter(&ibuf_mutex);
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space, NULL), &mtr);
header_page = ibuf_header_page_get(space, &mtr); header_page = ibuf_header_page_get(space, &mtr);
...@@ -496,7 +497,8 @@ ibuf_data_init_for_space( ...@@ -496,7 +497,8 @@ ibuf_data_init_for_space(
{ {
buf_block_t* block = buf_page_get( buf_block_t* block = buf_page_get(
space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH, &mtr); space, 0, FSP_IBUF_TREE_ROOT_PAGE_NO,
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -767,7 +769,7 @@ ibuf_bitmap_get_map_page( ...@@ -767,7 +769,7 @@ ibuf_bitmap_get_map_page(
{ {
buf_block_t* block; buf_block_t* block;
block = buf_page_get(space, block = buf_page_get(space, zip_size,
ibuf_bitmap_page_no_calc(zip_size, page_no), ibuf_bitmap_page_no_calc(zip_size, page_no),
RW_X_LATCH, mtr); RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -1661,12 +1663,11 @@ ibuf_add_free_page( ...@@ -1661,12 +1663,11 @@ ibuf_add_free_page(
/* out: DB_SUCCESS, or DB_STRONG_FAIL /* out: DB_SUCCESS, or DB_STRONG_FAIL
if no space left */ if no space left */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in
bytes, or 0 */
ibuf_data_t* ibuf_data) /* in: ibuf data for the space */ ibuf_data_t* ibuf_data) /* in: ibuf data for the space */
{ {
mtr_t mtr; mtr_t mtr;
page_t* header_page; page_t* header_page;
ulint zip_size;
ulint page_no; ulint page_no;
page_t* page; page_t* page;
page_t* root; page_t* root;
...@@ -1678,7 +1679,7 @@ ibuf_add_free_page( ...@@ -1678,7 +1679,7 @@ ibuf_add_free_page(
/* Acquire the fsp latch before the ibuf header, obeying the latching /* Acquire the fsp latch before the ibuf header, obeying the latching
order */ order */
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space, &zip_size), &mtr);
header_page = ibuf_header_page_get(space, &mtr); header_page = ibuf_header_page_get(space, &mtr);
...@@ -1703,7 +1704,7 @@ ibuf_add_free_page( ...@@ -1703,7 +1704,7 @@ ibuf_add_free_page(
{ {
buf_block_t* block = buf_page_get( buf_block_t* block = buf_page_get(
space, page_no, RW_X_LATCH, &mtr); space, 0, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -1750,13 +1751,12 @@ void ...@@ -1750,13 +1751,12 @@ void
ibuf_remove_free_page( ibuf_remove_free_page(
/*==================*/ /*==================*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in
bytes, or 0 */
ibuf_data_t* ibuf_data) /* in: ibuf data for the space */ ibuf_data_t* ibuf_data) /* in: ibuf data for the space */
{ {
mtr_t mtr; mtr_t mtr;
mtr_t mtr2; mtr_t mtr2;
page_t* header_page; page_t* header_page;
ulint zip_size;
ulint page_no; ulint page_no;
page_t* page; page_t* page;
page_t* root; page_t* root;
...@@ -1768,7 +1768,7 @@ ibuf_remove_free_page( ...@@ -1768,7 +1768,7 @@ ibuf_remove_free_page(
/* Acquire the fsp latch before the ibuf header, obeying the latching /* Acquire the fsp latch before the ibuf header, obeying the latching
order */ order */
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space, &zip_size), &mtr);
header_page = ibuf_header_page_get(space, &mtr); header_page = ibuf_header_page_get(space, &mtr);
...@@ -1832,7 +1832,7 @@ ibuf_remove_free_page( ...@@ -1832,7 +1832,7 @@ ibuf_remove_free_page(
{ {
buf_block_t* block = buf_page_get( buf_block_t* block = buf_page_get(
space, page_no, RW_X_LATCH, &mtr); space, 0, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -1874,8 +1874,7 @@ file segment, and the thread did not own the fsp latch before this call. */ ...@@ -1874,8 +1874,7 @@ file segment, and the thread did not own the fsp latch before this call. */
void void
ibuf_free_excess_pages( ibuf_free_excess_pages(
/*===================*/ /*===================*/
ulint space, /* in: space id */ ulint space) /* in: compressed page size in bytes, or 0 */
ulint zip_size) /* in: compressed page size in bytes, or 0 */
{ {
ibuf_data_t* ibuf_data; ibuf_data_t* ibuf_data;
ulint i; ulint i;
...@@ -1888,9 +1887,9 @@ ibuf_free_excess_pages( ...@@ -1888,9 +1887,9 @@ ibuf_free_excess_pages(
} }
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(fil_space_get_latch(space), RW_LOCK_EX)); ut_ad(rw_lock_own(fil_space_get_latch(space, NULL), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_ad(rw_lock_get_x_lock_count(fil_space_get_latch(space)) == 1); ut_ad(rw_lock_get_x_lock_count(fil_space_get_latch(space, NULL)) == 1);
ut_ad(!ibuf_inside()); ut_ad(!ibuf_inside());
/* NOTE: We require that the thread did not own the latch before, /* NOTE: We require that the thread did not own the latch before,
...@@ -1926,7 +1925,7 @@ ibuf_free_excess_pages( ...@@ -1926,7 +1925,7 @@ ibuf_free_excess_pages(
mutex_exit(&ibuf_mutex); mutex_exit(&ibuf_mutex);
ibuf_remove_free_page(space, zip_size, ibuf_data); ibuf_remove_free_page(space, ibuf_data);
} }
} }
...@@ -2392,7 +2391,7 @@ ibuf_get_volume_buffered( ...@@ -2392,7 +2391,7 @@ ibuf_get_volume_buffered(
{ {
buf_block_t* block = buf_page_get( buf_block_t* block = buf_page_get(
0, prev_page_no, RW_X_LATCH, mtr); 0, 0, prev_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -2462,7 +2461,7 @@ count_later: ...@@ -2462,7 +2461,7 @@ count_later:
{ {
buf_block_t* block = buf_page_get( buf_block_t* block = buf_page_get(
0, next_page_no, RW_X_LATCH, mtr); 0, 0, next_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TREE_NODE); buf_block_dbg_add_level(block, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -2636,7 +2635,7 @@ ibuf_insert_low( ...@@ -2636,7 +2635,7 @@ ibuf_insert_low(
mutex_exit(&ibuf_pessimistic_insert_mutex); mutex_exit(&ibuf_pessimistic_insert_mutex);
err = ibuf_add_free_page(0, zip_size, ibuf_data); err = ibuf_add_free_page(0, ibuf_data);
if (err == DB_STRONG_FAIL) { if (err == DB_STRONG_FAIL) {
......
...@@ -71,6 +71,8 @@ buf_block_t* ...@@ -71,6 +71,8 @@ buf_block_t*
btr_block_get( btr_block_get(
/*==========*/ /*==========*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
ulint mode, /* in: latch mode */ ulint mode, /* in: latch mode */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
...@@ -81,6 +83,8 @@ page_t* ...@@ -81,6 +83,8 @@ page_t*
btr_page_get( btr_page_get(
/*=========*/ /*=========*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
ulint mode, /* in: latch mode */ ulint mode, /* in: latch mode */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
...@@ -178,6 +182,8 @@ btr_create( ...@@ -178,6 +182,8 @@ btr_create(
FIL_NULL if did not succeed */ FIL_NULL if did not succeed */
ulint type, /* in: type of the index */ ulint type, /* in: type of the index */
ulint space, /* in: space where created */ ulint space, /* in: space where created */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
dulint index_id,/* in: index id */ dulint index_id,/* in: index id */
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
...@@ -189,6 +195,8 @@ void ...@@ -189,6 +195,8 @@ void
btr_free_but_not_root( btr_free_but_not_root(
/*==================*/ /*==================*/
ulint space, /* in: space where created */ ulint space, /* in: space where created */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint root_page_no); /* in: root page number */ ulint root_page_no); /* in: root page number */
/**************************************************************** /****************************************************************
Frees the B-tree root page. Other tree MUST already have been freed. */ Frees the B-tree root page. Other tree MUST already have been freed. */
...@@ -197,6 +205,8 @@ void ...@@ -197,6 +205,8 @@ void
btr_free_root( btr_free_root(
/*==========*/ /*==========*/
ulint space, /* in: space where created */ ulint space, /* in: space where created */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint root_page_no, /* in: root page number */ ulint root_page_no, /* in: root page number */
mtr_t* mtr); /* in: a mini-transaction which has already mtr_t* mtr); /* in: a mini-transaction which has already
been started */ been started */
......
...@@ -20,13 +20,15 @@ buf_block_t* ...@@ -20,13 +20,15 @@ buf_block_t*
btr_block_get( btr_block_get(
/*==========*/ /*==========*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
ulint mode, /* in: latch mode */ ulint mode, /* in: latch mode */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
buf_block_t* block; buf_block_t* block;
block = buf_page_get(space, page_no, mode, mtr); block = buf_page_get(space, zip_size, page_no, mode, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
if (mode != RW_NO_LATCH) { if (mode != RW_NO_LATCH) {
...@@ -43,11 +45,14 @@ page_t* ...@@ -43,11 +45,14 @@ page_t*
btr_page_get( btr_page_get(
/*=========*/ /*=========*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
ulint mode, /* in: latch mode */ ulint mode, /* in: latch mode */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
return(buf_block_get_frame(btr_block_get(space, page_no, mode, mtr))); return(buf_block_get_frame(btr_block_get(space, zip_size, page_no,
mode, mtr)));
} }
/****************************************************************** /******************************************************************
......
...@@ -116,6 +116,8 @@ void ...@@ -116,6 +116,8 @@ void
btr_search_drop_page_hash_when_freed( btr_search_drop_page_hash_when_freed(
/*=================================*/ /*=================================*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no); /* in: page number */ ulint page_no); /* in: page number */
/************************************************************************ /************************************************************************
Updates the page hash index when a single record is inserted on a page. */ Updates the page hash index when a single record is inserted on a page. */
......
...@@ -148,8 +148,8 @@ buf_frame_copy( ...@@ -148,8 +148,8 @@ buf_frame_copy(
NOTE! The following macros should be used instead of buf_page_get_gen, NOTE! The following macros should be used instead of buf_page_get_gen,
to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
in LA! */ in LA! */
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\ #define buf_page_get(SP, ZS, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\ SP, ZS, OF, LA, NULL,\
BUF_GET, __FILE__, __LINE__, MTR) BUF_GET, __FILE__, __LINE__, MTR)
/****************************************************************** /******************************************************************
Use these macros to bufferfix a page with no latching. Remember not to Use these macros to bufferfix a page with no latching. Remember not to
...@@ -157,14 +157,14 @@ read the contents of the page unless you know it is safe. Do not modify ...@@ -157,14 +157,14 @@ read the contents of the page unless you know it is safe. Do not modify
the contents of the page! We have separated this case, because it is the contents of the page! We have separated this case, because it is
error-prone programming not to set a latch, and it should be used error-prone programming not to set a latch, and it should be used
with care. */ with care. */
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\ #define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\ SP, ZS, OF, RW_NO_LATCH, NULL,\
BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR) BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
/****************************************************************** /******************************************************************
NOTE! The following macros should be used instead of buf_page_get_gen, to NOTE! The following macros should be used instead of buf_page_get_gen, to
improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\ #define buf_page_get_nowait(SP, ZS, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\ SP, ZS, OF, LA, NULL,\
BUF_GET_NOWAIT, __FILE__, __LINE__, MTR) BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
/****************************************************************** /******************************************************************
NOTE! The following macros should be used instead of NOTE! The following macros should be used instead of
...@@ -199,6 +199,8 @@ buf_page_get_release_on_io( ...@@ -199,6 +199,8 @@ buf_page_get_release_on_io(
/* out: pointer to the block, or NULL /* out: pointer to the block, or NULL
if not in buffer buf_pool */ if not in buffer buf_pool */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint offset, /* in: offset of the page within space ulint offset, /* in: offset of the page within space
in units of a page */ in units of a page */
buf_block_t* guess, /* in: guessed frame or NULL */ buf_block_t* guess, /* in: guessed frame or NULL */
...@@ -228,6 +230,8 @@ buf_page_get_gen( ...@@ -228,6 +230,8 @@ buf_page_get_gen(
/*=============*/ /*=============*/
/* out: pointer to the block or NULL */ /* out: pointer to the block or NULL */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint offset, /* in: page number */ ulint offset, /* in: page number */
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
buf_block_t* guess, /* in: guessed block or NULL */ buf_block_t* guess, /* in: guessed block or NULL */
......
...@@ -928,6 +928,8 @@ buf_page_get_release_on_io( ...@@ -928,6 +928,8 @@ buf_page_get_release_on_io(
/* out: pointer to the block, or NULL /* out: pointer to the block, or NULL
if not in buffer buf_pool */ if not in buffer buf_pool */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint offset, /* in: offset of the page within space ulint offset, /* in: offset of the page within space
in units of a page */ in units of a page */
buf_block_t* guess, /* in: guessed block or NULL */ buf_block_t* guess, /* in: guessed block or NULL */
...@@ -938,7 +940,7 @@ buf_page_get_release_on_io( ...@@ -938,7 +940,7 @@ buf_page_get_release_on_io(
{ {
buf_block_t* block; buf_block_t* block;
block = buf_page_get_gen(space, offset, rw_latch, guess, block = buf_page_get_gen(space, zip_size, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, __FILE__, __LINE__,
mtr); mtr);
...@@ -952,7 +954,7 @@ buf_page_get_release_on_io( ...@@ -952,7 +954,7 @@ buf_page_get_release_on_io(
mtr_rollback_to_savepoint(mtr, savepoint); mtr_rollback_to_savepoint(mtr, savepoint);
buf_page_get(space, offset, RW_S_LATCH, mtr); buf_page_get(space, zip_size, offset, RW_S_LATCH, mtr);
/* When we get here, the page is in buffer, but we release /* When we get here, the page is in buffer, but we release
the latches again down to the savepoint, before returning */ the latches again down to the savepoint, before returning */
......
...@@ -145,7 +145,9 @@ rw_lock_t* ...@@ -145,7 +145,9 @@ rw_lock_t*
fil_space_get_latch( fil_space_get_latch(
/*================*/ /*================*/
/* out: latch protecting storage allocation */ /* out: latch protecting storage allocation */
ulint id); /* in: space id */ ulint id, /* in: space id */
ulint* zip_size);/* out: compressed page size, or
0 for uncompressed tablespaces */
/*********************************************************************** /***********************************************************************
Returns the type of a file space. */ Returns the type of a file space. */
......
...@@ -87,7 +87,7 @@ Reads the compressed page size from the first page of a tablespace. */ ...@@ -87,7 +87,7 @@ Reads the compressed page size from the first page of a tablespace. */
ulint ulint
fsp_header_get_zip_size( fsp_header_get_zip_size(
/*=====================*/ /*====================*/
/* out: compressed page size in bytes, /* out: compressed page size in bytes,
or 0 if uncompressed */ or 0 if uncompressed */
const page_t* page); /* in: first page of a tablespace */ const page_t* page); /* in: first page of a tablespace */
...@@ -112,7 +112,6 @@ fsp_header_init( ...@@ -112,7 +112,6 @@ fsp_header_init(
/*============*/ /*============*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint size, /* in: current size in blocks */ ulint size, /* in: current size in blocks */
ulint zip_size, /* in: compressed page size, or 0 */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************** /**************************************************************************
Increases the space size field of a space. */ Increases the space size field of a space. */
...@@ -281,6 +280,8 @@ void ...@@ -281,6 +280,8 @@ void
fseg_free( fseg_free(
/*======*/ /*======*/
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no,/* in: page number where the segment header is ulint page_no,/* in: page number where the segment header is
placed */ placed */
ulint offset);/* in: byte offset of the segment header on that ulint offset);/* in: byte offset of the segment header on that
......
...@@ -24,6 +24,8 @@ fut_get_ptr( ...@@ -24,6 +24,8 @@ fut_get_ptr(
/* out: pointer to a byte in a frame; the file /* out: pointer to a byte in a frame; the file
page in the frame is bufferfixed and latched */ page in the frame is bufferfixed and latched */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
fil_addr_t addr, /* in: file address */ fil_addr_t addr, /* in: file address */
ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH */ ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH */
mtr_t* mtr); /* in: mtr handle */ mtr_t* mtr); /* in: mtr handle */
......
...@@ -18,6 +18,8 @@ fut_get_ptr( ...@@ -18,6 +18,8 @@ fut_get_ptr(
/* out: pointer to a byte in a frame; the file /* out: pointer to a byte in a frame; the file
page in the frame is bufferfixed and latched */ page in the frame is bufferfixed and latched */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
fil_addr_t addr, /* in: file address */ fil_addr_t addr, /* in: file address */
ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH */ ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH */
mtr_t* mtr) /* in: mtr handle */ mtr_t* mtr) /* in: mtr handle */
...@@ -28,7 +30,7 @@ fut_get_ptr( ...@@ -28,7 +30,7 @@ fut_get_ptr(
ut_ad(addr.boffset < UNIV_PAGE_SIZE); ut_ad(addr.boffset < UNIV_PAGE_SIZE);
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
block = buf_page_get(space, addr.page, rw_latch, mtr); block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr);
ptr = buf_block_get_frame(block) + addr.boffset; ptr = buf_block_get_frame(block) + addr.boffset;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
......
...@@ -176,8 +176,7 @@ file segment, and the thread did not own the fsp latch before this call. */ ...@@ -176,8 +176,7 @@ file segment, and the thread did not own the fsp latch before this call. */
void void
ibuf_free_excess_pages( ibuf_free_excess_pages(
/*===================*/ /*===================*/
ulint space, /* in: space id */ ulint space); /* in: space id */
ulint zip_size); /* in: compressed page size in bytes, or 0 */
/************************************************************************* /*************************************************************************
Makes an index insert to the insert buffer, instead of directly to the disk Makes an index insert to the insert buffer, instead of directly to the disk
page, if this is possible. Does not do insert if the index is clustered page, if this is possible. Does not do insert if the index is clustered
......
...@@ -22,6 +22,8 @@ trx_rsegf_get( ...@@ -22,6 +22,8 @@ trx_rsegf_get(
/* out: rollback segment header, page /* out: rollback segment header, page
x-latched */ x-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number of the header */ ulint page_no, /* in: page number of the header */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/********************************************************************** /**********************************************************************
...@@ -33,6 +35,8 @@ trx_rsegf_get_new( ...@@ -33,6 +35,8 @@ trx_rsegf_get_new(
/* out: rollback segment header, page /* out: rollback segment header, page
x-latched */ x-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number of the header */ ulint page_no, /* in: page number of the header */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/******************************************************************* /*******************************************************************
...@@ -83,6 +87,8 @@ trx_rseg_header_create( ...@@ -83,6 +87,8 @@ trx_rseg_header_create(
/* out: page number of the created segment, /* out: page number of the created segment,
FIL_NULL if fail */ FIL_NULL if fail */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint max_size, /* in: max size in pages */ ulint max_size, /* in: max size in pages */
ulint* slot_no, /* out: rseg id == slot number in trx sys */ ulint* slot_no, /* out: rseg id == slot number in trx sys */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
...@@ -126,6 +132,8 @@ struct trx_rseg_struct{ ...@@ -126,6 +132,8 @@ struct trx_rseg_struct{
rseg mutex */ rseg mutex */
ulint space; /* space where the rollback segment is ulint space; /* space where the rollback segment is
header is placed */ header is placed */
ulint zip_size;/* in: compressed page size of space
in bytes, or 0 for uncompressed spaces */
ulint page_no;/* page number of the rollback segment ulint page_no;/* page number of the rollback segment
header */ header */
ulint max_size;/* maximum allowed size in pages */ ulint max_size;/* maximum allowed size in pages */
......
...@@ -17,13 +17,15 @@ trx_rsegf_get( ...@@ -17,13 +17,15 @@ trx_rsegf_get(
/* out: rollback segment header, page /* out: rollback segment header, page
x-latched */ x-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number of the header */ ulint page_no, /* in: page number of the header */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
buf_block_t* block; buf_block_t* block;
trx_rsegf_t* header; trx_rsegf_t* header;
block = buf_page_get(space, page_no, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -41,13 +43,15 @@ trx_rsegf_get_new( ...@@ -41,13 +43,15 @@ trx_rsegf_get_new(
/* out: rollback segment header, page /* out: rollback segment header, page
x-latched */ x-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number of the header */ ulint page_no, /* in: page number of the header */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
buf_block_t* block; buf_block_t* block;
trx_rsegf_t* header; trx_rsegf_t* header;
block = buf_page_get(space, page_no, RW_X_LATCH, mtr); block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW); buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
......
...@@ -100,7 +100,8 @@ trx_sysf_get( ...@@ -100,7 +100,8 @@ trx_sysf_get(
ut_ad(mtr); ut_ad(mtr);
block = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, mtr); block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER); buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
......
...@@ -74,6 +74,8 @@ trx_undo_page_get( ...@@ -74,6 +74,8 @@ trx_undo_page_get(
/*==============*/ /*==============*/
/* out: pointer to page x-latched */ /* out: pointer to page x-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/********************************************************************** /**********************************************************************
...@@ -84,6 +86,8 @@ trx_undo_page_get_s_latched( ...@@ -84,6 +86,8 @@ trx_undo_page_get_s_latched(
/*========================*/ /*========================*/
/* out: pointer to page s-latched */ /* out: pointer to page s-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/********************************************************************** /**********************************************************************
...@@ -163,6 +167,8 @@ trx_undo_get_first_rec( ...@@ -163,6 +167,8 @@ trx_undo_get_first_rec(
/* out: undo log record, the page latched, NULL if /* out: undo log record, the page latched, NULL if
none */ none */
ulint space, /* in: undo log header space */ ulint space, /* in: undo log header space */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no,/* in: undo log header page number */ ulint page_no,/* in: undo log header page number */
ulint offset, /* in: undo log header offset on page */ ulint offset, /* in: undo log header offset on page */
ulint mode, /* in: latching mode: RW_S_LATCH or RW_X_LATCH */ ulint mode, /* in: latching mode: RW_S_LATCH or RW_X_LATCH */
...@@ -355,6 +361,8 @@ struct trx_undo_struct{ ...@@ -355,6 +361,8 @@ struct trx_undo_struct{
/*-----------------------------*/ /*-----------------------------*/
ulint space; /* space id where the undo log ulint space; /* space id where the undo log
placed */ placed */
ulint zip_size; /* in: compressed page size of space
in bytes, or 0 for uncompressed */
ulint hdr_page_no; /* page number of the header page in ulint hdr_page_no; /* page number of the header page in
the undo log */ the undo log */
ulint hdr_offset; /* header offset of the undo log on the ulint hdr_offset; /* header offset of the undo log on the
......
...@@ -128,10 +128,13 @@ trx_undo_page_get( ...@@ -128,10 +128,13 @@ trx_undo_page_get(
/*==============*/ /*==============*/
/* out: pointer to page x-latched */ /* out: pointer to page x-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
buf_block_t* block = buf_page_get(space, page_no, RW_X_LATCH, mtr); buf_block_t* block = buf_page_get(space, zip_size, page_no,
RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -147,10 +150,13 @@ trx_undo_page_get_s_latched( ...@@ -147,10 +150,13 @@ trx_undo_page_get_s_latched(
/*========================*/ /*========================*/
/* out: pointer to page s-latched */ /* out: pointer to page s-latched */
ulint space, /* in: space where placed */ ulint space, /* in: space where placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number */ ulint page_no, /* in: page number */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
buf_block_t* block = buf_page_get(space, page_no, RW_S_LATCH, mtr); buf_block_t* block = buf_page_get(space, zip_size, page_no,
RW_S_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
......
...@@ -4292,6 +4292,7 @@ lock_rec_print( ...@@ -4292,6 +4292,7 @@ lock_rec_print(
{ {
buf_block_t* block; buf_block_t* block;
ulint space; ulint space;
ulint zip_size;
ulint page_no; ulint page_no;
ulint i; ulint i;
mtr_t mtr; mtr_t mtr;
...@@ -4306,6 +4307,7 @@ lock_rec_print( ...@@ -4306,6 +4307,7 @@ lock_rec_print(
ut_a(lock_get_type(lock) == LOCK_REC); ut_a(lock_get_type(lock) == LOCK_REC);
space = lock->un_member.rec_lock.space; space = lock->un_member.rec_lock.space;
zip_size = fil_space_get_zip_size(space);
page_no = lock->un_member.rec_lock.page_no; page_no = lock->un_member.rec_lock.page_no;
fprintf(file, "RECORD LOCKS space id %lu page no %lu n bits %lu ", fprintf(file, "RECORD LOCKS space id %lu page no %lu n bits %lu ",
...@@ -4348,27 +4350,28 @@ lock_rec_print( ...@@ -4348,27 +4350,28 @@ lock_rec_print(
because we have the kernel mutex and ibuf operations would because we have the kernel mutex and ibuf operations would
break the latching order */ break the latching order */
block = buf_page_get_gen(space, page_no, RW_NO_LATCH, block = buf_page_get_gen(space, zip_size, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL, NULL, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &mtr); __FILE__, __LINE__, &mtr);
if (block) { if (block) {
block = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr); block = buf_page_get_nowait(space, zip_size,
page_no, RW_S_LATCH, &mtr);
if (!block) { if (!block) {
/* Let us try to get an X-latch. If the current thread /* Let us try to get an X-latch. If the current thread
is holding an X-latch on the page, we cannot get an is holding an X-latch on the page, we cannot get an
S-latch. */ S-latch. */
block = buf_page_get_nowait(space, page_no, RW_X_LATCH, block = buf_page_get_nowait(space, zip_size, page_no,
&mtr); RW_X_LATCH, &mtr);
} }
} }
if (block) {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
if (block) {
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
} }
#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < lock_rec_get_n_bits(lock); i++) { for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
...@@ -4482,8 +4485,6 @@ lock_print_info_all_transactions( ...@@ -4482,8 +4485,6 @@ lock_print_info_all_transactions(
FILE* file) /* in: file where to print */ FILE* file) /* in: file where to print */
{ {
lock_t* lock; lock_t* lock;
ulint space;
ulint page_no;
ibool load_page_first = TRUE; ibool load_page_first = TRUE;
ulint nth_trx = 0; ulint nth_trx = 0;
ulint nth_lock = 0; ulint nth_lock = 0;
...@@ -4590,16 +4591,18 @@ loop: ...@@ -4590,16 +4591,18 @@ loop:
} }
if (lock_get_type(lock) == LOCK_REC) { if (lock_get_type(lock) == LOCK_REC) {
space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no;
if (load_page_first) { if (load_page_first) {
ulint space = lock->un_member.rec_lock.space;
ulint zip_size= fil_space_get_zip_size(space);
ulint page_no = lock->un_member.rec_lock.page_no;
lock_mutex_exit_kernel(); lock_mutex_exit_kernel();
innobase_mysql_end_print_arbitrary_thd(); innobase_mysql_end_print_arbitrary_thd();
mtr_start(&mtr); mtr_start(&mtr);
buf_page_get_with_no_latch(space, page_no, &mtr); buf_page_get_with_no_latch(space, zip_size,
page_no, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -4835,7 +4838,8 @@ lock_rec_validate_page( ...@@ -4835,7 +4838,8 @@ lock_rec_validate_page(
mtr_start(&mtr); mtr_start(&mtr);
block = buf_page_get(space, page_no, RW_X_LATCH, &mtr); block = buf_page_get(space, fil_space_get_zip_size(space),
page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
......
...@@ -1469,8 +1469,9 @@ loop: ...@@ -1469,8 +1469,9 @@ loop:
mtr_start(&mtr); mtr_start(&mtr);
block = buf_page_get(space, page_no, block = buf_page_get(
RW_X_LATCH, &mtr); space, zip_size, page_no,
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level( buf_block_dbg_add_level(
block, SYNC_NO_ORDER_CHECK); block, SYNC_NO_ORDER_CHECK);
......
...@@ -445,7 +445,7 @@ skip_secondaries: ...@@ -445,7 +445,7 @@ skip_secondaries:
/* We assume in purge of externally stored fields /* We assume in purge of externally stored fields
that the space id of the undo log record is 0! */ that the space id of the undo log record is 0! */
block = buf_page_get(0, page_no, RW_X_LATCH, &mtr); block = buf_page_get(0, 0, page_no, RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE); buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
......
...@@ -1415,7 +1415,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1415,7 +1415,7 @@ innobase_start_or_create_for_mysql(void)
if (create_new_db) { if (create_new_db) {
mtr_start(&mtr); mtr_start(&mtr);
fsp_header_init(0, sum_of_new_sizes, 0, &mtr); fsp_header_init(0, sum_of_new_sizes, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
......
...@@ -264,7 +264,8 @@ trx_purge_add_update_undo_to_history( ...@@ -264,7 +264,8 @@ trx_purge_add_update_undo_to_history(
ut_ad(mutex_own(&(rseg->mutex))); ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr); rseg_header = trx_rsegf_get(rseg->space, rseg->zip_size,
rseg->page_no, mtr);
undo_header = undo_page + undo->hdr_offset; undo_header = undo_page + undo->hdr_offset;
seg_header = undo_page + TRX_UNDO_SEG_HDR; seg_header = undo_page + TRX_UNDO_SEG_HDR;
...@@ -348,9 +349,11 @@ loop: ...@@ -348,9 +349,11 @@ loop:
mtr_start(&mtr); mtr_start(&mtr);
mutex_enter(&(rseg->mutex)); mutex_enter(&(rseg->mutex));
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr); rseg_hdr = trx_rsegf_get(rseg->space, rseg->zip_size,
rseg->page_no, &mtr);
undo_page = trx_undo_page_get(rseg->space, hdr_addr.page, &mtr); undo_page = trx_undo_page_get(rseg->space, rseg->zip_size,
hdr_addr.page, &mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR; seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
log_hdr = undo_page + hdr_addr.boffset; log_hdr = undo_page + hdr_addr.boffset;
...@@ -452,7 +455,8 @@ trx_purge_truncate_rseg_history( ...@@ -452,7 +455,8 @@ trx_purge_truncate_rseg_history(
mtr_start(&mtr); mtr_start(&mtr);
mutex_enter(&(rseg->mutex)); mutex_enter(&(rseg->mutex));
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr); rseg_hdr = trx_rsegf_get(rseg->space, rseg->zip_size,
rseg->page_no, &mtr);
hdr_addr = trx_purge_get_log_from_hist( hdr_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr)); flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr));
...@@ -466,7 +470,8 @@ loop: ...@@ -466,7 +470,8 @@ loop:
return; return;
} }
undo_page = trx_undo_page_get(rseg->space, hdr_addr.page, &mtr); undo_page = trx_undo_page_get(rseg->space, rseg->zip_size,
hdr_addr.page, &mtr);
log_hdr = undo_page + hdr_addr.boffset; log_hdr = undo_page + hdr_addr.boffset;
...@@ -518,7 +523,8 @@ loop: ...@@ -518,7 +523,8 @@ loop:
mtr_start(&mtr); mtr_start(&mtr);
mutex_enter(&(rseg->mutex)); mutex_enter(&(rseg->mutex));
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr); rseg_hdr = trx_rsegf_get(rseg->space, rseg->zip_size,
rseg->page_no, &mtr);
hdr_addr = prev_hdr_addr; hdr_addr = prev_hdr_addr;
...@@ -624,7 +630,7 @@ trx_purge_rseg_get_next_history_log( ...@@ -624,7 +630,7 @@ trx_purge_rseg_get_next_history_log(
mtr_start(&mtr); mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(rseg->space, undo_page = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size,
rseg->last_page_no, &mtr); rseg->last_page_no, &mtr);
log_hdr = undo_page + rseg->last_offset; log_hdr = undo_page + rseg->last_offset;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR; seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
...@@ -676,7 +682,7 @@ trx_purge_rseg_get_next_history_log( ...@@ -676,7 +682,7 @@ trx_purge_rseg_get_next_history_log(
/* Read the trx number and del marks from the previous log header */ /* Read the trx number and del marks from the previous log header */
mtr_start(&mtr); mtr_start(&mtr);
log_hdr = trx_undo_page_get_s_latched(rseg->space, log_hdr = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size,
prev_log_addr.page, &mtr) prev_log_addr.page, &mtr)
+ prev_log_addr.boffset; + prev_log_addr.boffset;
...@@ -711,6 +717,7 @@ trx_purge_choose_next_log(void) ...@@ -711,6 +717,7 @@ trx_purge_choose_next_log(void)
trx_rseg_t* min_rseg; trx_rseg_t* min_rseg;
dulint min_trx_no; dulint min_trx_no;
ulint space = 0; /* remove warning (??? bug ???) */ ulint space = 0; /* remove warning (??? bug ???) */
ulint zip_size = 0;
ulint page_no = 0; /* remove warning (??? bug ???) */ ulint page_no = 0; /* remove warning (??? bug ???) */
ulint offset = 0; /* remove warning (??? bug ???) */ ulint offset = 0; /* remove warning (??? bug ???) */
mtr_t mtr; mtr_t mtr;
...@@ -738,6 +745,7 @@ trx_purge_choose_next_log(void) ...@@ -738,6 +745,7 @@ trx_purge_choose_next_log(void)
min_rseg = rseg; min_rseg = rseg;
min_trx_no = rseg->last_trx_no; min_trx_no = rseg->last_trx_no;
space = rseg->space; space = rseg->space;
zip_size = rseg->zip_size;
ut_a(space == 0); /* We assume in purge of ut_a(space == 0); /* We assume in purge of
externally stored fields externally stored fields
that space id == 0 */ that space id == 0 */
...@@ -763,7 +771,7 @@ trx_purge_choose_next_log(void) ...@@ -763,7 +771,7 @@ trx_purge_choose_next_log(void)
rec = &trx_purge_dummy_rec; rec = &trx_purge_dummy_rec;
} else { } else {
rec = trx_undo_get_first_rec(space, page_no, offset, rec = trx_undo_get_first_rec(space, zip_size, page_no, offset,
RW_S_LATCH, &mtr); RW_S_LATCH, &mtr);
if (rec == NULL) { if (rec == NULL) {
/* Undo log empty */ /* Undo log empty */
...@@ -814,6 +822,7 @@ trx_purge_get_next_rec( ...@@ -814,6 +822,7 @@ trx_purge_get_next_rec(
ulint offset; ulint offset;
ulint page_no; ulint page_no;
ulint space; ulint space;
ulint zip_size;
ulint type; ulint type;
ulint cmpl_info; ulint cmpl_info;
mtr_t mtr; mtr_t mtr;
...@@ -824,6 +833,7 @@ trx_purge_get_next_rec( ...@@ -824,6 +833,7 @@ trx_purge_get_next_rec(
ut_ad(purge_sys->next_stored); ut_ad(purge_sys->next_stored);
space = purge_sys->rseg->space; space = purge_sys->rseg->space;
zip_size = purge_sys->rseg->zip_size;
page_no = purge_sys->page_no; page_no = purge_sys->page_no;
offset = purge_sys->offset; offset = purge_sys->offset;
...@@ -842,7 +852,8 @@ trx_purge_get_next_rec( ...@@ -842,7 +852,8 @@ trx_purge_get_next_rec(
mtr_start(&mtr); mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(space, page_no, &mtr); undo_page = trx_undo_page_get_s_latched(space, zip_size,
page_no, &mtr);
rec = undo_page + offset; rec = undo_page + offset;
rec2 = rec; rec2 = rec;
...@@ -893,7 +904,8 @@ trx_purge_get_next_rec( ...@@ -893,7 +904,8 @@ trx_purge_get_next_rec(
mtr_start(&mtr); mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(space, page_no, &mtr); undo_page = trx_undo_page_get_s_latched(space, zip_size,
page_no, &mtr);
rec = undo_page + offset; rec = undo_page + offset;
} else { } else {
......
...@@ -1094,7 +1094,8 @@ trx_undo_report_row_operation( ...@@ -1094,7 +1094,8 @@ trx_undo_report_row_operation(
mtr_start(&mtr); mtr_start(&mtr);
for (;;) { for (;;) {
undo_block = buf_page_get_gen(undo->space, page_no, RW_X_LATCH, undo_block = buf_page_get_gen(undo->space, undo->zip_size,
page_no, RW_X_LATCH,
undo->guess_block, BUF_GET, undo->guess_block, BUF_GET,
__FILE__, __LINE__, &mtr); __FILE__, __LINE__, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -1203,7 +1204,8 @@ trx_undo_get_undo_rec_low( ...@@ -1203,7 +1204,8 @@ trx_undo_get_undo_rec_low(
mtr_start(&mtr); mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(rseg->space, page_no, &mtr); undo_page = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size,
page_no, &mtr);
undo_rec = trx_undo_rec_copy(undo_page + offset, heap); undo_rec = trx_undo_rec_copy(undo_page + offset, heap);
......
...@@ -835,7 +835,7 @@ trx_roll_pop_top_rec( ...@@ -835,7 +835,7 @@ trx_roll_pop_top_rec(
ut_ad(mutex_own(&(trx->undo_mutex))); ut_ad(mutex_own(&(trx->undo_mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get_s_latched(undo->space, undo_page = trx_undo_page_get_s_latched(undo->space, undo->zip_size,
undo->top_page_no, mtr); undo->top_page_no, mtr);
offset = undo->top_offset; offset = undo->top_offset;
......
...@@ -49,6 +49,8 @@ trx_rseg_header_create( ...@@ -49,6 +49,8 @@ trx_rseg_header_create(
/* out: page number of the created segment, /* out: page number of the created segment,
FIL_NULL if fail */ FIL_NULL if fail */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint max_size, /* in: max size in pages */ ulint max_size, /* in: max size in pages */
ulint* slot_no, /* out: rseg id == slot number in trx sys */ ulint* slot_no, /* out: rseg id == slot number in trx sys */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
...@@ -63,7 +65,7 @@ trx_rseg_header_create( ...@@ -63,7 +65,7 @@ trx_rseg_header_create(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space), ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
MTR_MEMO_X_LOCK)); MTR_MEMO_X_LOCK));
sys_header = trx_sysf_get(mtr); sys_header = trx_sysf_get(mtr);
...@@ -75,7 +77,8 @@ trx_rseg_header_create( ...@@ -75,7 +77,8 @@ trx_rseg_header_create(
} }
/* Allocate a new file segment for the rollback segment */ /* Allocate a new file segment for the rollback segment */
block = fseg_create(space, 0, TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr); block = fseg_create(space, 0,
TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr);
if (block == NULL) { if (block == NULL) {
/* No space left */ /* No space left */
...@@ -90,7 +93,7 @@ trx_rseg_header_create( ...@@ -90,7 +93,7 @@ trx_rseg_header_create(
page_no = buf_block_get_page_no(block); page_no = buf_block_get_page_no(block);
/* Get the rollback segment file page */ /* Get the rollback segment file page */
rsegf = trx_rsegf_get_new(space, page_no, mtr); rsegf = trx_rsegf_get_new(space, zip_size, page_no, mtr);
/* Initialize max size field */ /* Initialize max size field */
mlog_write_ulint(rsegf + TRX_RSEG_MAX_SIZE, max_size, mlog_write_ulint(rsegf + TRX_RSEG_MAX_SIZE, max_size,
...@@ -128,6 +131,8 @@ trx_rseg_mem_create( ...@@ -128,6 +131,8 @@ trx_rseg_mem_create(
/* out, own: rollback segment object */ /* out, own: rollback segment object */
ulint id, /* in: rollback segment id */ ulint id, /* in: rollback segment id */
ulint space, /* in: space where the segment placed */ ulint space, /* in: space where the segment placed */
ulint zip_size, /* in: compressed page size in bytes
or 0 for uncompressed pages */
ulint page_no, /* in: page number of the segment header */ ulint page_no, /* in: page number of the segment header */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
...@@ -146,6 +151,7 @@ trx_rseg_mem_create( ...@@ -146,6 +151,7 @@ trx_rseg_mem_create(
rseg->id = id; rseg->id = id;
rseg->space = space; rseg->space = space;
rseg->zip_size = zip_size;
rseg->page_no = page_no; rseg->page_no = page_no;
mutex_create(&rseg->mutex, SYNC_RSEG); mutex_create(&rseg->mutex, SYNC_RSEG);
...@@ -154,7 +160,7 @@ trx_rseg_mem_create( ...@@ -154,7 +160,7 @@ trx_rseg_mem_create(
trx_sys_set_nth_rseg(trx_sys, id, rseg); trx_sys_set_nth_rseg(trx_sys, id, rseg);
rseg_header = trx_rsegf_get_new(space, page_no, mtr); rseg_header = trx_rsegf_get_new(space, zip_size, page_no, mtr);
rseg->max_size = mtr_read_ulint(rseg_header + TRX_RSEG_MAX_SIZE, rseg->max_size = mtr_read_ulint(rseg_header + TRX_RSEG_MAX_SIZE,
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
...@@ -176,7 +182,8 @@ trx_rseg_mem_create( ...@@ -176,7 +182,8 @@ trx_rseg_mem_create(
rseg->last_page_no = node_addr.page; rseg->last_page_no = node_addr.page;
rseg->last_offset = node_addr.boffset; rseg->last_offset = node_addr.boffset;
undo_log_hdr = trx_undo_page_get(rseg->space, node_addr.page, undo_log_hdr = trx_undo_page_get(rseg->space, rseg->zip_size,
node_addr.page,
mtr) + node_addr.boffset; mtr) + node_addr.boffset;
rseg->last_trx_no = mtr_read_dulint( rseg->last_trx_no = mtr_read_dulint(
...@@ -216,9 +223,13 @@ trx_rseg_list_and_array_init( ...@@ -216,9 +223,13 @@ trx_rseg_list_and_array_init(
trx_sys_set_nth_rseg(trx_sys, i, NULL); trx_sys_set_nth_rseg(trx_sys, i, NULL);
} else { } else {
ulint zip_size;
space = trx_sysf_rseg_get_space(sys_header, i, mtr); space = trx_sysf_rseg_get_space(sys_header, i, mtr);
trx_rseg_mem_create(i, space, page_no, mtr); zip_size = space ? fil_space_get_zip_size(space) : 0;
trx_rseg_mem_create(i, space, zip_size, page_no, mtr);
} }
} }
} }
...@@ -236,13 +247,14 @@ trx_rseg_create( ...@@ -236,13 +247,14 @@ trx_rseg_create(
ulint* id, /* out: rseg id */ ulint* id, /* out: rseg id */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint zip_size;
ulint page_no; ulint page_no;
trx_rseg_t* rseg; trx_rseg_t* rseg;
mtr_x_lock(fil_space_get_latch(space), mtr); mtr_x_lock(fil_space_get_latch(space, &zip_size), mtr);
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
page_no = trx_rseg_header_create(space, max_size, id, mtr); page_no = trx_rseg_header_create(space, zip_size, max_size, id, mtr);
if (page_no == FIL_NULL) { if (page_no == FIL_NULL) {
...@@ -250,7 +262,7 @@ trx_rseg_create( ...@@ -250,7 +262,7 @@ trx_rseg_create(
return(NULL); return(NULL);
} }
rseg = trx_rseg_mem_create(*id, space, page_no, mtr); rseg = trx_rseg_mem_create(*id, space, zip_size, page_no, mtr);
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
......
...@@ -136,7 +136,8 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void) ...@@ -136,7 +136,8 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void)
mtr_start(&mtr); mtr_start(&mtr);
block = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr); block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -181,7 +182,8 @@ trx_sys_create_doublewrite_buf(void) ...@@ -181,7 +182,8 @@ trx_sys_create_doublewrite_buf(void)
start_again: start_again:
mtr_start(&mtr); mtr_start(&mtr);
block = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr); block = buf_page_get(TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO,
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -268,7 +270,7 @@ start_again: ...@@ -268,7 +270,7 @@ start_again:
the page position in the tablespace, then the page the page position in the tablespace, then the page
has not been written to in doublewrite. */ has not been written to in doublewrite. */
new_block = buf_page_get(TRX_SYS_SPACE, page_no, new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no,
RW_X_LATCH, &mtr); RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(new_block, buf_block_dbg_add_level(new_block,
...@@ -849,7 +851,7 @@ trx_sysf_create( ...@@ -849,7 +851,7 @@ trx_sysf_create(
then enter the kernel: we must do it in this order to conform then enter the kernel: we must do it in this order to conform
to the latching order rules. */ to the latching order rules. */
mtr_x_lock(fil_space_get_latch(TRX_SYS_SPACE), mtr); mtr_x_lock(fil_space_get_latch(TRX_SYS_SPACE, NULL), mtr);
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
/* Create the trx sys file block in a new allocated file segment */ /* Create the trx sys file block in a new allocated file segment */
...@@ -897,7 +899,7 @@ trx_sysf_create( ...@@ -897,7 +899,7 @@ trx_sysf_create(
+ page - sys_header); + page - sys_header);
/* Create the first rollback segment in the SYSTEM tablespace */ /* Create the first rollback segment in the SYSTEM tablespace */
page_no = trx_rseg_header_create(TRX_SYS_SPACE, ULINT_MAX, &slot_no, page_no = trx_rseg_header_create(TRX_SYS_SPACE, 0, ULINT_MAX, &slot_no,
mtr); mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID); ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
ut_a(page_no != FIL_NULL); ut_a(page_no != FIL_NULL);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment