Commit 8b14f397 authored by marko's avatar marko

branches/zip: Remove some more references to XDES_DESCRIBED_PER_PAGE.

ibuf_parse_bitmap_init(), ibuf_bitmap_page_init(),
ibuf_bitmap_page_get_bits(), ibuf_bitmap_set_bits(),
ibuf_bitmap_page_no_calc(), ibuf_bitmap_get_map_page(),
xdes_calc_descriptor_page(), xdes_calc_descriptor_index(),
fsp_descr_page(): Add parameter zip_size.
parent a782c1cc
...@@ -606,14 +606,24 @@ ulint ...@@ -606,14 +606,24 @@ ulint
xdes_calc_descriptor_page( xdes_calc_descriptor_page(
/*======================*/ /*======================*/
/* out: descriptor page offset */ /* out: descriptor page offset */
ulint zip_size, /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint offset) /* in: page offset */ ulint offset) /* in: page offset */
{ {
#if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \ #if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
+ (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE) * XDES_SIZE + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
# error # error
#endif #endif
#if 1024 <= XDES_ARR_OFFSET + (1024 / FSP_EXTENT_SIZE) * XDES_SIZE
return(ut_2pow_round(offset, XDES_DESCRIBED_PER_PAGE)); # error /* extent descriptor will not fit on smallest page_zip */
#endif
ut_ad(zip_size <= XDES_ARR_OFFSET
+ (zip_size / FSP_EXTENT_SIZE) * XDES_SIZE);
if (!zip_size) {
return(ut_2pow_round(offset, UNIV_PAGE_SIZE));
} else {
return(ut_2pow_round(offset, zip_size));
}
} }
/************************************************************************ /************************************************************************
...@@ -623,10 +633,16 @@ ulint ...@@ -623,10 +633,16 @@ ulint
xdes_calc_descriptor_index( xdes_calc_descriptor_index(
/*=======================*/ /*=======================*/
/* out: descriptor index */ /* out: descriptor index */
ulint zip_size, /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint offset) /* in: page offset */ ulint offset) /* in: page offset */
{ {
return(ut_2pow_remainder(offset, XDES_DESCRIBED_PER_PAGE) / if (!zip_size) {
FSP_EXTENT_SIZE); return(ut_2pow_remainder(offset, UNIV_PAGE_SIZE)
/ FSP_EXTENT_SIZE);
} else {
return(ut_2pow_remainder(offset, zip_size) / FSP_EXTENT_SIZE);
}
} }
/************************************************************************ /************************************************************************
...@@ -652,15 +668,21 @@ xdes_get_descriptor_with_space_hdr( ...@@ -652,15 +668,21 @@ xdes_get_descriptor_with_space_hdr(
{ {
ulint limit; ulint limit;
ulint size; ulint size;
ulint zip_size;
ulint descr_page_no; ulint descr_page_no;
page_t* descr_page; page_t* descr_page;
ut_ad(mtr); ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space), ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK)); MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr,
buf_block_align(sp_header), MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains(mtr,
buf_block_align(sp_header), MTR_MEMO_PAGE_X_FIX));
/* Read free limit and space size */ /* Read free limit and space size */
limit = mtr_read_ulint(sp_header + FSP_FREE_LIMIT, MLOG_4BYTES, mtr); limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
size = mtr_read_ulint(sp_header + FSP_SIZE, MLOG_4BYTES, mtr); size = mach_read_from_4(sp_header + FSP_SIZE);
zip_size = mach_read_from_4(sp_header + FSP_PAGE_ZIP_SIZE);
/* If offset is >= size or > limit, return NULL */ /* If offset is >= size or > limit, return NULL */
...@@ -675,7 +697,7 @@ xdes_get_descriptor_with_space_hdr( ...@@ -675,7 +697,7 @@ xdes_get_descriptor_with_space_hdr(
fsp_fill_free_list(FALSE, space, sp_header, mtr); fsp_fill_free_list(FALSE, space, sp_header, mtr);
} }
descr_page_no = xdes_calc_descriptor_page(offset); descr_page_no = xdes_calc_descriptor_page(zip_size, offset);
if (descr_page_no == 0) { if (descr_page_no == 0) {
/* It is on the space header page */ /* It is on the space header page */
...@@ -690,7 +712,7 @@ xdes_get_descriptor_with_space_hdr( ...@@ -690,7 +712,7 @@ xdes_get_descriptor_with_space_hdr(
} }
return(descr_page + XDES_ARR_OFFSET return(descr_page + XDES_ARR_OFFSET
+ XDES_SIZE * xdes_calc_descriptor_index(offset)); + XDES_SIZE * xdes_calc_descriptor_index(zip_size, offset));
} }
/************************************************************************ /************************************************************************
...@@ -1304,7 +1326,7 @@ fsp_fill_free_list( ...@@ -1304,7 +1326,7 @@ fsp_fill_free_list(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(ibuf_page, &ibuf_mtr); fsp_init_file_page(ibuf_page, &ibuf_mtr);
ibuf_bitmap_page_init(ibuf_page, &ibuf_mtr); ibuf_bitmap_page_init(ibuf_page, zip_size, &ibuf_mtr);
mtr_commit(&ibuf_mtr); mtr_commit(&ibuf_mtr);
} }
...@@ -1313,8 +1335,11 @@ fsp_fill_free_list( ...@@ -1313,8 +1335,11 @@ fsp_fill_free_list(
mtr); mtr);
xdes_init(descr, mtr); xdes_init(descr, mtr);
#if XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE #if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE
# error "XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE != 0" # error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0"
#endif
#if 1024 % FSP_EXTENT_SIZE /* smallest page_zip->size */
# error "1024 % FSP_EXTENT_SIZE != 0"
#endif #endif
if (0 == i % XDES_DESCRIBED_PER_PAGE) { if (0 == i % XDES_DESCRIBED_PER_PAGE) {
......
This diff is collapsed.
...@@ -315,6 +315,8 @@ ibool ...@@ -315,6 +315,8 @@ ibool
fsp_descr_page( fsp_descr_page(
/*===========*/ /*===========*/
/* out: TRUE if a descriptor page */ /* out: TRUE if a descriptor page */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
ulint page_no);/* in: page number */ ulint page_no);/* in: page number */
/*************************************************************** /***************************************************************
Parses a redo log record of a file page init. */ Parses a redo log record of a file page init. */
......
...@@ -13,12 +13,16 @@ ibool ...@@ -13,12 +13,16 @@ ibool
fsp_descr_page( fsp_descr_page(
/*===========*/ /*===========*/
/* out: TRUE if a descriptor page */ /* out: TRUE if a descriptor page */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
ulint page_no)/* in: page number */ ulint page_no)/* in: page number */
{ {
if (page_no % XDES_DESCRIBED_PER_PAGE == FSP_XDES_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_XDES_OFFSET));
} }
return(FALSE); return(UNIV_UNLIKELY((page_no & (zip_size - 1)) == FSP_XDES_OFFSET));
} }
...@@ -53,6 +53,8 @@ void ...@@ -53,6 +53,8 @@ void
ibuf_bitmap_page_init( ibuf_bitmap_page_init(
/*==================*/ /*==================*/
page_t* page, /* in: bitmap page */ page_t* page, /* in: bitmap page */
ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/**************************************************************************** /****************************************************************************
Resets the free bits of the page in the ibuf bitmap. This is done in a Resets the free bits of the page in the ibuf bitmap. This is done in a
...@@ -268,6 +270,8 @@ ibuf_parse_bitmap_init( ...@@ -268,6 +270,8 @@ ibuf_parse_bitmap_init(
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
page_t* page, /* in: page or NULL */ 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 */ mtr_t* mtr); /* in: mtr or NULL */
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/********************************************************************** /**********************************************************************
......
...@@ -878,7 +878,8 @@ recv_parse_or_apply_log_rec_body( ...@@ -878,7 +878,8 @@ recv_parse_or_apply_log_rec_body(
} }
break; break;
case MLOG_IBUF_BITMAP_INIT: case MLOG_IBUF_BITMAP_INIT:
ptr = ibuf_parse_bitmap_init(ptr, end_ptr, page, mtr); ptr = ibuf_parse_bitmap_init(ptr, end_ptr, page,
page_zip ? page_zip->size : 0, mtr);
break; break;
case MLOG_INIT_FILE_PAGE: case MLOG_INIT_FILE_PAGE:
ptr = fsp_parse_init_file_page(ptr, end_ptr, page); ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment