From 6bf2b64a97ec5a8c46018f9ceaf4acbd28d1e922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 10 May 2024 12:49:16 +0300 Subject: [PATCH] MDEV-34118 fsp_alloc_free_extent() fails to flag DB_OUT_OF_FILE_SPACE fsp_alloc_free_extent(): When applicable, set *err = DB_OUT_OF_FILE_SPACE. --- .../suite/innodb/r/temporary_table.result | 10 ++++++++++ .../suite/innodb/t/temporary_table.test | 19 +++++++++++++++++++ storage/innobase/fsp/fsp0fsp.cc | 1 + 3 files changed, 30 insertions(+) diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result index ffcee726f0d..aaa5fbbd524 100644 --- a/mysql-test/suite/innodb/r/temporary_table.result +++ b/mysql-test/suite/innodb/r/temporary_table.result @@ -801,4 +801,14 @@ CHECK TABLE t EXTENDED; Table Op Msg_type Msg_text test.t check status OK DROP TEMPORARY TABLE t; +# +# MDEV-34118 fsp_alloc_free_extent() fails to flag DB_OUT_OF_FILE_SPACE +# +SET @save_increment = @@GLOBAL.innodb_autoextend_increment; +SET GLOBAL innodb_autoextend_increment=1; +CREATE TEMPORARY TABLE t (c LONGTEXT) ENGINE=INNODB; +INSERT INTO t VALUES (REPEAT ('1',16777216)); +ERROR HY000: The table 't' is full +DROP TEMPORARY TABLE t; +SET GLOBAL innodb_autoextend_increment=@save_increment; # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test index d4e292bc6e8..36c78c5ee9c 100644 --- a/mysql-test/suite/innodb/t/temporary_table.test +++ b/mysql-test/suite/innodb/t/temporary_table.test @@ -635,4 +635,23 @@ CHECK TABLE t; CHECK TABLE t EXTENDED; DROP TEMPORARY TABLE t; +--echo # +--echo # MDEV-34118 fsp_alloc_free_extent() fails to flag DB_OUT_OF_FILE_SPACE +--echo # +SET @save_increment = @@GLOBAL.innodb_autoextend_increment; +SET GLOBAL innodb_autoextend_increment=1; +CREATE TEMPORARY TABLE t (c LONGTEXT) ENGINE=INNODB; +if ($MTR_COMBINATION_4K) +{ +--error ER_RECORD_FILE_FULL +INSERT INTO t VALUES (REPEAT ('1',16777216)); +} +if (!$MTR_COMBINATION_4K) +{ +INSERT INTO t VALUES (REPEAT ('1',16777216)); +--echo ERROR HY000: The table 't' is full +} +DROP TEMPORARY TABLE t; +SET GLOBAL innodb_autoextend_increment=@save_increment; + --echo # End of 10.6 tests diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 314a3ae6952..457fbed2408 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -967,6 +967,7 @@ corrupted: first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE + header->page.frame); if (first.page == FIL_NULL) { + *err = DB_OUT_OF_FILE_SPACE; return nullptr; /* No free extents left */ } if (first.page >= space->free_limit) {