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