Commit a69cff29 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-16264: Remove IORequest::IGNORE_MISSING

After MDEV-11556, not even crash recovery should attempt to access
non-existing pages. But, buf_load() is not validating its input
and must thus be able to ignore missing pages, so that is why
buf_read_page_background() does that.
parent 80409986
......@@ -100,12 +100,11 @@ flag is cleared and the x-lock released by an i/o-handler thread.
if we are trying
to read from a non-existent tablespace
@param[in] sync true if synchronous aio is desired
@param[in] type IO type, SIMULATED, IGNORE_MISSING
@param[in] mode BUF_READ_IBUF_PAGES_ONLY, ...,
@param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0
@param[in] unzip true=request uncompressed page
@param[in] ignore_missing_space true=ignore missing space when reading
@param[in] ignore whether to ignore out-of-bounds page_id
@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
......@@ -115,12 +114,11 @@ ulint
buf_read_page_low(
dberr_t* err,
bool sync,
ulint type,
ulint mode,
const page_id_t page_id,
ulint zip_size,
bool unzip,
bool ignore_missing_space = false)
bool ignore = false)
{
buf_page_t* bpage;
......@@ -176,20 +174,17 @@ buf_read_page_low(
dst = ((buf_block_t*) bpage)->frame;
}
IORequest request(type | IORequest::READ);
*err = fil_io(
request, sync, page_id, zip_size, 0,
IORequestRead, sync, page_id, zip_size, 0,
zip_size ? zip_size : srv_page_size,
dst, bpage, ignore_missing_space);
dst, bpage, ignore);
if (sync) {
thd_wait_end(NULL);
}
if (UNIV_UNLIKELY(*err != DB_SUCCESS)) {
if (IORequest::ignore_missing(type)
|| *err == DB_TABLESPACE_DELETED) {
if (ignore || *err == DB_TABLESPACE_DELETED) {
buf_read_page_handle_error(bpage);
return(0);
}
......@@ -344,7 +339,6 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf)
if (!ibuf_bitmap_page(cur_page_id, zip_size)) {
count += buf_read_page_low(
&err, false,
0,
ibuf_mode,
cur_page_id, zip_size, false);
......@@ -404,8 +398,7 @@ dberr_t buf_read_page(const page_id_t page_id, ulint zip_size)
of the buffer pool mutex becomes an expensive bottleneck. */
count = buf_read_page_low(
&err, true,
0, BUF_READ_ANY_PAGE, page_id, zip_size, false);
&err, true, BUF_READ_ANY_PAGE, page_id, zip_size, false);
srv_stats.buf_pool_reads.add(count);
......@@ -435,9 +428,8 @@ buf_read_page_background(const page_id_t page_id, ulint zip_size, bool sync)
count = buf_read_page_low(
&err, sync,
IORequest::IGNORE_MISSING,
BUF_READ_ANY_PAGE,
page_id, zip_size, false);
page_id, zip_size, false, true);
switch (err) {
case DB_SUCCESS:
......@@ -707,7 +699,6 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf)
if (!ibuf_bitmap_page(cur_page_id, zip_size)) {
count += buf_read_page_low(
&err, false,
0,
ibuf_mode, cur_page_id, zip_size, false);
switch (err) {
......@@ -792,20 +783,9 @@ buf_read_recv_pages(
}
dberr_t err;
if (sync && i + 1 == n_stored) {
buf_read_page_low(
&err, true,
0,
BUF_READ_ANY_PAGE,
cur_page_id, zip_size, true);
} else {
buf_read_page_low(
&err, false,
0,
BUF_READ_ANY_PAGE,
cur_page_id, zip_size, true);
}
buf_read_page_low(
&err, sync && i + 1 == n_stored,
BUF_READ_ANY_PAGE, cur_page_id, zip_size, true);
if (err == DB_DECRYPTION_FAILED || err == DB_PAGE_CORRUPTED) {
ib::error() << "Recovery failed to read or decrypt "
......
......@@ -4097,7 +4097,7 @@ inline void IORequest::set_fil_node(fil_node_t* node)
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
@param[in] ignore whether to ignore out-of-bounds page_id
@return DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace which does not exist */
dberr_t
......@@ -4110,7 +4110,7 @@ fil_io(
ulint len,
void* buf,
void* message,
bool ignore_missing_space)
bool ignore)
{
os_offset_t offset;
IORequest req_type(type);
......@@ -4181,7 +4181,7 @@ fil_io(
mutex_exit(&fil_system.mutex);
if (!req_type.ignore_missing() && !ignore_missing_space) {
if (!ignore) {
ib::error()
<< "Trying to do I/O to a tablespace which"
" does not exist. I/O type: "
......@@ -4199,8 +4199,7 @@ fil_io(
for (;;) {
if (node == NULL) {
if (req_type.ignore_missing()) {
if (ignore) {
mutex_exit(&fil_system.mutex);
return(DB_ERROR);
}
......@@ -4234,7 +4233,7 @@ fil_io(
&& fil_is_user_tablespace_id(space->id)) {
mutex_exit(&fil_system.mutex);
if (!req_type.ignore_missing()) {
if (!ignore) {
ib::error()
<< "Trying to do I/O to a tablespace"
" which exists without .ibd data file."
......@@ -4262,8 +4261,7 @@ fil_io(
if (node->size <= cur_page_no
&& space->id != TRX_SYS_SPACE
&& fil_type_is_data(space->purpose)) {
if (req_type.ignore_missing()) {
if (ignore) {
/* If we can tolerate the non-existent pages, we
should return with DB_ERROR and let caller decide
what to do. */
......
......@@ -1420,7 +1420,7 @@ fil_space_extend(
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
@param[in] ignore whether to ignore out-of-bounds page_id
@return DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace which does not exist */
dberr_t
......@@ -1433,7 +1433,7 @@ fil_io(
ulint len,
void* buf,
void* message,
bool ignore_missing_space = false);
bool ignore = false);
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
......
......@@ -215,12 +215,8 @@ class IORequest {
/** Disable partial read warnings */
DISABLE_PARTIAL_IO_WARNINGS = 32,
/** Ignore failed reads of non-existent pages */
IGNORE_MISSING = 128,
/** Use punch hole if available*/
PUNCH_HOLE = 256,
PUNCH_HOLE = 64,
};
/** Default constructor */
......@@ -269,13 +265,6 @@ class IORequest {
/** Destructor */
~IORequest() { }
/** @return true if ignore missing flag is set */
static bool ignore_missing(ulint type)
MY_ATTRIBUTE((warn_unused_result))
{
return((type & IGNORE_MISSING) == IGNORE_MISSING);
}
/** @return true if it is a read request */
bool is_read() const
MY_ATTRIBUTE((warn_unused_result))
......@@ -317,13 +306,6 @@ class IORequest {
m_type |= DISABLE_PARTIAL_IO_WARNINGS;
}
/** @return true if missing files should be ignored */
bool ignore_missing() const
MY_ATTRIBUTE((warn_unused_result))
{
return(ignore_missing(m_type));
}
/** @return true if punch hole should be used */
bool punch_hole() const
MY_ATTRIBUTE((warn_unused_result))
......
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