Commit cdb096b6 authored by marko's avatar marko

branches/zip: Remove many fil_space_get_zip_size() calls.

ibuf_page(), ibuf_page_low(), ibuf_free_excess_pages(), ibuf_insert(),
buf_read_page(), buf_read_ahead_linear(), buf_read_recv_pages():
Add parameter zip_size.
parent 24d0bbf8
......@@ -468,8 +468,9 @@ btr_cur_search_to_nth_level(
ut_ad(cursor->thr);
if (ibuf_should_try(index, ignore_sec_unique)
&& ibuf_insert(tuple, index, space, page_no,
cursor->thr)) {
&& ibuf_insert(tuple, index, space,
dict_table_zip_size(index->table),
page_no, cursor->thr)) {
/* Insertion to the insert buffer succeeded */
cursor->flag = BTR_CUR_INSERT_TO_IBUF;
if (UNIV_LIKELY_NULL(heap)) {
......
......@@ -1185,7 +1185,8 @@ buf_page_get_gen(
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, offset));
ut_ad(!ibuf_inside()
|| ibuf_page(space, fil_space_get_zip_size(space), offset));
#endif
buf_pool->n_page_gets++;
loop:
......@@ -1217,7 +1218,7 @@ buf_page_get_gen(
return(NULL);
}
buf_read_page(space, offset);
buf_read_page(space, fil_space_get_zip_size(space), offset);
#ifdef UNIV_DEBUG
buf_dbg_counter++;
......@@ -1353,7 +1354,8 @@ buf_page_get_gen(
/* In the case of a first access, try to apply linear
read-ahead */
buf_read_ahead_linear(space, offset);
buf_read_ahead_linear(space, buf_block_get_zip_size(block),
offset);
}
#ifdef UNIV_IBUF_DEBUG
......@@ -1414,7 +1416,9 @@ buf_page_optimistic_get_func(
mutex_exit(&(buf_pool->mutex));
ut_ad(!ibuf_inside() || ibuf_page(block->space, block->offset));
ut_ad(!ibuf_inside()
|| ibuf_page(block->space, buf_block_get_zip_size(block),
block->offset));
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
......@@ -1474,8 +1478,9 @@ buf_page_optimistic_get_func(
/* In the case of a first access, try to apply linear
read-ahead */
buf_read_ahead_linear(page_get_space_id(guess),
page_get_page_no(guess));
buf_read_ahead_linear(buf_block_get_space(block),
buf_block_get_zip_size(block),
buf_block_get_page_no(block));
}
#ifdef UNIV_IBUF_DEBUG
......@@ -1740,7 +1745,7 @@ buf_page_init_for_read(
mtr_start(&mtr);
if (!ibuf_page_low(space, offset, &mtr)) {
if (!ibuf_page_low(space, zip_size, offset, &mtr)) {
mtr_commit(&mtr);
......
......@@ -170,11 +170,11 @@ buf_read_ahead_random(
the page at the given page number does not get
read even if we return a value > 0! */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint offset) /* in: page number of a page which the current thread
wants to access */
{
ib_longlong tablespace_version;
ulint zip_size;
buf_block_t* block;
ulint recent_blocks = 0;
ulint count;
......@@ -189,10 +189,8 @@ buf_read_ahead_random(
return(0);
}
zip_size = fil_space_get_zip_size(space);
if (ibuf_bitmap_page(zip_size, offset)
|| trx_sys_hdr_page(space, 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
......@@ -317,18 +315,17 @@ buf_read_page(
/* out: number of page read requests issued: this can
be > 1 if read-ahead occurred */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint offset) /* in: page number */
{
ib_longlong tablespace_version;
ulint zip_size;
ulint count;
ulint count2;
ulint err;
zip_size = fil_space_get_zip_size(space);
tablespace_version = fil_space_get_version(space);
count = buf_read_ahead_random(space, offset);
count = buf_read_ahead_random(space, zip_size, offset);
/* We do the i/o in the synchronous aio mode to save thread
switches: hence TRUE */
......@@ -381,11 +378,11 @@ buf_read_ahead_linear(
/*==================*/
/* out: number of page read requests issued */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint offset) /* in: page number of a page; NOTE: the current thread
must want access to this page (see NOTE 3 above) */
{
ib_longlong tablespace_version;
ulint zip_size;
buf_block_t* block;
buf_frame_t* frame;
buf_block_t* pred_block = NULL;
......@@ -416,10 +413,8 @@ buf_read_ahead_linear(
return(0);
}
zip_size = fil_space_get_zip_size(space);
if (ibuf_bitmap_page(zip_size, offset)
|| trx_sys_hdr_page(space, 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
......@@ -688,16 +683,22 @@ Issues read requests for pages which recovery wants to read in. */
void
buf_read_recv_pages(
/*================*/
ibool sync, /* in: TRUE if the caller wants this function
to wait for the highest address page to get
read in, before this function returns */
ulint space, /* in: space id */
ulint* page_nos, /* in: array of page numbers to read, with the
highest page number the last in the array */
ulint n_stored) /* in: number of page numbers in the array */
ibool sync, /* in: TRUE if the caller
wants this function to wait
for the highest address page
to get read in, before this
function returns */
ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in
bytes, or 0 */
const ulint* page_nos, /* in: array of page numbers
to read, with the highest page
number the last in the
array */
ulint n_stored) /* in: number of page numbers
in the array */
{
ib_longlong tablespace_version;
ulint zip_size;
ulint count;
ulint err;
ulint i;
......
......@@ -4237,13 +4237,13 @@ fil_io(
|| sync || is_log);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
|| ibuf_page(space_id, block_offset));
|| ibuf_page(space_id, zip_size, block_offset));
#endif
#endif
if (sync) {
mode = OS_AIO_SYNC;
} else if (type == OS_FILE_READ && !is_log
&& ibuf_page(space_id, block_offset)) {
&& ibuf_page(space_id, zip_size, block_offset)) {
mode = OS_AIO_IBUF;
} else if (is_log) {
mode = OS_AIO_LOG;
......
......@@ -2176,7 +2176,7 @@ fseg_create_general(
excess pages from the insert buffer free list */
if (space == 0) {
ibuf_free_excess_pages(space);
ibuf_free_excess_pages(0, 0);
}
}
......@@ -2730,7 +2730,7 @@ fseg_alloc_free_page_general(
excess pages from the insert buffer free list */
if (space == 0) {
ibuf_free_excess_pages(space);
ibuf_free_excess_pages(0, 0);
}
}
......
......@@ -1001,12 +1001,12 @@ ibuf_page(
/*======*/
/* out: TRUE if level 2 or level 3 page */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no)/* in: page number */
{
page_t* bitmap_page;
mtr_t mtr;
ibool ret;
ulint zip_size;
if (recv_no_ibuf_operations) {
/* Recovery is running: no ibuf operations should be
......@@ -1015,8 +1015,6 @@ ibuf_page(
return(FALSE);
}
zip_size = fil_space_get_zip_size(space);
if (ibuf_fixed_addr_page(space, zip_size, page_no)) {
return(TRUE);
......@@ -1049,15 +1047,13 @@ ibuf_page_low(
/*==========*/
/* out: TRUE if level 2 or level 3 page */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no,/* in: page number */
mtr_t* mtr) /* in: mtr which will contain an x-latch to the
bitmap page if the page is not one of the fixed
address ibuf pages */
{
page_t* bitmap_page;
ulint zip_size;
zip_size = fil_space_get_zip_size(space);
if (ibuf_fixed_addr_page(space, zip_size, page_no)) {
......@@ -1662,6 +1658,8 @@ ibuf_add_free_page(
/* out: DB_SUCCESS, or DB_STRONG_FAIL
if no space left */
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 */
{
mtr_t mtr;
......@@ -1670,7 +1668,6 @@ ibuf_add_free_page(
page_t* page;
page_t* root;
page_t* bitmap_page;
ulint zip_size;
ut_a(space == 0);
......@@ -1730,8 +1727,6 @@ ibuf_add_free_page(
/* Set the bit indicating that this page is now an ibuf tree page
(level 2 page) */
zip_size = fil_space_get_zip_size(space);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr);
ibuf_bitmap_page_set_bits(bitmap_page, page_no, zip_size,
......@@ -1752,13 +1747,14 @@ void
ibuf_remove_free_page(
/*==================*/
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 */
{
mtr_t mtr;
mtr_t mtr2;
page_t* header_page;
ulint page_no;
ulint zip_size;
page_t* page;
page_t* root;
page_t* bitmap_page;
......@@ -1853,8 +1849,6 @@ ibuf_remove_free_page(
/* Set the bit indicating that this page is no more an ibuf tree page
(level 2 page) */
zip_size = fil_space_get_zip_size(space);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr);
ibuf_bitmap_page_set_bits(bitmap_page, page_no, zip_size,
......@@ -1877,7 +1871,8 @@ file segment, and the thread did not own the fsp latch before this call. */
void
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 */
{
ibuf_data_t* ibuf_data;
ulint i;
......@@ -1928,7 +1923,7 @@ ibuf_free_excess_pages(
mutex_exit(&ibuf_mutex);
ibuf_remove_free_page(space, ibuf_data);
ibuf_remove_free_page(space, zip_size, ibuf_data);
}
}
......@@ -2564,6 +2559,7 @@ ibuf_insert_low(
dict_index_t* index, /* in: index where to insert; must not be
unique or clustered */
ulint space, /* in: space id where to insert */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no,/* in: page number where to insert */
que_thr_t* thr) /* in: query thread */
{
......@@ -2587,7 +2583,6 @@ ibuf_insert_low(
ulint page_nos[IBUF_MAX_N_PAGES_MERGED];
ulint n_stored;
ulint bits;
ulint zip_size;
mtr_t mtr;
mtr_t bitmap_mtr;
......@@ -2639,7 +2634,7 @@ ibuf_insert_low(
mutex_exit(&ibuf_pessimistic_insert_mutex);
err = ibuf_add_free_page(0, ibuf_data);
err = ibuf_add_free_page(0, zip_size, ibuf_data);
if (err == DB_STRONG_FAIL) {
......@@ -2683,8 +2678,6 @@ ibuf_insert_low(
#endif
mtr_start(&bitmap_mtr);
zip_size = fil_space_get_zip_size(space);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
zip_size, &bitmap_mtr);
......@@ -2829,6 +2822,7 @@ ibuf_insert(
dtuple_t* entry, /* in: index entry to insert */
dict_index_t* index, /* in: index where to insert */
ulint space, /* in: space id where to insert */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no,/* in: page number where to insert */
que_thr_t* thr) /* in: query thread */
{
......@@ -2846,11 +2840,11 @@ ibuf_insert(
return(FALSE);
}
err = ibuf_insert_low(BTR_MODIFY_PREV, entry, index, space, page_no,
thr);
err = ibuf_insert_low(BTR_MODIFY_PREV, entry, index,
space, zip_size, page_no, thr);
if (err == DB_FAIL) {
err = ibuf_insert_low(BTR_MODIFY_TREE, entry, index, space,
page_no, thr);
err = ibuf_insert_low(BTR_MODIFY_TREE, entry, index,
space, zip_size, page_no, thr);
}
if (err == DB_SUCCESS) {
......@@ -2973,7 +2967,7 @@ ibuf_insert_to_index_page(
"InnoDB: that table.\n", stderr);
space = page_get_space_id(page);
zip_size = fil_space_get_zip_size(space);
zip_size = buf_block_get_zip_size(block);
page_no = page_get_page_no(page);
bitmap_page = ibuf_bitmap_get_map_page(
......
......@@ -25,6 +25,7 @@ buf_read_page(
/* out: number of page read requests issued: this can
be > 1 if read-ahead occurred */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint offset);/* in: page number */
/************************************************************************
Applies linear read-ahead if in the buf_pool the page is a border page of
......@@ -55,6 +56,7 @@ buf_read_ahead_linear(
/*==================*/
/* out: number of page read requests issued */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint offset);/* in: page number of a page; NOTE: the current thread
must want access to this page (see NOTE 3 above) */
/************************************************************************
......@@ -90,13 +92,20 @@ Issues read requests for pages which recovery wants to read in. */
void
buf_read_recv_pages(
/*================*/
ibool sync, /* in: TRUE if the caller wants this function
to wait for the highest address page to get
read in, before this function returns */
ulint space, /* in: space id */
ulint* page_nos, /* in: array of page numbers to read, with the
highest page number the last in the array */
ulint n_stored); /* in: number of page numbers in the array */
ibool sync, /* in: TRUE if the caller
wants this function to wait
for the highest address page
to get read in, before this
function returns */
ulint space, /* in: space id */
ulint zip_size, /* in: compressed page size in
bytes, or 0 */
const ulint* page_nos, /* in: array of page numbers
to read, with the highest page
number the last in the
array */
ulint n_stored); /* in: number of page numbers
in the array */
/* The size in pages of the area which the read-ahead algorithms read if
invoked */
......
......@@ -153,6 +153,7 @@ ibuf_page(
/*======*/
/* out: TRUE if level 2 or level 3 page */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no);/* in: page number */
/***************************************************************************
Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. */
......@@ -162,6 +163,7 @@ ibuf_page_low(
/*==========*/
/* out: TRUE if level 2 or level 3 page */
ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no,/* in: page number */
mtr_t* mtr); /* in: mtr which will contain an x-latch to the
bitmap page if the page is not one of the fixed
......@@ -174,7 +176,8 @@ file segment, and the thread did not own the fsp latch before this call. */
void
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
page, if this is possible. Does not do insert if the index is clustered
......@@ -187,6 +190,7 @@ ibuf_insert(
dtuple_t* entry, /* in: index entry to insert */
dict_index_t* index, /* in: index where to insert */
ulint space, /* in: space id where to insert */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no,/* in: page number where to insert */
que_thr_t* thr); /* in: query thread */
/*************************************************************************
......
......@@ -1359,6 +1359,7 @@ recv_read_in_area(
/*==============*/
/* out: number of pages found */
ulint space, /* in: space */
ulint zip_size,/* in: compressed page size in bytes, or 0 */
ulint page_no)/* in: page number */
{
recv_addr_t* recv_addr;
......@@ -1390,7 +1391,7 @@ recv_read_in_area(
}
}
buf_read_recv_pages(FALSE, space, page_nos, n);
buf_read_recv_pages(FALSE, space, zip_size, page_nos, n);
/*
fprintf(stderr, "Recv pages at %lu n %lu\n", page_nos[0], n);
*/
......@@ -1416,8 +1417,6 @@ recv_apply_hashed_log_recs(
{
recv_addr_t* recv_addr;
ulint i;
ulint space;
ulint page_no;
ulint n_pages;
ibool has_printed = FALSE;
mtr_t mtr;
......@@ -1448,8 +1447,9 @@ recv_apply_hashed_log_recs(
recv_addr = HASH_GET_FIRST(recv_sys->addr_hash, i);
while (recv_addr) {
space = recv_addr->space;
page_no = recv_addr->page_no;
ulint space = recv_addr->space;
ulint zip_size = fil_space_get_zip_size(space);
ulint page_no = recv_addr->page_no;
if (recv_addr->state == RECV_NOT_PROCESSED) {
if (!has_printed) {
......@@ -1478,7 +1478,8 @@ recv_apply_hashed_log_recs(
recv_recover_page(FALSE, FALSE, block);
mtr_commit(&mtr);
} else {
recv_read_in_area(space, page_no);
recv_read_in_area(space, zip_size,
page_no);
}
mutex_enter(&(recv_sys->mutex));
......@@ -1654,9 +1655,7 @@ recv_apply_log_recs_for_backup(void)
}
/* Apply the log records to this page */
recv_recover_page(TRUE, FALSE, block->frame,
recv_addr->space,
recv_addr->page_no);
recv_recover_page(TRUE, FALSE, block);
/* Write the page back to the tablespace file using the
fil0fil.c routines */
......
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