From 979ce5f392f0651833dea8f0332ee2a533a7da6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 28 Oct 2025 11:20:43 +0200 Subject: [PATCH 001/119] MDEV-37306: buf_zip_decompress() is noisy on all-zero page When a page is being requested from buf_page_get_gen() with mode=BUF_GET_POSSIBLY_FREED, it is very well possible that the page had been marked as freed in the tablespace and had never been written back to the tablespace. buf_page_t::read_complete(): Validate the page identifier before invoking buf_zip_decompress(), to avoid noisy messages or debug assertion failures on an obviously invalid page. Reviewed by: Thirunarayanan Balathandayuthapani Tested by: Saahil Alam --- storage/innobase/buf/buf0buf.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 33dd8dc75cc..c053970b090 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3699,19 +3699,6 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) noexcept goto database_corrupted; } - if (belongs_to_unzip_LRU()) - { - buf_pool.n_pend_unzip++; - auto ok= buf_zip_decompress(reinterpret_cast(this), false); - buf_pool.n_pend_unzip--; - - if (!ok) - { - err= DB_PAGE_CORRUPTED; - goto database_corrupted_compressed; - } - } - { const page_id_t read_id(mach_read_from_4(read_frame + FIL_PAGE_SPACE_ID), mach_read_from_4(read_frame + FIL_PAGE_OFFSET)); @@ -3752,6 +3739,19 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) noexcept } } + if (belongs_to_unzip_LRU()) + { + buf_pool.n_pend_unzip++; + auto ok= buf_zip_decompress(reinterpret_cast(this), false); + buf_pool.n_pend_unzip--; + + if (!ok) + { + err= DB_PAGE_CORRUPTED; + goto database_corrupted_compressed; + } + } + err= buf_page_check_corrupt(this, node); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { From e80998281aa1551f12a6b86cb3765796130d822d Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 29 Oct 2025 12:08:45 +0530 Subject: [PATCH 002/119] MDEV-37558 Multi-batch recovery discards needed doublewrite pages Problem: ======= In multi-batch recovery, pages with LSN > recv_sys.scanned_lsn are discarded from doublewrite buffer. Later when reading a corrupted page from disk, corresponding dblwr page is no longer available. This leads to failure of InnoDB recovery. Solution: ========= In buf_dblwr_t::recover(): Replace recv_sys.scanned_lsn with max_lsn when checking if a page's LSN is within the recovery range. --- storage/innobase/buf/buf0dblwr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index dc8d5e506c5..3f26fe23cee 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -384,7 +384,7 @@ void buf_dblwr_t::recover() noexcept const page_t *const page= *i; const uint32_t page_no= page_get_page_no(page); const lsn_t lsn= mach_read_from_8(page + FIL_PAGE_LSN); - if (recv_sys.parse_start_lsn > lsn || lsn > recv_sys.scanned_lsn) + if (recv_sys.parse_start_lsn > lsn || lsn > max_lsn) /* Pages written before or after the recovery range are not usable. */ continue; const uint32_t space_id= page_get_space_id(page); From 66aa2501b15b7d75a4eb6bb3053c5234ffabe39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 27 Oct 2025 15:56:15 +0200 Subject: [PATCH 003/119] MDEV-37935 : Assertion `0' failed in int wsrep::transaction::before_rollback() Problem was executable comment in REPLACE that caused consistency check that is not supported for RSU and !InnoDB tables. Fix is to check is Online Schema Upgrade (OSU) method something else than TOI and if it is then table storage engine must be InnoDB or error is produced and execution returns and no consistency check is done. --- mysql-test/suite/galera/r/MDEV-37935.result | 40 +++++++++++++++++++++ mysql-test/suite/galera/t/MDEV-37935.test | 30 ++++++++++++++++ sql/sql_parse.cc | 21 ++++++----- 3 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 mysql-test/suite/galera/r/MDEV-37935.result create mode 100644 mysql-test/suite/galera/t/MDEV-37935.test diff --git a/mysql-test/suite/galera/r/MDEV-37935.result b/mysql-test/suite/galera/r/MDEV-37935.result new file mode 100644 index 00000000000..ee7d000c1bd --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-37935.result @@ -0,0 +1,40 @@ +connection node_2; +connection node_1; +SET sql_mode=''; +SET SESSION autocommit=0; +SET SESSION enforce_storage_engine=Aria; +SET WSREP_OSU_METHOD = RSU; +CREATE TABLE t1 (a TEXT) ; +Warnings: +Note 1266 Using storage engine Aria for table 't1' +Note 1266 Using storage engine Aria for table 't1' +CREATE TABLE t2 (a TEXT) ; +Warnings: +Note 1266 Using storage engine Aria for table 't2' +Note 1266 Using storage engine Aria for table 't2' +SET SESSION autocommit=1; +REPLACE INTO t2 (a) SELECT a from t1; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +SET WSREP_OSU_METHOD = TOI; +DROP TABLE t1,t2; +SET sql_mode=''; +SET SESSION autocommit=0; +SET SESSION enforce_storage_engine=MyISAM; +SET WSREP_OSU_METHOD = RSU; +CREATE TABLE t1 (a TEXT) ; +Warnings: +Note 1266 Using storage engine MyISAM for table 't1' +Note 1266 Using storage engine MyISAM for table 't1' +CREATE TABLE t2 (a TEXT) ; +Warnings: +Note 1266 Using storage engine MyISAM for table 't2' +Note 1266 Using storage engine MyISAM for table 't2' +SET SESSION autocommit=1; +REPLACE INTO t2 (a) SELECT a from t1; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +SET WSREP_OSU_METHOD = TOI; +DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MDEV-37935.test b/mysql-test/suite/galera/t/MDEV-37935.test new file mode 100644 index 00000000000..217a60c2492 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-37935.test @@ -0,0 +1,30 @@ +--source include/galera_cluster.inc +--source include/have_aria.inc + +SET sql_mode=''; +SET SESSION autocommit=0; +SET SESSION enforce_storage_engine=Aria; +SET WSREP_OSU_METHOD = RSU; +CREATE TABLE t1 (a TEXT) ; +CREATE TABLE t2 (a TEXT) ; +SET SESSION autocommit=1; +--error ER_NOT_SUPPORTED_YET +REPLACE INTO t2 (a) SELECT a from t1; +--error ER_NOT_SUPPORTED_YET +REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1; +SET WSREP_OSU_METHOD = TOI; +DROP TABLE t1,t2; + +SET sql_mode=''; +SET SESSION autocommit=0; +SET SESSION enforce_storage_engine=MyISAM; +SET WSREP_OSU_METHOD = RSU; +CREATE TABLE t1 (a TEXT) ; +CREATE TABLE t2 (a TEXT) ; +SET SESSION autocommit=1; +--error ER_NOT_SUPPORTED_YET +REPLACE INTO t2 (a) SELECT a from t1; +--error ER_NOT_SUPPORTED_YET +REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1; +SET WSREP_OSU_METHOD = TOI; +DROP TABLE t1,t2; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a66e1ec83c1..a053ac3ccdb 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4724,10 +4724,21 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) #ifdef WITH_WSREP if (wsrep && !first_table->view) { - const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type; + const handlerton *hton= first_table->table->file->partition_ht() ? + first_table->table->file->partition_ht() : + first_table->table->file->ht; + + const legacy_db_type db_type= hton->db_type; // For InnoDB we don't need to worry about anything here: if (db_type != DB_TYPE_INNODB) { + /* Only TOI allowed to !InnoDB tables */ + if (thd->variables.wsrep_OSU_method != WSREP_OSU_TOI) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine"); + break; + } + // For consistency check inserted table needs to be InnoDB if (thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK) { @@ -4737,16 +4748,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) " for InnoDB tables."); thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; } - /* Only TOI allowed to !InnoDB tables */ - if (wsrep_OSU_method_get(thd) != WSREP_OSU_TOI) - { - my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine"); - break; - } // For !InnoDB we start TOI if it is not yet started and hope for the best if (!wsrep_toi) { - /* Currently we support TOI for MyISAM only. */ + /* Currently we support TOI for MyISAM && Aria only. */ if ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) || (db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))) { From 6fea5712d12acb088f6708df2dea64df8612a333 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 30 Oct 2025 15:50:24 +0100 Subject: [PATCH 004/119] MDEV-3799 Windows WITH_ZLIB=bundled build errors with hashicorp_key_management We compile curl with vcpkg. vcpkg prefers dependencies of the vcpkg package to come from vcpkg as well. We break its logic by setting and ZLIB_LIBRARY in cmake/zlib.cmake to the static library that we compile outselves. This vcpkg check is not critical or needed when shared libraries are used. As a workaround, set CMAKE_DISABLE_FIND_PACKAGE_ZLIB when compiling hashicorp_key_management, in this case vcpkg skips the zlib check. --- plugin/hashicorp_key_management/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/hashicorp_key_management/CMakeLists.txt b/plugin/hashicorp_key_management/CMakeLists.txt index 809b480f6ac..0705760fc29 100644 --- a/plugin/hashicorp_key_management/CMakeLists.txt +++ b/plugin/hashicorp_key_management/CMakeLists.txt @@ -1,3 +1,6 @@ +IF(VCPKG_INSTALLED_DIR AND (WITH_ZLIB STREQUAL "bundled")) + SET(CMAKE_DISABLE_FIND_PACKAGE_ZLIB 1) +ENDIF() FIND_PACKAGE(CURL) IF(NOT CURL_FOUND) # Can't build plugin From 654e8440b51b1b8da09b6f72de80ba50dc0c24f9 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 30 Oct 2025 00:40:25 +0400 Subject: [PATCH 005/119] MDEV-19373 - main.old-mode failed in buildbot with wrong result Test output was affected by incompletely closed preceding connections. Wait for connections to leave I_S.PROCESSLIST before issuing SHOW PROCESSLIST. --- mysql-test/main/old-mode.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test index 177e00edce8..3d720233c50 100644 --- a/mysql-test/main/old-mode.test +++ b/mysql-test/main/old-mode.test @@ -19,6 +19,8 @@ drop table t1,t2; # # Test that SHOW PROCESSLIST doesn't have the Progress column # +let $count_sessions= 1; +source include/wait_until_count_sessions.inc; --replace_column 1 3 6