|
|
|
@ -50,6 +50,44 @@ read-ahead is not done: this is to prevent flooding the buffer pool with |
|
|
|
i/o-fixed buffer blocks */ |
|
|
|
#define BUF_READ_AHEAD_PEND_LIMIT 2 |
|
|
|
|
|
|
|
/********************************************************************//** |
|
|
|
Unfixes the pages, unlatches the page, |
|
|
|
removes it from page_hash and removes it from LRU. */ |
|
|
|
static |
|
|
|
void |
|
|
|
buf_read_page_handle_error( |
|
|
|
/*=======================*/ |
|
|
|
buf_page_t* bpage) /*!< in: pointer to the block */ |
|
|
|
{ |
|
|
|
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); |
|
|
|
const ibool uncompressed = (buf_page_get_state(bpage) |
|
|
|
== BUF_BLOCK_FILE_PAGE); |
|
|
|
|
|
|
|
/* First unfix and release lock on the bpage */ |
|
|
|
buf_pool_mutex_enter(buf_pool); |
|
|
|
mutex_enter(buf_page_get_mutex(bpage)); |
|
|
|
ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ); |
|
|
|
ut_ad(bpage->buf_fix_count == 0); |
|
|
|
|
|
|
|
/* Set BUF_IO_NONE before we remove the block from LRU list */ |
|
|
|
buf_page_set_io_fix(bpage, BUF_IO_NONE); |
|
|
|
|
|
|
|
if (uncompressed) { |
|
|
|
rw_lock_x_unlock_gen( |
|
|
|
&((buf_block_t*) bpage)->lock, |
|
|
|
BUF_IO_READ); |
|
|
|
} |
|
|
|
|
|
|
|
/* remove the block from LRU list */ |
|
|
|
buf_LRU_free_one_page(bpage); |
|
|
|
|
|
|
|
ut_ad(buf_pool->n_pend_reads > 0); |
|
|
|
buf_pool->n_pend_reads--; |
|
|
|
|
|
|
|
mutex_exit(buf_page_get_mutex(bpage)); |
|
|
|
buf_pool_mutex_exit(buf_pool); |
|
|
|
} |
|
|
|
|
|
|
|
/********************************************************************//** |
|
|
|
Low-level function which reads a page asynchronously from a file to the |
|
|
|
buffer buf_pool if it is not already there, in which case does nothing. |
|
|
|
@ -152,12 +190,20 @@ buf_read_page_low( |
|
|
|
((buf_block_t*) bpage)->frame, bpage); |
|
|
|
} |
|
|
|
thd_wait_end(NULL); |
|
|
|
|
|
|
|
if (*err == DB_TABLESPACE_DELETED) { |
|
|
|
buf_read_page_handle_error(bpage); |
|
|
|
return(0); |
|
|
|
} |
|
|
|
|
|
|
|
ut_a(*err == DB_SUCCESS); |
|
|
|
|
|
|
|
if (sync) { |
|
|
|
/* The i/o is already completed when we arrive from |
|
|
|
fil_read */ |
|
|
|
buf_page_io_complete(bpage); |
|
|
|
if (!buf_page_io_complete(bpage)) { |
|
|
|
return(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return(1); |
|
|
|
|