Commit 7d2d9f04 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-20931 fixup

The merge commit 4a259572
caused a test failure on Windows. The suppression regexp
needs to accept the backslash.

fil_invalid_page_access_msg(): Simplify the implementation
and invoke sql_print_error() directly.

fil_space_t::io(): Invoke fil_invalid_page_access_msg() only from
one location.
parent 4a259572
call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes"); call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: ./test/t2.ibd"); call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: \\..test.t2\\.ibd");
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY, id INT AUTO_INCREMENT PRIMARY KEY,
not_id INT, not_id INT,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes"); call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: ./test/t2.ibd"); call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: \\..test.t2\\.ibd");
let MYSQLD_DATADIR = `SELECT @@datadir`; let MYSQLD_DATADIR = `SELECT @@datadir`;
......
...@@ -49,6 +49,7 @@ Created 10/25/1995 Heikki Tuuri ...@@ -49,6 +49,7 @@ Created 10/25/1995 Heikki Tuuri
#include "os0event.h" #include "os0event.h"
#include "sync0sync.h" #include "sync0sync.h"
#include "buf0flu.h" #include "buf0flu.h"
#include "log.h"
#ifdef UNIV_LINUX #ifdef UNIV_LINUX
# include <sys/types.h> # include <sys/types.h>
# include <sys/sysmacros.h> # include <sys/sysmacros.h>
...@@ -3217,14 +3218,17 @@ fil_space_for_table_exists_in_mem( ...@@ -3217,14 +3218,17 @@ fil_space_for_table_exists_in_mem(
/** Report information about an invalid page access. */ /** Report information about an invalid page access. */
ATTRIBUTE_COLD ATTRIBUTE_COLD
static std::string fil_invalid_page_access_msg(const char *name, static void fil_invalid_page_access_msg(bool fatal, const char *name,
os_offset_t offset, ulint len, os_offset_t offset, ulint len,
bool is_read) bool is_read)
{ {
std::stringstream ss; sql_print_error("%s%s %zu bytes at " UINT64PF
ss << "Trying to " << (is_read ? "read " : "write ") << len << " bytes at " " outside the bounds of the file: %s",
<< offset << " outside the bounds of the file: " << name; fatal ? "[FATAL] InnoDB: " : "InnoDB: ",
return ss.str(); is_read ? "Trying to read" : "Trying to write",
len, offset, name);
if (fatal)
abort();
} }
/** Update the data structures on write completion */ /** Update the data structures on write completion */
...@@ -3280,6 +3284,7 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, ...@@ -3280,6 +3284,7 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len,
} }
ulint p = static_cast<ulint>(offset >> srv_page_size_shift); ulint p = static_cast<ulint>(offset >> srv_page_size_shift);
bool fatal;
if (UNIV_LIKELY_NULL(UT_LIST_GET_NEXT(chain, node))) { if (UNIV_LIKELY_NULL(UT_LIST_GET_NEXT(chain, node))) {
ut_ad(this == fil_system.sys_space ut_ad(this == fil_system.sys_space
...@@ -3294,9 +3299,13 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, ...@@ -3294,9 +3299,13 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len,
release(); release();
return {DB_ERROR, nullptr}; return {DB_ERROR, nullptr};
} }
ib::fatal()
<< fil_invalid_page_access_msg(name, fatal = true;
offset, len, type.is_read()); fail:
fil_invalid_page_access_msg(fatal, node->name,
offset, len,
type.is_read());
return {DB_IO_ERROR, nullptr};
} }
} }
...@@ -3304,25 +3313,17 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len, ...@@ -3304,25 +3313,17 @@ fil_io_t fil_space_t::io(const IORequest &type, os_offset_t offset, size_t len,
} }
if (UNIV_UNLIKELY(node->size <= p)) { if (UNIV_UNLIKELY(node->size <= p)) {
release();
if (type.type == IORequest::READ_ASYNC) { if (type.type == IORequest::READ_ASYNC) {
release();
/* If we can tolerate the non-existent pages, we /* If we can tolerate the non-existent pages, we
should return with DB_ERROR and let caller decide should return with DB_ERROR and let caller decide
what to do. */ what to do. */
return {DB_ERROR, nullptr}; return {DB_ERROR, nullptr};
} }
if (node->space->purpose == FIL_TYPE_IMPORT) { fatal = node->space->purpose != FIL_TYPE_IMPORT;
release(); goto fail;
ib::error() << fil_invalid_page_access_msg(
node->name, offset, len, type.is_read());
return {DB_IO_ERROR, nullptr};
}
ib::fatal() << fil_invalid_page_access_msg(
node->name, offset, len, type.is_read());
} }
dberr_t err; dberr_t err;
......
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