Commit e05b8e86 authored by vasil's avatar vasil

branches/zip:

Move part of the code from lock_rec_print() in a separate function
buf_page_try_get() because the same functionality is needed in
INFORMATION SCHEMA code.

Approved by:	Heikki
parent 511cab19
......@@ -2212,6 +2212,51 @@ buf_page_get_known_nowait(
return(TRUE);
}
/***********************************************************************
Given a tablespace id and page number tries to get that page. If the
page is not in the buffer pool it is not loaded and NULL is returned.
Suitable for using when holding the kernel mutex. */
buf_block_t*
buf_page_try_get_func(
/*==================*/
ulint space_id,/* in: tablespace id */
ulint page_no,/* in: page number */
const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
buf_block_t* block;
ulint zip_size;
ut_ad(mtr);
zip_size = fil_space_get_zip_size(space_id);
/* If the page is not in the buffer pool, we cannot load it
because we may have the kernel mutex and ibuf operations would
break the latching order */
block = buf_page_get_gen(space_id, zip_size, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, mtr);
if (block != NULL) {
block = buf_page_get_nowait(space_id, zip_size,
page_no, RW_S_LATCH, mtr);
if (block == NULL) {
/* Let us try to get an X-latch. If the current thread
is holding an X-latch on the page, we cannot get an
S-latch. */
block = buf_page_get_nowait(space_id, zip_size, page_no,
RW_X_LATCH, mtr);
}
}
return(block);
}
/************************************************************************
Initialize some fields of a control block. */
UNIV_INLINE
......
......@@ -222,6 +222,24 @@ buf_page_get_known_nowait(
const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/***********************************************************************
Given a tablespace id and page number tries to get that page. If the
page is not in the buffer pool it is not loaded and NULL is returned.
Suitable for using when holding the kernel mutex. */
buf_block_t*
buf_page_try_get_func(
/*==================*/
ulint space_id,/* in: tablespace id */
ulint page_no,/* in: page number */
const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
#define buf_page_try_get(space_id, page_no, mtr) \
buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr);
/************************************************************************
Get read access to a compressed page (usually FIL_PAGE_TYPE_ZBLOB).
The page must be released with buf_page_release_zip(). */
......
......@@ -4247,26 +4247,7 @@ lock_rec_print(
putc('\n', file);
/* If the page is not in the buffer pool, we cannot load it
because we have the kernel mutex and ibuf operations would
break the latching order */
block = buf_page_get_gen(space, zip_size, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &mtr);
if (block) {
block = buf_page_get_nowait(space, zip_size,
page_no, RW_S_LATCH, &mtr);
if (!block) {
/* Let us try to get an X-latch. If the current thread
is holding an X-latch on the page, we cannot get an
S-latch. */
block = buf_page_get_nowait(space, zip_size, page_no,
RW_X_LATCH, &mtr);
}
}
block = buf_page_try_get(space, page_no, &mtr);
#ifdef UNIV_SYNC_DEBUG
if (block) {
......
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