summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-07-22 16:09:58 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-07-22 16:10:56 +0530
commit92014bd1c611fd27c487bcc47a7521baa435214c (patch)
tree9e447933109e89bf794168e469d7dac21e66a8d2
parentd96027c84af4a80630dd05d7f86910ae8b741181 (diff)
downloadmariadb-git-92014bd1c611fd27c487bcc47a7521baa435214c.tar.gz
MDEV-23252 Assertion failure 'req_type.is_dblwr_recover() || err == DB_SUCCESS' for page_compressed tables
- This issue is caused by a5584b13d1e04f38b843602413669591aa65c359 (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
-rw-r--r--storage/innobase/buf/buf0flu.cc8
-rw-r--r--storage/innobase/fil/fil0fil.cc6
-rw-r--r--storage/innobase/os/os0file.cc1
3 files changed, 9 insertions, 6 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 13f120414f3..a8de0ef5085 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -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)
{
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index c813bbad39f..cca2d0b93b7 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -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(
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index f30e42adeae..8c7eaf24e7e 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -4568,6 +4568,7 @@ invalid:
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) {