Skip to content

Commit

Permalink
MDEV-12741: innodb.ibuf_not_empty failed in buildbot with "InnoDB: Tr…
Browse files Browse the repository at this point in the history
…ying 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.
  • Loading branch information
Jan Lindström committed Aug 31, 2017
1 parent 0e45edf commit aa22981
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 5 additions & 3 deletions storage/innobase/buf/buf0rea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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] page_id page id
@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
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
Expand All @@ -118,7 +119,8 @@ buf_read_page_low(
ulint mode,
const page_id_t& page_id,
const page_size_t& page_size,
bool unzip)
bool unzip,
bool ignore_missing_space = false)
{
buf_page_t* bpage;

Expand Down Expand Up @@ -178,7 +180,7 @@ buf_read_page_low(

*err = fil_io(
request, sync, page_id, page_size, 0, page_size.physical(),
dst, bpage);
dst, bpage, ignore_missing_space);

if (sync) {
thd_wait_end(NULL);
Expand Down Expand Up @@ -847,7 +849,7 @@ buf_read_ibuf_merge_pages(
sync && (i + 1 == n_stored),
0,
BUF_READ_ANY_PAGE, page_id, page_size,
true);
true, true /* ignore_missing_space */);

switch(err) {
case DB_SUCCESS:
Expand Down
6 changes: 4 additions & 2 deletions storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5158,6 +5158,7 @@ fil_report_invalid_page_access(
aligned
@param[in] message message for aio handler if non-sync aio
used, else ignored
@param[in] ignore_missing_space true=ignore missing space duging read
@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 */
dberr_t
Expand All @@ -5169,7 +5170,8 @@ fil_io(
ulint byte_offset,
ulint len,
void* buf,
void* message)
void* message,
bool ignore_missing_space)
{
os_offset_t offset;
IORequest req_type(type);
Expand Down Expand Up @@ -5248,7 +5250,7 @@ fil_io(

mutex_exit(&fil_system->mutex);

if (!req_type.ignore_missing()) {
if (!req_type.ignore_missing() && !ignore_missing_space) {
ib::error()
<< "Trying to do I/O to a tablespace which"
" does not exist. I/O type: "
Expand Down
6 changes: 4 additions & 2 deletions storage/innobase/include/fil0fil.h
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ fil_space_get_n_reserved_extents(
aligned
@param[in] message message for aio handler if non-sync aio
used, else ignored
@param[in] ignore_missing_space true=ignore missing space during read
@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 */
dberr_t
Expand All @@ -1236,7 +1236,9 @@ fil_io(
ulint byte_offset,
ulint len,
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
handler for completed requests. The aio array of pending requests is divided
Expand Down

0 comments on commit aa22981

Please sign in to comment.