Commit aa22981d authored by Jan Lindström's avatar Jan Lindström

MDEV-12741: innodb.ibuf_not_empty failed in buildbot with "InnoDB: Trying to...

MDEV-12741: innodb.ibuf_not_empty failed in buildbot with "InnoDB: Trying to do I/O to a tablespace which does not exist"

Background thread is doing ibuf merge, in buf0rea.cc buf_read_ibuf_merge_pages().
It first tries to get page_size and if space is not found it deletes them, but
as we do not hold any mutexes, space can be marked as stopped between that
and buf_read_page_low() for same space. This naturally leads seen error
message on log.

buf_read_page_low(): Add parameter ignore_missing_space = false that
is passed to fil_io()

buf_read_ibuf_merge_pages(): call buf_read_page_low with
ignore_missing_space = true, this function will handle missing
space error code after buf_read_page_low returns.

fil_io(): if ignore_missing_space = true do not print error
message about trying to do I/0 for missing space, just return
correct error code that is handled later.
parent 0e45edf3
...@@ -105,6 +105,7 @@ flag is cleared and the x-lock released by an i/o-handler thread. ...@@ -105,6 +105,7 @@ flag is cleared and the x-lock released by an i/o-handler thread.
@param[in] mode BUF_READ_IBUF_PAGES_ONLY, ..., @param[in] mode BUF_READ_IBUF_PAGES_ONLY, ...,
@param[in] page_id page id @param[in] page_id page id
@param[in] unzip true=request uncompressed page @param[in] unzip true=request uncompressed page
@param[in] ignore_missing_space true=ignore missing space when reading
@return 1 if a read request was queued, 0 if the page already resided @return 1 if a read request was queued, 0 if the page already resided
in buf_pool, or if the page is in the doublewrite buffer blocks in in buf_pool, or if the page is in the doublewrite buffer blocks in
which case it is never read into the pool, or if the tablespace does which case it is never read into the pool, or if the tablespace does
...@@ -118,7 +119,8 @@ buf_read_page_low( ...@@ -118,7 +119,8 @@ buf_read_page_low(
ulint mode, ulint mode,
const page_id_t& page_id, const page_id_t& page_id,
const page_size_t& page_size, const page_size_t& page_size,
bool unzip) bool unzip,
bool ignore_missing_space = false)
{ {
buf_page_t* bpage; buf_page_t* bpage;
...@@ -178,7 +180,7 @@ buf_read_page_low( ...@@ -178,7 +180,7 @@ buf_read_page_low(
*err = fil_io( *err = fil_io(
request, sync, page_id, page_size, 0, page_size.physical(), request, sync, page_id, page_size, 0, page_size.physical(),
dst, bpage); dst, bpage, ignore_missing_space);
if (sync) { if (sync) {
thd_wait_end(NULL); thd_wait_end(NULL);
...@@ -847,7 +849,7 @@ buf_read_ibuf_merge_pages( ...@@ -847,7 +849,7 @@ buf_read_ibuf_merge_pages(
sync && (i + 1 == n_stored), sync && (i + 1 == n_stored),
0, 0,
BUF_READ_ANY_PAGE, page_id, page_size, BUF_READ_ANY_PAGE, page_id, page_size,
true); true, true /* ignore_missing_space */);
switch(err) { switch(err) {
case DB_SUCCESS: case DB_SUCCESS:
......
...@@ -5158,6 +5158,7 @@ fil_report_invalid_page_access( ...@@ -5158,6 +5158,7 @@ fil_report_invalid_page_access(
aligned aligned
@param[in] message message for aio handler if non-sync aio @param[in] message message for aio handler if non-sync aio
used, else ignored used, else ignored
@param[in] ignore_missing_space true=ignore missing space duging read
@return DB_SUCCESS, DB_TABLESPACE_DELETED or DB_TABLESPACE_TRUNCATED @return DB_SUCCESS, DB_TABLESPACE_DELETED or DB_TABLESPACE_TRUNCATED
if we are trying to do i/o on a tablespace which does not exist */ if we are trying to do i/o on a tablespace which does not exist */
dberr_t dberr_t
...@@ -5169,7 +5170,8 @@ fil_io( ...@@ -5169,7 +5170,8 @@ fil_io(
ulint byte_offset, ulint byte_offset,
ulint len, ulint len,
void* buf, void* buf,
void* message) void* message,
bool ignore_missing_space)
{ {
os_offset_t offset; os_offset_t offset;
IORequest req_type(type); IORequest req_type(type);
...@@ -5248,7 +5250,7 @@ fil_io( ...@@ -5248,7 +5250,7 @@ fil_io(
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system->mutex);
if (!req_type.ignore_missing()) { if (!req_type.ignore_missing() && !ignore_missing_space) {
ib::error() ib::error()
<< "Trying to do I/O to a tablespace which" << "Trying to do I/O to a tablespace which"
" does not exist. I/O type: " " does not exist. I/O type: "
......
...@@ -1224,7 +1224,7 @@ fil_space_get_n_reserved_extents( ...@@ -1224,7 +1224,7 @@ fil_space_get_n_reserved_extents(
aligned aligned
@param[in] message message for aio handler if non-sync aio @param[in] message message for aio handler if non-sync aio
used, else ignored used, else ignored
@param[in] ignore_missing_space true=ignore missing space during read
@return DB_SUCCESS, DB_TABLESPACE_DELETED or DB_TABLESPACE_TRUNCATED @return DB_SUCCESS, DB_TABLESPACE_DELETED or DB_TABLESPACE_TRUNCATED
if we are trying to do i/o on a tablespace which does not exist */ if we are trying to do i/o on a tablespace which does not exist */
dberr_t dberr_t
...@@ -1236,7 +1236,9 @@ fil_io( ...@@ -1236,7 +1236,9 @@ fil_io(
ulint byte_offset, ulint byte_offset,
ulint len, ulint len,
void* buf, void* buf,
void* message); void* message,
bool ignore_missing_space = false);
/**********************************************************************//** /**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided handler for completed requests. The aio array of pending requests is divided
......
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