From 87ae34ac834a601f7974219dbe131a13b12f3ac0 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 12 Dec 2023 08:57:11 +0100 Subject: [PATCH 01/10] galera: updating the list of disabled tests --- mysql-test/suite/galera/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4db06714bc106..72be88fd1a197 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -24,4 +24,4 @@ galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test fa mdev-31285 : MDEV-25089 Assertion `error.len > 0' failed in galera::ReplicatorSMM::handle_apply_error() galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes MW-402 : temporarily disabled at the request of Codership -MDEV-22232 : temporarily disabled at the request of Codership +galera_desync_overlapped : MDEV-21538 galera_desync_overlapped MTR failed: Result content mismatch From 148cbf2aed16062c829ab87748800c0f9d9c817f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 12 Dec 2023 09:41:53 +0200 Subject: [PATCH 02/10] MDEV-32995 : Remove not supported tests from wsrep suite Changes to be committed: modified: mysql-test/suite/wsrep/disabled.def deleted: mysql-test/suite/wsrep/r/MDEV-22443.result deleted: mysql-test/suite/wsrep/r/MDEV-23092.result deleted: mysql-test/suite/wsrep/r/mdev_6832.result deleted: mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result deleted: mysql-test/suite/wsrep/t/MDEV-22443.cnf deleted: mysql-test/suite/wsrep/t/MDEV-22443.test deleted: mysql-test/suite/wsrep/t/MDEV-23092.cnf deleted: mysql-test/suite/wsrep/t/MDEV-23092.test deleted: mysql-test/suite/wsrep/t/mdev_6832.cnf deleted: mysql-test/suite/wsrep/t/mdev_6832.test deleted: mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf deleted: mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test These test cases used feature not available anymore. Signed-off-by: Julius Goryavsky --- mysql-test/suite/wsrep/disabled.def | 4 -- mysql-test/suite/wsrep/r/MDEV-22443.result | 3 -- mysql-test/suite/wsrep/r/MDEV-23092.result | 13 ------ mysql-test/suite/wsrep/r/mdev_6832.result | 11 ----- .../r/wsrep_variables_no_provider.result | 44 ------------------- mysql-test/suite/wsrep/t/MDEV-22443.cnf | 8 ---- mysql-test/suite/wsrep/t/MDEV-22443.test | 12 ----- mysql-test/suite/wsrep/t/MDEV-23092.cnf | 8 ---- mysql-test/suite/wsrep/t/MDEV-23092.test | 22 ---------- mysql-test/suite/wsrep/t/mdev_6832.cnf | 7 --- mysql-test/suite/wsrep/t/mdev_6832.test | 17 ------- .../wsrep/t/wsrep_variables_no_provider.cnf | 12 ----- .../wsrep/t/wsrep_variables_no_provider.test | 38 ---------------- 13 files changed, 199 deletions(-) delete mode 100644 mysql-test/suite/wsrep/r/MDEV-22443.result delete mode 100644 mysql-test/suite/wsrep/r/MDEV-23092.result delete mode 100644 mysql-test/suite/wsrep/r/mdev_6832.result delete mode 100644 mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result delete mode 100644 mysql-test/suite/wsrep/t/MDEV-22443.cnf delete mode 100644 mysql-test/suite/wsrep/t/MDEV-22443.test delete mode 100644 mysql-test/suite/wsrep/t/MDEV-23092.cnf delete mode 100644 mysql-test/suite/wsrep/t/MDEV-23092.test delete mode 100644 mysql-test/suite/wsrep/t/mdev_6832.cnf delete mode 100644 mysql-test/suite/wsrep/t/mdev_6832.test delete mode 100644 mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf delete mode 100644 mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index 991109d72b8d4..f41452116809d 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -11,7 +11,3 @@ ############################################################################## -mdev_6832: wsrep_provider is read-only for security reasons -MDEV-23092: wsrep_provider is read-only for security reasons -wsrep_variables_no_provider: wsrep_provider is read-only for security reasons -MDEV-22443: it is no longer allowed enable wsrep_on if wsrep_provider is 'none' diff --git a/mysql-test/suite/wsrep/r/MDEV-22443.result b/mysql-test/suite/wsrep/r/MDEV-22443.result deleted file mode 100644 index ea07cbec5a015..0000000000000 --- a/mysql-test/suite/wsrep/r/MDEV-22443.result +++ /dev/null @@ -1,3 +0,0 @@ -SET SESSION wsrep_sync_wait=15; -SET SESSION wsrep_on=1; -START TRANSACTION READ WRITE; diff --git a/mysql-test/suite/wsrep/r/MDEV-23092.result b/mysql-test/suite/wsrep/r/MDEV-23092.result deleted file mode 100644 index d88aacf7d5c52..0000000000000 --- a/mysql-test/suite/wsrep/r/MDEV-23092.result +++ /dev/null @@ -1,13 +0,0 @@ -SET COLLATION_CONNECTION='utf16le_bin'; -SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so'; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/' -SET GLOBAL wsrep_cluster_address='OFF'; -SET GLOBAL wsrep_slave_threads=10; -SELECT 1; -1 -1 -SET GLOBAL wsrep_cluster_address='gcomm://'; -SET GLOBAL wsrep_slave_threads=DEFAULT; -CALL mtr.add_suppression("wsrep_load()"); -CALL mtr.add_suppression("Failed to create a new provider"); -CALL mtr.add_suppression("Failed to load provider"); diff --git a/mysql-test/suite/wsrep/r/mdev_6832.result b/mysql-test/suite/wsrep/r/mdev_6832.result deleted file mode 100644 index 43894a6ec4941..0000000000000 --- a/mysql-test/suite/wsrep/r/mdev_6832.result +++ /dev/null @@ -1,11 +0,0 @@ -# -# MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS -# -SHOW STATUS LIKE 'wsrep_ready'; -Variable_name Value -wsrep_ready ON -SHOW STATUS LIKE 'wsrep_ready'; -Variable_name Value -wsrep_ready OFF -SET @@global.wsrep_cluster_address='gcomm://'; -# End of test. diff --git a/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result b/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result deleted file mode 100644 index ad35dc8dbcdbb..0000000000000 --- a/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result +++ /dev/null @@ -1,44 +0,0 @@ -SELECT @@wsrep_on; -@@wsrep_on -1 -SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads; -SET @wsrep_debug_saved = @@global.wsrep_debug; -SET @wsrep_provider_options_saved= @@global.wsrep_provider_options; -SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address; -SET GLOBAL wsrep_provider=none; -SET SESSION wsrep_trx_fragment_size=DEFAULT; -ERROR HY000: Incorrect arguments to SET -SELECT @@session.wsrep_trx_fragment_size; -@@session.wsrep_trx_fragment_size -0 -SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100'; -ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100' -SHOW WARNINGS; -Level Code Message -Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded -Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100' -SELECT @@global.wsrep_start_position; -@@global.wsrep_start_position -00000000-0000-0000-0000-000000000000:-1 -SET GLOBAL wsrep_debug=1; -Warnings: -Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off -SELECT @@global.wsrep_debug; -@@global.wsrep_debug -NONE -SET GLOBAL wsrep_slave_threads=5; -SELECT @@global.wsrep_slave_threads; -@@global.wsrep_slave_threads -5 -SET GLOBAL wsrep_desync=1; -ERROR HY000: WSREP (galera) not started -SELECT @@global.wsrep_desync; -@@global.wsrep_desync -0 -SET SESSION wsrep_trx_fragment_unit='rows'; -ERROR HY000: Incorrect arguments to SET -SELECT @@session.wsrep_trx_fragment_unit; -@@session.wsrep_trx_fragment_unit -rows -SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved; -SET @@global.wsrep_debug = @wsrep_debug_saved; diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.cnf b/mysql-test/suite/wsrep/t/MDEV-22443.cnf deleted file mode 100644 index 851f2999a83f5..0000000000000 --- a/mysql-test/suite/wsrep/t/MDEV-22443.cnf +++ /dev/null @@ -1,8 +0,0 @@ -!include ../my.cnf - -[mysqld.1] -wsrep-on=OFF -binlog-format=ROW -wsrep-provider=none -wsrep-cluster-address='gcomm://' -innodb_autoinc_lock_mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.test b/mysql-test/suite/wsrep/t/MDEV-22443.test deleted file mode 100644 index 674cb5ae2d8b2..0000000000000 --- a/mysql-test/suite/wsrep/t/MDEV-22443.test +++ /dev/null @@ -1,12 +0,0 @@ -# -# MDEV-22443: terminate called after throwing an instance of -# 'wsrep::runtime_error' in std::terminate on START TRANSACTION -# - ---source include/have_innodb.inc ---source include/have_wsrep.inc ---source include/have_binlog_format_row.inc - -SET SESSION wsrep_sync_wait=15; -SET SESSION wsrep_on=1; -START TRANSACTION READ WRITE; diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.cnf b/mysql-test/suite/wsrep/t/MDEV-23092.cnf deleted file mode 100644 index 851f2999a83f5..0000000000000 --- a/mysql-test/suite/wsrep/t/MDEV-23092.cnf +++ /dev/null @@ -1,8 +0,0 @@ -!include ../my.cnf - -[mysqld.1] -wsrep-on=OFF -binlog-format=ROW -wsrep-provider=none -wsrep-cluster-address='gcomm://' -innodb_autoinc_lock_mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.test b/mysql-test/suite/wsrep/t/MDEV-23092.test deleted file mode 100644 index 92a6e3920139b..0000000000000 --- a/mysql-test/suite/wsrep/t/MDEV-23092.test +++ /dev/null @@ -1,22 +0,0 @@ -# -# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting -# invalid wsrep_provider (on optimized builds) -# - ---source include/have_innodb.inc ---source include/have_wsrep.inc ---source include/have_binlog_format_row.inc - -SET COLLATION_CONNECTION='utf16le_bin'; ---error 1231 -SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so'; -SET GLOBAL wsrep_cluster_address='OFF'; -SET GLOBAL wsrep_slave_threads=10; -SELECT 1; - -SET GLOBAL wsrep_cluster_address='gcomm://'; -SET GLOBAL wsrep_slave_threads=DEFAULT; - -CALL mtr.add_suppression("wsrep_load()"); -CALL mtr.add_suppression("Failed to create a new provider"); -CALL mtr.add_suppression("Failed to load provider"); diff --git a/mysql-test/suite/wsrep/t/mdev_6832.cnf b/mysql-test/suite/wsrep/t/mdev_6832.cnf deleted file mode 100644 index 0bf01f81fc557..0000000000000 --- a/mysql-test/suite/wsrep/t/mdev_6832.cnf +++ /dev/null @@ -1,7 +0,0 @@ -!include ../my.cnf - -[mysqld.1] -wsrep-on=ON -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep-cluster-address=gcomm:// - diff --git a/mysql-test/suite/wsrep/t/mdev_6832.test b/mysql-test/suite/wsrep/t/mdev_6832.test deleted file mode 100644 index d5303ce3fcf2d..0000000000000 --- a/mysql-test/suite/wsrep/t/mdev_6832.test +++ /dev/null @@ -1,17 +0,0 @@ ---source include/have_innodb.inc ---source include/have_wsrep_provider.inc ---source include/have_binlog_format_row.inc - ---echo # ---echo # MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS ---echo # - -SHOW STATUS LIKE 'wsrep_ready'; ---disable_query_log -eval SET @@global.wsrep_provider='$WSREP_PROVIDER'; ---enable_query_log -SHOW STATUS LIKE 'wsrep_ready'; -SET @@global.wsrep_cluster_address='gcomm://'; ---let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ---source include/wait_condition.inc ---echo # End of test. diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf deleted file mode 100644 index b73146d26e7d6..0000000000000 --- a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf +++ /dev/null @@ -1,12 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf - -[mysqld.1] -wsrep-on=ON -binlog-format=ROW -wsrep-provider=@ENV.WSREP_PROVIDER -wsrep-cluster-address='gcomm://' -#galera_port=@OPT.port -#ist_port=@OPT.port -#sst_port=@OPT.port - diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test deleted file mode 100644 index b44c9c5ebc874..0000000000000 --- a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test +++ /dev/null @@ -1,38 +0,0 @@ ---source include/have_wsrep.inc ---source include/have_innodb.inc - -SELECT @@wsrep_on; - -SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads; -SET @wsrep_debug_saved = @@global.wsrep_debug; -SET @wsrep_provider_options_saved= @@global.wsrep_provider_options; -SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address; - -SET GLOBAL wsrep_provider=none; - ---error ER_WRONG_ARGUMENTS -SET SESSION wsrep_trx_fragment_size=DEFAULT; -SELECT @@session.wsrep_trx_fragment_size; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100'; -SHOW WARNINGS; -SELECT @@global.wsrep_start_position; -SET GLOBAL wsrep_debug=1; -SELECT @@global.wsrep_debug; -SET GLOBAL wsrep_slave_threads=5; -SELECT @@global.wsrep_slave_threads; ---error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_desync=1; -SELECT @@global.wsrep_desync; ---error ER_WRONG_ARGUMENTS -SET SESSION wsrep_trx_fragment_unit='rows'; -SELECT @@session.wsrep_trx_fragment_unit; - ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; -SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved; -SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved; ---source include/galera_wait_ready.inc -SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved; -SET @@global.wsrep_debug = @wsrep_debug_saved; ---enable_query_log From ddd8a90812e8ab7675b989696023e0a9966b6409 Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Thu, 7 Dec 2023 15:35:27 +0300 Subject: [PATCH 03/10] MDEV-32964: Expect DB_INTERRUPTED from wsrep_row_upd_check_foreign_constraints Remove DB_LOCK_WAIT return code check as it should have been resolved to one of the other errors by that point. Signed-off-by: Julius Goryavsky --- storage/innobase/row/row0upd.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 58c93e4db0fa7..9a69c2948e7b2 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2486,18 +2486,18 @@ row_upd_sec_index_entry( case DB_NO_REFERENCED_ROW: err = DB_SUCCESS; break; - case DB_LOCK_WAIT: + case DB_INTERRUPTED: case DB_DEADLOCK: case DB_LOCK_WAIT_TIMEOUT: WSREP_DEBUG("Foreign key check fail: " "%s on table %s index %s query %s", - ut_strerr(err), index->name(), index->table->name.m_name, + ut_strerr(err), index->table->name.m_name, index->name(), wsrep_thd_query(trx->mysql_thd)); break; default: WSREP_ERROR("Foreign key check fail: " "%s on table %s index %s query %s", - ut_strerr(err), index->name(), index->table->name.m_name, + ut_strerr(err), index->table->name.m_name, index->name(), wsrep_thd_query(trx->mysql_thd)); break; } @@ -2506,7 +2506,7 @@ row_upd_sec_index_entry( } #ifdef WITH_WSREP - ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT + ut_ad(err == DB_SUCCESS || err == DB_INTERRUPTED || err == DB_DEADLOCK || err == DB_LOCK_WAIT_TIMEOUT); #else ut_ad(err == DB_SUCCESS); From 0e1f4bd6610d2363982b0d0db918725d3d643753 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 12 Oct 2023 15:40:13 +0200 Subject: [PATCH 04/10] MDEV-31272 Statement rollback causes empty writeset replication This patch fixes cases where a transaction caused empty writeset to be replicated. This could happen in the case where a transaction executes a statement that initially manages to modify some data and therefore appended keys some for certification. The statement is however rolled back at some later stage due to some error (for example, a duplicate key error). After statement rollback the transaction is still alive, has no other changes. When committing such transaction, an empty writeset was replicated through Galera. The fix is to avoid calling into commit hook only when transaction has appended one or keys for certification *and* has some data in binlog cache to replicate. Otherwise, the commit is considered empty, and goes through usual empty commit path. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-31272.result | 36 ++++++++++++ .../suite/galera/t/MDEV-31272.combinations | 5 ++ mysql-test/suite/galera/t/MDEV-31272.test | 58 +++++++++++++++++++ sql/log.cc | 9 +++ sql/log.h | 1 + sql/wsrep_trans_observer.h | 8 ++- 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/galera/r/MDEV-31272.result create mode 100644 mysql-test/suite/galera/t/MDEV-31272.combinations create mode 100644 mysql-test/suite/galera/t/MDEV-31272.test diff --git a/mysql-test/suite/galera/r/MDEV-31272.result b/mysql-test/suite/galera/r/MDEV-31272.result new file mode 100644 index 0000000000000..e8469bc75c0db --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-31272.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 int primary key, f2 int); +INSERT INTO t1 VALUES (1,0); +BEGIN; +INSERT INTO t1 VALUES (2,4),(1,1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +COMMIT; +Writesets replicated (expect 0) +0 +connection node_1; +SELECT * FROM t1; +f1 f2 +1 0 +connection node_2; +SELECT * FROM t1; +f1 f2 +1 0 +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,4), (1,1); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +Writesets replicated (expect 0) +0 +connection node_1; +SELECT * FROM t1; +f1 f2 +1 0 +connection node_2; +SELECT * FROM t1; +f1 f2 +1 0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-31272.combinations b/mysql-test/suite/galera/t/MDEV-31272.combinations new file mode 100644 index 0000000000000..def4dda7def7c --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-31272.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates=ON + +[binlogoff] diff --git a/mysql-test/suite/galera/t/MDEV-31272.test b/mysql-test/suite/galera/t/MDEV-31272.test new file mode 100644 index 0000000000000..d2c823788a0d8 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-31272.test @@ -0,0 +1,58 @@ +# +# MDEV-31272: Statement rollback causes empty writeset replication +# + +--source include/galera_cluster.inc + +# +# Case 1: Multi statement transaction +# +--connection node_1 +CREATE TABLE t1 (f1 int primary key, f2 int); +INSERT INTO t1 VALUES (1,0); + +--let $replicated_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'` + +BEGIN; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (2,4),(1,1); +COMMIT; + +--let $replicated_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'` + +--disable_query_log +--eval SELECT $replicated_new - $replicated_old AS 'Writesets replicated (expect 0)'; +--enable_query_log + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +DROP TABLE t1; + + +# +# Case 2: autocommit statement +# +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER); +INSERT INTO t1 VALUES (1,0); + +--let $replicated_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'` + +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (2,4), (1,1); + +--let $replicated_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'` + +--disable_query_log +--eval SELECT $replicated_new - $replicated_old AS 'Writesets replicated (expect 0)'; +--enable_query_log + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/sql/log.cc b/sql/log.cc index 59730c3205ae1..ba5ebfbfabbcb 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -10894,6 +10894,15 @@ IO_CACHE *wsrep_get_cache(THD * thd, bool is_transactional) return NULL; } +bool wsrep_is_binlog_cache_empty(THD *thd) +{ + binlog_cache_mngr *cache_mngr= + (binlog_cache_mngr *) thd_get_ha_data(thd, binlog_hton); + if (cache_mngr) + return cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty(); + return true; +} + void wsrep_thd_binlog_trx_reset(THD * thd) { DBUG_ENTER("wsrep_thd_binlog_trx_reset"); diff --git a/sql/log.h b/sql/log.h index 48169be0d68e4..cb3f205c1e95f 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1240,6 +1240,7 @@ static inline TC_LOG *get_tc_log_implementation() #ifdef WITH_WSREP IO_CACHE* wsrep_get_cache(THD *, bool); +bool wsrep_is_binlog_cache_empty(THD *); void wsrep_thd_binlog_trx_reset(THD * thd); void wsrep_thd_binlog_stmt_rollback(THD * thd); #endif /* WITH_WSREP */ diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index cf5063df04dd9..5c5dc6fd174cd 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -88,7 +88,13 @@ static inline bool wsrep_is_real(THD* thd, bool all) */ static inline bool wsrep_has_changes(THD* thd) { - return (thd->wsrep_trx().is_empty() == false); + // Transaction has changes to replicate if it + // has appended one or more certification keys, + // and has actual changes to replicate in binlog + // cache. Except for streaming replication, + // where commit message may have no payload. + return !thd->wsrep_trx().is_empty() && + (!wsrep_is_binlog_cache_empty(thd) || thd->wsrep_trx().is_streaming()); } /* From 2b8c59fffaaf33455d2a226ecc209b5763c2b7bf Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 20 Dec 2023 14:51:00 +0300 Subject: [PATCH 05/10] Fix main.type_timestamp: Change 10.10 in "End of 10.10 tests" to 10.5 --- mysql-test/main/type_timestamp.result | 2 +- mysql-test/main/type_timestamp.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index c78619fe58597..f95a1d6ae3904 100644 --- a/mysql-test/main/type_timestamp.result +++ b/mysql-test/main/type_timestamp.result @@ -1368,5 +1368,5 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # -# End of 10.10 tests +# End of 10.5 tests # diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index abff4e69c2254..526a0e6985754 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -921,5 +921,5 @@ show create table t1; drop table t1; --echo # ---echo # End of 10.10 tests +--echo # End of 10.5 tests --echo # From 96e49c76a8f57a74e5d41322628b2fa5eea48739 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 20 Dec 2023 14:20:40 +0100 Subject: [PATCH 06/10] Revert "MDEV-32964: Expect DB_INTERRUPTED from wsrep_row_upd_check_foreign_constraints" This reverts commit ddd8a90812e8ab7675b989696023e0a9966b6409 (additional correction required) --- storage/innobase/row/row0upd.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 9a69c2948e7b2..58c93e4db0fa7 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2486,18 +2486,18 @@ row_upd_sec_index_entry( case DB_NO_REFERENCED_ROW: err = DB_SUCCESS; break; - case DB_INTERRUPTED: + case DB_LOCK_WAIT: case DB_DEADLOCK: case DB_LOCK_WAIT_TIMEOUT: WSREP_DEBUG("Foreign key check fail: " "%s on table %s index %s query %s", - ut_strerr(err), index->table->name.m_name, index->name(), + ut_strerr(err), index->name(), index->table->name.m_name, wsrep_thd_query(trx->mysql_thd)); break; default: WSREP_ERROR("Foreign key check fail: " "%s on table %s index %s query %s", - ut_strerr(err), index->table->name.m_name, index->name(), + ut_strerr(err), index->name(), index->table->name.m_name, wsrep_thd_query(trx->mysql_thd)); break; } @@ -2506,7 +2506,7 @@ row_upd_sec_index_entry( } #ifdef WITH_WSREP - ut_ad(err == DB_SUCCESS || err == DB_INTERRUPTED + ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT || err == DB_DEADLOCK || err == DB_LOCK_WAIT_TIMEOUT); #else ut_ad(err == DB_SUCCESS); From cfaab614ea9bf0df4b5398c5d51f18cda8a9a00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 19 Dec 2023 10:03:54 +0200 Subject: [PATCH 07/10] MDEV-24481 : galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed Improve test case to wait until cluster membership is correct. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera_3nodes/disabled.def | 1 - .../r/galera_vote_rejoin_mysqldump.result | 12 +++++------ .../t/galera_vote_rejoin_mysqldump.test | 21 +++++++++---------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 356f9dddb47a7..730f98667e652 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -12,7 +12,6 @@ galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)' -galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message galera_ipv6_mariabackup : temporarily disabled at the request of Codership galera_pc_bootstrap : temporarily disabled at the request of Codership diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result index e49a1714a3edf..cacf1298058f6 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result @@ -39,6 +39,9 @@ SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STAT expect_Disconnected Disconnected SET SESSION wsrep_on=ON; +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +expect_3 +3 SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; expect_Primary Primary @@ -49,17 +52,11 @@ t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci connection node_2; -SET SESSION wsrep_on=OFF; -SET SESSION wsrep_on=ON; -# restart SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci -SELECT COUNT(*) AS expect_0 FROM t1; -expect_0 -0 CALL mtr.add_suppression("is inconsistent with group"); connection node_3; SHOW CREATE TABLE t1; @@ -81,3 +78,6 @@ CALL mtr.add_suppression("Can't open and lock privilege tables"); CALL mtr.add_suppression("Info table is not ready to be used"); CALL mtr.add_suppression("Native table .* has the wrong structure"); CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist"); +connection node_2; +# restart +connection node_1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test index 70d58cb25f4d1..6c7b255bdc3f5 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test @@ -59,6 +59,7 @@ SET SESSION wsrep_on=ON; --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc +SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; # Confirm that the table is now identical throughout @@ -67,18 +68,7 @@ SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WH SHOW CREATE TABLE t1; --connection node_2 -SET SESSION wsrep_on=OFF; ---let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ---source include/wait_condition.inc ---source include/galera_wait_ready.inc -SET SESSION wsrep_on=ON; - -# restart node so we don't fail on WSREP_START_POSITION internal check ---source include/restart_mysqld.inc ---source include/wait_until_connected_again.inc - SHOW CREATE TABLE t1; -SELECT COUNT(*) AS expect_0 FROM t1; CALL mtr.add_suppression("is inconsistent with group"); --connection node_3 @@ -89,5 +79,14 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that col --connection node_1 --source suite/galera/include/galera_sst_restore.inc +--connection node_2 +# restart node so we don't fail on WSREP_START_POSITION internal check +--source include/restart_mysqld.inc +--source include/wait_until_connected_again.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc From c73417c68eb03e35c93e4896df3f3d2d4dd4bfc0 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 13 Dec 2023 14:43:41 +1100 Subject: [PATCH 08/10] MDEV-32986 Make regexp operator work in spider group by handler In spider_db_mbase_util::print_item_func(), if the sql item_func has an UNKNOWN_FUNC type, by default the spider group by handler (gbh) transform infix to prefix. But regexp should remain infix, so we add an if condition to account for this. --- .../spider/bugfix/r/mdev_32986.result | 23 +++++++++++++++ .../spider/bugfix/t/mdev_32986.test | 28 +++++++++++++++++++ storage/spider/spd_db_mysql.cc | 17 +++++++---- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_32986.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_32986.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_32986.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_32986.result new file mode 100644 index 0000000000000..bdc580d421ac4 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_32986.result @@ -0,0 +1,23 @@ +# +# MDEV-32907 +# +for master_1 +for child2 +for child3 +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +create table t2 (c varchar(16)); +create table t1 (c varchar(16)) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values ('TestSpiderRegex'); +select c from t1 where c regexp '(Test|Spider|Regex)'; +c +TestSpiderRegex +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 +# +# end of test mdev_32907 +# diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_32986.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_32986.test new file mode 100644 index 0000000000000..94081d24ad809 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_32986.test @@ -0,0 +1,28 @@ +--echo # +--echo # MDEV-32907 +--echo # +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +create table t2 (c varchar(16)); +create table t1 (c varchar(16)) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; + +insert into t1 values ('TestSpiderRegex'); +select c from t1 where c regexp '(Test|Spider|Regex)'; +drop table t1, t2; +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--echo # +--echo # end of test mdev_32907 +--echo # diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 0bca68e0d4e72..e689c9d93f04b 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -5856,12 +5856,17 @@ int spider_db_mbase_util::print_item_func( item_count -= 2; break; } - } else if (func_name_length == 6 && - !strncasecmp("istrue", func_name, func_name_length) - ) { - last_str = SPIDER_SQL_IS_TRUE_STR; - last_str_length = SPIDER_SQL_IS_TRUE_LEN; - break; + } else if (func_name_length == 6) + { + if (!strncasecmp("istrue", func_name, func_name_length)) + { + last_str= SPIDER_SQL_IS_TRUE_STR; + last_str_length= SPIDER_SQL_IS_TRUE_LEN; + break; + } + else if (!strncasecmp("regexp", func_name, func_name_length)) + /* Keep the infix expression */ + break; } else if (func_name_length == 7) { if (!strncasecmp("isfalse", func_name, func_name_length)) From c712a5302b29d3e6a7d46fe4f22ea7cabb926d31 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 18 Dec 2023 22:13:23 +0100 Subject: [PATCH 09/10] fix test failures with ASAN ASAN uses *a lot* more stack. use not_asan.inc for tests that recursively put a lot of data on the stack --- mysql-test/main/execution_constants.test | 1 + mysql-test/main/func_regexp_pcre.test | 1 + mysql-test/main/lotofstack.result | 101 ++++++++++++++ mysql-test/main/lotofstack.test | 133 +++++++++++++++++++ mysql-test/main/sp_notembedded.result | 119 ----------------- mysql-test/main/sp_notembedded.test | 161 ----------------------- 6 files changed, 236 insertions(+), 280 deletions(-) create mode 100644 mysql-test/main/lotofstack.result create mode 100644 mysql-test/main/lotofstack.test diff --git a/mysql-test/main/execution_constants.test b/mysql-test/main/execution_constants.test index 285197cd1f430..49b1da8f8e991 100644 --- a/mysql-test/main/execution_constants.test +++ b/mysql-test/main/execution_constants.test @@ -1,5 +1,6 @@ # In embedded server we don't really have a control over stack usage -- source include/not_embedded.inc +-- source include/not_asan.inc # # Bug#21476: Lost Database Connection During Query diff --git a/mysql-test/main/func_regexp_pcre.test b/mysql-test/main/func_regexp_pcre.test index fdf5a7c27359c..c5a6820d07652 100644 --- a/mysql-test/main/func_regexp_pcre.test +++ b/mysql-test/main/func_regexp_pcre.test @@ -1,3 +1,4 @@ +--source include/not_asan.inc # 10.4 uses an old buggy PCRE library --disable_service_connection SET NAMES utf8; diff --git a/mysql-test/main/lotofstack.result b/mysql-test/main/lotofstack.result new file mode 100644 index 0000000000000..553dcb3b1b4fe --- /dev/null +++ b/mysql-test/main/lotofstack.result @@ -0,0 +1,101 @@ +create function bug10100f(prm int) returns int +begin +if prm > 1 then +return prm * bug10100f(prm - 1); +end if; +return 1; +end| +set statement sql_mode = '' for +create procedure bug10100p(prm int, inout res int) +begin +set res = res * prm; +if prm > 1 then +call bug10100p(prm - 1, res); +end if; +end| +set statement sql_mode = '' for +create procedure bug10100t(prm int) +begin +declare res int; +set res = 1; +call bug10100p(prm, res); +select res; +end| +create table t3 (a int)| +insert into t3 values (0)| +create view v1 as select a from t3| +create procedure bug10100pt(level int, lim int) +begin +if level < lim then +update t3 set a=level; +FLUSH TABLES; +call bug10100pt(level+1, lim); +else +select * from t3; +end if; +end| +create procedure bug10100pv(level int, lim int) +begin +if level < lim then +update v1 set a=level; +FLUSH TABLES; +call bug10100pv(level+1, lim); +else +select * from v1; +end if; +end| +prepare stmt2 from "select * from t3;"; +create procedure bug10100pd(level int, lim int) +begin +if level < lim then +select level; +prepare stmt1 from "update t3 set a=a+2"; +execute stmt1; +FLUSH TABLES; +execute stmt1; +FLUSH TABLES; +execute stmt1; +FLUSH TABLES; +deallocate prepare stmt1; +execute stmt2; +select * from t3; +call bug10100pd(level+1, lim); +else +execute stmt2; +end if; +end| +create procedure bug10100pc(level int, lim int) +begin +declare lv int; +declare c cursor for select a from t3; +open c; +if level < lim then +select level; +fetch c into lv; +select lv; +update t3 set a=level+lv; +FLUSH TABLES; +call bug10100pc(level+1, lim); +else +select * from t3; +end if; +close c; +end| +set @@max_sp_recursion_depth=255| +set @var=1| +call bug10100p(255, @var)| +call bug10100pt(1,255)| +call bug10100pv(1,255)| +call bug10100pd(1,255)| +call bug10100pc(1,255)| +set @@max_sp_recursion_depth=0| +deallocate prepare stmt2| +drop function bug10100f| +drop procedure bug10100p| +drop procedure bug10100t| +drop procedure bug10100pt| +drop procedure bug10100pv| +drop procedure bug10100pd| +drop procedure bug10100pc| +drop view v1| +drop table t3| diff --git a/mysql-test/main/lotofstack.test b/mysql-test/main/lotofstack.test new file mode 100644 index 0000000000000..a658fb00e9ff9 --- /dev/null +++ b/mysql-test/main/lotofstack.test @@ -0,0 +1,133 @@ +# +# For tests that need a lot of stack - they likely won't work under ASAN +# +source include/not_asan.inc; +source include/not_embedded.inc; + +# +# Bug#10100 function (and stored procedure?) recursivity problem +# +# routines with simple recursion +delimiter |; +create function bug10100f(prm int) returns int +begin + if prm > 1 then + return prm * bug10100f(prm - 1); + end if; + return 1; +end| +set statement sql_mode = '' for +create procedure bug10100p(prm int, inout res int) +begin + set res = res * prm; + if prm > 1 then + call bug10100p(prm - 1, res); + end if; +end| +set statement sql_mode = '' for +create procedure bug10100t(prm int) +begin + declare res int; + set res = 1; + call bug10100p(prm, res); + select res; +end| + +# a procedure which use tables and recursion +create table t3 (a int)| +insert into t3 values (0)| +create view v1 as select a from t3| +create procedure bug10100pt(level int, lim int) +begin + if level < lim then + update t3 set a=level; + FLUSH TABLES; + call bug10100pt(level+1, lim); + else + select * from t3; + end if; +end| +# view & recursion +create procedure bug10100pv(level int, lim int) +begin + if level < lim then + update v1 set a=level; + FLUSH TABLES; + call bug10100pv(level+1, lim); + else + select * from v1; + end if; +end| +# dynamic sql & recursion +prepare stmt2 from "select * from t3;"; +create procedure bug10100pd(level int, lim int) +begin + if level < lim then + select level; + prepare stmt1 from "update t3 set a=a+2"; + execute stmt1; + FLUSH TABLES; + execute stmt1; + FLUSH TABLES; + execute stmt1; + FLUSH TABLES; + deallocate prepare stmt1; + execute stmt2; + select * from t3; + call bug10100pd(level+1, lim); + else + execute stmt2; + end if; +end| +# cursor & recursion +create procedure bug10100pc(level int, lim int) +begin + declare lv int; + declare c cursor for select a from t3; + open c; + if level < lim then + select level; + fetch c into lv; + select lv; + update t3 set a=level+lv; + FLUSH TABLES; + call bug10100pc(level+1, lim); + else + select * from t3; + end if; + close c; +end| + +# end of the stack checking +set @@max_sp_recursion_depth=255| +set @var=1| +# disable log because error about stack overrun contains numbers which +# depend on a system +-- disable_ps_protocol +-- disable_result_log +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100p(255, @var)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pt(1,255)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pv(1,255)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pd(1,255)| +-- error ER_STACK_OVERRUN_NEED_MORE +call bug10100pc(1,255)| +-- enable_result_log +-- enable_ps_protocol +set @@max_sp_recursion_depth=0| + +deallocate prepare stmt2| + +drop function bug10100f| +drop procedure bug10100p| +drop procedure bug10100t| +drop procedure bug10100pt| +drop procedure bug10100pv| +drop procedure bug10100pd| +drop procedure bug10100pc| +drop view v1| +drop table t3| +delimiter ;| diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index e03361598a601..927e03d2a4d8b 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -1,7 +1,5 @@ set @old_concurrent_insert= @@global.concurrent_insert; set @@global.concurrent_insert= 0; -drop table if exists t1,t3; -drop procedure if exists bug4902| create procedure bug4902() begin show grants for 'root'@'localhost'; @@ -15,7 +13,6 @@ Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION drop procedure bug4902| -drop procedure if exists bug4902_2| create procedure bug4902_2() begin show processlist; @@ -23,13 +20,10 @@ end| call bug4902_2()| show warnings| Level Code Message -Note 1305 PROCEDURE test.bug4902_2 does not exist call bug4902_2()| show warnings| Level Code Message -Note 1305 PROCEDURE test.bug4902_2 does not exist drop procedure bug4902_2| -drop procedure if exists bug6807| create procedure bug6807() begin declare a int; @@ -42,116 +36,6 @@ ERROR 70100: Query execution was interrupted call bug6807()| ERROR 70100: Query execution was interrupted drop procedure bug6807| -drop function if exists bug10100f| -drop procedure if exists bug10100p| -drop procedure if exists bug10100t| -drop procedure if exists bug10100pt| -drop procedure if exists bug10100pv| -drop procedure if exists bug10100pd| -drop procedure if exists bug10100pc| -create function bug10100f(prm int) returns int -begin -if prm > 1 then -return prm * bug10100f(prm - 1); -end if; -return 1; -end| -set statement sql_mode = '' for -create procedure bug10100p(prm int, inout res int) -begin -set res = res * prm; -if prm > 1 then -call bug10100p(prm - 1, res); -end if; -end| -set statement sql_mode = '' for -create procedure bug10100t(prm int) -begin -declare res int; -set res = 1; -call bug10100p(prm, res); -select res; -end| -create table t3 (a int)| -insert into t3 values (0)| -create view v1 as select a from t3| -create procedure bug10100pt(level int, lim int) -begin -if level < lim then -update t3 set a=level; -FLUSH TABLES; -call bug10100pt(level+1, lim); -else -select * from t3; -end if; -end| -create procedure bug10100pv(level int, lim int) -begin -if level < lim then -update v1 set a=level; -FLUSH TABLES; -call bug10100pv(level+1, lim); -else -select * from v1; -end if; -end| -prepare stmt2 from "select * from t3;"; -create procedure bug10100pd(level int, lim int) -begin -if level < lim then -select level; -prepare stmt1 from "update t3 set a=a+2"; -execute stmt1; -FLUSH TABLES; -execute stmt1; -FLUSH TABLES; -execute stmt1; -FLUSH TABLES; -deallocate prepare stmt1; -execute stmt2; -select * from t3; -call bug10100pd(level+1, lim); -else -execute stmt2; -end if; -end| -create procedure bug10100pc(level int, lim int) -begin -declare lv int; -declare c cursor for select a from t3; -open c; -if level < lim then -select level; -fetch c into lv; -select lv; -update t3 set a=level+lv; -FLUSH TABLES; -call bug10100pc(level+1, lim); -else -select * from t3; -end if; -close c; -end| -set @@max_sp_recursion_depth=255| -set @var=1| -call bug10100p(255, @var)| -call bug10100pt(1,255)| -call bug10100pv(1,255)| -call bug10100pd(1,255)| -call bug10100pc(1,255)| -set @@max_sp_recursion_depth=0| -deallocate prepare stmt2| -drop function bug10100f| -drop procedure bug10100p| -drop procedure bug10100t| -drop procedure bug10100pt| -drop procedure bug10100pv| -drop procedure bug10100pd| -drop procedure bug10100pc| -drop view v1| -drop table t3| -drop procedure if exists bug15298_1; -drop procedure if exists bug15298_2; create user 'mysqltest_1'@'localhost'; grant all privileges on test.* to 'mysqltest_1'@'localhost'; create procedure 15298_1 () sql security definer show grants for current_user; @@ -170,8 +54,6 @@ disconnect con1; drop user mysqltest_1@localhost; drop procedure 15298_1; drop procedure 15298_2; -drop table if exists t1; -drop procedure if exists p1; create table t1 (value varchar(15)); create procedure p1() update t1 set value='updated' where value='old'; call p1(); @@ -283,7 +165,6 @@ disconnect con2; # functions in databases which names contained dot. # connection default; -DROP DATABASE IF EXISTS `my.db`; create database `my.db`; use `my.db`; CREATE FUNCTION f1(a int) RETURNS INT RETURN a; diff --git a/mysql-test/main/sp_notembedded.test b/mysql-test/main/sp_notembedded.test index 29901c1221b14..9aca03fbdc5c1 100644 --- a/mysql-test/main/sp_notembedded.test +++ b/mysql-test/main/sp_notembedded.test @@ -7,19 +7,12 @@ set @@global.concurrent_insert= 0; # Save the initial number of concurrent sessions --source include/count_sessions.inc ---disable_warnings -drop table if exists t1,t3; ---enable_warnings delimiter |; - # # Bug#4902 Stored procedure with SHOW WARNINGS leads to packet error # # Added tests for show grants command ---disable_warnings -drop procedure if exists bug4902| ---enable_warnings create procedure bug4902() begin show grants for 'root'@'localhost'; @@ -38,9 +31,6 @@ call bug4902()| drop procedure bug4902| # We need separate SP for SHOW PROCESSLIST since we want use replace_column ---disable_warnings -drop procedure if exists bug4902_2| ---enable_warnings create procedure bug4902_2() begin show processlist; @@ -58,9 +48,6 @@ drop procedure bug4902_2| # # Bug#6807 Stored procedure crash if CREATE PROCEDURE ... KILL QUERY # ---disable_warnings -drop procedure if exists bug6807| ---enable_warnings create procedure bug6807() begin declare a int; @@ -77,150 +64,11 @@ call bug6807()| drop procedure bug6807| - -# -# Bug#10100 function (and stored procedure?) recursivity problem -# ---disable_warnings -drop function if exists bug10100f| -drop procedure if exists bug10100p| -drop procedure if exists bug10100t| -drop procedure if exists bug10100pt| -drop procedure if exists bug10100pv| -drop procedure if exists bug10100pd| -drop procedure if exists bug10100pc| ---enable_warnings -# routines with simple recursion -create function bug10100f(prm int) returns int -begin - if prm > 1 then - return prm * bug10100f(prm - 1); - end if; - return 1; -end| -set statement sql_mode = '' for -create procedure bug10100p(prm int, inout res int) -begin - set res = res * prm; - if prm > 1 then - call bug10100p(prm - 1, res); - end if; -end| -set statement sql_mode = '' for -create procedure bug10100t(prm int) -begin - declare res int; - set res = 1; - call bug10100p(prm, res); - select res; -end| - -# a procedure which use tables and recursion -create table t3 (a int)| -insert into t3 values (0)| -create view v1 as select a from t3| -create procedure bug10100pt(level int, lim int) -begin - if level < lim then - update t3 set a=level; - FLUSH TABLES; - call bug10100pt(level+1, lim); - else - select * from t3; - end if; -end| -# view & recursion -create procedure bug10100pv(level int, lim int) -begin - if level < lim then - update v1 set a=level; - FLUSH TABLES; - call bug10100pv(level+1, lim); - else - select * from v1; - end if; -end| -# dynamic sql & recursion -prepare stmt2 from "select * from t3;"; -create procedure bug10100pd(level int, lim int) -begin - if level < lim then - select level; - prepare stmt1 from "update t3 set a=a+2"; - execute stmt1; - FLUSH TABLES; - execute stmt1; - FLUSH TABLES; - execute stmt1; - FLUSH TABLES; - deallocate prepare stmt1; - execute stmt2; - select * from t3; - call bug10100pd(level+1, lim); - else - execute stmt2; - end if; -end| -# cursor & recursion -create procedure bug10100pc(level int, lim int) -begin - declare lv int; - declare c cursor for select a from t3; - open c; - if level < lim then - select level; - fetch c into lv; - select lv; - update t3 set a=level+lv; - FLUSH TABLES; - call bug10100pc(level+1, lim); - else - select * from t3; - end if; - close c; -end| - -# end of the stack checking -set @@max_sp_recursion_depth=255| -set @var=1| -# disable log because error about stack overrun contains numbers which -# depend on a system --- disable_result_log --- error ER_STACK_OVERRUN_NEED_MORE -call bug10100p(255, @var)| --- error ER_STACK_OVERRUN_NEED_MORE -call bug10100pt(1,255)| --- error ER_STACK_OVERRUN_NEED_MORE -call bug10100pv(1,255)| --- error ER_STACK_OVERRUN_NEED_MORE -call bug10100pd(1,255)| --- error ER_STACK_OVERRUN_NEED_MORE -call bug10100pc(1,255)| --- enable_result_log -set @@max_sp_recursion_depth=0| - -deallocate prepare stmt2| - -drop function bug10100f| -drop procedure bug10100p| -drop procedure bug10100t| -drop procedure bug10100pt| -drop procedure bug10100pv| -drop procedure bug10100pd| -drop procedure bug10100pc| -drop view v1| -drop table t3| - delimiter ;| - # # Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context # ---disable_warnings -drop procedure if exists bug15298_1; -drop procedure if exists bug15298_2; ---enable_warnings create user 'mysqltest_1'@'localhost'; grant all privileges on test.* to 'mysqltest_1'@'localhost'; create procedure 15298_1 () sql security definer show grants for current_user; @@ -240,11 +88,6 @@ drop procedure 15298_2; # Bug#29936 Stored Procedure DML ignores low_priority_updates setting # ---disable_warnings -drop table if exists t1; -drop procedure if exists p1; ---enable_warnings - create table t1 (value varchar(15)); create procedure p1() update t1 set value='updated' where value='old'; @@ -409,10 +252,6 @@ DROP FUNCTION f1; connection default; ---disable_warnings -DROP DATABASE IF EXISTS `my.db`; ---enable_warnings - create database `my.db`; use `my.db`; From cf86e075c046a13b8c0c8ced565990f313926440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Dec 2023 12:58:39 +0200 Subject: [PATCH 10/10] Add an end-of-test marker --- mysql-test/main/type_timestamp.result | 1 + mysql-test/main/type_timestamp.test | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index 6193359ce4734..2b4aec726bb15 100644 --- a/mysql-test/main/type_timestamp.result +++ b/mysql-test/main/type_timestamp.result @@ -1489,3 +1489,4 @@ indexed_col not_indexed_col DROP TABLE t2; DROP TABLE t1; SET note_verbosity=DEFAULT; +# End of 10.6 tests diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index 8410ef41aab0f..27de823851bf8 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -941,3 +941,5 @@ DELIMITER ;$$ --source unusable_keys_joins.inc DROP TABLE t1; SET note_verbosity=DEFAULT; + +--echo # End of 10.6 tests