Commit a782c1cc authored by marko's avatar marko

branches/zip: When identifying insert buffer bitmap pages, note that the

pages occur every zip_size pages in compressed tablespaces, instead of
UNIV_PAGESIZE (or XDES_DESCRIBED_PER_PAGE).

ibuf_bitmap_page(): Add parameter zip_size.

ibuf_fixed_addr_page(): Add parameter space.
parent 1dd4d568
......@@ -1759,7 +1759,7 @@ buf_page_init_for_read(
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
/* It is a read-ahead within an ibuf routine */
ut_ad(!ibuf_bitmap_page(offset));
ut_ad(!ibuf_bitmap_page(zip_size, offset));
ut_ad(ibuf_inside());
mtr_start(&mtr);
......
......@@ -108,7 +108,8 @@ buf_read_page_low(
sync = TRUE;
}
#endif
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
if (ibuf_bitmap_page(zip_size, offset)
|| trx_sys_hdr_page(space, offset)) {
/* Trx sys header is so low in the latching order that we play
safe and do not leave the i/o-completion to an asynchronous
......@@ -203,7 +204,10 @@ buf_read_ahead_random(
return(0);
}
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
zip_size = fil_space_get_zip_size(space);
if (ibuf_bitmap_page(zip_size, offset)
|| trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
no read-ahead, as that could break the ibuf page access
......@@ -212,8 +216,6 @@ buf_read_ahead_random(
return(0);
}
zip_size = fil_space_get_zip_size(space);
/* Remember the tablespace version before we ask te tablespace size
below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
do not try to read outside the bounds of the tablespace! */
......@@ -280,7 +282,7 @@ buf_read_ahead_random(
/* It is only sensible to do read-ahead in the non-sync aio
mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) {
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size,
......@@ -409,20 +411,11 @@ buf_read_ahead_linear(
ulint err;
ulint i;
if (srv_startup_is_before_trx_rollback_phase) {
if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {
/* No read-ahead to avoid thread deadlocks */
return(0);
}
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
no read-ahead, as that could break the ibuf page access
order */
return(0);
}
low = (offset / BUF_READ_AHEAD_LINEAR_AREA)
* BUF_READ_AHEAD_LINEAR_AREA;
high = (offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
......@@ -436,6 +429,16 @@ buf_read_ahead_linear(
zip_size = fil_space_get_zip_size(space);
if (ibuf_bitmap_page(zip_size, offset)
|| trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
no read-ahead, as that could break the ibuf page access
order */
return(0);
}
/* Remember the tablespace version before we ask te tablespace size
below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
do not try to read outside the bounds of the tablespace! */
......@@ -573,7 +576,7 @@ buf_read_ahead_linear(
/* It is only sensible to do read-ahead in the non-sync
aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) {
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size,
......
......@@ -4011,7 +4011,8 @@ fil_io(
#ifndef UNIV_LOG_DEBUG
/* ibuf bitmap pages must be read in the sync aio mode: */
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
|| !ibuf_bitmap_page(block_offset) || sync || is_log);
|| !ibuf_bitmap_page(fil_space_get_zip_size(space_id),
block_offset) || sync || is_log);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
|| ibuf_page(space_id, block_offset));
......
......@@ -952,14 +952,11 @@ ibool
ibuf_fixed_addr_page(
/*=================*/
/* out: TRUE if a fixed address ibuf i/o page */
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
if ((ibuf_bitmap_page(page_no))
|| (page_no == IBUF_TREE_ROOT_PAGE_NO)) {
return(TRUE);
}
return(FALSE);
return((space == 0 && page_no == IBUF_TREE_ROOT_PAGE_NO)
|| ibuf_bitmap_page(fil_space_get_zip_size(space), page_no));
}
/***************************************************************************
......@@ -983,7 +980,7 @@ ibuf_page(
return(FALSE);
}
if (ibuf_fixed_addr_page(page_no)) {
if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE);
}
......@@ -1031,7 +1028,7 @@ ibuf_page_low(
return(FALSE);
}
#endif
if (ibuf_fixed_addr_page(page_no)) {
if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE);
}
......@@ -3073,7 +3070,7 @@ ibuf_merge_or_delete_for_page(
return;
}
#endif
if (ibuf_fixed_addr_page(page_no) || fsp_descr_page(page_no)
if (ibuf_fixed_addr_page(space, page_no) || fsp_descr_page(page_no)
|| trx_sys_hdr_page(space, page_no)) {
return;
}
......
......@@ -155,6 +155,8 @@ ibool
ibuf_bitmap_page(
/*=============*/
/* out: TRUE if a bitmap page */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
ulint page_no);/* in: page number */
/***************************************************************************
Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. */
......
......@@ -112,14 +112,19 @@ ibool
ibuf_bitmap_page(
/*=============*/
/* out: TRUE if a bitmap page */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
ulint page_no)/* in: page number */
{
if (page_no % XDES_DESCRIBED_PER_PAGE == FSP_IBUF_BITMAP_OFFSET) {
ut_ad(!(zip_size & (zip_size - 1))); /* must be a power of 2 */
return(TRUE);
if (!zip_size) {
return(UNIV_UNLIKELY((page_no & (UNIV_PAGE_SIZE - 1))
== FSP_IBUF_BITMAP_OFFSET));
}
return(FALSE);
return(UNIV_UNLIKELY((page_no & (zip_size - 1))
== FSP_IBUF_BITMAP_OFFSET));
}
/*************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment