MDEV-23252 Assertion failure 'req_type.is_dblwr_recover() || err ==...

MDEV-23252 Assertion failure 'req_type.is_dblwr_recover() || err == DB_SUCCESS' for page_compressed tables

- This issue is caused by a5584b13
(MDEV-15528). os_file_punch_hole() is added to fil_io() in MDEV-15528.
But it fails to handle failure of os_file_punch_hole(). InnoDB should
handle the DB_IO_NO_PUNCH_HOLE error and silently transform to
DB_SUCCESS. InnoDB should set the punch hole flag correctly when
tablespace is loaded

fil_node_t::read_page0(): Set the punch hole flag when tablespace is loaded

fil_io(): Handle the DB_IO_NO_PUNCH_HOLE error

buf_flush_free_pages(): Checks the punch hole condition earlier using
tablespace punch hole flag
parent d96027c8
......@@ -1308,7 +1308,8 @@ innodb_immediate_scrub_data_uncompressed from the freed ranges.
static void buf_flush_freed_pages(fil_space_t *space)
{
ut_ad(space != NULL);
if (!srv_immediate_scrub_data_uncompressed && !space->is_compressed())
const bool punch_hole= space->punch_hole;
if (!srv_immediate_scrub_data_uncompressed && !punch_hole)
return;
lsn_t flush_to_disk_lsn= log_sys.get_flushed_lsn();
......@@ -1322,11 +1323,6 @@ static void buf_flush_freed_pages(fil_space_t *space)
range_set freed_ranges= std::move(space->freed_ranges);
freed_lock.unlock();
const bool punch_hole=
#if defined(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) || defined(_WIN32)
space->is_compressed() ||
#endif
false;
for (const auto &range : freed_ranges)
{
......
......@@ -3903,6 +3903,12 @@ fil_io(
if (punch_hole) {
/* Punch the hole to the file */
err = os_file_punch_hole(node->handle, offset, len);
/* Punch hole is not supported, make space not to
support punch hole */
if (UNIV_UNLIKELY(err == DB_IO_NO_PUNCH_HOLE)) {
node->space->punch_hole = false;
err = DB_SUCCESS;
}
} else {
/* Queue the aio request */
err = os_aio(
......
......@@ -4568,6 +4568,7 @@ bool fil_node_t::read_page0(bool first)
space->flags = (space->flags & FSP_FLAGS_MEM_MASK) | flags;
space->punch_hole = space->is_compressed();
this->size = ulint(size_bytes / psize);
space->committed_size = space->size += this->size;
} else if (space->id != TRX_SYS_SPACE || space->size_in_header) {
......
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