From cba9ed12790727c70332f8862684b13ac3f25bbc Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Wed, 8 Jan 2020 00:51:04 +0700 Subject: [PATCH 01/43] fix compilation --- storage/innobase/include/dyn0buf.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h index b5da367bae1..f66c7e3d405 100644 --- a/storage/innobase/include/dyn0buf.h +++ b/storage/innobase/include/dyn0buf.h @@ -303,8 +303,7 @@ public: #ifdef UNIV_DEBUG ulint total_size = 0; - for (typename list_t::iterator it = m_list.begin(), - end = m_list.end(); + for (list_t::iterator it = m_list.begin(), end = m_list.end(); it != end; ++it) { total_size += it->used(); } @@ -320,8 +319,7 @@ public: template bool for_each_block(Functor& functor) const { - for (typename list_t::iterator it = m_list.begin(), - end = m_list.end(); + for (list_t::iterator it = m_list.begin(), end = m_list.end(); it != end; ++it) { if (!functor(&*it)) { @@ -338,8 +336,8 @@ public: template bool for_each_block_in_reverse(Functor& functor) const { - for (typename list_t::reverse_iterator it = m_list.rbegin(), - end = m_list.rend(); + for (list_t::reverse_iterator it = m_list.rbegin(), + end = m_list.rend(); it != end; ++it) { if (!functor(&*it)) { @@ -356,8 +354,8 @@ public: template bool for_each_block_in_reverse(const Functor& functor) const { - for (typename list_t::reverse_iterator it = m_list.rbegin(), - end = m_list.rend(); + for (list_t::reverse_iterator it = m_list.rbegin(), + end = m_list.rend(); it != end; ++it) { if (!functor(&*it)) { @@ -425,8 +423,7 @@ private: { ut_ad(!m_list.empty()); - for (typename list_t::iterator it = m_list.begin(), - end = m_list.end(); + for (list_t::iterator it = m_list.begin(), end = m_list.end(); it != end; ++it) { if (pos < it->used()) { From 983163209d026bfd979b4298053fcbdb373efa9d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 8 Jan 2020 16:23:49 +0100 Subject: [PATCH 02/43] MDEV-21444 : Fix socket leak if AcceptEx() return WSAECONNRESET. Also, ignore/retry on ERROR_NETNAME_DELETED in addition to WSAECONNRESET. This is how golang handles failing AcceptEx(), see https://github.com/golang/go/commit/c7ef348bad102b3427b4242018e92eba17d079ba --- sql/handle_connections_win.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc index e5b601d7fe0..0046dcdfd8c 100644 --- a/sql/handle_connections_win.cc +++ b/sql/handle_connections_win.cc @@ -207,10 +207,11 @@ retry : &m_overlapped); DWORD last_error= ret? 0: WSAGetLastError(); - if (last_error == WSAECONNRESET) + if (last_error == WSAECONNRESET || last_error == ERROR_NETNAME_DELETED) { if (m_tp_io) CancelThreadpoolIo(m_tp_io); + closesocket(m_client_socket); goto retry; } From 41cde4fe2219ea20ad5364c3b648bdebf2927270 Mon Sep 17 00:00:00 2001 From: Sujatha Date: Thu, 9 Jan 2020 12:45:05 +0530 Subject: [PATCH 03/43] MDEV-18514: Assertion `!writer.checksum_len || writer.remains == 0' failed Analysis: ======== 'max_binlog_cache_size' is configured and a huge transaction is executed. When the transaction specific events size exceeds 'max_binlog_cache_size' the event cannot be written to the binary log cache and cache write error is raised. Upon cache write error the statement is rolled back and the transaction cache should be truncated to a previous statement specific position. The truncate operation should reset the cache to earlier valid positions and flush the new changes. Even though the flush is successful the cache write error is still in marked state. The truncate code interprets the cache write error as cache flush failure and returns abruptly without modifying the write cache parameters. Hence cache is in a invalid state. When a COMMIT statement is executed in this session it tries to flush the contents of transaction cache to binary log. Since cache has partial events the cache write operation will report 'writer.remains' assert. Fix: === Binlog truncate function resets the cache to a specified size. As a first step of truncation, clear the cache write error flag that was raised during earlier execution. With this new errors that surface during cache truncation can be clearly identified. --- .../rpl/r/rpl_binlog_rollback_cleanup.result | 9 ++++ .../rpl/t/rpl_binlog_rollback_cleanup.test | 46 +++++++++++++++++++ sql/log.cc | 3 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test diff --git a/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result b/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result new file mode 100644 index 00000000000..a677cbfecf6 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result @@ -0,0 +1,9 @@ +include/master-slave.inc +[connection master] +connection master; +SET GLOBAL max_binlog_cache_size = 65536; +CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again +SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test b/mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test new file mode 100644 index 00000000000..ed4d713f626 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test @@ -0,0 +1,46 @@ +# ==== Purpose ==== +# +# Test verifies that when flushing an event to binary log fails the transaction +# is successfully rolled back and following COMMIT command doesn't report any +# assert. +# +# ==== Implementation ==== +# +# Steps: +# 0 - SET max_binlog_cache_size=64K +# 1 - Create an Innodb table and insert required amount of data. Execute an +# UPDATE operation which generates a big update event whose size exceeds +# max_binlog_cache_size. +# 2 - Wait for error 1197. Execute COMMIT command. +# 3 - COMMIT should be successful. +# +# ==== References ==== +# +# MDEV-18514: Assertion `!writer.checksum_len || writer.remains == 0' failed +# +--source include/have_innodb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc +--connection master +let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1); +SET GLOBAL max_binlog_cache_size = 65536; +CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB; +let $data = `select concat('"', repeat('a',6000), '"')`; +let $data1 = `select concat('"', repeat('b',6000), '"')`; +--disable_query_log +eval INSERT INTO t1 (a, data) VALUES (1, CONCAT($data, $data)); +eval INSERT INTO t1 (a, data) VALUES (2, CONCAT($data, $data)); +eval INSERT INTO t1 (a, data) VALUES (3, CONCAT($data, $data)); +eval INSERT INTO t1 (a, data) VALUES (4, CONCAT($data, $data)); +eval INSERT INTO t1 (a, data) VALUES (5, CONCAT($data, $data)); +START TRANSACTION; +--error ER_TRANS_CACHE_FULL +eval UPDATE t1 SET data=$data1; +COMMIT; +--enable_query_log + +--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size +DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/sql/log.cc b/sql/log.cc index 5fd384d55a0..91dfac07993 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -448,6 +448,7 @@ private: void truncate(my_off_t pos) { DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos)); + cache_log.error=0; if (pending()) { delete pending(); @@ -456,7 +457,7 @@ private: reinit_io_cache(&cache_log, WRITE_CACHE, pos, 0, 0); cache_log.end_of_file= saved_max_binlog_cache_size; } - + binlog_cache_data& operator=(const binlog_cache_data& info); binlog_cache_data(const binlog_cache_data& info); }; From 56529a7d7f329b9c799a57343c6dec48966f530b Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Fri, 10 Jan 2020 22:50:19 +0700 Subject: [PATCH 04/43] MDEV-21454 Show actual mismatching values in mismatch error messages from row_import::match_table_columns() Patch by Hartmut Holzgraefe --- .../suite/innodb/r/innodb-wl5522-1.result | 2 +- .../suite/innodb/r/innodb-wl5522.result | 2 +- .../suite/innodb_zip/r/wl5522_zip.result | 2 +- storage/innobase/row/row0import.cc | 70 ++++++++++++------- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-1.result b/mysql-test/suite/innodb/r/innodb-wl5522-1.result index b2a5f49a9ad..55557a8fb99 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-1.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-1.result @@ -389,7 +389,7 @@ CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb; ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE; restore: t1 .ibd and .cfg files ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Column i precise type mismatch.) +ERROR HY000: Schema mismatch (Column i precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file) unlink: t1.ibd unlink: t1.cfg DROP TABLE testdb_wl5522.t1; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result index 62f03292baa..b364b36a36f 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522.result @@ -426,7 +426,7 @@ SELECT * FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Column c2 precise type mismatch.) +ERROR HY000: Schema mismatch (Column c2 precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file) unlink: t1.ibd unlink: t1.cfg DROP TABLE t1; diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result index f57e2191d9f..a8e06835d85 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result @@ -410,7 +410,7 @@ SELECT * FROM t1; ERROR HY000: Tablespace has been discarded for table `t1` restore: t1 .ibd and .cfg files ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Schema mismatch (Column c2 precise type mismatch.) +ERROR HY000: Schema mismatch (Column c2 precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file) unlink: t1.ibd unlink: t1.cfg DROP TABLE t1; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 930a8303316..e8933ea5419 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1154,60 +1154,82 @@ row_import::match_table_columns( if (cfg_col->prtype != col->prtype) { ib_errf(thd, - IB_LOG_LEVEL_ERROR, - ER_TABLE_SCHEMA_MISMATCH, - "Column %s precise type mismatch.", - col_name); + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s precise type mismatch," + " it's 0X%X in the table and 0X%X" + " in the tablespace meta file", + col_name, col->prtype, cfg_col->prtype); err = DB_ERROR; } if (cfg_col->mtype != col->mtype) { ib_errf(thd, - IB_LOG_LEVEL_ERROR, - ER_TABLE_SCHEMA_MISMATCH, - "Column %s main type mismatch.", - col_name); + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s main type mismatch," + " it's 0X%X in the table and 0X%X" + " in the tablespace meta file", + col_name, col->mtype, cfg_col->mtype); err = DB_ERROR; } if (cfg_col->len != col->len) { ib_errf(thd, - IB_LOG_LEVEL_ERROR, - ER_TABLE_SCHEMA_MISMATCH, - "Column %s length mismatch.", - col_name); + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s length mismatch," + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->len, cfg_col->len); err = DB_ERROR; } if (cfg_col->mbminlen != col->mbminlen || cfg_col->mbmaxlen != col->mbmaxlen) { ib_errf(thd, - IB_LOG_LEVEL_ERROR, - ER_TABLE_SCHEMA_MISMATCH, - "Column %s multi-byte len mismatch.", - col_name); + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s multi-byte len mismatch," + " it's %u-%u in the table and %u-%u" + " in the tablespace meta file", + col_name, col->mbminlen, col->mbmaxlen, + cfg_col->mbminlen, cfg_col->mbmaxlen); err = DB_ERROR; } if (cfg_col->ind != col->ind) { + ib_errf(thd, + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s position mismatch," + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->ind, cfg_col->ind); err = DB_ERROR; } if (cfg_col->ord_part != col->ord_part) { ib_errf(thd, - IB_LOG_LEVEL_ERROR, - ER_TABLE_SCHEMA_MISMATCH, - "Column %s ordering mismatch.", - col_name); + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s ordering mismatch," + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->ord_part, + cfg_col->ord_part); err = DB_ERROR; } if (cfg_col->max_prefix != col->max_prefix) { ib_errf(thd, - IB_LOG_LEVEL_ERROR, - ER_TABLE_SCHEMA_MISMATCH, - "Column %s max prefix mismatch.", - col_name); + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s max prefix mismatch" + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->max_prefix, + cfg_col->max_prefix); err = DB_ERROR; } } From 9c3eca85141836548214e3c68f256b3868502509 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sat, 7 Dec 2019 18:21:36 +0300 Subject: [PATCH 05/43] MDEV-21243: Join buffer: condition is checked in wrong place for range access In this scenario: - There is a possible range access for table T - And there is a ref access on the same index which uses fewer key parts - The join optimizer picks the ref access (because it is cheaper) - make_join_select applies this heuristic to switch to range: /* Range uses longer key; Use this instead of ref on key */ Join buffer will be used without having called JOIN_TAB::make_scan_filter(). This means, conditions that should be checked when reading table T will be checked after T is joined with the contents of the join buffer, instead. Fixed this by adding a make_scan_filter() check. (updated patch after backport to 10.3) (Fix testcase on Windows) --- mysql-test/main/join_cache.result | 72 +++++++++++++++++++++++++++++++ mysql-test/main/join_cache.test | 40 +++++++++++++++++ sql/sql_select.cc | 10 +++++ 3 files changed, 122 insertions(+) diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index bab32395413..3d1d91df997 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -6056,4 +6056,76 @@ select f2 from t2,t1 where f2 = 0; f2 drop table t1, t2; set join_buffer_size=@save_join_buffer_size; +# +# MDEV-21243: Join buffer: condition is checked in wrong place for range access +# +create table t1(a int primary key); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int); +insert into t2 select A.a + 10*B.a from t1 A, t1 B; +create table t3 ( +kp1 int, +kp2 int, +col1 int, +col2 int, +key (kp1, kp2) +); +insert into t3 +select +A.a, +B.a, +A.a + 100*B.a, +A.a + 100*B.a +from +t2 A, t2 B; +analyze table t3; +Table Op Msg_type Msg_text +test.t3 analyze status Table is already up to date +# The following must have "B.col1 + 1 < 33333" attached to table B +# and not to the block-nl-join node: +explain format=json +select * +from t1 a, t3 b +where +b.kp1=a.a and +b.kp1 <= 10 and +b.kp2 <= 10 and +b.col1 +1 < 33333; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "a", + "access_type": "index", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["a"], + "rows": 10, + "filtered": 100, + "attached_condition": "a.a <= 10", + "using_index": true + }, + "block-nl-join": { + "table": { + "table_name": "b", + "access_type": "range", + "possible_keys": ["kp1"], + "key": "kp1", + "key_length": "10", + "used_key_parts": ["kp1", "kp2"], + "rows": 836, + "filtered": 11.962, + "index_condition": "b.kp2 <= 10", + "attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "b.kp1 = a.a" + } + } +} +drop table t1,t2,t3; set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index 9576d598125..91339c2cb21 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -4014,5 +4014,45 @@ select f2 from t2,t1 where f2 = 0; drop table t1, t2; set join_buffer_size=@save_join_buffer_size; + +--echo # +--echo # MDEV-21243: Join buffer: condition is checked in wrong place for range access +--echo # +create table t1(a int primary key); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int); +insert into t2 select A.a + 10*B.a from t1 A, t1 B; + +create table t3 ( + kp1 int, + kp2 int, + col1 int, + col2 int, + key (kp1, kp2) +); + +insert into t3 +select + A.a, + B.a, + A.a + 100*B.a, + A.a + 100*B.a +from + t2 A, t2 B; +analyze table t3; + +--echo # The following must have "B.col1 + 1 < 33333" attached to table B +--echo # and not to the block-nl-join node: +explain format=json +select * +from t1 a, t3 b +where + b.kp1=a.a and + b.kp1 <= 10 and + b.kp2 <= 10 and + b.col1 +1 < 33333; + +drop table t1,t2,t3; + # The following command must be the last one in the file set @@optimizer_switch=@save_optimizer_switch; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index da8dfdd015a..76cad16de28 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10966,6 +10966,13 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) if (i != join->const_tables && tab->use_quick != 2 && !tab->first_inner) { /* Read with cache */ + /* + TODO: the execution also gets here when we will not be using + join buffer. Review these cases and perhaps, remove this call. + (The final decision whether to use join buffer is made in + check_join_cache_usage, so we should only call make_scan_filter() + there, too). + */ if (tab->make_scan_filter()) DBUG_RETURN(1); } @@ -11928,6 +11935,9 @@ uint check_join_cache_usage(JOIN_TAB *tab, if ((tab->cache= new (root) JOIN_CACHE_BNL(join, tab, prev_cache))) { tab->icp_other_tables_ok= FALSE; + /* If make_join_select() hasn't called make_scan_filter(), do it now */ + if (!tab->cache_select && tab->make_scan_filter()) + goto no_join_cache; return (2 - MY_TEST(!prev_cache)); } goto no_join_cache; From d531b4ee3a9bcd89a2fa6b49a2207eaf966f53e3 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 12 Jan 2020 22:15:55 +0300 Subject: [PATCH 06/43] MDEV-21341: Fix UBSAN failures: Issue Six (Variant #2 of the patch, which keeps the sp_head object inside the MEM_ROOT that sp_head object owns) (10.3 version of the fix, with handling for class sp_package) sp_head::operator new() and operator delete() were dereferencing sp_head* pointers to memory that didn't hold a valid sp_head object (it was not created/already destroyed). This caused UBSan to crash when looking up type information. Fixed by providing static sp_head::create() and sp_head::destroy() methods. --- sql/sp.cc | 2 +- sql/sp_cache.cc | 2 +- sql/sp_head.cc | 77 ++++++++++++++++++++++++++-------------------- sql/sp_head.h | 23 +++++++++----- sql/sql_lex.cc | 10 +++--- sql/sql_parse.cc | 2 +- sql/sql_prepare.cc | 2 +- sql/sql_show.cc | 6 ++-- sql/sql_trigger.cc | 2 +- 9 files changed, 71 insertions(+), 55 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index 5661c6910cb..5e162e5dfec 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -854,7 +854,7 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode, if (parse_sql(thd, & parser_state, creation_ctx) || thd->lex == NULL) { sp= thd->lex->sphead; - delete sp; + sp_head::destroy(sp); sp= 0; } else diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index 99e68cd2595..e4ffbdcb155 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -283,7 +283,7 @@ uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen, void hash_free_sp_head(void *p) { sp_head *sp= (sp_head *)p; - delete sp; + sp_head::destroy(sp); } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 360713fc452..af4316085b7 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -474,47 +474,39 @@ check_routine_name(const LEX_CSTRING *ident) * */ -void * -sp_head::operator new(size_t size) throw() +sp_head *sp_head::create(sp_package *parent, const Sp_handler *handler) { - DBUG_ENTER("sp_head::operator new"); MEM_ROOT own_root; + init_sql_alloc(&own_root, "sp_head", MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, + MYF(0)); sp_head *sp; + if (!(sp= new (&own_root) sp_head(&own_root, parent, handler))) + free_root(&own_root, MYF(0)); - init_sql_alloc(&own_root, "sp_head", - MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0)); - sp= (sp_head *) alloc_root(&own_root, size); - if (sp == NULL) - DBUG_RETURN(NULL); - sp->main_mem_root= own_root; - DBUG_PRINT("info", ("mem_root %p", &sp->mem_root)); - DBUG_RETURN(sp); + return sp; } -void -sp_head::operator delete(void *ptr, size_t size) throw() + +void sp_head::destroy(sp_head *sp) { - DBUG_ENTER("sp_head::operator delete"); - MEM_ROOT own_root; - - if (ptr == NULL) - DBUG_VOID_RETURN; - - sp_head *sp= (sp_head *) ptr; - - /* Make a copy of main_mem_root as free_root will free the sp */ - own_root= sp->main_mem_root; - DBUG_PRINT("info", ("mem_root %p moved to %p", - &sp->mem_root, &own_root)); - free_root(&own_root, MYF(0)); - - DBUG_VOID_RETURN; + if (sp) + { + /* Make a copy of main_mem_root as free_root will free the sp */ + MEM_ROOT own_root= sp->main_mem_root; + delete sp; + + DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx", + (ulong) &sp->mem_root, (ulong) &own_root)); + free_root(&own_root, MYF(0)); + } } -sp_head::sp_head(sp_package *parent, const Sp_handler *sph) - :Query_arena(&main_mem_root, STMT_INITIALIZED_FOR_SP), +sp_head::sp_head(MEM_ROOT *mem_root_arg, sp_package *parent, + const Sp_handler *sph) + :Query_arena(NULL, STMT_INITIALIZED_FOR_SP), Database_qualified_name(&null_clex_str, &null_clex_str), + main_mem_root(*mem_root_arg), m_parent(parent), m_handler(sph), m_flags(0), @@ -545,6 +537,8 @@ sp_head::sp_head(sp_package *parent, const Sp_handler *sph) m_pcont(new (&main_mem_root) sp_pcontext()), m_cont_level(0) { + mem_root= &main_mem_root; + m_first_instance= this; m_first_free_instance= this; m_last_cached_sp= this; @@ -567,10 +561,25 @@ sp_head::sp_head(sp_package *parent, const Sp_handler *sph) } -sp_package::sp_package(LEX *top_level_lex, +sp_package *sp_package::create(LEX *top_level_lex, const sp_name *name, + const Sp_handler *sph) +{ + MEM_ROOT own_root; + init_sql_alloc(&own_root, "sp_package", MEM_ROOT_BLOCK_SIZE, + MEM_ROOT_PREALLOC, MYF(0)); + sp_package *sp; + if (!(sp= new (&own_root) sp_package(&own_root, top_level_lex, name, sph))) + free_root(&own_root, MYF(0)); + + return sp; +} + + +sp_package::sp_package(MEM_ROOT *mem_root_arg, + LEX *top_level_lex, const sp_name *name, const Sp_handler *sph) - :sp_head(NULL, sph), + :sp_head(mem_root_arg, NULL, sph), m_current_routine(NULL), m_top_level_lex(top_level_lex), m_rcontext(NULL), @@ -588,7 +597,7 @@ sp_package::~sp_package() m_routine_declarations.cleanup(); m_body= null_clex_str; if (m_current_routine) - delete m_current_routine->sphead; + sp_head::destroy(m_current_routine->sphead); delete m_rcontext; } @@ -845,7 +854,7 @@ sp_head::~sp_head() my_hash_free(&m_sptabs); my_hash_free(&m_sroutines); - delete m_next_cached_sp; + sp_head::destroy(m_next_cached_sp); DBUG_VOID_RETURN; } diff --git a/sql/sp_head.h b/sql/sp_head.h index 75c95d6705d..7e00cf7a0d8 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -127,7 +127,8 @@ bool check_routine_name(const LEX_CSTRING *ident); class sp_head :private Query_arena, - public Database_qualified_name + public Database_qualified_name, + public Sql_alloc { sp_head(const sp_head &); /**< Prevent use of these */ void operator=(sp_head &); @@ -316,13 +317,14 @@ public: */ SQL_I_List m_trg_table_fields; - static void * - operator new(size_t size) throw (); +protected: + sp_head(MEM_ROOT *mem_root, sp_package *parent, const Sp_handler *handler); + virtual ~sp_head(); - static void - operator delete(void *ptr, size_t size) throw (); +public: + static void destroy(sp_head *sp); + static sp_head *create(sp_package *parent, const Sp_handler *handler); - sp_head(sp_package *parent, const Sp_handler *handler); /// Initialize after we have reset mem_root void @@ -340,7 +342,6 @@ public: void set_stmt_end(THD *thd); - virtual ~sp_head(); bool execute_trigger(THD *thd, @@ -964,10 +965,16 @@ public: bool m_is_instantiated; bool m_is_cloning_routine; - sp_package(LEX *top_level_lex, +private: + sp_package(MEM_ROOT *mem_root, + LEX *top_level_lex, const sp_name *name, const Sp_handler *sph); ~sp_package(); +public: + static sp_package *create(LEX *top_level_lex, const sp_name *name, + const Sp_handler *sph); + bool add_routine_declaration(LEX *lex) { return m_routine_declarations.check_dup_qualified(lex->sphead) || diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index f6df176c6a0..6e6c79c0e6c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -793,7 +793,7 @@ void lex_end_stage1(LEX *lex) } else { - delete lex->sphead; + sp_head::destroy(lex->sphead); lex->sphead= NULL; } @@ -3049,13 +3049,13 @@ void LEX::cleanup_lex_after_parse_error(THD *thd) DBUG_ASSERT(pkg == pkg->m_top_level_lex->sphead); pkg->restore_thd_mem_root(thd); LEX *top= pkg->m_top_level_lex; - delete pkg; + sp_package::destroy(pkg); thd->lex= top; thd->lex->sphead= NULL; } else { - delete thd->lex->sphead; + sp_head::destroy(thd->lex->sphead); thd->lex->sphead= NULL; } } @@ -6190,7 +6190,7 @@ sp_head *LEX::make_sp_head(THD *thd, const sp_name *name, sp_head *sp; /* Order is important here: new - reset - init */ - if (likely((sp= new sp_head(package, sph)))) + if (likely((sp= sp_head::create(package, sph)))) { sp->reset_thd_mem_root(thd); sp->init(this); @@ -7829,7 +7829,7 @@ sp_package *LEX::create_package_start(THD *thd, return 0; } } - if (unlikely(!(pkg= new sp_package(this, name_arg, sph)))) + if (unlikely(!(pkg= sp_package::create(this, name_arg, sph)))) return NULL; pkg->reset_thd_mem_root(thd); pkg->init(this); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 861d50e8872..db38a20ea8a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5083,7 +5083,7 @@ mysql_execute_command(THD *thd) /* Don't do it, if we are inside a SP */ if (!thd->spcont) { - delete lex->sphead; + sp_head::destroy(lex->sphead); lex->sphead= NULL; } /* lex->unit.cleanup() is called outside, no need to call it here */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index da6ec106208..d273db7d0d4 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -3848,7 +3848,7 @@ Prepared_statement::~Prepared_statement() free_items(); if (lex) { - delete lex->sphead; + sp_head::destroy(lex->sphead); delete lex->result; delete (st_lex_local *) lex; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 3f18f659f7e..0b35789b869 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -6331,7 +6331,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, { free_table_share(&share); if (free_sp_head) - delete sp; + sp_head::destroy(sp); DBUG_RETURN(1); } } @@ -6378,7 +6378,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, } } if (free_sp_head) - delete sp; + sp_head::destroy(sp); } free_table_share(&share); DBUG_RETURN(error); @@ -6457,7 +6457,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, store_column_type(table, field, cs, 5); free_table_share(&share); if (free_sp_head) - delete sp; + sp_head::destroy(sp); } } diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index b8ce5d743b4..26ec04cb89e 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -338,7 +338,7 @@ public: Trigger::~Trigger() { - delete body; + sp_head::destroy(body); } From 2d4b6571ecf15a4382702d26df9439bc5a1005de Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 14 Jan 2020 06:33:02 +0100 Subject: [PATCH 07/43] Wsrep position not updated in InnoDB after certification failures (#1432) A certification failure followed by a clean shutdown would cause an inconsistency between the sequence number stored in innodb and the sequence number stored in provider. This happened both in the case of local certification failure, and in the case where dummy writeset is applied. The fix consists of: - updating wsrep position after dummy writeset is delivered in `Wsrep_high_priority_service::log_dummy_write_set()` - updating wsrep position while releasing commit order in wsrep-lib side Added two tests which stress the situation where a server is shutdown after a certification failure. --- ...era_set_position_after_cert_failure.result | 36 +++++++ ...a_set_position_after_dummy_writeset.result | 36 +++++++ ...alera_set_position_after_cert_failure.test | 98 ++++++++++++++++++ ...era_set_position_after_dummy_writeset.test | 99 +++++++++++++++++++ sql/wsrep_high_priority_service.cc | 1 + sql/wsrep_server_service.cc | 6 ++ sql/wsrep_server_service.h | 1 + wsrep-lib | 2 +- 8 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result create mode 100644 mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result create mode 100644 mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test create mode 100644 mysql-test/suite/galera/t/galera_set_position_after_dummy_writeset.test diff --git a/mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result b/mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result new file mode 100644 index 00000000000..7717428ba21 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; +connection node_1; +INSERT INTO t1 VALUES (1, 'node_1');; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_retry_autocommit = 0; +INSERT INTO t1 VALUES (1, 'node_2');; +connection node_2a; +SET SESSION wsrep_sync_wait = 0; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +connection node_2a; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "RESET"; +disconnect node_2a; +connection node_2; +connection node_1; +SET SESSION wsrep_sync_wait = 0; +Performing --wsrep-recover ... +connection node_2; +Using --wsrep-start-position when starting mysqld ... +connection node_1; +DROP TABLE t1; +SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result b/mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result new file mode 100644 index 00000000000..da398b76754 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; +connection node_2; +INSERT INTO t1 VALUES (1, 'node_2');; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +connection node_1; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_retry_autocommit = 0; +INSERT INTO t1 VALUES (1, 'node_1');; +connection node_1a; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2; +connection node_2; +connection node_1; +SET SESSION wsrep_sync_wait = 0; +Performing --wsrep-recover ... +connection node_2; +Using --wsrep-start-position when starting mysqld ... +connection node_1; +DROP TABLE t1; +SET GLOBAL wsrep_slave_threads = DEFAULT; +connection node_1a; +SET GLOBAL DEBUG_DBUG=NULL; +SET DEBUG_SYNC = "RESET"; diff --git a/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test b/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test new file mode 100644 index 00000000000..4dfddb0f32a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test @@ -0,0 +1,98 @@ +# +# Check that wsrep position is updated in innodb after +# a local certification failure. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +# +# Cause a certification failure. The INSERT on node_2 will fail certification, +# and it is going to be the last event before shutting down node_2. +# +--connection node_2 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + +--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + +--connection node_1 +--send INSERT INTO t1 VALUES (1, 'node_1'); + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_retry_autocommit = 0; + +--send INSERT INTO t1 VALUES (1, 'node_2'); + +--connection node_2a +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc + +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_1 +--reap + +--connection node_2a +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "RESET"; + +# +# Keep track of the current position in variable $expected_position +# +--let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'` +--let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--let $expected_position = $expected_position_uuid:$expected_position_seqno +--disconnect node_2a + +# +# Shutdown node 2 +# +--connection node_2 +--source include/shutdown_mysqld.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# +# Check that start position matches the position we recorded +# before shutdown in $expected_position +# +--let $galera_wsrep_recover_server_id = 2 +--source suite/galera/include/galera_wsrep_recover.inc + +if ($galera_wsrep_start_position != $expected_position) +{ + --exec echo "expected position $expected_position" + --exec echo "recover position $galera_wsrep_start_position" + die("Expected position and recover position did not match"); +} + +# +# Restart node 2 and cleanup +# +--connection node_2 +--source include/start_mysqld.inc + +--connection node_1 +DROP TABLE t1; +SET GLOBAL wsrep_slave_threads = DEFAULT; +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_set_position_after_dummy_writeset.test b/mysql-test/suite/galera/t/galera_set_position_after_dummy_writeset.test new file mode 100644 index 00000000000..f528b1435bb --- /dev/null +++ b/mysql-test/suite/galera/t/galera_set_position_after_dummy_writeset.test @@ -0,0 +1,99 @@ +# +# Check that wsrep position is updated in innodb after +# a dummy write set is applied. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +# +# Cause a certification failure. The INSERT on in node_1 will fail certification, +# and will result in a dummy writeset on node_2. This is going to be the last +# writeset before shutting down node_2. +# +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB; +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + +--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + +--connection node_2 +--send INSERT INTO t1 VALUES (1, 'node_2'); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_retry_autocommit = 0; + +--send INSERT INTO t1 VALUES (1, 'node_1'); + +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc + +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_2 +--reap + +# +# Keep track of the current position in variable $expected_position +# +--let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'` +--let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--let $expected_position = $expected_position_uuid:$expected_position_seqno + +# +# Shutdown node 2 +# +--connection node_2 +--source include/shutdown_mysqld.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# +# Check that start position matches the position we recorded +# before shutdown in $expected_position +# +--let $galera_wsrep_recover_server_id = 2 +--source suite/galera/include/galera_wsrep_recover.inc + +if ($galera_wsrep_start_position != $expected_position) +{ + --exec echo "expected position $expected_position" + --exec echo "recover position $galera_wsrep_start_position" + die("Expected position and recover position did not match"); +} + +# +# Restart the node 2 and cleanup +# +--connection node_2 +--source include/start_mysqld.inc + +--connection node_1 +DROP TABLE t1; +SET GLOBAL wsrep_slave_threads = DEFAULT; +--source include/auto_increment_offset_restore.inc + +--connection node_1a +SET GLOBAL DEBUG_DBUG=NULL; +SET DEBUG_SYNC = "RESET"; diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index e668a57dc96..ef9a46f1a8e 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -429,6 +429,7 @@ int Wsrep_high_priority_service::log_dummy_write_set(const wsrep::ws_handle& ws_ cs.before_rollback(); cs.after_rollback(); } + wsrep_set_SE_checkpoint(ws_meta.gtid()); ret= ret || cs.provider().commit_order_leave(ws_handle, ws_meta, err); cs.after_applying(); } diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index aa288e67420..d0a9b54ac1b 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -302,6 +302,12 @@ wsrep::gtid Wsrep_server_service::get_position(wsrep::client_service&) return wsrep_get_SE_checkpoint(); } +void Wsrep_server_service::set_position(wsrep::client_service&, + const wsrep::gtid& gtid) +{ + wsrep_set_SE_checkpoint(gtid); +} + void Wsrep_server_service::log_state_change( enum Wsrep_server_state::state prev_state, enum Wsrep_server_state::state current_state) diff --git a/sql/wsrep_server_service.h b/sql/wsrep_server_service.h index 4017c9b2d58..168e98206e3 100644 --- a/sql/wsrep_server_service.h +++ b/sql/wsrep_server_service.h @@ -61,6 +61,7 @@ public: wsrep::view get_view(wsrep::client_service&, const wsrep::id& own_id); wsrep::gtid get_position(wsrep::client_service&); + void set_position(wsrep::client_service&, const wsrep::gtid&); void log_state_change(enum wsrep::server_state::state, enum wsrep::server_state::state); diff --git a/wsrep-lib b/wsrep-lib index 76f7249b8df..a17b65a25f5 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 76f7249b8df209a2a3cefd7d4bbf31f6c72812f1 +Subproject commit a17b65a25f5e608ffa8e6e051930bf47ed95019a From 7d313214641241e8ce839d9de01529c2335c620f Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 10 Jan 2020 11:55:30 +0100 Subject: [PATCH 08/43] MDEV-19803 Long semaphore wait error on galera.MW-388 The long semaphore wait appeared to be the caused by the following pattern in the MTR test: ``` SET DEBUG_SYNC = "now SIGNAL wsrep_after_certification_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb; ``` Raising two signals, one right after another, caused one signal to overwrite the other, before the signal was consumed by the thread. This caused one thread to be stuck until the debug sync point would timeout. --- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera/r/MW-388.result | 4 +--- .../suite/galera/r/galera_ist_restart_joiner.result | 1 - mysql-test/suite/galera/t/MW-388.test | 8 +++++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index ebe8d2ac2d3..0801736c159 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -12,7 +12,6 @@ MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill MW-329 : MDEV-19962 Galera test failure on MW-329 -MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388 galera_account_management : MariaDB 10.0 does not support ALTER USER galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result index 4b4b321c542..2785c1d0326 100644 --- a/mysql-test/suite/galera/r/MW-388.result +++ b/mysql-test/suite/galera/r/MW-388.result @@ -18,12 +18,10 @@ connection node_1a; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; SET SESSION wsrep_sync_wait = 0; -SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; CALL insert_proc ();; connection node_1a; -SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; +SET SESSION wsrep_sync_wait = 0; SET GLOBAL debug_dbug = ""; -SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; connection node_2; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result index c81cecfae1c..d38d664b6fa 100644 --- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result +++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result @@ -13,7 +13,6 @@ Loading wsrep_provider ... SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=ON; connection node_1; -connection node_1; UPDATE t1 SET f2 = 'd' WHERE f1 > 3; connection node_2; connection node_1; diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test index fafdde092bf..40522f30abb 100644 --- a/mysql-test/suite/galera/t/MW-388.test +++ b/mysql-test/suite/galera/t/MW-388.test @@ -31,6 +31,8 @@ DELIMITER ;| SET GLOBAL wsrep_slave_threads = 2; SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; +--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + --connection node_2 --send INSERT INTO t1 VALUES (1, 'node 2'); @@ -40,14 +42,14 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; --connection node_1 SET SESSION wsrep_sync_wait = 0; -SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; --send CALL insert_proc (); --connection node_1a -SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc SET GLOBAL debug_dbug = ""; -SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; --connection node_2 From 5e5ae51b730aa67f9efb87af4f4921309eac51f1 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 12 Jan 2020 20:50:12 +0200 Subject: [PATCH 09/43] MDEV-21341: Fix UBSAN failures: Issue Six (Variant #2 of the patch, which keeps the sp_head object inside the MEM_ROOT that sp_head object owns) (10.3 requires extra work due to sp_package, will commit a separate patch for it) sp_head::operator new() and operator delete() were dereferencing sp_head* pointers to memory that didn't hold a valid sp_head object (it was not created/already destroyed). This caused UBSan to crash when looking up type information. Fixed by providing static sp_head::create() and sp_head::destroy() methods. --- sql/sp.cc | 2 +- sql/sp_cache.cc | 2 +- sql/sp_head.cc | 72 +++++++++++++++++++++------------------------- sql/sp_head.h | 17 +++++------ sql/sql_lex.cc | 4 +-- sql/sql_parse.cc | 2 +- sql/sql_prepare.cc | 2 +- sql/sql_show.cc | 6 ++-- sql/sql_trigger.cc | 2 +- sql/sql_yacc.yy | 2 +- 10 files changed, 52 insertions(+), 59 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index 966ea0280b4..1d340644ba1 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -754,7 +754,7 @@ static sp_head *sp_compile(THD *thd, String *defstr, ulonglong sql_mode, if (parse_sql(thd, & parser_state, creation_ctx) || thd->lex == NULL) { sp= thd->lex->sphead; - delete sp; + sp_head::destroy(sp); sp= 0; } else diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index f99c0bd0b6e..bc91634eb32 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -284,7 +284,7 @@ uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen, void hash_free_sp_head(void *p) { sp_head *sp= (sp_head *)p; - delete sp; + sp_head::destroy(sp); } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 5c5688be4a3..f940040b480 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -550,51 +550,41 @@ check_routine_name(LEX_STRING *ident) } +sp_head* sp_head::create() +{ + MEM_ROOT own_root; + init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0)); + sp_head *sp; + if (!(sp= new (&own_root) sp_head(&own_root))) + free_root(&own_root, MYF(0)); + + return sp; +} + + +void sp_head::destroy(sp_head *sp) +{ + if (sp) + { + /* Make a copy of main_mem_root as free_root will free the sp */ + MEM_ROOT own_root= sp->main_mem_root; + delete sp; + + DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx", + (ulong) &sp->mem_root, (ulong) &own_root)); + free_root(&own_root, MYF(0)); + } +} + /* * * sp_head * */ -void * -sp_head::operator new(size_t size) throw() -{ - DBUG_ENTER("sp_head::operator new"); - MEM_ROOT own_root; - sp_head *sp; - - init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0)); - sp= (sp_head *) alloc_root(&own_root, size); - if (sp == NULL) - DBUG_RETURN(NULL); - sp->main_mem_root= own_root; - DBUG_PRINT("info", ("mem_root 0x%lx", (ulong) &sp->mem_root)); - DBUG_RETURN(sp); -} - -void -sp_head::operator delete(void *ptr, size_t size) throw() -{ - DBUG_ENTER("sp_head::operator delete"); - MEM_ROOT own_root; - - if (ptr == NULL) - DBUG_VOID_RETURN; - - sp_head *sp= (sp_head *) ptr; - - /* Make a copy of main_mem_root as free_root will free the sp */ - own_root= sp->main_mem_root; - DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx", - (ulong) &sp->mem_root, (ulong) &own_root)); - free_root(&own_root, MYF(0)); - - DBUG_VOID_RETURN; -} - - -sp_head::sp_head() - :Query_arena(&main_mem_root, STMT_INITIALIZED_FOR_SP), +sp_head::sp_head(MEM_ROOT *mem_root_arg) + :Query_arena(NULL, STMT_INITIALIZED_FOR_SP), + main_mem_root(*mem_root_arg), // todo: std::move operator. m_flags(0), m_sp_cache_version(0), m_creation_ctx(0), @@ -603,6 +593,8 @@ sp_head::sp_head() m_next_cached_sp(0), m_cont_level(0) { + mem_root= &main_mem_root; + m_first_instance= this; m_first_free_instance= this; m_last_cached_sp= this; @@ -848,7 +840,7 @@ sp_head::~sp_head() my_hash_free(&m_sptabs); my_hash_free(&m_sroutines); - delete m_next_cached_sp; + sp_head::destroy(m_next_cached_sp); DBUG_VOID_RETURN; } diff --git a/sql/sp_head.h b/sql/sp_head.h index 2b3e568fb9a..47cb0985b05 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -142,7 +142,7 @@ public: bool check_routine_name(LEX_STRING *ident); -class sp_head :private Query_arena +class sp_head :private Query_arena, public Sql_alloc { sp_head(const sp_head &); /**< Prevent use of these */ void operator=(sp_head &); @@ -301,14 +301,16 @@ public: being opened is probably enough). */ SQL_I_List m_trg_table_fields; +private: + // users must use sp= sp_head::create() + sp_head(MEM_ROOT *mem_root_arg); - static void * - operator new(size_t size) throw (); + // users must use sp_head::destroy(sp) + virtual ~sp_head(); - static void - operator delete(void *ptr, size_t size) throw (); - - sp_head(); +public: + static sp_head* create(); + static void destroy(sp_head *sp); /// Initialize after we have reset mem_root void @@ -326,7 +328,6 @@ public: void set_stmt_end(THD *thd); - virtual ~sp_head(); bool execute_trigger(THD *thd, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1cd2a369d7a..27da1fc16fd 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -785,7 +785,7 @@ void lex_end_stage1(LEX *lex) } else { - delete lex->sphead; + sp_head::destroy(lex->sphead); lex->sphead= NULL; } @@ -2781,7 +2781,7 @@ void LEX::cleanup_lex_after_parse_error(THD *thd) if (thd->lex->sphead) { thd->lex->sphead->restore_thd_mem_root(thd); - delete thd->lex->sphead; + sp_head::destroy(thd->lex->sphead); thd->lex->sphead= NULL; } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 218d0dbd357..e5626ccbd7c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4347,7 +4347,7 @@ mysql_execute_command(THD *thd) /* Don't do it, if we are inside a SP */ if (!thd->spcont) { - delete lex->sphead; + sp_head::destroy(lex->sphead); lex->sphead= NULL; } /* lex->unit.cleanup() is called outside, no need to call it here */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 2c6aeda794a..f5adaeaa956 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -3607,7 +3607,7 @@ Prepared_statement::~Prepared_statement() free_items(); if (lex) { - delete lex->sphead; + sp_head::destroy(lex->sphead); delete lex->result; delete (st_lex_local *) lex; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fbdb76e9e71..4f217159e5c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5863,7 +5863,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, { free_table_share(&share); if (free_sp_head) - delete sp; + sp_head::destroy(sp); DBUG_RETURN(1); } } @@ -5919,7 +5919,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, } } if (free_sp_head) - delete sp; + sp_head::destroy(sp); } free_table_share(&share); DBUG_RETURN(error); @@ -6012,7 +6012,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, store_column_type(table, field, cs, 5); free_table_share(&share); if (free_sp_head) - delete sp; + sp_head::destroy(sp); } } diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 4ecd8139921..c4d348ce400 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1063,7 +1063,7 @@ Table_triggers_list::~Table_triggers_list() { for (int i= 0; i < (int)TRG_EVENT_MAX; i++) for (int j= 0; j < (int)TRG_ACTION_MAX; j++) - delete bodies[i][j]; + sp_head::destroy(bodies[i][j]); /* Free blobs used in insert */ if (record0_field) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 71e0a18b1a3..2a46bb2a027 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -224,7 +224,7 @@ static sp_head *make_sp_head(THD *thd, sp_name *name, sp_head *sp; /* Order is important here: new - reset - init */ - if ((sp= new sp_head())) + if ((sp= sp_head::create())) { sp->reset_thd_mem_root(thd); sp->init(lex); From 800d1f3010e5b34b343008514017a29fa6ce7fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 15 Jan 2020 14:55:42 +0200 Subject: [PATCH 10/43] Disable usually failing Galera tests until a real fix is found. --- mysql-test/suite/galera/disabled.def | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 0801736c159..c810cfa2db9 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -11,21 +11,30 @@ ############################################################################## MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill +MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B +MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B MW-329 : MDEV-19962 Galera test failure on MW-329 +MW-336 : MDEV-17062 Test failure on galera.MW-336 galera_account_management : MariaDB 10.0 does not support ALTER USER galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID +galera_as_slave_gtid_myisam : MDEV-21421 galera.galera_as_slave_gtid_myisam galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events +galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_flush : MariaDB does not have global.thread_statistics galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_ist_mariabackup : MDEV-18829 test leaves port open galera_ist_progress : MDEV-15236 fails when trying to read transfer status +galera_load_data : MDEV-19968 galera.galera_load_data galera_migrate : MariaDB does not support START SLAVE USER +galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade +galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key +galera_sst_mariabackup_table_options: MDEV-19741 Galera test failure on galera.galera_sst_mariabackup_table_options galera_var_node_address : MDEV-20485 Galera test failure galera_wan : MDEV-17259 Test failure on galera.galera_wan partition : MDEV-19958 Galera test failure on galera.partition From 4635047ca1dbcd8b536da4be9236ffab8d48f2d9 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 15 Jan 2020 16:34:51 +0300 Subject: [PATCH 11/43] MDEV-21341: Fix UBSAN failures, part #5 Item_cond inherits from Item_args but doesn't store its arguments as function arguments, which means it has zero arguments. Don't call memcpy in this case. --- sql/item_func.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 702d8a1a2ee..ffd2b462431 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -109,7 +109,8 @@ Item_args::Item_args(THD *thd, const Item_args *other) arg_count= 0; return; } - memcpy(args, other->args, sizeof(Item*) * arg_count); + if (arg_count) + memcpy(args, other->args, sizeof(Item*) * arg_count); } From 23041af720416f00db69e07b15861fc6d61b2b45 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 15 Jan 2020 16:35:59 +0300 Subject: [PATCH 12/43] MDEV-21341: Fix UBSAN failures, part 8: fix error in compare_fields_by_table_order Dont assign Item_field variables to point to Item_string objects (even if we don't make any dangerous calls for them). --- sql/sql_select.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 40941294013..2358615affc 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13669,12 +13669,16 @@ static int compare_fields_by_table_order(Item *field1, { int cmp= 0; bool outer_ref= 0; - Item_field *f1= (Item_field *) (field1->real_item()); - Item_field *f2= (Item_field *) (field2->real_item()); - if (field1->const_item() || f1->const_item()) + Item *field1_real= field1->real_item(); + Item *field2_real= field2->real_item(); + + if (field1->const_item() || field1_real->const_item()) return 1; - if (field2->const_item() || f2->const_item()) + if (field2->const_item() || field2_real->const_item()) return -1; + + Item_field *f1= (Item_field *) field1_real; + Item_field *f2= (Item_field *) field2_real; if (f2->used_tables() & OUTER_REF_TABLE_BIT) { outer_ref= 1; From 6a8a4c19e2db22573207f32a714d354f8e870df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 15 Jan 2020 18:28:52 +0200 Subject: [PATCH 13/43] MDEV-21485 ASAN use-after-poison in dfield_get_len or Assertion `pos < index->n_def' failed The server would crash when instantly reordering the columns of a table whose all columns belong to the PRIMARY KEY. --- mysql-test/suite/innodb/r/instant_alter,4k.rdiff | 8 ++++---- mysql-test/suite/innodb/r/instant_alter.result | 11 ++++++++++- mysql-test/suite/innodb/t/instant_alter.test | 4 ++++ storage/innobase/rem/rem0rec.cc | 13 ++++++++++--- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index 113504d97e4..ca93b1d6519 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -1,5 +1,5 @@ ---- suite/innodb/r/instant_alter.result 2019-12-05 10:54:59.611505580 +0100 -+++ suite/innodb/r/instant_alter,4k.reject 2019-12-05 11:47:54.013615820 +0100 +--- instant_alter.result ++++ instant_alter,4k.result @@ -242,7 +242,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; @@ -318,8 +318,8 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants --196 -+198 +-199 ++201 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; # # MDEV-18266: Changing an index comment unnecessarily rebuilds index diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index d1ae07f545b..5780849d279 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -932,6 +932,9 @@ SELECT * FROM t1; a b vb fubar 42 42 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, c2 INT UNIQUE, c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), @@ -1809,6 +1812,9 @@ SELECT * FROM t1; a b vb fubar 42 42 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, c2 INT UNIQUE, c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), @@ -2686,12 +2692,15 @@ SELECT * FROM t1; a b vb fubar 42 42 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; disconnect analyze; SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants -196 +199 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; # # MDEV-18266: Changing an index comment unnecessarily rebuilds index diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 2a2bd6660c3..8473984afba 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -826,6 +826,10 @@ ALTER TABLE t1 ADD vb INT AS (b); SELECT * FROM t1; DROP TABLE t1; +eval CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) $engine; +ALTER TABLE t1 MODIFY b INT FIRST; +DROP TABLE t1; + dec $format; let $redundant_4k= 0; } diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index c1324c64a9f..a1e19164ce9 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1155,7 +1155,10 @@ rec_get_converted_size_comp_prefix_low( for (ulint i = 0; dfield < end; i++, dfield++) { if (mblob && i == index->first_user_field()) { data_size += FIELD_REF_SIZE; - ++dfield; + if (++dfield == end) { + ut_ad(i == index->n_fields); + break; + } } ulint len = dfield_get_len(dfield); @@ -1597,7 +1600,11 @@ start: ut_ad(dfield_is_ext(field)); memcpy(end, dfield_get_data(field), len); end += len; - len = dfield_get_len(++field); + if (++field == fend) { + ut_ad(i == index->n_fields); + break; + } + len = dfield_get_len(field); } } else if (UNIV_UNLIKELY(i == n_node_ptr_field)) { ut_ad(field->type.prtype & DATA_NOT_NULL); From 451573fab1071afe2f82a3bf65f5b14fa0125d16 Mon Sep 17 00:00:00 2001 From: Alice Sherepa Date: Mon, 23 Dec 2019 21:48:59 +0100 Subject: [PATCH 14/43] MDEV-21360 debug_dbug pre-test value restoration issues --- .../extra/binlog_tests/binlog_ioerr.inc | 3 +- mysql-test/extra/rpl_tests/rpl_checksum.inc | 12 +++-- mysql-test/extra/rpl_tests/rpl_corruption.inc | 5 +- mysql-test/extra/rpl_tests/rpl_incident.inc | 6 +-- .../extra/rpl_tests/rpl_init_slave_errors.inc | 3 +- mysql-test/include/binlog_inject_error.inc | 4 +- mysql-test/r/cache_temporal_4265.result | 3 +- mysql-test/r/drop_bad_db_type.result | 4 +- .../r/engine_error_in_alter-8453.result | 3 +- mysql-test/r/error_simulation.result | 11 ++-- mysql-test/r/func_regexp_pcre_debug.result | 3 +- mysql-test/r/log_slow_debug.result | 4 +- mysql-test/r/mdev6830.result | 2 + mysql-test/r/merge-big.result | 2 +- mysql-test/r/merge_debug.result | 2 +- mysql-test/r/range_innodb.result | 3 +- mysql-test/r/select_debug.result | 2 + mysql-test/r/show_explain_ps.result | 3 +- mysql-test/r/slowlog_enospace-10508.result | 3 +- mysql-test/r/stat_tables-enospc.result | 3 +- mysql-test/r/union_crash-714.result | 2 + mysql-test/r/warnings_debug.result | 2 + mysql-test/suite/binlog/r/binlog_ioerr.result | 3 +- .../suite/binlog/r/binlog_write_error.result | 51 ++++++++++++------- .../binlog_encryption/binlog_ioerr.result | 3 +- .../binlog_write_error.result | 51 ++++++++++++------- .../binlog_encryption/rpl_checksum.result | 11 ++-- .../binlog_encryption/rpl_corruption.result | 5 +- .../binlog_encryption/rpl_incident.result | 2 + .../rpl_init_slave_errors.result | 3 +- .../suite/innodb/r/blob-update-debug.result | 2 + .../r/innodb-stats-initialize-failure.result | 3 +- .../suite/innodb/r/innodb_bug11754376.result | 2 + .../suite/innodb/r/innodb_bug56947.result | 2 + .../r/innodb_sys_semaphore_waits.result | 3 +- .../suite/innodb/t/blob-update-debug.test | 2 + .../t/innodb-stats-initialize-failure.test | 5 +- .../suite/innodb/t/innodb_bug11754376.test | 3 +- .../suite/innodb/t/innodb_bug56947.test | 2 + .../innodb/t/innodb_sys_semaphore_waits.test | 3 +- .../innodb_fts/r/concurrent_insert.result | 3 +- .../suite/innodb_fts/t/concurrent_insert.test | 3 +- .../optimizer_unfixed_bugs/r/bug36981.result | 2 + .../optimizer_unfixed_bugs/r/bug40992.result | 2 + .../optimizer_unfixed_bugs/r/bug41996.result | 2 + .../optimizer_unfixed_bugs/r/bug42991.result | 2 + .../optimizer_unfixed_bugs/r/bug43249.result | 2 + .../optimizer_unfixed_bugs/r/bug43360.result | 2 + .../optimizer_unfixed_bugs/r/bug43448.result | 2 + .../optimizer_unfixed_bugs/r/bug43617.result | 2 + .../optimizer_unfixed_bugs/t/bug36981.test | 2 + .../optimizer_unfixed_bugs/t/bug40992.test | 2 + .../optimizer_unfixed_bugs/t/bug41996.test | 2 + .../optimizer_unfixed_bugs/t/bug42991.test | 2 + .../optimizer_unfixed_bugs/t/bug43249.test | 2 + .../optimizer_unfixed_bugs/t/bug43360.test | 2 + .../optimizer_unfixed_bugs/t/bug43448.test | 2 + .../optimizer_unfixed_bugs/t/bug43617.test | 3 +- .../suite/parts/r/partition_debug.result | 4 +- mysql-test/suite/parts/t/partition_debug.test | 4 +- .../suite/parts/t/partition_debug_innodb.test | 4 +- ...hostcache_ipv4_addrinfo_again_allow.result | 3 +- .../hostcache_ipv4_addrinfo_again_deny.result | 3 +- .../hostcache_ipv4_addrinfo_bad_allow.result | 3 +- .../r/hostcache_ipv4_addrinfo_bad_deny.result | 3 +- .../hostcache_ipv4_addrinfo_good_allow.result | 3 +- .../hostcache_ipv4_addrinfo_good_deny.result | 3 +- ...ostcache_ipv4_addrinfo_noname_allow.result | 3 +- ...hostcache_ipv4_addrinfo_noname_deny.result | 3 +- .../r/hostcache_ipv4_auth_plugin.result | 3 +- .../r/hostcache_ipv4_blocked.result | 3 +- .../perfschema/r/hostcache_ipv4_format.result | 3 +- .../r/hostcache_ipv4_max_con.result | 3 +- ...hostcache_ipv4_nameinfo_again_allow.result | 3 +- .../hostcache_ipv4_nameinfo_again_deny.result | 3 +- ...ostcache_ipv4_nameinfo_noname_allow.result | 3 +- ...hostcache_ipv4_nameinfo_noname_deny.result | 3 +- .../perfschema/r/hostcache_ipv4_passwd.result | 3 +- .../perfschema/r/hostcache_ipv4_ssl.result | 3 +- ...hostcache_ipv6_addrinfo_again_allow.result | 3 +- .../hostcache_ipv6_addrinfo_again_deny.result | 3 +- .../hostcache_ipv6_addrinfo_bad_allow.result | 3 +- .../r/hostcache_ipv6_addrinfo_bad_deny.result | 3 +- .../hostcache_ipv6_addrinfo_good_allow.result | 3 +- .../hostcache_ipv6_addrinfo_good_deny.result | 3 +- ...ostcache_ipv6_addrinfo_noname_allow.result | 3 +- ...hostcache_ipv6_addrinfo_noname_deny.result | 3 +- .../r/hostcache_ipv6_auth_plugin.result | 3 +- .../r/hostcache_ipv6_blocked.result | 3 +- .../r/hostcache_ipv6_max_con.result | 3 +- ...hostcache_ipv6_nameinfo_again_allow.result | 3 +- .../hostcache_ipv6_nameinfo_again_deny.result | 3 +- ...ostcache_ipv6_nameinfo_noname_allow.result | 3 +- ...hostcache_ipv6_nameinfo_noname_deny.result | 3 +- .../perfschema/r/hostcache_ipv6_passwd.result | 3 +- .../perfschema/r/hostcache_ipv6_ssl.result | 3 +- .../perfschema/r/hostcache_peer_addr.result | 3 +- .../hostcache_ipv4_addrinfo_again_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_again_deny.test | 3 +- .../t/hostcache_ipv4_addrinfo_bad_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_bad_deny.test | 3 +- .../t/hostcache_ipv4_addrinfo_good_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_good_deny.test | 3 +- .../hostcache_ipv4_addrinfo_noname_allow.test | 3 +- .../hostcache_ipv4_addrinfo_noname_deny.test | 3 +- .../t/hostcache_ipv4_auth_plugin.test | 3 +- .../perfschema/t/hostcache_ipv4_blocked.test | 3 +- .../perfschema/t/hostcache_ipv4_format.test | 3 +- .../perfschema/t/hostcache_ipv4_max_con.test | 3 +- .../hostcache_ipv4_nameinfo_again_allow.test | 3 +- .../t/hostcache_ipv4_nameinfo_again_deny.test | 3 +- .../hostcache_ipv4_nameinfo_noname_allow.test | 3 +- .../hostcache_ipv4_nameinfo_noname_deny.test | 3 +- .../perfschema/t/hostcache_ipv4_passwd.test | 3 +- .../perfschema/t/hostcache_ipv4_ssl.test | 3 +- .../hostcache_ipv6_addrinfo_again_allow.test | 3 +- .../t/hostcache_ipv6_addrinfo_again_deny.test | 3 +- .../t/hostcache_ipv6_addrinfo_bad_allow.test | 3 +- .../t/hostcache_ipv6_addrinfo_bad_deny.test | 3 +- .../t/hostcache_ipv6_addrinfo_good_allow.test | 3 +- .../t/hostcache_ipv6_addrinfo_good_deny.test | 3 +- .../hostcache_ipv6_addrinfo_noname_allow.test | 4 +- .../hostcache_ipv6_addrinfo_noname_deny.test | 4 +- .../t/hostcache_ipv6_auth_plugin.test | 3 +- .../perfschema/t/hostcache_ipv6_blocked.test | 3 +- .../perfschema/t/hostcache_ipv6_max_con.test | 3 +- .../hostcache_ipv6_nameinfo_again_allow.test | 3 +- .../t/hostcache_ipv6_nameinfo_again_deny.test | 3 +- .../hostcache_ipv6_nameinfo_noname_allow.test | 3 +- .../hostcache_ipv6_nameinfo_noname_deny.test | 3 +- .../perfschema/t/hostcache_ipv6_passwd.test | 3 +- .../perfschema/t/hostcache_ipv6_ssl.test | 3 +- .../perfschema/t/hostcache_peer_addr.test | 3 +- .../suite/rpl/r/kill_race_condition.result | 3 +- mysql-test/suite/rpl/r/rpl_bug33931.result | 3 +- mysql-test/suite/rpl/r/rpl_bug41902.result | 3 ++ mysql-test/suite/rpl/r/rpl_checksum.result | 11 ++-- mysql-test/suite/rpl/r/rpl_corruption.result | 5 +- .../suite/rpl/r/rpl_heartbeat_debug.result | 4 +- mysql-test/suite/rpl/r/rpl_incident.result | 2 + .../suite/rpl/r/rpl_init_slave_errors.result | 3 +- .../suite/rpl/r/rpl_row_big_table_id.result | 2 + .../suite/rpl/r/rpl_row_find_row_debug.result | 3 +- .../rpl/r/rpl_semi_sync_skip_repl.result | 3 +- .../suite/rpl/r/rpl_show_slave_running.result | 3 +- .../r/rpl_slave_load_remove_tmpfile.result | 3 +- mysql-test/suite/rpl/r/rpl_stop_slave.result | 4 ++ mysql-test/suite/rpl/r/rpl_view_debug.result | 2 + .../suite/rpl/t/kill_race_condition.test | 3 +- mysql-test/suite/rpl/t/rpl_bug33931.test | 3 +- mysql-test/suite/rpl/t/rpl_bug41902.test | 5 +- .../t/rpl_get_master_version_and_clock.test | 6 +-- .../suite/rpl/t/rpl_heartbeat_debug.test | 4 +- .../suite/rpl/t/rpl_row_big_table_id.test | 3 +- .../suite/rpl/t/rpl_row_find_row_debug.test | 4 +- .../suite/rpl/t/rpl_row_index_choice.test | 4 +- .../suite/rpl/t/rpl_semi_sync_skip_repl.test | 4 +- .../suite/rpl/t/rpl_show_slave_running.test | 4 +- .../rpl/t/rpl_slave_load_remove_tmpfile.test | 4 +- mysql-test/suite/rpl/t/rpl_stop_slave.test | 12 ++--- mysql-test/suite/rpl/t/rpl_view_debug.test | 3 +- mysql-test/t/cache_temporal_4265.test | 6 +-- mysql-test/t/drop_bad_db_type.test | 4 +- mysql-test/t/engine_error_in_alter-8453.test | 3 +- mysql-test/t/error_simulation.test | 11 ++-- mysql-test/t/func_regexp_pcre_debug.test | 3 +- mysql-test/t/log_slow_debug.test | 4 +- mysql-test/t/mdev6830.test | 4 +- mysql-test/t/merge-big.test | 2 +- mysql-test/t/merge_debug.test | 2 +- mysql-test/t/range_innodb.test | 3 +- mysql-test/t/select_debug.test | 2 + mysql-test/t/show_explain_ps.test | 3 +- mysql-test/t/slowlog_enospace-10508.test | 3 +- mysql-test/t/stat_tables-enospc.test | 3 +- mysql-test/t/union_crash-714.test | 2 + mysql-test/t/warnings_debug.test | 2 + 177 files changed, 446 insertions(+), 234 deletions(-) diff --git a/mysql-test/extra/binlog_tests/binlog_ioerr.inc b/mysql-test/extra/binlog_tests/binlog_ioerr.inc index 8d1069bacb0..07c99373a41 100644 --- a/mysql-test/extra/binlog_tests/binlog_ioerr.inc +++ b/mysql-test/extra/binlog_tests/binlog_ioerr.inc @@ -15,12 +15,13 @@ RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; INSERT INTO t1 VALUES(0); +set @saved_dbug = @@session.debug_dbug; SET SESSION debug_dbug='+d,fail_binlog_write_1'; --error ER_ERROR_ON_WRITE INSERT INTO t1 VALUES(1); --error ER_ERROR_ON_WRITE INSERT INTO t1 VALUES(2); -SET SESSION debug_dbug=''; +SET SESSION debug_dbug=@saved_dbug; INSERT INTO t1 VALUES(3); SELECT * FROM t1; diff --git a/mysql-test/extra/rpl_tests/rpl_checksum.inc b/mysql-test/extra/rpl_tests/rpl_checksum.inc index b5e70abe4d0..9951472a773 100644 --- a/mysql-test/extra/rpl_tests/rpl_checksum.inc +++ b/mysql-test/extra/rpl_tests/rpl_checksum.inc @@ -108,6 +108,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */; # instruction to the dump thread connection slave; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; start slave; --let $slave_io_errno= 1236 @@ -116,8 +117,7 @@ source include/wait_for_slave_io_error.inc; select count(*) as zero from t1; -###connection master; -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; connection slave; source include/start_slave.inc; @@ -129,10 +129,11 @@ source include/start_slave.inc; # C1. Failure by a client thread connection master; set @@global.master_verify_checksum = 1; +set @save_dbug = @@session.debug_dbug; set @@session.debug_dbug='d,simulate_checksum_test_failure'; --error ER_ERROR_WHEN_EXECUTING_COMMAND show binlog events; -set @@session.debug_dbug=''; +set debug_dbug= @save_dbug; set @@global.master_verify_checksum = default; #connection master; @@ -149,6 +150,7 @@ connection slave; # C2. Failure by IO thread # instruction to io thread +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave io_thread; # When the checksum error is detected, the slave sets error code 1913 @@ -158,7 +160,7 @@ start slave io_thread; --let $slave_io_errno= 1595,1913 --let $show_slave_io_error= 0 source include/wait_for_slave_io_error.inc; -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; # to make IO thread re-read it again w/o the failure start slave io_thread; @@ -179,7 +181,7 @@ source include/wait_for_slave_sql_error.inc; # resuming SQL thread to parse out the event w/o the failure -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; source include/start_slave.inc; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_corruption.inc b/mysql-test/extra/rpl_tests/rpl_corruption.inc index 1726ee4ba2f..88f683ed53d 100644 --- a/mysql-test/extra/rpl_tests/rpl_corruption.inc +++ b/mysql-test/extra/rpl_tests/rpl_corruption.inc @@ -73,6 +73,7 @@ while ($i) { # Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing --echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; --echo SHOW BINLOG EVENTS; --disable_query_log @@ -167,10 +168,10 @@ let $diff_tables= master:test.t1, slave:test.t1; # Clean up --echo # 8. Clean up --connection master -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; SET GLOBAL master_verify_checksum = @old_master_verify_checksum; DROP TABLE t1; --sync_slave_with_master -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_incident.inc b/mysql-test/extra/rpl_tests/rpl_incident.inc index 350a2086681..75d28d6a6c6 100644 --- a/mysql-test/extra/rpl_tests/rpl_incident.inc +++ b/mysql-test/extra/rpl_tests/rpl_incident.inc @@ -20,7 +20,7 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); SELECT * FROM t1; -let $debug_save= `SELECT @@GLOBAL.debug`; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; # This will generate an incident log event and store it in the binary @@ -29,9 +29,7 @@ REPLACE INTO t1 VALUES (4); --save_master_pos SELECT * FROM t1; ---disable_query_log -eval SET GLOBAL debug_dbug= '$debug_save'; ---enable_query_log +set @@global.debug_dbug = @saved_dbug; connection slave; # Wait until SQL thread stops with error LOST_EVENT on master diff --git a/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc b/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc index 4fdea651edd..46673ea4764 100644 --- a/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc +++ b/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc @@ -51,6 +51,7 @@ reset slave; connection slave; # Set debug flags on slave to force errors to occur +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; @@ -66,7 +67,7 @@ start slave; call mtr.add_suppression("Failed during slave.* thread initialization"); -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; ###################################################################### # Injecting faults in the init_slave option diff --git a/mysql-test/include/binlog_inject_error.inc b/mysql-test/include/binlog_inject_error.inc index 383f66ba843..ce940352723 100644 --- a/mysql-test/include/binlog_inject_error.inc +++ b/mysql-test/include/binlog_inject_error.inc @@ -13,10 +13,10 @@ # let query= 'CREATE TABLE t1 (a INT)'; # source include/binlog_inject_error.inc; # - +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; --echo $query; --replace_regex /(errno: .*)/(errno: #)/ --error ER_ERROR_ON_WRITE --eval $query -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result index 7f215de43fb..1cda7004a6f 100644 --- a/mysql-test/r/cache_temporal_4265.result +++ b/mysql-test/r/cache_temporal_4265.result @@ -1,13 +1,12 @@ create table t1 (a date); insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04'); -set debug_dbug='d,str_to_datetime_warn'; +SET STATEMENT debug_dbug='d,str_to_datetime_warn' for select * from t1 where a > date_add('2000-01-01', interval 5 day); a 2001-02-03 2002-03-04 Warnings: Note 1003 2000-01-01 -set debug_dbug=''; drop table t1; create table t1 (id int not null, ut timestamp(6) not null); insert into t1 values(1, '2001-01-01 00:00:00.2'); diff --git a/mysql-test/r/drop_bad_db_type.result b/mysql-test/r/drop_bad_db_type.result index 1b691957877..b6fa3bfd70e 100644 --- a/mysql-test/r/drop_bad_db_type.result +++ b/mysql-test/r/drop_bad_db_type.result @@ -1,4 +1,4 @@ -SET @save_dbug = @@debug_dbug; +SET @saved_dbug = @@debug_dbug; set debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; create table t1 (a int) engine=archive; @@ -33,4 +33,4 @@ t1.frm drop table t1; db.opt uninstall soname 'ha_archive'; -set debug_dbug=@save_dbug; +set debug_dbug=@saved_dbug; diff --git a/mysql-test/r/engine_error_in_alter-8453.result b/mysql-test/r/engine_error_in_alter-8453.result index c5a3375f33c..d1d4181cf68 100644 --- a/mysql-test/r/engine_error_in_alter-8453.result +++ b/mysql-test/r/engine_error_in_alter-8453.result @@ -1,6 +1,7 @@ create table t1 (a int, b int); +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,external_lock_failure'; alter table t1 add column c int; ERROR HY000: Got error 168 'KABOOM!' from MyISAM -set debug_dbug=''; +set debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result index 7e728d24fc8..19d1ff4db17 100644 --- a/mysql-test/r/error_simulation.result +++ b/mysql-test/r/error_simulation.result @@ -10,6 +10,7 @@ INSERT INTO t1 VALUES ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); set tmp_table_size=1024; +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,raise_error"; SELECT MAX(a) FROM t1 GROUP BY a,b; ERROR 23000: Can't write; duplicate key in table '(temporary)' @@ -22,7 +23,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL); INSERT INTO t1 VALUES (1), (0), (2); SET SESSION debug_dbug='+d,alter_table_only_index_change'; ALTER TABLE t1 ADD INDEX a(a); -SET SESSION debug_dbug=DEFAULT; +set debug_dbug= @saved_dbug; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -42,7 +43,7 @@ CREATE TABLE t1(a BLOB); SET SESSION debug_dbug="+d,bug42064_simulate_oom"; INSERT INTO t1 VALUES(""); Got one of the listed errors -SET SESSION debug_dbug=DEFAULT; +set debug_dbug= @saved_dbug; DROP TABLE t1; # # Bug#41660: Sort-index_merge for non-first join table may require @@ -79,7 +80,7 @@ a a b filler 7 1 1 data 8 1 1 data 9 1 1 data -SET SESSION debug_dbug= DEFAULT; +set debug_dbug= @saved_dbug; SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1, t2; # @@ -92,7 +93,7 @@ INSERT INTO t2 VALUES (1),(2); SET SESSION debug_dbug="+d,bug11747970_raise_error"; INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); ERROR 70100: Query execution was interrupted -SET SESSION debug_dbug = DEFAULT; +set debug_dbug= @saved_dbug; DROP TABLE t1,t2; # # End of 5.1 tests @@ -126,4 +127,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory"; SELECT f1(1); Got one of the listed errors DROP FUNCTION f1; -SET SESSION debug_dbug=DEFAULT; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/r/func_regexp_pcre_debug.result b/mysql-test/r/func_regexp_pcre_debug.result index e44492fca72..40a379a077d 100644 --- a/mysql-test/r/func_regexp_pcre_debug.result +++ b/mysql-test/r/func_regexp_pcre_debug.result @@ -1,10 +1,9 @@ -SET debug_dbug='+d,pcre_exec_error_123'; +SET STATEMENT debug_dbug='+d,pcre_exec_error_123' for SELECT 'a' RLIKE 'a'; 'a' RLIKE 'a' 0 Warnings: Warning 1139 Got error 'pcre_exec: Internal error (-123)' from regexp -SET debug_dbug=''; SELECT 'a' RLIKE 'a'; 'a' RLIKE 'a' 1 diff --git a/mysql-test/r/log_slow_debug.result b/mysql-test/r/log_slow_debug.result index 09460fa5d01..a21cc1ce744 100644 --- a/mysql-test/r/log_slow_debug.result +++ b/mysql-test/r/log_slow_debug.result @@ -6,7 +6,7 @@ SET @@GLOBAL.log_output='TABLE'; FLUSH SLOW LOGS; SET @@GLOBAL.slow_query_log=ON; SET @@GLOBAL.log_slow_admin_statements=ON; -SET @save_dbug = @@debug_dbug; +SET @saved_dbug = @@debug_dbug; SET SESSION debug_dbug="+d,simulate_slow_query"; CREATE PROCEDURE show_slow_log() BEGIN @@ -130,7 +130,7 @@ sql_text # # Clean up # -SET SESSION debug_dbug=@save_dbug; +SET SESSION debug_dbug=@saved_dbug; TRUNCATE mysql.slow_log; SET @@global.slow_query_log= @org_slow_query_log; SET @@global.log_output= @org_log_output; diff --git a/mysql-test/r/mdev6830.result b/mysql-test/r/mdev6830.result index d1cf8c98ac1..e3b3ed41edf 100644 --- a/mysql-test/r/mdev6830.result +++ b/mysql-test/r/mdev6830.result @@ -1,3 +1,4 @@ +set @saved_dbug = @@session.debug_dbug; set @@debug_dbug= 'd,opt'; CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 ( @@ -46,3 +47,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2 drop table t1,t2,t3,t4; drop view v2,v3; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/r/merge-big.result b/mysql-test/r/merge-big.result index 3b6e116986e..bd188d7a856 100644 --- a/mysql-test/r/merge-big.result +++ b/mysql-test/r/merge-big.result @@ -7,7 +7,7 @@ drop table if exists t1,t2,t3,t4,t5,t6; CREATE TABLE t1 (c1 INT) ENGINE= MyISAM; LOCK TABLE t1 WRITE; connect con1,localhost,root,,; -SET @orig_debug=@@debug; +SET @orig_debug=@@global.debug_dbug; SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open"; INSERT INTO t1 VALUES (1); connection default; diff --git a/mysql-test/r/merge_debug.result b/mysql-test/r/merge_debug.result index 51905e52d24..29858810ff1 100644 --- a/mysql-test/r/merge_debug.result +++ b/mysql-test/r/merge_debug.result @@ -3,7 +3,7 @@ set global storage_engine=myisam; set session storage_engine=myisam; call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair it"); drop table if exists crashed,t2,t3,t4; -SET @orig_debug=@@debug; +SET @orig_debug=@@global.debug_dbug; CREATE TABLE crashed (c1 INT); CREATE TABLE t2 (c1 INT); CREATE TABLE t3 (c1 INT); diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result index 6572b248911..aed8bff278b 100644 --- a/mysql-test/r/range_innodb.result +++ b/mysql-test/r/range_innodb.result @@ -70,6 +70,7 @@ key(a),key(b),key(c) insert into t1 select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a from t0 A, t0 B, t0 C, t0 D where D.a<5; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug="+d,ha_index_init_fail"; explain select * from t1 where a=10 and b=10; id select_type table type possible_keys key key_len ref rows Extra @@ -77,5 +78,5 @@ id select_type table type possible_keys key key_len ref rows Extra select * from t1 where a=10 and b=10; ERROR HY000: Table definition has changed, please retry transaction DROP TABLE t0,t1; -set @@global.debug_dbug="-d"; +set @@global.debug_dbug = @saved_dbug; set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/r/select_debug.result b/mysql-test/r/select_debug.result index 55882ad337a..ad663828290 100644 --- a/mysql-test/r/select_debug.result +++ b/mysql-test/r/select_debug.result @@ -6,6 +6,7 @@ insert into t1 values (2,2), (1,1); create table t2 (a int); insert into t2 values (2), (3); set session join_cache_level=3; +set @saved_dbug = @@session.debug_dbug; set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; id select_type table type possible_keys key key_len ref rows Extra @@ -16,3 +17,4 @@ b 2 set session join_cache_level=default; drop table t1,t2; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result index 38f368ec4f5..3721a13dd79 100644 --- a/mysql-test/r/show_explain_ps.result +++ b/mysql-test/r/show_explain_ps.result @@ -17,6 +17,7 @@ connection con1; connection default; connection con1; set @show_explain_probe_select_id=1; +set @saved_dbug = @@session.debug_dbug; set debug_dbug='d,show_explain_probe_join_exec_start'; select count(*) from t0 where a < 100000; connection default; @@ -28,7 +29,7 @@ Note 1003 select count(*) from t0 where a < 100000 connection con1; count(*) 10 -set debug_dbug=''; +set debug_dbug= @saved_dbug; select event_name from performance_schema.events_stages_history_long join diff --git a/mysql-test/r/slowlog_enospace-10508.result b/mysql-test/r/slowlog_enospace-10508.result index f39bfa2f00e..4dfd3474804 100644 --- a/mysql-test/r/slowlog_enospace-10508.result +++ b/mysql-test/r/slowlog_enospace-10508.result @@ -3,6 +3,7 @@ create table t1 (a int, b int) engine=memory; insert t1 select seq, seq+1 from seq_1_to_1000; set global general_log=0; set global log_queries_not_using_indexes=1; +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,simulate_file_write_error'; select * from t1 where a>10; select * from t1 where a>10; @@ -54,7 +55,7 @@ select * from t1 where a>10; select * from t1 where a>10; select * from t1 where a>10; select * from t1 where a>10; -set debug_dbug=''; +set debug_dbug= @saved_dbug; set global general_log=1; set global log_queries_not_using_indexes=default; drop table t1; diff --git a/mysql-test/r/stat_tables-enospc.result b/mysql-test/r/stat_tables-enospc.result index 943cbca6bc5..23b0f9d41ed 100644 --- a/mysql-test/r/stat_tables-enospc.result +++ b/mysql-test/r/stat_tables-enospc.result @@ -1,11 +1,12 @@ call mtr.add_suppression("No space left on device"); create table t1 (a varchar(255), b varchar(255), c varchar(255)); set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3; +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,simulate_file_write_error'; set @@max_heap_table_size=128*1024; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze Error Error writing file 'tmp-file' (Errcode: 28 "No space left on device") test.t1 analyze status Operation failed -set debug_dbug=''; +set debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/r/union_crash-714.result b/mysql-test/r/union_crash-714.result index 4a51f88b76f..b5ed7d205dc 100644 --- a/mysql-test/r/union_crash-714.result +++ b/mysql-test/r/union_crash-714.result @@ -1,5 +1,7 @@ create table t1 (i tinyint); +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,bug11747970_raise_error'; insert into t1 (i) select i from t1 union select i from t1; ERROR 70100: Query execution was interrupted drop table t1; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/r/warnings_debug.result b/mysql-test/r/warnings_debug.result index 4cdce7a5feb..eba6e8f8f4e 100644 --- a/mysql-test/r/warnings_debug.result +++ b/mysql-test/r/warnings_debug.result @@ -1,5 +1,6 @@ drop table if exists t1; create table t1 (a int primary key) engine=innodb; +set @saved_dbug = @@session.debug_dbug; SET SESSION debug_dbug="+d,warn_during_ha_commit_trans"; INSERT INTO t1 VALUES (1); Warnings: @@ -8,3 +9,4 @@ SHOW WARNINGS; Level Code Message Warning 1196 Some non-transactional changed tables couldn't be rolled back drop table t1; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/binlog/r/binlog_ioerr.result b/mysql-test/suite/binlog/r/binlog_ioerr.result index 1d3c3d7d12d..f09d6415fa4 100644 --- a/mysql-test/suite/binlog/r/binlog_ioerr.result +++ b/mysql-test/suite/binlog/r/binlog_ioerr.result @@ -2,12 +2,13 @@ CALL mtr.add_suppression("Error writing file 'master-bin'"); RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; INSERT INTO t1 VALUES(0); +set @saved_dbug = @@session.debug_dbug; SET SESSION debug_dbug='+d,fail_binlog_write_1'; INSERT INTO t1 VALUES(1); ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") INSERT INTO t1 VALUES(2); ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") -SET SESSION debug_dbug=''; +SET SESSION debug_dbug=@saved_dbug; INSERT INTO t1 VALUES(3); SELECT * FROM t1; a diff --git a/mysql-test/suite/binlog/r/binlog_write_error.result b/mysql-test/suite/binlog/r/binlog_write_error.result index 2606a9f40b3..6e8a212035a 100644 --- a/mysql-test/suite/binlog/r/binlog_write_error.result +++ b/mysql-test/suite/binlog/r/binlog_write_error.result @@ -12,92 +12,109 @@ DROP VIEW IF EXISTS v1, v2; # # Test injecting binlog write error when executing queries # +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; INSERT INTO t1 VALUES (1),(2),(3); +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; INSERT INTO t1 VALUES (4),(5),(6); INSERT INTO t1 VALUES (4),(5),(6); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; UPDATE t1 set a=a+1; UPDATE t1 set a=a+1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DELETE FROM t1; DELETE FROM t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP TRIGGER tr1; DROP TRIGGER tr1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; ALTER TABLE t1 ADD (b INT); ALTER TABLE t1 ADD (b INT); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE VIEW v1 AS SELECT a FROM t1; CREATE VIEW v1 AS SELECT a FROM t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP VIEW v1; DROP VIEW v1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1; CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP PROCEDURE p1; DROP PROCEDURE p1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP TABLE t1; DROP TABLE t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE FUNCTION f1() RETURNS INT return 1; CREATE FUNCTION f1() RETURNS INT return 1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP FUNCTION f1; DROP FUNCTION f1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE USER user1; CREATE USER user1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP USER user1; DROP USER user1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; # # Cleanup # diff --git a/mysql-test/suite/binlog_encryption/binlog_ioerr.result b/mysql-test/suite/binlog_encryption/binlog_ioerr.result index 6b3120b6d89..9b04c9be4e1 100644 --- a/mysql-test/suite/binlog_encryption/binlog_ioerr.result +++ b/mysql-test/suite/binlog_encryption/binlog_ioerr.result @@ -2,12 +2,13 @@ CALL mtr.add_suppression("Error writing file 'master-bin'"); RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; INSERT INTO t1 VALUES(0); +set @saved_dbug = @@session.debug_dbug; SET SESSION debug_dbug='+d,fail_binlog_write_1'; INSERT INTO t1 VALUES(1); ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") INSERT INTO t1 VALUES(2); ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") -SET SESSION debug_dbug=''; +SET SESSION debug_dbug=@saved_dbug; INSERT INTO t1 VALUES(3); SELECT * FROM t1; a diff --git a/mysql-test/suite/binlog_encryption/binlog_write_error.result b/mysql-test/suite/binlog_encryption/binlog_write_error.result index 2606a9f40b3..6e8a212035a 100644 --- a/mysql-test/suite/binlog_encryption/binlog_write_error.result +++ b/mysql-test/suite/binlog_encryption/binlog_write_error.result @@ -12,92 +12,109 @@ DROP VIEW IF EXISTS v1, v2; # # Test injecting binlog write error when executing queries # +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; INSERT INTO t1 VALUES (1),(2),(3); +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; INSERT INTO t1 VALUES (4),(5),(6); INSERT INTO t1 VALUES (4),(5),(6); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; UPDATE t1 set a=a+1; UPDATE t1 set a=a+1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DELETE FROM t1; DELETE FROM t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP TRIGGER tr1; DROP TRIGGER tr1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; ALTER TABLE t1 ADD (b INT); ALTER TABLE t1 ADD (b INT); ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE VIEW v1 AS SELECT a FROM t1; CREATE VIEW v1 AS SELECT a FROM t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP VIEW v1; DROP VIEW v1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1; CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP PROCEDURE p1; DROP PROCEDURE p1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP TABLE t1; DROP TABLE t1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE FUNCTION f1() RETURNS INT return 1; CREATE FUNCTION f1() RETURNS INT return 1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP FUNCTION f1; DROP FUNCTION f1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; CREATE USER user1; CREATE USER user1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; DROP USER user1; DROP USER user1; ERROR HY000: Error writing file 'master-bin' ((errno: #) -SET GLOBAL debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; # # Cleanup # diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.result b/mysql-test/suite/binlog_encryption/rpl_checksum.result index 41c4cd94aff..14220a356ca 100644 --- a/mysql-test/suite/binlog_encryption/rpl_checksum.result +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.result @@ -76,6 +76,7 @@ connection master; set @@global.binlog_checksum = CRC32; insert into t1 values (1) /* will not be applied on slave due to simulation */; connection slave; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; start slave; include/wait_for_slave_io_error.inc [errno=1236] @@ -83,15 +84,16 @@ Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary select count(*) as zero from t1; zero 0 -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; connection slave; include/start_slave.inc connection master; set @@global.master_verify_checksum = 1; +set @save_dbug = @@session.debug_dbug; set @@session.debug_dbug='d,simulate_checksum_test_failure'; show binlog events; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error -set @@session.debug_dbug=''; +set debug_dbug= @save_dbug; set @@global.master_verify_checksum = default; connection slave; connection slave; @@ -99,10 +101,11 @@ include/stop_slave.inc connection master; create table t2 (a int); connection slave; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave io_thread; include/wait_for_slave_io_error.inc [errno=1595,1913] -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; start slave io_thread; include/wait_for_slave_param.inc [Read_Master_Log_Pos] set @@global.slave_sql_verify_checksum = 1; @@ -110,7 +113,7 @@ set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave sql_thread; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4' -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; include/start_slave.inc connection master; connection slave; diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.result b/mysql-test/suite/binlog_encryption/rpl_corruption.result index 25a82fd60cd..db72bb304fc 100644 --- a/mysql-test/suite/binlog_encryption/rpl_corruption.result +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.result @@ -13,6 +13,7 @@ connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); include/stop_slave.inc # 2. Corruption in master binlog and SHOW BINLOG EVENTS +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SHOW BINLOG EVENTS; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error @@ -55,9 +56,9 @@ connection slave; include/diff_tables.inc [master:test.t1, slave:test.t1] # 8. Clean up connection master; -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; SET GLOBAL master_verify_checksum = @old_master_verify_checksum; DROP TABLE t1; connection slave; -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_incident.result b/mysql-test/suite/binlog_encryption/rpl_incident.result index 8fb4aa907cc..6dbe4417c5a 100644 --- a/mysql-test/suite/binlog_encryption/rpl_incident.result +++ b/mysql-test/suite/binlog_encryption/rpl_incident.result @@ -14,6 +14,7 @@ a 1 2 3 +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; REPLACE INTO t1 VALUES (4); SELECT * FROM t1; @@ -22,6 +23,7 @@ a 2 3 4 +set @@global.debug_dbug = @saved_dbug; connection slave; call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); include/wait_for_slave_sql_error.inc [errno=1590] diff --git a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result index 91742814b4c..fc23734c645 100644 --- a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result +++ b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result @@ -4,12 +4,13 @@ connection slave; stop slave; reset slave; connection slave; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Failed during slave thread initialization' call mtr.add_suppression("Failed during slave.* thread initialization"); -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; connection slave; reset slave; SET GLOBAL init_slave= "garbage"; diff --git a/mysql-test/suite/innodb/r/blob-update-debug.result b/mysql-test/suite/innodb/r/blob-update-debug.result index 1360745b7e6..0d0fc6d5070 100644 --- a/mysql-test/suite/innodb/r/blob-update-debug.result +++ b/mysql-test/suite/innodb/r/blob-update-debug.result @@ -7,9 +7,11 @@ insert into t1 values (1, repeat('*', 50000)); select f1, substring(f2, 1, 40) from t1; f1 substring(f2, 1, 40) 1 **************************************** +set @saved_debug = @@session.debug_dbug; set debug_dbug = 'd,row_ins_index_entry_timeout'; update t1 set f1 = 3; select f1, substring(f2, 1, 40) from t1; f1 substring(f2, 1, 40) 3 **************************************** drop table t1; +set debug_dbug= @saved_debug; diff --git a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result index ef2d3182b92..b48cfb05a5c 100644 --- a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result +++ b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: Warning: Index.*"); +set @saved_dbug = @@session.debug_dbug; set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized'; create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb; create procedure innodb_insert_proc (repeat_count int) @@ -27,6 +28,6 @@ count(1) select count(1) from t1 where c between 7 and 787; count(1) 781 -set DEBUG_DBUG=NULL; drop procedure innodb_insert_proc; drop table t1; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug11754376.result b/mysql-test/suite/innodb/r/innodb_bug11754376.result index b9f2a169a73..a2c1ceed61f 100644 --- a/mysql-test/suite/innodb/r/innodb_bug11754376.result +++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result @@ -1,3 +1,5 @@ CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; +set @saved_dbug = @@session.debug_dbug; SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; DROP TABLE bug11754376; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result index 4248013b088..981e08609a2 100644 --- a/mysql-test/suite/innodb/r/innodb_bug56947.result +++ b/mysql-test/suite/innodb/r/innodb_bug56947.result @@ -1,5 +1,6 @@ SET GLOBAL innodb_file_per_table=0; create table bug56947(a int not null) engine = innodb; +set @saved_dbug = @@session.debug_dbug; SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename'; alter table bug56947 add unique index (a); ERROR HY000: Got error 11 "xxx" from storage engine InnoDB @@ -8,3 +9,4 @@ Table Op Msg_type Msg_text test.bug56947 check status OK drop table bug56947; SET @@global.innodb_file_per_table=DEFAULT; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result b/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result index 5f14ad9b0d7..73b5f81a76f 100644 --- a/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result +++ b/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result @@ -4,6 +4,7 @@ drop table if exists t1; connection con1; create table t1 (id integer, x integer) engine = InnoDB; insert into t1 values(0, 0); +set @saved_dbug = @@session.debug_dbug; set DEBUG_DBUG='+d,fatal-semaphore-timeout'; set autocommit=0; # Sending query on con1, @@ -21,6 +22,6 @@ connection default; # Waitting for reconnect after mysqld restarts # Reconnected after mysqld was successfully restarted # Cleaning up before exit -set DEBUG_DBUG=NULL; +set debug_dbug = @saved_dbug; drop table if exists t1; # Clean exit diff --git a/mysql-test/suite/innodb/t/blob-update-debug.test b/mysql-test/suite/innodb/t/blob-update-debug.test index 948cd749148..37c364290f4 100644 --- a/mysql-test/suite/innodb/t/blob-update-debug.test +++ b/mysql-test/suite/innodb/t/blob-update-debug.test @@ -11,7 +11,9 @@ create table t1 (f1 int primary key, f2 blob) engine = innodb; insert into t1 values (1, repeat('*', 50000)); select f1, substring(f2, 1, 40) from t1; +set @saved_debug = @@session.debug_dbug; set debug_dbug = 'd,row_ins_index_entry_timeout'; update t1 set f1 = 3; select f1, substring(f2, 1, 40) from t1; drop table t1; +set debug_dbug= @saved_debug; diff --git a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test index e480f0caf07..dc85aa6e892 100644 --- a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test +++ b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test @@ -6,6 +6,7 @@ call mtr.add_suppression("InnoDB: Warning: Index.*"); # This caused crash earlier +set @saved_dbug = @@session.debug_dbug; set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized'; create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb; @@ -32,8 +33,8 @@ select count(1) from t1 where a between 5 and 100; select count(1) from t1 where b between 5 and 256; select count(1) from t1 where c between 7 and 787; -set DEBUG_DBUG=NULL; + drop procedure innodb_insert_proc; drop table t1; - +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug11754376.test b/mysql-test/suite/innodb/t/innodb_bug11754376.test index a7f35c1a960..238c86194d6 100644 --- a/mysql-test/suite/innodb/t/innodb_bug11754376.test +++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test @@ -8,7 +8,8 @@ CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; # This will invoke test_normalize_table_name_low() in debug builds - +set @saved_dbug = @@session.debug_dbug; SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; DROP TABLE bug11754376; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug56947.test b/mysql-test/suite/innodb/t/innodb_bug56947.test index 84c5e70e1b5..98bca895e82 100644 --- a/mysql-test/suite/innodb/t/innodb_bug56947.test +++ b/mysql-test/suite/innodb/t/innodb_bug56947.test @@ -7,6 +7,7 @@ SET GLOBAL innodb_file_per_table=0; create table bug56947(a int not null) engine = innodb; +set @saved_dbug = @@session.debug_dbug; SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename'; --replace_regex /"[^"]*"/"xxx"/ --error ER_GET_ERRNO @@ -15,3 +16,4 @@ check table bug56947; drop table bug56947; SET @@global.innodb_file_per_table=DEFAULT; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test index e7acb98b0d0..e7076527b2b 100644 --- a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test +++ b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test @@ -17,6 +17,7 @@ eval create table t1 (id integer, x integer) engine = InnoDB; insert into t1 values(0, 0); # Enable the debug injection. +set @saved_dbug = @@session.debug_dbug; set DEBUG_DBUG='+d,fatal-semaphore-timeout'; set autocommit=0; @@ -107,7 +108,7 @@ source include/wait_until_connected_again.inc; --echo # Cleaning up before exit --disable_warnings -set DEBUG_DBUG=NULL; +set debug_dbug = @saved_dbug; drop table if exists t1; --enable_warnings diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result index 9871d43119a..31d832ba483 100644 --- a/mysql-test/suite/innodb_fts/r/concurrent_insert.result +++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result @@ -17,6 +17,7 @@ INSERT INTO t1 VALUES('test'); CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB; INSERT INTO t2 VALUES('mariadb'); connection default; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang'; SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL drop_index_start WAIT_FOR sync_op'; @@ -28,7 +29,7 @@ ALTER TABLE t2 drop index idx1; connection default; set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; -SET global DEBUG_DBUG=RESET; +set @@global.debug_dbug = @saved_dbug; drop table t1, t2; connection default; set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test index 77097d44dc5..881441b66b6 100644 --- a/mysql-test/suite/innodb_fts/t/concurrent_insert.test +++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test @@ -29,6 +29,7 @@ CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB; INSERT INTO t2 VALUES('mariadb'); connection default; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang'; SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL drop_index_start WAIT_FOR sync_op'; @@ -45,7 +46,7 @@ set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; reap; -SET global DEBUG_DBUG=RESET; +set @@global.debug_dbug = @saved_dbug; drop table t1, t2; connection default; set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result index 760d7342752..1dd675bc8a9 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result @@ -1,3 +1,4 @@ +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; create table `t1` (`c1` char(1) default null,`c2` char(10) default null, key (`c1`)) @@ -7,3 +8,4 @@ select * from `t1` where `c1`='3' for update; c1 c2 3 NULL drop table `t1`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result index 5e53649c538..3e6f4b2b4f1 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result @@ -1,6 +1,7 @@ # # Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on # +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t ( dummy INT PRIMARY KEY, @@ -13,3 +14,4 @@ dummy a b 3 3 3 5 5 5 DROP TABLE t; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result index 31e39d4421d..ef0d8e7043a 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result @@ -1,3 +1,4 @@ +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; drop table if exists `t1`; Warnings: @@ -6,3 +7,4 @@ create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb; insert into `t1` values(2,2); delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ; drop table `t1`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result index e4fdf0d03a7..018bb0dd6e0 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result @@ -1,3 +1,4 @@ +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -252,3 +253,4 @@ Warning 1292 Truncated incorrect DOUBLE value: 'd' Warning 1292 Truncated incorrect DOUBLE value: 'd' Warning 1292 Truncated incorrect DOUBLE value: 'd' drop table `table5`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result index 0cd801280c8..ca8b54dc1ae 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result @@ -1,3 +1,4 @@ +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY KEY(c1), UNIQUE INDEX(c2)) engine=innodb; @@ -9,3 +10,4 @@ SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; c1 c2 c3 08:29:45 NULL 2009-02-01 drop table `t1`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result index 899bf04e635..d2df789ccf0 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result @@ -1,6 +1,7 @@ # # Bug#43360 - Server crash with a simple multi-table update # +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1 ( a CHAR(2) NOT NULL PRIMARY KEY, @@ -42,3 +43,4 @@ AB Sweden MS United States of Ame JA USA DROP TABLE t1,t2; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result index a8f56923386..552c8629962 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result @@ -1,6 +1,7 @@ # # Bug#43448 - Server crashes on multi table delete with Innodb # +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1 ( id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -28,3 +29,4 @@ DELETE t1, t2, t3 FROM t1, t2, t3 WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5; DROP TABLE t1, t2, t3; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result index 0d88ff3d2cb..388c88c1d05 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result @@ -1,6 +1,7 @@ set storage_engine=innodb; set @save_time_zone= @@time_zone; set time_zone='+03:00'; +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28'); @@ -100,3 +101,4 @@ c1 c2 c3 c4 2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 DROP TABLE t1; set time_zone= @save_time_zone; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test index da9de306b09..63219c8172d 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test @@ -4,6 +4,7 @@ --source include/have_innodb.inc # crash requires this +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; create table `t1` (`c1` char(1) default null,`c2` char(10) default null, @@ -12,3 +13,4 @@ engine=innodb default charset=latin1; insert into `t1` values ('3',null); select * from `t1` where `c1`='3' for update; drop table `t1`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test index b16f55aa951..c442712cc62 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test @@ -5,6 +5,7 @@ --source include/have_debug.inc --source include/have_innodb.inc +set @saved_dbug = @@session.debug_dbug; # Crash requires that we enable Index Condition Pushdown in InnoDB set session debug_dbug="+d,optimizer_innodb_icp"; @@ -19,3 +20,4 @@ INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5); SELECT * FROM t WHERE a > 2 FOR UPDATE; DROP TABLE t; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test index 7d6237fa536..e7c04eec496 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test @@ -5,6 +5,7 @@ --source include/have_innodb.inc # crash requires this +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; drop table if exists `t1`; @@ -12,3 +13,4 @@ create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb; insert into `t1` values(2,2); delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ; drop table `t1`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test index 2b5864a3e69..e768e775a01 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test @@ -6,6 +6,7 @@ --source include/have_innodb.inc +set @saved_dbug = @@session.debug_dbug; # Valgrind errors happen only with this: set session debug_dbug="+d,optimizer_innodb_icp"; @@ -246,3 +247,4 @@ UNLOCK TABLES; select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ; drop table `table5`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test index 6275038a650..e727bc24763 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test @@ -4,6 +4,7 @@ --source include/have_debug.inc --source include/have_innodb.inc +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY @@ -15,3 +16,4 @@ SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; drop table `t1`; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test index 9bfff0ccdb7..3bb6e79a784 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test @@ -6,6 +6,7 @@ --source include/have_debug.inc --source include/have_innodb.inc +set @saved_dbug = @@session.debug_dbug; # crash requires this set session debug_dbug="+d,optimizer_innodb_icp"; @@ -42,3 +43,4 @@ SELECT * FROM t1; SELECT * FROM t2; DROP TABLE t1,t2; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test index f7f40a6d3bf..9bc83195b73 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test @@ -5,6 +5,7 @@ --source include/have_debug.inc --source include/have_innodb.inc +set @saved_dbug = @@session.debug_dbug; # crash requires ICP support in InnoDB set session debug_dbug="+d,optimizer_innodb_icp"; @@ -58,3 +59,4 @@ FROM t1, t2, t3 WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5; DROP TABLE t1, t2, t3; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test index 2b5b5fd96dd..6533025a7b6 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test @@ -6,6 +6,7 @@ set storage_engine=innodb; set @save_time_zone= @@time_zone; set time_zone='+03:00'; +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; ######## Running INSERT tests for TIMESTAMP ######## @@ -83,4 +84,4 @@ SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER DROP TABLE t1; set time_zone= @save_time_zone; - +set debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index 7460fe8dd74..e438cae7a14 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -6,11 +6,11 @@ CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a)) PARTITION BY HASH (a) PARTITIONS 3; INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"), (6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine"); -SET @save_dbug=@@debug_dbug; +SET @saved_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,ha_partition_fail_index_init"; SELECT * FROM t1 WHERE b = "Seven"; ERROR HY000: Table has no partition for value 0 -SET SESSION debug_dbug=@save_dbug; +SET SESSION debug_dbug=@saved_dbug; SELECT * FROM t1 WHERE b = "Seven"; a b 7 Seven diff --git a/mysql-test/suite/parts/t/partition_debug.test b/mysql-test/suite/parts/t/partition_debug.test index ef12ee99948..864452f8d8b 100644 --- a/mysql-test/suite/parts/t/partition_debug.test +++ b/mysql-test/suite/parts/t/partition_debug.test @@ -18,11 +18,11 @@ CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a)) PARTITION BY HASH (a) PARTITIONS 3; INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"), (6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine"); -SET @save_dbug=@@debug_dbug; +SET @saved_dbug=@@debug_dbug; SET SESSION debug_dbug="+d,ha_partition_fail_index_init"; --error ER_NO_PARTITION_FOR_GIVEN_VALUE SELECT * FROM t1 WHERE b = "Seven"; -SET SESSION debug_dbug=@save_dbug; +SET SESSION debug_dbug=@saved_dbug; SELECT * FROM t1 WHERE b = "Seven"; DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_debug_innodb.test b/mysql-test/suite/parts/t/partition_debug_innodb.test index c3fa85ba5ba..0d065d0e3f2 100644 --- a/mysql-test/suite/parts/t/partition_debug_innodb.test +++ b/mysql-test/suite/parts/t/partition_debug_innodb.test @@ -30,7 +30,7 @@ INSERT INTO t1 VALUES (6, 'X 6 row'), (7, 'Seventh row'), (8, 'Last row'); ALTER TABLE t1 ADD INDEX new_b_index (b); ALTER TABLE t1 DROP INDEX new_b_index; -SET @save_dbug=@@debug_dbug; +SET @saved_dbug=@@debug_dbug; SET SESSION debug_dbug = "+d,ha_partition_fail_final_add_index"; --error ER_NO_PARTITION_FOR_GIVEN_VALUE @@ -46,7 +46,7 @@ SHOW CREATE TABLE t1; --sorted_result SELECT * FROM t1; -SET SESSION debug_dbug = @save_dbug; +SET SESSION debug_dbug = @saved_dbug; SHOW CREATE TABLE t1; DROP TABLE t1; } diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result index 27243b52422..24f6a448334 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result index 7879919b09d..a4072a4681a 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result index 1d5923483c9..277eb5a57f3 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result index 87fc75817df..716089f7022 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result index 949fa8f9c3e..e7ef6c05d4b 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN null LAST_ERROR_SEEN null revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result index b2e0fb60811..a516f77a66d 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; ERROR HY000: Host 'santa.claus.ipv4.example.com' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result index bfc7fde5be8..d6212a009cb 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -103,4 +104,4 @@ revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result index 41eb9636e31..08f4152fdcc 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result index 22dd7e7632c..7dd56fffdca 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; uninstall plugin test_plugin_server; ERROR HY000: Plugin 'test_plugin_server' is not loaded @@ -194,5 +195,5 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com' FROM 'plug'@'santa.claus.ipv4.example.com'; DROP USER 'plug'@'santa.claus.ipv4.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result index f301df94ce6..33000173925 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result @@ -25,6 +25,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4,native_password_bad_reply"; ERROR 08S01: Bad handshake connection default; @@ -427,4 +428,4 @@ drop user 'root'@'santa.claus.ipv4.example.com'; revoke select on test.* from 'quota'@'santa.claus.ipv4.example.com'; drop user 'quota'@'santa.claus.ipv4.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result index 14a6ace09e4..8af7cadda99 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_format_ipv4"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result index 6cca75f9775..75d784e3381 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result @@ -25,6 +25,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect con2a,"127.0.0.1",quota,,test,$MASTER_MYPORT,; select "Con2a is alive"; @@ -702,4 +703,4 @@ disconnect tmp_con7; set global max_connections = @saved_max_connections; set global max_user_connections = @saved_max_user_connections; drop user 'quota'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result index 5aa80d90d84..6f80a0883a3 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -178,4 +179,4 @@ revoke select on test.* from 'root'@'192.0.2.4'; revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result index abe9a606bc4..0a80efd3333 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -142,4 +143,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result index 18986674491..9499789334b 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result index 88ac817ce17..2592a003d59 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result index a5f70873ed9..fc20f4e1c2f 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; ERROR 28000: Access denied for user 'user_without'@'santa.claus.ipv4.example.com' (using password: YES) connection default; @@ -207,4 +208,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_with'@'santa.claus.ipv4.example.com'; drop user 'user_without'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result index 86e7bf5780b..c7ae1cdd12f 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result @@ -28,6 +28,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; ERROR 28000: Access denied for user 'user_ssl'@'santa.claus.ipv4.example.com' (using password: NO) connection default; @@ -151,4 +152,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_ssl'@'santa.claus.ipv4.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result index 42d86e858fb..330aaa57b1d 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result index 87e97ba2138..dd730123cc4 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result index bcd47243d03..c613bda07ba 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result index 5c24a86248a..32fcc37b75b 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result index 68ea9a1d826..2558047ab62 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN null LAST_ERROR_SEEN null revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result index 5b1f546b30e..a4da4f54058 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result @@ -19,6 +19,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; ERROR HY000: Host 'santa.claus.ipv6.example.com' is not allowed to connect to this MariaDB server connection default; @@ -80,4 +81,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result index 0a3a3329c1e..e4da1079176 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -103,4 +104,4 @@ revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result index 493ada909b7..2aeb0189da4 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result index a36d1442ee6..0897fdd1872 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; uninstall plugin test_plugin_server; ERROR HY000: Plugin 'test_plugin_server' is not loaded @@ -194,5 +195,5 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com' FROM 'plug'@'santa.claus.ipv6.example.com'; DROP USER 'plug'@'santa.claus.ipv6.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result index 7cfb6f87277..c4d482a6b12 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result @@ -25,6 +25,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply"; ERROR 08S01: Bad handshake connection default; @@ -427,4 +428,4 @@ drop user 'root'@'santa.claus.ipv6.example.com'; revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com'; drop user 'quota'@'santa.claus.ipv6.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result index f9d2b556804..a77603b6e99 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result @@ -25,6 +25,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect con2a,"::1",quota,,test,$MASTER_MYPORT,; select "Con2a is alive"; @@ -702,4 +703,4 @@ disconnect tmp_con7; set global max_connections = @saved_max_connections; set global max_user_connections = @saved_max_user_connections; drop user 'quota'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result index 6140f655e7c..3227b1eec67 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -178,4 +179,4 @@ revoke select on test.* from 'root'@'2001:db8::6:6'; revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result index 22ce0c3e809..b801010e0b7 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -142,4 +143,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result index a78ba09513c..a17421161f9 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result @@ -22,6 +22,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result index da1570f1b37..dd1b2f89ac3 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result @@ -20,6 +20,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result index a4cc3eeb0d0..6d6362b2874 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result @@ -24,6 +24,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; ERROR 28000: Access denied for user 'user_without'@'santa.claus.ipv6.example.com' (using password: YES) connection default; @@ -207,4 +208,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_with'@'santa.claus.ipv6.example.com'; drop user 'user_without'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result index 75f8e5391cf..61c98b0c868 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result @@ -28,6 +28,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; ERROR 28000: Access denied for user 'user_ssl'@'santa.claus.ipv6.example.com' (using password: NO) connection default; @@ -151,4 +152,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_ssl'@'santa.claus.ipv6.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result index ddb44157f44..d88a240a2b7 100644 --- a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result +++ b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result @@ -27,6 +27,7 @@ current_user() root@localhost disconnect con1; connection default; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_error"; ERROR HY000: Can't get hostname for your address connection default; @@ -50,7 +51,7 @@ Connection_errors_peer_address 2 Connection_errors_select 0 Connection_errors_tcpwrap 0 "Dumping performance_schema.host_cache" -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; flush status; show global status like "connection_errors_%"; Variable_name Value diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test index 6bed01e50bf..07a6f14f114 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test @@ -27,6 +27,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -48,5 +49,5 @@ disconnect con3; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test index 3c72de8a05e..1218538d173 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test @@ -25,6 +25,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; --disable_query_log @@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test index 5cbe4c30530..285563ddc62 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test @@ -30,6 +30,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -51,5 +52,5 @@ disconnect con3; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test index c0639cd6b86..a7d197e03d1 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test @@ -27,6 +27,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; --disable_query_log @@ -45,5 +46,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test index 3b69e0731a0..0f8881e3caa 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test @@ -28,6 +28,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -49,5 +50,5 @@ disconnect con3; revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test index e6478c13951..dd2c7209e54 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test @@ -25,6 +25,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; --disable_query_log @@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test index b4b11526af6..12f82b2a52c 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test @@ -30,6 +30,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -53,5 +54,5 @@ revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test index 06f0f7d29ee..28030802afb 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test @@ -25,6 +25,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; --disable_query_log @@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test index 325460e66ba..3e487f38636 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test @@ -30,6 +30,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; uninstall plugin test_plugin_server; @@ -86,6 +87,6 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com' DROP USER 'plug'@'santa.claus.ipv4.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test index 6990a4e7118..59cd855feaf 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test @@ -33,6 +33,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4,native_password_bad_reply"; --disable_query_log @@ -156,5 +157,5 @@ revoke select on test.* from 'quota'@'santa.claus.ipv4.example.com'; drop user 'quota'@'santa.claus.ipv4.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test index b37bfc79ada..a7c0117284d 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test @@ -24,6 +24,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_format_ipv4"; --disable_query_log @@ -42,5 +43,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test index c0349184506..904de7335ee 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test @@ -31,6 +31,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect (con2a,"127.0.0.1",quota,,test,$MASTER_MYPORT,); @@ -259,5 +260,5 @@ set global max_user_connections = @saved_max_user_connections; # revoke all privileges on test.* from 'quota'@'santa.claus.ipv4.example.com'; drop user 'quota'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test index 187879985c9..0a83bc51f12 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test @@ -30,6 +30,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -71,5 +72,5 @@ revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test index a78c0dab4eb..465133859d2 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test @@ -25,6 +25,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; --disable_query_log @@ -61,5 +62,5 @@ connect (con5,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test index 23ecd51eb4f..15153dd07aa 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test @@ -28,6 +28,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -49,5 +50,5 @@ disconnect con3; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test index 4b6c91c3df3..9df41d429f2 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test @@ -25,6 +25,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; --disable_query_log @@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test index ea331647b48..064200f80b8 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test @@ -29,6 +29,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; --disable_query_log @@ -82,5 +83,5 @@ connect (con2f,"127.0.0.1",user_with,wrong_password,test,$MASTER_MYPORT,); drop user 'user_with'@'santa.claus.ipv4.example.com'; drop user 'user_without'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test index 2b949098bad..116ad07dd68 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test @@ -30,6 +30,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; --disable_query_log @@ -67,5 +68,5 @@ connect (con2d,"127.0.0.1",user_ssl_x509,good_password,test,$MASTER_MYPORT,,SSL) drop user 'user_ssl'@'santa.claus.ipv4.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv4.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test index 11c45724f70..a45da8c614a 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test @@ -29,6 +29,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -50,5 +51,5 @@ disconnect con3; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test index bdbc0e3c025..c9102366a7d 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test @@ -26,6 +26,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; --disable_query_log @@ -44,5 +45,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test index 1eb0d3ec41f..e6c5c9c7d7b 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test @@ -31,6 +31,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -52,5 +53,5 @@ disconnect con3; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test index f8a3cc23c00..7a9fa037079 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test @@ -28,6 +28,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; --disable_query_log @@ -46,5 +47,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test index 6493bb61a1a..507e04f8d3f 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test @@ -29,6 +29,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -50,5 +51,5 @@ disconnect con3; revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test index 065ae02dd49..5bd4d8a7bd0 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test @@ -22,6 +22,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; --disable_query_log @@ -40,5 +41,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test index 9ebafc9627d..dd790e77dbd 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test @@ -31,6 +31,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -54,5 +55,4 @@ revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; - +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test index 136b3c7a24f..c6cb78da508 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test @@ -26,6 +26,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; --disable_query_log @@ -44,5 +45,4 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; - +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test index 3a822bfacb3..e8b8c42fd8a 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test @@ -31,6 +31,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; uninstall plugin test_plugin_server; @@ -87,6 +88,6 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com' DROP USER 'plug'@'santa.claus.ipv6.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test index 0a04ec306cf..b28917d6ddd 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test @@ -33,6 +33,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply"; --disable_query_log @@ -156,5 +157,5 @@ revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com'; drop user 'quota'@'santa.claus.ipv6.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test index b14fff1cc72..a2782619b15 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test @@ -32,6 +32,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect (con2a,"::1",quota,,test,$MASTER_MYPORT,); @@ -241,5 +242,5 @@ set global max_user_connections = @saved_max_user_connections; # revoke all privileges on test.* from 'quota'@'santa.claus.ipv6.example.com'; drop user 'quota'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test index b44b58eb0d5..c1cc68a10e1 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test @@ -31,6 +31,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -72,5 +73,5 @@ revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test index 073451c7e75..80fccd6924f 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test @@ -26,6 +26,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; --disable_query_log @@ -62,5 +63,5 @@ connect (con5,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test index a7b1a961f09..af809674711 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test @@ -29,6 +29,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -50,5 +51,5 @@ disconnect con3; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test index 5c3d643b166..5e3f3b605d4 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test @@ -26,6 +26,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; --disable_query_log @@ -44,5 +45,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test index 7dcfbb922e5..a5d635d6133 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test @@ -27,6 +27,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; --disable_query_log @@ -80,5 +81,5 @@ connect (con2f,"::1",user_with,wrong_password,test,$MASTER_MYPORT,); drop user 'user_with'@'santa.claus.ipv6.example.com'; drop user 'user_without'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test index 3ea4451c7aa..9821b4f8882 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test @@ -31,6 +31,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; --disable_query_log @@ -68,5 +69,5 @@ connect (con2d,"::1",user_ssl_x509,good_password,test,$MASTER_MYPORT,,SSL); drop user 'user_ssl'@'santa.claus.ipv6.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv6.example.com'; -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test index 65f33ce73a8..cd36c88ffae 100644 --- a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test +++ b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test @@ -22,6 +22,7 @@ select current_user(); disconnect con1; --connection default +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_error"; --disable_query_log @@ -42,7 +43,7 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); show global status like "connection_errors_%"; --source ../include/hostcache_dump.inc -set global debug_dbug= default; +set @@global.debug_dbug = @saved_dbug; flush status; show global status like "connection_errors_%"; diff --git a/mysql-test/suite/rpl/r/kill_race_condition.result b/mysql-test/suite/rpl/r/kill_race_condition.result index 1181eb0b0b1..4da61a78eb9 100644 --- a/mysql-test/suite/rpl/r/kill_race_condition.result +++ b/mysql-test/suite/rpl/r/kill_race_condition.result @@ -4,6 +4,7 @@ connection master; create table t1 (a int); connection slave; connection slave; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug='d,rows_log_event_before_open_table'; connection master; insert t1 values (1),(2),(3); @@ -13,7 +14,7 @@ kill slave_sql_thread; set debug_sync='now SIGNAL go_ahead_sql'; include/wait_for_slave_sql_error.inc [errno=1927] Last_SQL_Error = Error executing row event: 'Connection was killed' -set global debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; set debug_sync='RESET'; connection master; drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 74ba945b027..a3d60a672a9 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -5,10 +5,11 @@ call mtr.add_suppression("Failed during slave I/O thread initialization"); call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* 1593"); include/stop_slave.inc reset slave; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Failed during slave thread initialization' -SET GLOBAL debug_dbug=""; +set @@global.debug_dbug = @saved_dbug; RESET SLAVE; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug41902.result b/mysql-test/suite/rpl/r/rpl_bug41902.result index 8667795bd77..de594d39a98 100644 --- a/mysql-test/suite/rpl/r/rpl_bug41902.result +++ b/mysql-test/suite/rpl/r/rpl_bug41902.result @@ -2,6 +2,7 @@ include/master-slave.inc [connection master] connection slave; stop slave; +set @saved_dbug = @@global.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; reset slave; ERROR HY000: Target log not found in binlog index @@ -19,6 +20,7 @@ SET @@debug_dbug=""; reset slave; change master to master_host='dummy'; connection master; +set @saved_dbug_m = @@global.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; reset master; ERROR HY000: Target log not found in binlog index @@ -29,6 +31,7 @@ purge binary logs to 'master-bin.000001'; ERROR HY000: Target log not found in binlog index SET @@debug_dbug=""; purge binary logs to 'master-bin.000001'; +set @@global.debug_dbug = @saved_dbug; ==== clean up ==== CHANGE MASTER TO MASTER_HOST = '127.0.0.1'; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index a74b688d722..7a8644f6bea 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -76,6 +76,7 @@ connection master; set @@global.binlog_checksum = CRC32; insert into t1 values (1) /* will not be applied on slave due to simulation */; connection slave; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; start slave; include/wait_for_slave_io_error.inc [errno=1236] @@ -83,15 +84,16 @@ Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary select count(*) as zero from t1; zero 0 -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; connection slave; include/start_slave.inc connection master; set @@global.master_verify_checksum = 1; +set @save_dbug = @@session.debug_dbug; set @@session.debug_dbug='d,simulate_checksum_test_failure'; show binlog events; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error -set @@session.debug_dbug=''; +set debug_dbug= @save_dbug; set @@global.master_verify_checksum = default; connection slave; connection slave; @@ -99,10 +101,11 @@ include/stop_slave.inc connection master; create table t2 (a int); connection slave; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave io_thread; include/wait_for_slave_io_error.inc [errno=1595,1913] -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; start slave io_thread; include/wait_for_slave_param.inc [Read_Master_Log_Pos] set @@global.slave_sql_verify_checksum = 1; @@ -110,7 +113,7 @@ set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave sql_thread; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4' -set @@global.debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; include/start_slave.inc connection master; connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result index 25a82fd60cd..db72bb304fc 100644 --- a/mysql-test/suite/rpl/r/rpl_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_corruption.result @@ -13,6 +13,7 @@ connection master; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100)); include/stop_slave.inc # 2. Corruption in master binlog and SHOW BINLOG EVENTS +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; SHOW BINLOG EVENTS; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error @@ -55,9 +56,9 @@ connection slave; include/diff_tables.inc [master:test.t1, slave:test.t1] # 8. Clean up connection master; -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; SET GLOBAL master_verify_checksum = @old_master_verify_checksum; DROP TABLE t1; connection slave; -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result b/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result index cf26c3bf04a..dc45c0b9ab3 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result @@ -7,7 +7,7 @@ set @@global.slave_net_timeout= 10; show status like 'Slave_heartbeat_period';; Variable_name Slave_heartbeat_period Value 60.000 -SET @save_dbug= @@GLOBAL.debug_dbug; +SET @saved_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error"; CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error'); CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); @@ -25,7 +25,7 @@ connection master; drop table t1; connection slave; include/stop_slave.inc -SET GLOBAL debug_dbug=@save_dbug; +SET GLOBAL debug_dbug=@saved_dbug; set @@global.slave_net_timeout= @restore_slave_net_timeout; include/start_slave.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index 8fb4aa907cc..6dbe4417c5a 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -14,6 +14,7 @@ a 1 2 3 +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*'; REPLACE INTO t1 VALUES (4); SELECT * FROM t1; @@ -22,6 +23,7 @@ a 2 3 4 +set @@global.debug_dbug = @saved_dbug; connection slave; call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); include/wait_for_slave_sql_error.inc [errno=1590] diff --git a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result index 91742814b4c..fc23734c645 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result @@ -4,12 +4,13 @@ connection slave; stop slave; reset slave; connection slave; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Failed during slave thread initialization' call mtr.add_suppression("Failed during slave.* thread initialization"); -SET GLOBAL debug_dbug= ""; +set @@global.debug_dbug = @saved_dbug; connection slave; reset slave; SET GLOBAL init_slave= "garbage"; diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result index 6fece52dda3..8d22289370b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result @@ -2,6 +2,7 @@ include/master-slave.inc [connection master] connection master; include/rpl_restart_server.inc [server_number=1] +set @saved_dbug = @@session.debug_dbug; SET @@debug_dbug="d,simulate_big_table_id"; CREATE TABLE t (a int); INSERT INTO t SET a= 0; @@ -42,5 +43,6 @@ master-bin.000002 # Query 1 # COMMIT connection slave; connection master; DROP TABLE t; +set debug_dbug= @saved_dbug; connection slave; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result index 491fb68615c..118266399fb 100644 --- a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result +++ b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result @@ -2,6 +2,7 @@ include/master-slave.inc [connection master] connection slave; include/stop_slave.inc +set @saved_dbug = @@global.debug_dbug; SET GLOBAL log_warnings = 2; SET GLOBAL debug_dbug="d,inject_long_find_row_note"; include/start_slave.inc @@ -17,7 +18,7 @@ connection slave; # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log Occurrences: update=1, delete=1 include/stop_slave.inc -SET GLOBAL debug_dbug = ''; +set @@global.debug_dbug = @saved_dbug; SET GLOBAL log_warnings = 2; include/start_slave.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result index ec9607148d4..62d4ea896ef 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result @@ -11,6 +11,7 @@ SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1; include/start_slave.inc connection master; CREATE TABLE t1 (a INT) ENGINE=innodb; +set @saved_dbug = @@global.debug_dbug; SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB"; SET @@SESSION.skip_replication=1; INSERT INTO t1 SET a=1; @@ -20,7 +21,7 @@ SET @@GLOBAL.debug_dbug=""; FLUSH LOGS; connection slave; connection master; -SET @@GLOBAL.debug_dbug=@@GLOBAL.debug_dbug; +set @@global.debug_dbug = @saved_dbug; SET @@GLOBAL.rpl_semi_sync_master_timeout = 10000; SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; connection master; diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_running.result b/mysql-test/suite/rpl/r/rpl_show_slave_running.result index 729c718390a..a668b8b26f3 100644 --- a/mysql-test/suite/rpl/r/rpl_show_slave_running.result +++ b/mysql-test/suite/rpl/r/rpl_show_slave_running.result @@ -3,6 +3,7 @@ include/master-slave.inc connection slave; SET DEBUG_SYNC= 'RESET'; include/stop_slave.inc +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= 'd,dbug.before_get_running_status_yes'; Slave_running, Slave_IO_Running, Slave_SQL_Running, must be OFF, NO, NO in three following queries SHOW STATUS LIKE 'Slave_running'; @@ -34,7 +35,7 @@ Slave_running ON Slave_IO_Running= Yes Slave_SQL_Running= Yes connection slave; -set global debug_dbug= ''; +set @@global.debug_dbug = @saved_dbug; SET DEBUG_SYNC= 'RESET'; End of tests include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index be2a17ea2b7..aac0d956e6c 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,6 +1,7 @@ include/master-slave.inc [connection master] connection slave; +set @saved_dbug = @@global.debug_dbug; SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write'; connection master; create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; @@ -21,5 +22,5 @@ call mtr.add_suppression("Slave: Can't get stat of .*"); call mtr.add_suppression("Slave SQL: Error .Can.t get stat of.* error.* 13"); call mtr.add_suppression("Slave: File.* not found.*"); call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29"); -SET @@global.debug_dbug= ''; +set @@global.debug_dbug = @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result index 2417c5abda8..e5ef1224033 100644 --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@ -15,6 +15,7 @@ include/stop_slave.inc # Suspend the INSERT statement in current transaction on SQL thread. # It guarantees that SQL thread is applying the transaction when # STOP SLAVE command launchs. +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,after_mysql_insert,*'; include/start_slave.inc @@ -74,6 +75,7 @@ connection master; connection slave; # Test end +set @@global.debug_dbug = @saved_dbug; include/restart_slave.inc connection slave; call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); @@ -98,6 +100,7 @@ connection slave; include/stop_slave.inc connection master; include/stop_dump_threads.inc +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*'; connection slave; include/start_slave.inc @@ -120,6 +123,7 @@ connection slave; include/wait_for_slave_to_stop.inc connection slave1; connection master; +set @@global.debug_dbug = @saved_dbug; include/stop_dump_threads.inc connection slave1; include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_view_debug.result b/mysql-test/suite/rpl/r/rpl_view_debug.result index 22032c3fb90..1f2f7f2ab15 100644 --- a/mysql-test/suite/rpl/r/rpl_view_debug.result +++ b/mysql-test/suite/rpl/r/rpl_view_debug.result @@ -21,6 +21,7 @@ Tables_in_test t1 v1 connection master; +set @saved_dbug = @@session.debug_dbug; set @@debug_dbug="d,simulate_register_view_failure"; CREATE VIEW v2 as SELECT * FROM t1; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space @@ -36,4 +37,5 @@ v1 connection master; DROP VIEW IF EXISTS v1; DROP TABLE t1; +set debug_dbug= @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/kill_race_condition.test b/mysql-test/suite/rpl/t/kill_race_condition.test index 0f3b44864fe..79e1270b13c 100644 --- a/mysql-test/suite/rpl/t/kill_race_condition.test +++ b/mysql-test/suite/rpl/t/kill_race_condition.test @@ -7,6 +7,7 @@ create table t1 (a int); --sync_slave_with_master connection slave; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug='d,rows_log_event_before_open_table'; connection master; @@ -22,7 +23,7 @@ set debug_sync='now SIGNAL go_ahead_sql'; --source include/wait_for_slave_sql_error.inc let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); --echo Last_SQL_Error = $error -set global debug_dbug=''; +set @@global.debug_dbug = @saved_dbug; set debug_sync='RESET'; connection master; drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 2273219a821..c5e88fd68bf 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -15,6 +15,7 @@ call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* reset slave; # Set debug flags on slave to force errors to occur +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; --disable_query_log @@ -39,7 +40,7 @@ start slave; # # Cleanup # -SET GLOBAL debug_dbug=""; +set @@global.debug_dbug = @saved_dbug; # Clear Last_SQL_Error RESET SLAVE; diff --git a/mysql-test/suite/rpl/t/rpl_bug41902.test b/mysql-test/suite/rpl/t/rpl_bug41902.test index fe9452b0eda..21a556b9c8e 100644 --- a/mysql-test/suite/rpl/t/rpl_bug41902.test +++ b/mysql-test/suite/rpl/t/rpl_bug41902.test @@ -15,7 +15,7 @@ source include/master-slave.inc; connection slave; stop slave; - +set @saved_dbug = @@global.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; --error ER_UNKNOWN_TARGET_BINLOG @@ -36,6 +36,7 @@ reset slave; change master to master_host='dummy'; connection master; +set @saved_dbug_m = @@global.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; --error ER_UNKNOWN_TARGET_BINLOG reset master; @@ -53,10 +54,12 @@ purge binary logs to 'master-bin.000001'; --disable_query_log call mtr.add_suppression("Failed to locate old binlog or relay log files"); call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ..master-bin.000001 not listed in the index"); +set @@global.debug_dbug = @saved_dbug_m; connection slave; call mtr.add_suppression("Failed to locate old binlog or relay log files"); call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ..master-bin.000001 not listed in the index"); --enable_query_log +set @@global.debug_dbug = @saved_dbug; --echo ==== clean up ==== CHANGE MASTER TO MASTER_HOST = '127.0.0.1'; diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index dca32c30a94..ac625e0b21a 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -26,7 +26,7 @@ call mtr.add_suppression("Fatal error: The slave I/O thread stops because master call mtr.add_suppression("Slave I/O thread .* register on master"); #Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection -let $debug_saved= `select @@global.debug`; +set @saved_dbug = @@global.debug_dbug; # set up two parameters to pass into extra/rpl_tests/rpl_get_master_version_and_clock let $dbug_sync_point= 'debug_lock.before_get_UNIX_TIMESTAMP'; @@ -40,11 +40,9 @@ let $dbug_sync_point= 'debug_lock.before_get_SERVER_ID'; let $debug_sync_action= 'now SIGNAL signal.get_server_id'; source extra/rpl_tests/rpl_get_master_version_and_clock.test; -eval set global debug_dbug= '$debug_saved'; - # cleanup - +set @@global.debug_dbug = @saved_dbug; # is not really necessary but avoids mtr post-run env check warnings SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test index 6a426ed1e9f..bd66a249ada 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test @@ -18,7 +18,7 @@ set @@global.slave_net_timeout= 10; # default period slave_net_timeout/2 # --query_vertical show status like 'Slave_heartbeat_period'; -SET @save_dbug= @@GLOBAL.debug_dbug; +SET @saved_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error"; CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error'); CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); @@ -44,7 +44,7 @@ drop table t1; connection slave; --source include/stop_slave.inc --disable_warnings -SET GLOBAL debug_dbug=@save_dbug; +SET GLOBAL debug_dbug=@saved_dbug; set @@global.slave_net_timeout= @restore_slave_net_timeout; --enable_warnings --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test index 0c6f9d5e862..07e5aee4560 100644 --- a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test @@ -17,6 +17,7 @@ --let $rpl_server_number= 1 --source include/rpl_restart_server.inc +set @saved_dbug = @@session.debug_dbug; SET @@debug_dbug="d,simulate_big_table_id"; CREATE TABLE t (a int); @@ -51,7 +52,7 @@ if (`SELECT sum(a) != 6 FROM t`) --connection master DROP TABLE t; - +set debug_dbug= @saved_dbug; --sync_slave_with_master --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test index fb7491b0077..41a107e217d 100644 --- a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test +++ b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test @@ -9,7 +9,7 @@ # - setup log_warnings and debug --connection slave --source include/stop_slave.inc ---let $debug_save= `SELECT @@GLOBAL.debug_dbug` +set @saved_dbug = @@global.debug_dbug; --let $log_warnings_save= `SELECT @@GLOBAL.log_warnings` SET GLOBAL log_warnings = 2; @@ -55,7 +55,7 @@ EOF # cleanup --source include/stop_slave.inc ---eval SET GLOBAL debug_dbug = '$debug_save' +set @@global.debug_dbug = @saved_dbug; --eval SET GLOBAL log_warnings = $log_warnings_save --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_index_choice.test b/mysql-test/suite/rpl/t/rpl_row_index_choice.test index 0ad9b315d66..89b14add3b0 100644 --- a/mysql-test/suite/rpl/t/rpl_row_index_choice.test +++ b/mysql-test/suite/rpl/t/rpl_row_index_choice.test @@ -47,6 +47,7 @@ sync_slave_with_master; connection slave; ANALYZE TABLE t2; --echo # Slave will crash if using the wrong or no index +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; connection master; @@ -238,6 +239,5 @@ connection master; DROP TABLE t1; sync_slave_with_master; connection slave; -SET GLOBAL debug_dbug=""; - +set @@global.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test index 8c00bae06cd..2558792b438 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test @@ -33,7 +33,7 @@ source include/start_slave.inc; CREATE TABLE t1 (a INT) ENGINE=innodb; # Make the following events as if they offset over 2GB from the beginning of binlog ---let $sav_debug_dbug=@@GLOBAL.debug_dbug +set @saved_dbug = @@global.debug_dbug; SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB"; SET @@SESSION.skip_replication=1; INSERT INTO t1 SET a=1; @@ -51,7 +51,7 @@ FLUSH LOGS; # Clean up # --connection master ---eval SET @@GLOBAL.debug_dbug=$sav_debug_dbug +set @@global.debug_dbug = @saved_dbug; --eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master --eval SET @@GLOBAL.rpl_semi_sync_master_enabled = $sav_enabled_master diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test index 2cb44fc6ac1..33151bb87a4 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_running.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_running.test @@ -11,7 +11,7 @@ connection slave; SET DEBUG_SYNC= 'RESET'; source include/stop_slave.inc; -let $debug_saved= `select @@global.debug`; +set @saved_dbug = @@global.debug_dbug; set global debug_dbug= 'd,dbug.before_get_running_status_yes'; # to block due-started IO # Test 1. Slave is stopped @@ -77,7 +77,7 @@ echo Slave_SQL_Running= $status; connection slave; -eval set global debug_dbug= '$debug_saved'; +set @@global.debug_dbug = @saved_dbug; SET DEBUG_SYNC= 'RESET'; --echo End of tests --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 69319bad4a0..554ff564a0d 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -29,7 +29,7 @@ ########################################################################## connection slave; ---let $old_debug= `SELECT @@global.debug_dbug` +set @saved_dbug = @@global.debug_dbug; SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write'; connection master; @@ -74,7 +74,7 @@ call mtr.add_suppression("Slave: File.* not found.*"); call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29"); --let $rpl_only_running_threads= 1 -eval SET @@global.debug_dbug= '$old_debug'; +set @@global.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test index 5071fd348fb..c1130f1955e 100644 --- a/mysql-test/suite/rpl/t/rpl_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@ -22,7 +22,7 @@ source include/stop_slave.inc; --echo # Suspend the INSERT statement in current transaction on SQL thread. --echo # It guarantees that SQL thread is applying the transaction when --echo # STOP SLAVE command launchs. -let $debug_save= `SELECT @@GLOBAL.debug`; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,after_mysql_insert,*'; source include/start_slave.inc; @@ -44,9 +44,7 @@ source extra/rpl_tests/rpl_stop_slave.test; --echo --echo # Test end ---disable_query_log -eval SET GLOBAL debug_dbug= '$debug_save'; ---enable_query_log +set @@global.debug_dbug = @saved_dbug; source include/restart_slave_sql.inc; connection slave; @@ -79,7 +77,7 @@ connection master; # make sure that there are no zombie threads --source include/stop_dump_threads.inc -let $debug_save= `SELECT @@GLOBAL.debug`; +set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*'; connection slave; @@ -126,9 +124,7 @@ reap; # sure that we disable the DBUG_EXECUTE_IF # that would set the dump thread to wait connection master; ---disable_query_log -eval SET GLOBAL debug_dbug= '$debug_save'; ---enable_query_log +set @@global.debug_dbug = @saved_dbug; # make sure that there are no zombie threads --source include/stop_dump_threads.inc diff --git a/mysql-test/suite/rpl/t/rpl_view_debug.test b/mysql-test/suite/rpl/t/rpl_view_debug.test index a00b6733dea..ef59d25bf45 100644 --- a/mysql-test/suite/rpl/t/rpl_view_debug.test +++ b/mysql-test/suite/rpl/t/rpl_view_debug.test @@ -18,6 +18,7 @@ sync_slave_with_master; # view already has to be on slave show tables; connection master; +set @saved_dbug = @@session.debug_dbug; set @@debug_dbug="d,simulate_register_view_failure"; --error ER_OUT_OF_RESOURCES @@ -30,5 +31,5 @@ show tables; connection master; DROP VIEW IF EXISTS v1; DROP TABLE t1; - +set debug_dbug= @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test index c62f3c3c506..1af683c617b 100644 --- a/mysql-test/t/cache_temporal_4265.test +++ b/mysql-test/t/cache_temporal_4265.test @@ -5,9 +5,9 @@ create table t1 (a date); insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04'); -set debug_dbug='d,str_to_datetime_warn'; -select * from t1 where a > date_add('2000-01-01', interval 5 day); -set debug_dbug=''; + +SET STATEMENT debug_dbug='d,str_to_datetime_warn' for + select * from t1 where a > date_add('2000-01-01', interval 5 day); drop table t1; # diff --git a/mysql-test/t/drop_bad_db_type.test b/mysql-test/t/drop_bad_db_type.test index 6a3ac6ae00f..aa729217e50 100644 --- a/mysql-test/t/drop_bad_db_type.test +++ b/mysql-test/t/drop_bad_db_type.test @@ -7,7 +7,7 @@ if (!$HA_ARCHIVE_SO) { let $mysqld_datadir= `select @@datadir`; -SET @save_dbug = @@debug_dbug; +SET @saved_dbug = @@debug_dbug; set debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; @@ -28,4 +28,4 @@ drop table t1; --list_files $mysqld_datadir/test uninstall soname 'ha_archive'; -set debug_dbug=@save_dbug; +set debug_dbug=@saved_dbug; diff --git a/mysql-test/t/engine_error_in_alter-8453.test b/mysql-test/t/engine_error_in_alter-8453.test index c4600ec07fe..915a47570a3 100644 --- a/mysql-test/t/engine_error_in_alter-8453.test +++ b/mysql-test/t/engine_error_in_alter-8453.test @@ -4,8 +4,9 @@ --source include/have_debug.inc create table t1 (a int, b int); +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,external_lock_failure'; --error ER_GET_ERRMSG alter table t1 add column c int; -set debug_dbug=''; +set debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index 1debed871c7..c6ce8092029 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -21,6 +21,7 @@ set tmp_table_size=1024; # Set debug flag so an error is returned when # tmp table in query is converted from heap to myisam +set @saved_dbug = @@session.debug_dbug; set session debug_dbug="+d,raise_error"; --error ER_DUP_KEY @@ -36,7 +37,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL); INSERT INTO t1 VALUES (1), (0), (2); SET SESSION debug_dbug='+d,alter_table_only_index_change'; ALTER TABLE t1 ADD INDEX a(a); -SET SESSION debug_dbug=DEFAULT; +set debug_dbug= @saved_dbug; SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; @@ -51,7 +52,7 @@ SET SESSION debug_dbug="+d,bug42064_simulate_oom"; # May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY --error ER_OUT_OF_RESOURCES, 5 INSERT INTO t1 VALUES(""); -SET SESSION debug_dbug=DEFAULT; +set debug_dbug= @saved_dbug; DROP TABLE t1; @@ -84,7 +85,7 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); -SET SESSION debug_dbug= DEFAULT; +set debug_dbug= @saved_dbug; SET optimizer_switch=@save_optimizer_switch; @@ -101,7 +102,7 @@ INSERT INTO t2 VALUES (1),(2); SET SESSION debug_dbug="+d,bug11747970_raise_error"; --error ER_QUERY_INTERRUPTED INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); -SET SESSION debug_dbug = DEFAULT; +set debug_dbug= @saved_dbug; DROP TABLE t1,t2; @@ -156,4 +157,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory"; --error ER_OUT_OF_RESOURCES, 5 SELECT f1(1); DROP FUNCTION f1; -SET SESSION debug_dbug=DEFAULT; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/t/func_regexp_pcre_debug.test b/mysql-test/t/func_regexp_pcre_debug.test index c2581fa4110..cbf5c4a17ee 100644 --- a/mysql-test/t/func_regexp_pcre_debug.test +++ b/mysql-test/t/func_regexp_pcre_debug.test @@ -1,6 +1,5 @@ --source include/have_debug.inc -SET debug_dbug='+d,pcre_exec_error_123'; +SET STATEMENT debug_dbug='+d,pcre_exec_error_123' for SELECT 'a' RLIKE 'a'; -SET debug_dbug=''; SELECT 'a' RLIKE 'a'; diff --git a/mysql-test/t/log_slow_debug.test b/mysql-test/t/log_slow_debug.test index fd8e613ea1f..7390f1a8469 100644 --- a/mysql-test/t/log_slow_debug.test +++ b/mysql-test/t/log_slow_debug.test @@ -9,7 +9,7 @@ SET @@GLOBAL.log_output='TABLE'; FLUSH SLOW LOGS; SET @@GLOBAL.slow_query_log=ON; SET @@GLOBAL.log_slow_admin_statements=ON; -SET @save_dbug = @@debug_dbug; +SET @saved_dbug = @@debug_dbug; SET SESSION debug_dbug="+d,simulate_slow_query"; DELIMITER $$; @@ -119,7 +119,7 @@ CALL show_slow_log(); --echo # Clean up --echo # -SET SESSION debug_dbug=@save_dbug; +SET SESSION debug_dbug=@saved_dbug; TRUNCATE mysql.slow_log; SET @@global.slow_query_log= @org_slow_query_log; SET @@global.log_output= @org_log_output; diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test index 3898d5bbef6..0513899e519 100644 --- a/mysql-test/t/mdev6830.test +++ b/mysql-test/t/mdev6830.test @@ -2,7 +2,7 @@ # MDEV-6830 Server crashes in best_access_path after a sequence of SELECTs invollving a temptable view # --source include/have_debug.inc - +set @saved_dbug = @@session.debug_dbug; set @@debug_dbug= 'd,opt'; CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; @@ -60,4 +60,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; drop table t1,t2,t3,t4; drop view v2,v3; - +set debug_dbug= @saved_dbug; diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test index 9bd2cab2c8a..5873d2eb233 100644 --- a/mysql-test/t/merge-big.test +++ b/mysql-test/t/merge-big.test @@ -42,7 +42,7 @@ LOCK TABLE t1 WRITE; #SELECT NOW(); connect (con1,localhost,root,,); let $con1_id= `SELECT CONNECTION_ID()`; - SET @orig_debug=@@debug; + SET @orig_debug=@@global.debug_dbug; SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open"; send INSERT INTO t1 VALUES (1); connection default; diff --git a/mysql-test/t/merge_debug.test b/mysql-test/t/merge_debug.test index 3c617cfc545..50017bc1331 100644 --- a/mysql-test/t/merge_debug.test +++ b/mysql-test/t/merge_debug.test @@ -14,7 +14,7 @@ call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair i drop table if exists crashed,t2,t3,t4; --enable_warnings -SET @orig_debug=@@debug; +SET @orig_debug=@@global.debug_dbug; # # Check that MariaDB handles reopen that fails without crashing diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test index a17ef3f1146..0682286274f 100644 --- a/mysql-test/t/range_innodb.test +++ b/mysql-test/t/range_innodb.test @@ -80,10 +80,11 @@ create table t1 ( insert into t1 select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a from t0 A, t0 B, t0 C, t0 D where D.a<5; +set @saved_dbug = @@global.debug_dbug; set @@global.debug_dbug="+d,ha_index_init_fail"; explain select * from t1 where a=10 and b=10; --error ER_TABLE_DEF_CHANGED select * from t1 where a=10 and b=10; DROP TABLE t0,t1; -set @@global.debug_dbug="-d"; +set @@global.debug_dbug = @saved_dbug; set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/t/select_debug.test b/mysql-test/t/select_debug.test index 49415400db3..dba0576f945 100644 --- a/mysql-test/t/select_debug.test +++ b/mysql-test/t/select_debug.test @@ -10,6 +10,7 @@ create table t2 (a int); insert into t2 values (2), (3); set session join_cache_level=3; +set @saved_dbug = @@session.debug_dbug; set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; @@ -17,3 +18,4 @@ select t1.b from t1,t2 where t1.b=t2.a; set session join_cache_level=default; drop table t1,t2; +set debug_dbug= @saved_dbug; diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test index 13cd1538143..f4e6bd12426 100644 --- a/mysql-test/t/show_explain_ps.test +++ b/mysql-test/t/show_explain_ps.test @@ -38,6 +38,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr # connection con1; set @show_explain_probe_select_id=1; +set @saved_dbug = @@session.debug_dbug; set debug_dbug='d,show_explain_probe_join_exec_start'; send select count(*) from t0 where a < 100000; @@ -47,7 +48,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=''; +set debug_dbug= @saved_dbug; evalp select event_name from diff --git a/mysql-test/t/slowlog_enospace-10508.test b/mysql-test/t/slowlog_enospace-10508.test index b2c26a5984d..ef49700f0c9 100644 --- a/mysql-test/t/slowlog_enospace-10508.test +++ b/mysql-test/t/slowlog_enospace-10508.test @@ -9,6 +9,7 @@ create table t1 (a int, b int) engine=memory; insert t1 select seq, seq+1 from seq_1_to_1000; set global general_log=0; set global log_queries_not_using_indexes=1; +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,simulate_file_write_error'; --disable_result_log --let $run= 50 @@ -18,7 +19,7 @@ while ($run) dec $run; } --enable_result_log -set debug_dbug=''; +set debug_dbug= @saved_dbug; set global general_log=1; set global log_queries_not_using_indexes=default; drop table t1; diff --git a/mysql-test/t/stat_tables-enospc.test b/mysql-test/t/stat_tables-enospc.test index 932b2bde302..b2b4c071a70 100644 --- a/mysql-test/t/stat_tables-enospc.test +++ b/mysql-test/t/stat_tables-enospc.test @@ -16,9 +16,10 @@ while ($i) { } --enable_query_log set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3; +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,simulate_file_write_error'; set @@max_heap_table_size=128*1024; --replace_regex /'.*'/'tmp-file'/ analyze table t1; -set debug_dbug=''; +set debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/t/union_crash-714.test b/mysql-test/t/union_crash-714.test index 6c31a2202cb..97f0c90d854 100644 --- a/mysql-test/t/union_crash-714.test +++ b/mysql-test/t/union_crash-714.test @@ -3,7 +3,9 @@ # --source include/have_debug.inc create table t1 (i tinyint); +set @saved_dbug = @@session.debug_dbug; set debug_dbug='+d,bug11747970_raise_error'; --error ER_QUERY_INTERRUPTED insert into t1 (i) select i from t1 union select i from t1; drop table t1; +set debug_dbug= @saved_dbug; \ No newline at end of file diff --git a/mysql-test/t/warnings_debug.test b/mysql-test/t/warnings_debug.test index 3055e3894e5..53573f8a8d6 100644 --- a/mysql-test/t/warnings_debug.test +++ b/mysql-test/t/warnings_debug.test @@ -9,6 +9,7 @@ create table t1 (a int primary key) engine=innodb; # Test that warnings produced during autocommit (after calling # set_ok_status()) are still reported to the client. +set @saved_dbug = @@session.debug_dbug; SET SESSION debug_dbug="+d,warn_during_ha_commit_trans"; INSERT INTO t1 VALUES (1); # The warning will be shown automatically by mysqltest; there was a bug where @@ -17,3 +18,4 @@ INSERT INTO t1 VALUES (1); SHOW WARNINGS; drop table t1; +set debug_dbug= @saved_dbug; From b7fb30e930d544897fc13e817ded44557c882c91 Mon Sep 17 00:00:00 2001 From: Alice Sherepa Date: Thu, 9 Jan 2020 13:38:48 +0100 Subject: [PATCH 15/43] MDEV-21360 global debug_dbug pre-test value restoration issues --- .../extra/binlog_tests/binlog_ioerr.inc | 2 +- mysql-test/extra/rpl_tests/rpl_checksum.inc | 2 +- mysql-test/r/create_or_replace2.result | 4 +- mysql-test/r/drop_bad_db_type.result | 4 +- .../r/engine_error_in_alter-8453.result | 6 +- mysql-test/r/error_simulation.result | 12 +- mysql-test/r/mdev6830.result | 4 +- mysql-test/r/myisam_debug.result | 4 +- mysql-test/r/range_innodb.result | 4 +- mysql-test/r/range_interrupted-13751.result | 4 +- mysql-test/r/select_debug.result | 4 +- mysql-test/r/show_explain.result | 178 ++++++++--------- mysql-test/r/show_explain_non_select.result | 8 +- mysql-test/r/show_explain_ps.result | 6 +- mysql-test/r/slowlog_enospace-10508.result | 6 +- mysql-test/r/stat_tables-enospc.result | 6 +- mysql-test/r/union_crash-714.result | 6 +- mysql-test/r/warnings_debug.result | 4 +- mysql-test/suite/binlog/r/binlog_ioerr.result | 2 +- .../binlog_encryption/binlog_ioerr.result | 2 +- .../binlog_encryption/rpl_checksum.result | 2 +- .../gcol/r/innodb_virtual_debug_purge.result | 4 +- .../gcol/t/innodb_virtual_debug_purge.test | 4 +- .../suite/innodb/r/blob-update-debug.result | 4 +- .../innodb/r/innodb-replace-debug.result | 4 +- .../r/innodb-stats-initialize-failure.result | 4 +- .../suite/innodb/r/innodb_bug11754376.result | 4 +- .../suite/innodb/r/innodb_bug56947.result | 4 +- .../suite/innodb/r/innodb_corrupt_bit.result | 2 +- .../r/innodb_sys_semaphore_waits.result | 4 +- .../suite/innodb/r/truncate_inject.result | 28 +-- .../suite/innodb/t/blob-update-debug.test | 4 +- .../suite/innodb/t/innodb-replace-debug.test | 4 +- .../t/innodb-stats-initialize-failure.test | 4 +- .../suite/innodb/t/innodb_bug11754376.test | 4 +- .../suite/innodb/t/innodb_bug56947.test | 4 +- .../suite/innodb/t/innodb_corrupt_bit.test | 2 +- .../innodb/t/innodb_sys_semaphore_waits.test | 4 +- .../innodb/t/redo_log_during_checkpoint.test | 6 +- .../suite/innodb/t/truncate_inject.test | 28 +-- .../innodb_fts/r/concurrent_insert.result | 4 +- .../suite/innodb_fts/t/concurrent_insert.test | 4 +- .../suite/innodb_gis/t/rtree_debug.test | 2 +- .../optimizer_unfixed_bugs/r/bug36981.result | 4 +- .../optimizer_unfixed_bugs/r/bug40992.result | 4 +- .../optimizer_unfixed_bugs/r/bug41996.result | 4 +- .../optimizer_unfixed_bugs/r/bug42991.result | 4 +- .../optimizer_unfixed_bugs/r/bug43249.result | 4 +- .../optimizer_unfixed_bugs/r/bug43360.result | 4 +- .../optimizer_unfixed_bugs/r/bug43448.result | 4 +- .../optimizer_unfixed_bugs/r/bug43617.result | 4 +- .../optimizer_unfixed_bugs/t/bug36981.test | 4 +- .../optimizer_unfixed_bugs/t/bug40992.test | 4 +- .../optimizer_unfixed_bugs/t/bug41996.test | 4 +- .../optimizer_unfixed_bugs/t/bug42991.test | 4 +- .../optimizer_unfixed_bugs/t/bug43249.test | 4 +- .../optimizer_unfixed_bugs/t/bug43360.test | 4 +- .../optimizer_unfixed_bugs/t/bug43448.test | 4 +- .../optimizer_unfixed_bugs/t/bug43617.test | 4 +- ...hostcache_ipv4_addrinfo_again_allow.result | 4 +- .../hostcache_ipv4_addrinfo_again_deny.result | 4 +- .../hostcache_ipv4_addrinfo_bad_allow.result | 4 +- .../r/hostcache_ipv4_addrinfo_bad_deny.result | 4 +- .../hostcache_ipv4_addrinfo_good_allow.result | 4 +- .../hostcache_ipv4_addrinfo_good_deny.result | 4 +- ...ostcache_ipv4_addrinfo_noname_allow.result | 4 +- ...hostcache_ipv4_addrinfo_noname_deny.result | 4 +- .../r/hostcache_ipv4_auth_plugin.result | 4 +- .../r/hostcache_ipv4_blocked.result | 4 +- .../perfschema/r/hostcache_ipv4_format.result | 4 +- .../r/hostcache_ipv4_max_con.result | 4 +- ...hostcache_ipv4_nameinfo_again_allow.result | 4 +- .../hostcache_ipv4_nameinfo_again_deny.result | 4 +- ...ostcache_ipv4_nameinfo_noname_allow.result | 4 +- ...hostcache_ipv4_nameinfo_noname_deny.result | 4 +- .../perfschema/r/hostcache_ipv4_passwd.result | 4 +- .../perfschema/r/hostcache_ipv4_ssl.result | 4 +- ...hostcache_ipv6_addrinfo_again_allow.result | 4 +- .../hostcache_ipv6_addrinfo_again_deny.result | 4 +- .../hostcache_ipv6_addrinfo_bad_allow.result | 4 +- .../r/hostcache_ipv6_addrinfo_bad_deny.result | 4 +- .../hostcache_ipv6_addrinfo_good_allow.result | 4 +- .../hostcache_ipv6_addrinfo_good_deny.result | 4 +- ...ostcache_ipv6_addrinfo_noname_allow.result | 4 +- ...hostcache_ipv6_addrinfo_noname_deny.result | 4 +- .../r/hostcache_ipv6_auth_plugin.result | 4 +- .../r/hostcache_ipv6_blocked.result | 4 +- .../r/hostcache_ipv6_max_con.result | 4 +- ...hostcache_ipv6_nameinfo_again_allow.result | 4 +- .../hostcache_ipv6_nameinfo_again_deny.result | 4 +- ...ostcache_ipv6_nameinfo_noname_allow.result | 4 +- ...hostcache_ipv6_nameinfo_noname_deny.result | 4 +- .../perfschema/r/hostcache_ipv6_passwd.result | 4 +- .../perfschema/r/hostcache_ipv6_ssl.result | 4 +- .../perfschema/r/hostcache_peer_addr.result | 4 +- .../hostcache_ipv4_addrinfo_again_allow.test | 4 +- .../t/hostcache_ipv4_addrinfo_again_deny.test | 4 +- .../t/hostcache_ipv4_addrinfo_bad_allow.test | 4 +- .../t/hostcache_ipv4_addrinfo_bad_deny.test | 4 +- .../t/hostcache_ipv4_addrinfo_good_allow.test | 4 +- .../t/hostcache_ipv4_addrinfo_good_deny.test | 4 +- .../hostcache_ipv4_addrinfo_noname_allow.test | 4 +- .../hostcache_ipv4_addrinfo_noname_deny.test | 4 +- .../t/hostcache_ipv4_auth_plugin.test | 4 +- .../perfschema/t/hostcache_ipv4_blocked.test | 4 +- .../perfschema/t/hostcache_ipv4_format.test | 4 +- .../perfschema/t/hostcache_ipv4_max_con.test | 4 +- .../hostcache_ipv4_nameinfo_again_allow.test | 4 +- .../t/hostcache_ipv4_nameinfo_again_deny.test | 4 +- .../hostcache_ipv4_nameinfo_noname_allow.test | 4 +- .../hostcache_ipv4_nameinfo_noname_deny.test | 4 +- .../perfschema/t/hostcache_ipv4_passwd.test | 4 +- .../perfschema/t/hostcache_ipv4_ssl.test | 4 +- .../hostcache_ipv6_addrinfo_again_allow.test | 4 +- .../t/hostcache_ipv6_addrinfo_again_deny.test | 4 +- .../t/hostcache_ipv6_addrinfo_bad_allow.test | 4 +- .../t/hostcache_ipv6_addrinfo_bad_deny.test | 4 +- .../t/hostcache_ipv6_addrinfo_good_allow.test | 4 +- .../t/hostcache_ipv6_addrinfo_good_deny.test | 4 +- .../hostcache_ipv6_addrinfo_noname_allow.test | 4 +- .../hostcache_ipv6_addrinfo_noname_deny.test | 4 +- .../t/hostcache_ipv6_auth_plugin.test | 4 +- .../perfschema/t/hostcache_ipv6_blocked.test | 4 +- .../perfschema/t/hostcache_ipv6_max_con.test | 4 +- .../hostcache_ipv6_nameinfo_again_allow.test | 4 +- .../t/hostcache_ipv6_nameinfo_again_deny.test | 4 +- .../hostcache_ipv6_nameinfo_noname_allow.test | 4 +- .../hostcache_ipv6_nameinfo_noname_deny.test | 4 +- .../perfschema/t/hostcache_ipv6_passwd.test | 4 +- .../perfschema/t/hostcache_ipv6_ssl.test | 4 +- .../perfschema/t/hostcache_peer_addr.test | 4 +- .../suite/rpl/r/kill_race_condition.result | 4 +- mysql-test/suite/rpl/r/rpl_bug33931.result | 4 +- mysql-test/suite/rpl/r/rpl_bug41902.result | 6 +- mysql-test/suite/rpl/r/rpl_checksum.result | 2 +- .../suite/rpl/r/rpl_row_big_table_id.result | 4 +- .../suite/rpl/r/rpl_row_find_row_debug.result | 4 +- .../rpl/r/rpl_semi_sync_skip_repl.result | 4 +- .../suite/rpl/r/rpl_show_slave_running.result | 4 +- mysql-test/suite/rpl/r/rpl_stop_slave.result | 8 +- mysql-test/suite/rpl/r/rpl_view_debug.result | 4 +- .../suite/rpl/t/kill_race_condition.test | 4 +- mysql-test/suite/rpl/t/rpl_bug33931.test | 4 +- mysql-test/suite/rpl/t/rpl_bug41902.test | 6 +- .../t/rpl_get_master_version_and_clock.test | 4 +- .../suite/rpl/t/rpl_row_big_table_id.test | 4 +- .../suite/rpl/t/rpl_row_find_row_debug.test | 4 +- .../suite/rpl/t/rpl_row_index_choice.test | 4 +- .../suite/rpl/t/rpl_semi_sync_skip_repl.test | 4 +- .../suite/rpl/t/rpl_show_slave_running.test | 4 +- .../rpl/t/rpl_slave_load_remove_tmpfile.test | 4 +- mysql-test/suite/rpl/t/rpl_stop_slave.test | 8 +- mysql-test/suite/rpl/t/rpl_view_debug.test | 4 +- .../suite/sys_vars/r/debug_dbug_func.result | 6 +- .../suite/sys_vars/t/debug_dbug_func.test | 6 +- mysql-test/t/create_or_replace2.test | 4 +- mysql-test/t/drop_bad_db_type.test | 4 +- mysql-test/t/engine_error_in_alter-8453.test | 6 +- mysql-test/t/error_simulation.test | 12 +- mysql-test/t/mdev6830.test | 4 +- mysql-test/t/myisam_debug.test | 4 +- mysql-test/t/range_innodb.test | 4 +- mysql-test/t/range_interrupted-13751.test | 4 +- mysql-test/t/select_debug.test | 4 +- mysql-test/t/show_explain.test | 182 +++++++++--------- mysql-test/t/show_explain_non_select.test | 8 +- mysql-test/t/show_explain_ps.test | 6 +- mysql-test/t/slowlog_enospace-10508.test | 6 +- mysql-test/t/stat_tables-enospc.test | 6 +- mysql-test/t/union_crash-714.test | 6 +- mysql-test/t/warnings_debug.test | 4 +- 171 files changed, 564 insertions(+), 564 deletions(-) diff --git a/mysql-test/extra/binlog_tests/binlog_ioerr.inc b/mysql-test/extra/binlog_tests/binlog_ioerr.inc index 07c99373a41..da6fb5ac727 100644 --- a/mysql-test/extra/binlog_tests/binlog_ioerr.inc +++ b/mysql-test/extra/binlog_tests/binlog_ioerr.inc @@ -15,7 +15,7 @@ RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; INSERT INTO t1 VALUES(0); -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug='+d,fail_binlog_write_1'; --error ER_ERROR_ON_WRITE INSERT INTO t1 VALUES(1); diff --git a/mysql-test/extra/rpl_tests/rpl_checksum.inc b/mysql-test/extra/rpl_tests/rpl_checksum.inc index 9951472a773..17a986dc308 100644 --- a/mysql-test/extra/rpl_tests/rpl_checksum.inc +++ b/mysql-test/extra/rpl_tests/rpl_checksum.inc @@ -133,7 +133,7 @@ set @save_dbug = @@session.debug_dbug; set @@session.debug_dbug='d,simulate_checksum_test_failure'; --error ER_ERROR_WHEN_EXECUTING_COMMAND show binlog events; -set debug_dbug= @save_dbug; +SET debug_dbug= @save_dbug; set @@global.master_verify_checksum = default; #connection master; diff --git a/mysql-test/r/create_or_replace2.result b/mysql-test/r/create_or_replace2.result index 47431212492..6be0d46bdc1 100644 --- a/mysql-test/r/create_or_replace2.result +++ b/mysql-test/r/create_or_replace2.result @@ -4,9 +4,9 @@ drop table if exists t1; SET @old_debug= @@session.debug; CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB; CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam; -set debug_dbug='+d,send_kill_after_delete'; +SET debug_dbug='+d,send_kill_after_delete'; CREATE OR REPLACE TABLE t1 LIKE tmp; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; SHOW TABLES; Tables_in_test t1 diff --git a/mysql-test/r/drop_bad_db_type.result b/mysql-test/r/drop_bad_db_type.result index b6fa3bfd70e..ae6fe708e60 100644 --- a/mysql-test/r/drop_bad_db_type.result +++ b/mysql-test/r/drop_bad_db_type.result @@ -1,5 +1,5 @@ SET @saved_dbug = @@debug_dbug; -set debug_dbug='+d,unstable_db_type'; +SET debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; create table t1 (a int) engine=archive; insert t1 values (1),(2),(3); @@ -33,4 +33,4 @@ t1.frm drop table t1; db.opt uninstall soname 'ha_archive'; -set debug_dbug=@saved_dbug; +SET debug_dbug=@saved_dbug; diff --git a/mysql-test/r/engine_error_in_alter-8453.result b/mysql-test/r/engine_error_in_alter-8453.result index d1d4181cf68..2c823f83038 100644 --- a/mysql-test/r/engine_error_in_alter-8453.result +++ b/mysql-test/r/engine_error_in_alter-8453.result @@ -1,7 +1,7 @@ create table t1 (a int, b int); -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,external_lock_failure'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,external_lock_failure'; alter table t1 add column c int; ERROR HY000: Got error 168 'KABOOM!' from MyISAM -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result index 19d1ff4db17..457e5c8ec9c 100644 --- a/mysql-test/r/error_simulation.result +++ b/mysql-test/r/error_simulation.result @@ -10,7 +10,7 @@ INSERT INTO t1 VALUES ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); set tmp_table_size=1024; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,raise_error"; SELECT MAX(a) FROM t1 GROUP BY a,b; ERROR 23000: Can't write; duplicate key in table '(temporary)' @@ -23,7 +23,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL); INSERT INTO t1 VALUES (1), (0), (2); SET SESSION debug_dbug='+d,alter_table_only_index_change'; ALTER TABLE t1 ADD INDEX a(a); -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -43,7 +43,7 @@ CREATE TABLE t1(a BLOB); SET SESSION debug_dbug="+d,bug42064_simulate_oom"; INSERT INTO t1 VALUES(""); Got one of the listed errors -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; DROP TABLE t1; # # Bug#41660: Sort-index_merge for non-first join table may require @@ -80,7 +80,7 @@ a a b filler 7 1 1 data 8 1 1 data 9 1 1 data -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1, t2; # @@ -93,7 +93,7 @@ INSERT INTO t2 VALUES (1),(2); SET SESSION debug_dbug="+d,bug11747970_raise_error"; INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); ERROR 70100: Query execution was interrupted -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; DROP TABLE t1,t2; # # End of 5.1 tests @@ -127,4 +127,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory"; SELECT f1(1); Got one of the listed errors DROP FUNCTION f1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/r/mdev6830.result b/mysql-test/r/mdev6830.result index e3b3ed41edf..0048aa174bc 100644 --- a/mysql-test/r/mdev6830.result +++ b/mysql-test/r/mdev6830.result @@ -1,4 +1,4 @@ -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug= 'd,opt'; CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 ( @@ -47,4 +47,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2 drop table t1,t2,t3,t4; drop view v2,v3; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/r/myisam_debug.result b/mysql-test/r/myisam_debug.result index 6232e3eac0e..1428473c850 100644 --- a/mysql-test/r/myisam_debug.result +++ b/mysql-test/r/myisam_debug.result @@ -34,10 +34,10 @@ create table t1 (a int, index(a)); lock tables t1 write; insert t1 values (1),(2),(1); set @old_dbug=@@debug_dbug; -set debug_dbug='+d,mi_lock_database_failure'; +SET debug_dbug='+d,mi_lock_database_failure'; unlock tables; Warnings: Error 126 Index for table './test/t1.MYI' is corrupt; try to repair it Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM -set debug_dbug=@old_dbug; +SET debug_dbug=@old_dbug; drop table t1; diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result index aed8bff278b..38a8964bb61 100644 --- a/mysql-test/r/range_innodb.result +++ b/mysql-test/r/range_innodb.result @@ -70,7 +70,7 @@ key(a),key(b),key(c) insert into t1 select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a from t0 A, t0 B, t0 C, t0 D where D.a<5; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set @@global.debug_dbug="+d,ha_index_init_fail"; explain select * from t1 where a=10 and b=10; id select_type table type possible_keys key key_len ref rows Extra @@ -78,5 +78,5 @@ id select_type table type possible_keys key key_len ref rows Extra select * from t1 where a=10 and b=10; ERROR HY000: Table definition has changed, please retry transaction DROP TABLE t0,t1; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/r/range_interrupted-13751.result b/mysql-test/r/range_interrupted-13751.result index f4f995721ad..68610cdda8e 100644 --- a/mysql-test/r/range_interrupted-13751.result +++ b/mysql-test/r/range_interrupted-13751.result @@ -7,10 +7,10 @@ INSERT INTO t1 (c) SELECT c FROM t1; INSERT INTO t1 (c) SELECT c FROM t1; INSERT INTO t1 (c) SELECT c FROM t1; set @old_dbug=@@session.debug_dbug; -set debug_dbug="+d,kill_join_init_read_record"; +SET debug_dbug="+d,kill_join_init_read_record"; SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.c = alias2.c OR alias1.i <= 1 ; ERROR 70100: Query execution was interrupted -set debug_dbug=@old_dbug; +SET debug_dbug=@old_dbug; DROP TABLE t1; diff --git a/mysql-test/r/select_debug.result b/mysql-test/r/select_debug.result index ad663828290..dfe49aed215 100644 --- a/mysql-test/r/select_debug.result +++ b/mysql-test/r/select_debug.result @@ -6,7 +6,7 @@ insert into t1 values (2,2), (1,1); create table t2 (a int); insert into t2 values (2), (3); set session join_cache_level=3; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; id select_type table type possible_keys key key_len ref rows Extra @@ -17,4 +17,4 @@ b 2 set session join_cache_level=default; drop table t1,t2; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result index 0819ae5ba37..e280ae7040e 100644 --- a/mysql-test/r/show_explain.result +++ b/mysql-test/r/show_explain.result @@ -23,7 +23,7 @@ show explain for $thr1; ERROR HY000: Target is not running an EXPLAINable command connection con1; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select count(*) from t1 where a < 100000; connection default; show explain for $thr2; @@ -58,10 +58,10 @@ connection con1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan set optimizer_switch= @show_expl_tmp; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # UNION, first branch set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; connection default; show explain for $thr2; @@ -76,10 +76,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 2 UNION B ALL NULL NULL NULL NULL 10 NULL UNION RESULT ALL NULL NULL NULL NULL NULL -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # UNION, second branch set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; connection default; show explain for $thr2; @@ -94,10 +94,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 2 UNION B ALL NULL NULL NULL NULL 10 NULL UNION RESULT ALL NULL NULL NULL NULL NULL -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 B) from t0 A where a<1; connection default; show explain for $thr2; @@ -109,10 +109,10 @@ Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; a (select max(a) from t0 B) 0 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # Uncorrelated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a, (select max(a) from t0 B) from t0 A where a<1; connection default; show explain for $thr2; @@ -125,10 +125,10 @@ connection con1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where 2 SUBQUERY B ALL NULL NULL NULL NULL 10 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # correlated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; @@ -140,10 +140,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a connection con1; a (select max(a) from t0 b where b.a+a.a<10) 0 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # correlated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; @@ -155,10 +155,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a connection con1; a (select max(a) from t0 b where b.a+a.a<10) 0 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # correlated subquery, select, while inside the subquery set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; @@ -170,10 +170,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a connection con1; a (select max(a) from t0 b where b.a+a.a<10) 0 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; @@ -185,10 +185,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a connection con1; a (select max(a) from t0 b where b.a+a.a<10) 0 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; @@ -200,12 +200,12 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a connection con1; a (select max(a) from t0 b where b.a+a.a<10) 0 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # Try to do SHOW EXPLAIN for a query that runs a SET command: # I've found experimentally that select_id==2 here... # set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @foo= (select max(a) from t0 where sin(a) >0); connection default; show explain for $thr2; @@ -213,13 +213,13 @@ ERROR HY000: Target is not running an EXPLAINable command kill query $thr2; connection con1; ERROR 70100: Query execution was interrupted -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # Attempt SHOW EXPLAIN for an UPDATE # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show explain for $thr2; @@ -236,13 +236,13 @@ Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; drop table t2; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # Attempt SHOW EXPLAIN for a DELETE (UPD: now works) # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show explain for $thr2; @@ -259,13 +259,13 @@ Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; drop table t2; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # Multiple SHOW EXPLAIN calls for one select # create table t2 as select a as a, a as dummy from t0 limit 3; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; show explain for $thr2; @@ -292,14 +292,14 @@ a SUBQ 1 0 2 0 drop table t2; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort" # explain select * from t0 order by a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select * from t0 order by a; connection default; @@ -320,7 +320,7 @@ a 7 8 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # SHOW EXPLAIN for SELECT ... with "Using temporary" # @@ -329,7 +329,7 @@ explain select distinct a from t0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary connection con1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select distinct a from t0; connection default; @@ -350,7 +350,7 @@ a 7 8 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort" # @@ -359,7 +359,7 @@ explain select distinct a from t0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary connection con1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select distinct a from t0; connection default; @@ -380,7 +380,7 @@ a 7 8 9 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY # @@ -390,7 +390,7 @@ explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -set debug_dbug='+d,show_explain_in_find_all_keys'; +SET debug_dbug='+d,show_explain_in_find_all_keys'; SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; connection default; # FIXED by "conservative assumptions about when QEP is available" fix: @@ -406,7 +406,7 @@ a 1 2 4 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t2; # # MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with @@ -421,7 +421,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a` set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; connection default; show explain for $thr2; @@ -436,7 +436,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a` -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t2; # # MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in @@ -453,7 +453,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 6 2 DERIVED t3 system NULL NULL NULL NULL 1 set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; SELECT * FROM v1, t2; connection default; show explain for $thr2; @@ -461,14 +461,14 @@ ERROR HY000: Target is not running an EXPLAINable command kill query $thr2; connection con1; ERROR 70100: Query execution was interrupted -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t2, t3; # # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; select sleep(1); connection default; show explain for $thr2; @@ -479,12 +479,12 @@ Note 1003 select sleep(1) connection con1; sleep(1) 0 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # Same as above, but try another reason for JOIN to be degenerate # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; select * from t0 where 1>10; connection default; show explain for $thr2; @@ -494,14 +494,14 @@ Warnings: Note 1003 select * from t0 where 1>10 connection con1; a -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # Same as above, but try another reason for JOIN to be degenerate (2) # create table t3(a int primary key); insert into t3 select a from t0; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; select * from t0,t3 where t3.a=112233; connection default; show explain for $thr2; @@ -511,7 +511,7 @@ Warnings: Note 1003 select * from t0,t3 where t3.a=112233 connection con1; a a -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t3; # # MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with @@ -530,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; SELECT * FROM t2 WHERE a = (SELECT MAX(a) FROM t2 WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) @@ -552,7 +552,7 @@ pk a 6 7 7 7 9 7 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t2; # # MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE @@ -584,7 +584,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join) 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; SELECT count(*) FROM t2, t3 WHERE a1 < ALL ( SELECT a1 FROM t2 @@ -605,7 +605,7 @@ WHERE a1 IN ( SELECT a1 FROM t2, t4 ) connection con1; count(*) 1740 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t2, t3, t4; # # MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function @@ -615,7 +615,7 @@ INSERT INTO t2 VALUES (1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43), (11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`); connection default; show explain for $thr2; @@ -627,7 +627,7 @@ Warnings: Note 1003 SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`) connection con1; pk a1 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t2; DROP TABLE t1; # @@ -636,7 +636,7 @@ DROP TABLE t1; CREATE TABLE t1(a INT, KEY(a)); INSERT INTO t1 VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT 'test' FROM t1 WHERE a=1; connection default; show explain for $thr2; @@ -648,7 +648,7 @@ connection con1; test test test -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1; # # MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution @@ -666,7 +666,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where 1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_test_if_quick_select'; +SET debug_dbug='+d,show_explain_probe_test_if_quick_select'; select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; connection default; show explain for $thr2; @@ -696,7 +696,7 @@ Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND connection con1; count(*) 212 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1; # # MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while @@ -705,7 +705,7 @@ drop table t1; CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)); INSERT INTO t1 (a) VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SHOW INDEX FROM t1; connection default; show explain for $thr2; @@ -718,7 +718,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t1 1 a 1 a A NULL NULL NULL YES BTREE t1 1 b 1 b A NULL NULL NULL YES BTREE t1 1 c 1 c A NULL NULL NULL YES BTREE -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1; # # MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view @@ -731,7 +731,7 @@ EXPLAIN SELECT a + 1 FROM v1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 2 2 DERIVED t1 ALL NULL NULL NULL NULL 2 -set debug_dbug='+d,show_explain_probe_join_tab_preread'; +SET debug_dbug='+d,show_explain_probe_join_tab_preread'; set @show_explain_probe_select_id=1; SELECT a + 1 FROM v1; connection default; @@ -745,7 +745,7 @@ connection con1; a + 1 2 3 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t1; # @@ -761,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL -set debug_dbug='+d,show_explain_probe_union_read'; +SET debug_dbug='+d,show_explain_probe_union_read'; SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); connection default; show explain for $thr2; @@ -782,7 +782,7 @@ Warnings: Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ) connection con1; a -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1; # # MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN @@ -805,7 +805,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 SUBQUERY t1 ALL NULL NULL NULL NULL 20 3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); connection default; @@ -820,7 +820,7 @@ Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ) connection con1; a b -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1, t2; # # Test that SHOW EXPLAIN will print 'Distinct'. @@ -842,7 +842,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary 1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select distinct t1.a from t1,t3 where t1.a=t3.a; connection default; show explain for $thr2; @@ -855,7 +855,7 @@ connection con1; a 1 2 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1,t3,t4; # # ---------- SHOW EXPLAIN and permissions ----------------- @@ -869,7 +869,7 @@ connection con1; # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where a < 3; connection default; connection con2; @@ -886,14 +886,14 @@ a 0 1 2 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # # Check that user test2 can do SHOW EXPLAIN on its own queries # connect con3, localhost, test2,,; connection con2; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where a < 3; connection con1; connection con3; @@ -916,9 +916,9 @@ disconnect con2; grant process on *.* to test2@localhost; connect con2, localhost, test2,,; connection con1; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where a < 3; connection default; connection con2; @@ -932,7 +932,7 @@ a 0 1 2 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; revoke all privileges on test.* from test2@localhost; drop user test2@localhost; disconnect con2; @@ -1009,7 +1009,7 @@ ORDER BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; @@ -1030,9 +1030,9 @@ a+SLEEP(0.01) 0 0 0 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; @@ -1053,7 +1053,7 @@ a+SLEEP(0.01) 0 0 0 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1; # # MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains @@ -1067,7 +1067,7 @@ EXPLAIN SELECT a FROM t1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a FROM t1 GROUP BY a; connection default; show explain for $thr2; @@ -1093,7 +1093,7 @@ a 14 15 16 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1; # # MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output @@ -1107,7 +1107,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; connection default; show explain for $thr2; @@ -1119,7 +1119,7 @@ Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE connection con1; SUM(a + SLEEP(0.1)) 7862 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1, t2; # # MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice @@ -1157,7 +1157,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index 1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; connection default; show explain for $thr2; @@ -1169,7 +1169,7 @@ Warnings: Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2 connection con1; field1 field2 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1,t2,t3; # # MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output @@ -1190,7 +1190,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 20 3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10; connection default; @@ -1205,7 +1205,7 @@ WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10 connection con1; max(a+b+c) 279 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1,t2,t3; # # MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree) @@ -1231,7 +1231,7 @@ select hex(' hex('') E3FB set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; select * from t0 where length('') = a; connection default; set names utf8; @@ -1244,7 +1244,7 @@ set names default; connection con1; a 2 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set names default; # # MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value @@ -1270,7 +1270,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) 4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2 WHERE b <= ANY ( SELECT a FROM t1 @@ -1290,7 +1290,7 @@ WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 )) connection con1; SUM(b) 0 -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1,t2; drop table t0; # @@ -1302,7 +1302,7 @@ create table t1 (a int, b int); insert into t1 select a,a from t0; create table t2 as select * from t1; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_best_ext_lim_search'; +SET debug_dbug='+d,show_explain_probe_best_ext_lim_search'; explain select * from t0 where not exists ( select 1 from t1, t2 where t1.b=t2.b and t2.a=t0.a) and a is null; diff --git a/mysql-test/r/show_explain_non_select.result b/mysql-test/r/show_explain_non_select.result index 6076a848e22..8d96056ca91 100644 --- a/mysql-test/r/show_explain_non_select.result +++ b/mysql-test/r/show_explain_non_select.result @@ -14,7 +14,7 @@ from t0 A, t0 B, t0 C; # Test SHOW EXPLAIN for single-table DELETE # connection con2; -set debug_dbug='+d,show_explain_probe_delete_exec_start'; +SET debug_dbug='+d,show_explain_probe_delete_exec_start'; delete from t1 where a<10 and b+1>1000; connection default; show explain for $thr2; @@ -27,7 +27,7 @@ connection con2; # Test SHOW EXPLAIN for multi-table DELETE # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000; connection default; show explain for $thr2; @@ -41,7 +41,7 @@ connection con2; # Test SHOW EXPLAIN for single-table UPDATE # connection con2; -set debug_dbug='+d,show_explain_probe_update_exec_start'; +SET debug_dbug='+d,show_explain_probe_update_exec_start'; update t1 set filler='filler-data-2' where a<10 and b+1>1000; connection default; show explain for $thr2; @@ -51,5 +51,5 @@ Warnings: Note 1003 update t1 set filler='filler-data-2' where a<10 and b+1>1000 connection con2; drop table t0,t1; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set debug_sync='RESET'; diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result index 3721a13dd79..88f4ac7517a 100644 --- a/mysql-test/r/show_explain_ps.result +++ b/mysql-test/r/show_explain_ps.result @@ -17,8 +17,8 @@ connection con1; connection default; connection con1; set @show_explain_probe_select_id=1; -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='d,show_explain_probe_join_exec_start'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='d,show_explain_probe_join_exec_start'; select count(*) from t0 where a < 100000; connection default; show explain for $thr2; @@ -29,7 +29,7 @@ Note 1003 select count(*) from t0 where a < 100000 connection con1; count(*) 10 -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; select event_name from performance_schema.events_stages_history_long join diff --git a/mysql-test/r/slowlog_enospace-10508.result b/mysql-test/r/slowlog_enospace-10508.result index 4dfd3474804..66fb19eed6a 100644 --- a/mysql-test/r/slowlog_enospace-10508.result +++ b/mysql-test/r/slowlog_enospace-10508.result @@ -3,8 +3,8 @@ create table t1 (a int, b int) engine=memory; insert t1 select seq, seq+1 from seq_1_to_1000; set global general_log=0; set global log_queries_not_using_indexes=1; -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,simulate_file_write_error'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_write_error'; select * from t1 where a>10; select * from t1 where a>10; select * from t1 where a>10; @@ -55,7 +55,7 @@ select * from t1 where a>10; select * from t1 where a>10; select * from t1 where a>10; select * from t1 where a>10; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; set global general_log=1; set global log_queries_not_using_indexes=default; drop table t1; diff --git a/mysql-test/r/stat_tables-enospc.result b/mysql-test/r/stat_tables-enospc.result index 23b0f9d41ed..9ac24a2af99 100644 --- a/mysql-test/r/stat_tables-enospc.result +++ b/mysql-test/r/stat_tables-enospc.result @@ -1,12 +1,12 @@ call mtr.add_suppression("No space left on device"); create table t1 (a varchar(255), b varchar(255), c varchar(255)); set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3; -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,simulate_file_write_error'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_write_error'; set @@max_heap_table_size=128*1024; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze Error Error writing file 'tmp-file' (Errcode: 28 "No space left on device") test.t1 analyze status Operation failed -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/r/union_crash-714.result b/mysql-test/r/union_crash-714.result index b5ed7d205dc..371be1e03d0 100644 --- a/mysql-test/r/union_crash-714.result +++ b/mysql-test/r/union_crash-714.result @@ -1,7 +1,7 @@ create table t1 (i tinyint); -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,bug11747970_raise_error'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,bug11747970_raise_error'; insert into t1 (i) select i from t1 union select i from t1; ERROR 70100: Query execution was interrupted drop table t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/r/warnings_debug.result b/mysql-test/r/warnings_debug.result index eba6e8f8f4e..3a9d8225795 100644 --- a/mysql-test/r/warnings_debug.result +++ b/mysql-test/r/warnings_debug.result @@ -1,6 +1,6 @@ drop table if exists t1; create table t1 (a int primary key) engine=innodb; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,warn_during_ha_commit_trans"; INSERT INTO t1 VALUES (1); Warnings: @@ -9,4 +9,4 @@ SHOW WARNINGS; Level Code Message Warning 1196 Some non-transactional changed tables couldn't be rolled back drop table t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/binlog/r/binlog_ioerr.result b/mysql-test/suite/binlog/r/binlog_ioerr.result index f09d6415fa4..e4f00a017ba 100644 --- a/mysql-test/suite/binlog/r/binlog_ioerr.result +++ b/mysql-test/suite/binlog/r/binlog_ioerr.result @@ -2,7 +2,7 @@ CALL mtr.add_suppression("Error writing file 'master-bin'"); RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; INSERT INTO t1 VALUES(0); -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug='+d,fail_binlog_write_1'; INSERT INTO t1 VALUES(1); ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") diff --git a/mysql-test/suite/binlog_encryption/binlog_ioerr.result b/mysql-test/suite/binlog_encryption/binlog_ioerr.result index 9b04c9be4e1..2823b7050c3 100644 --- a/mysql-test/suite/binlog_encryption/binlog_ioerr.result +++ b/mysql-test/suite/binlog_encryption/binlog_ioerr.result @@ -2,7 +2,7 @@ CALL mtr.add_suppression("Error writing file 'master-bin'"); RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; INSERT INTO t1 VALUES(0); -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug='+d,fail_binlog_write_1'; INSERT INTO t1 VALUES(1); ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.result b/mysql-test/suite/binlog_encryption/rpl_checksum.result index 14220a356ca..22220b8e9fb 100644 --- a/mysql-test/suite/binlog_encryption/rpl_checksum.result +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.result @@ -93,7 +93,7 @@ set @save_dbug = @@session.debug_dbug; set @@session.debug_dbug='d,simulate_checksum_test_failure'; show binlog events; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error -set debug_dbug= @save_dbug; +SET debug_dbug= @save_dbug; set @@global.master_verify_checksum = default; connection slave; connection slave; diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result index 0309f084e5d..1a5734ca516 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -208,7 +208,7 @@ DROP TABLE t1, t2; # MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf # on table with virtual columns and indexes # -set @saved_dbug= @@global.debug_dbug; +SET @saved_dbug= @@GLOBAL.debug_dbug; set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2"; create table t1 ( pk serial, vb tinyblob as (b) virtual, b tinyblob, @@ -253,7 +253,7 @@ SET GLOBAL innodb_debug_sync = "ib_clust_v_col_before_row_allocated " SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open " "SIGNAL purge_open " "WAIT_FOR select_open"; -set @saved_dbug= @@global.debug_dbug; +SET @saved_dbug= @@GLOBAL.debug_dbug; set global debug_dbug= "+d,ib_purge_virtual_index_callback"; connect purge_waiter,localhost,root; SET debug_sync= "now WAIT_FOR before_row_allocated"; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 4ea3c9fd34b..b1a2f0cbdd6 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -265,7 +265,7 @@ DROP TABLE t1, t2; --echo # --let $datadir= `select @@datadir` -set @saved_dbug= @@global.debug_dbug; +SET @saved_dbug= @@GLOBAL.debug_dbug; set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2"; create table t1 ( @@ -349,7 +349,7 @@ SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open " # In 10.2 trx_undo_roll_ptr_is_insert(t_roll_ptr) condition never pass in purge, # so this condition is forced to pass in row_vers_old_has_index_entry -set @saved_dbug= @@global.debug_dbug; +SET @saved_dbug= @@GLOBAL.debug_dbug; set global debug_dbug= "+d,ib_purge_virtual_index_callback"; # The purge starts from REPLACE command. To avoid possible race, separate diff --git a/mysql-test/suite/innodb/r/blob-update-debug.result b/mysql-test/suite/innodb/r/blob-update-debug.result index 0d0fc6d5070..813a469dd2b 100644 --- a/mysql-test/suite/innodb/r/blob-update-debug.result +++ b/mysql-test/suite/innodb/r/blob-update-debug.result @@ -8,10 +8,10 @@ select f1, substring(f2, 1, 40) from t1; f1 substring(f2, 1, 40) 1 **************************************** set @saved_debug = @@session.debug_dbug; -set debug_dbug = 'd,row_ins_index_entry_timeout'; +SET debug_dbug = 'd,row_ins_index_entry_timeout'; update t1 set f1 = 3; select f1, substring(f2, 1, 40) from t1; f1 substring(f2, 1, 40) 3 **************************************** drop table t1; -set debug_dbug= @saved_debug; +SET debug_dbug= @saved_debug; diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result index 989fb055cbc..03e22b774e4 100644 --- a/mysql-test/suite/innodb/r/innodb-replace-debug.result +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -5,10 +5,10 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); set @old_dbug= @@session.debug_dbug; -set debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +SET debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); select * from t1; f1 f2 f3 14 25 34 drop table t1; -set debug_dbug = @old_dbug; +SET debug_dbug = @old_dbug; diff --git a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result index b48cfb05a5c..06bb708b82c 100644 --- a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result +++ b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result @@ -1,5 +1,5 @@ call mtr.add_suppression("InnoDB: Warning: Index.*"); -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized'; create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb; create procedure innodb_insert_proc (repeat_count int) @@ -30,4 +30,4 @@ count(1) 781 drop procedure innodb_insert_proc; drop table t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug11754376.result b/mysql-test/suite/innodb/r/innodb_bug11754376.result index a2c1ceed61f..650dfbb35c2 100644 --- a/mysql-test/suite/innodb/r/innodb_bug11754376.result +++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result @@ -1,5 +1,5 @@ CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; DROP TABLE bug11754376; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result index 981e08609a2..aa922776f7b 100644 --- a/mysql-test/suite/innodb/r/innodb_bug56947.result +++ b/mysql-test/suite/innodb/r/innodb_bug56947.result @@ -1,6 +1,6 @@ SET GLOBAL innodb_file_per_table=0; create table bug56947(a int not null) engine = innodb; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename'; alter table bug56947 add unique index (a); ERROR HY000: Got error 11 "xxx" from storage engine InnoDB @@ -9,4 +9,4 @@ Table Op Msg_type Msg_text test.bug56947 check status OK drop table bug56947; SET @@global.innodb_file_per_table=DEFAULT; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result index 2000db03efa..daf0345e8ca 100644 --- a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result +++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result @@ -24,7 +24,7 @@ test.corrupt_bit_test_ā check Warning InnoDB: Index idx is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index idxā is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index idxē is marked as corrupted test.corrupt_bit_test_ā check error Corrupt -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); ERROR HY000: Index idx is corrupted CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); diff --git a/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result b/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result index 73b5f81a76f..65d0a0bde43 100644 --- a/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result +++ b/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result @@ -4,7 +4,7 @@ drop table if exists t1; connection con1; create table t1 (id integer, x integer) engine = InnoDB; insert into t1 values(0, 0); -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set DEBUG_DBUG='+d,fatal-semaphore-timeout'; set autocommit=0; # Sending query on con1, @@ -22,6 +22,6 @@ connection default; # Waitting for reconnect after mysqld restarts # Reconnected after mysqld was successfully restarted # Cleaning up before exit -set debug_dbug = @saved_dbug; +SET debug_dbug = @saved_dbug; drop table if exists t1; # Clean exit diff --git a/mysql-test/suite/innodb/r/truncate_inject.result b/mysql-test/suite/innodb/r/truncate_inject.result index 5ec532a0f83..f69013172cd 100644 --- a/mysql-test/suite/innodb/r/truncate_inject.result +++ b/mysql-test/suite/innodb/r/truncate_inject.result @@ -7,10 +7,10 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); check table t; Table Op Msg_type Msg_text test.t check status OK -SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_assigning_undo_log'; truncate table t; ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check status OK @@ -20,10 +20,10 @@ i f c 2 2.2 b 3 3.3 c # 2. Error while preparing for truncate -SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_preparing_for_truncate'; truncate table t; ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check status OK @@ -33,10 +33,10 @@ i f c 2 2.2 b 3 3.3 c # 3. Error while dropping/creating indexes -SET debug_dbug = '+d,ib_err_trunc_drop_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_drop_index'; truncate table t; ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check Warning InnoDB: Index PRIMARY is marked as corrupted @@ -50,10 +50,10 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); check table t; Table Op Msg_type Msg_text test.t check status OK -SET debug_dbug = '+d,ib_err_trunc_create_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_create_index'; truncate table t; ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check Warning InnoDB: Index PRIMARY is marked as corrupted @@ -67,9 +67,9 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); check table t; Table Op Msg_type Msg_text test.t check status OK -SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check status OK @@ -85,9 +85,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'), check table t; Table Op Msg_type Msg_text test.t check status OK -SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check status OK @@ -103,9 +103,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'), check table t; Table Op Msg_type Msg_text test.t check status OK -SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; Table Op Msg_type Msg_text test.t check status OK diff --git a/mysql-test/suite/innodb/t/blob-update-debug.test b/mysql-test/suite/innodb/t/blob-update-debug.test index 37c364290f4..8d35dbfc70e 100644 --- a/mysql-test/suite/innodb/t/blob-update-debug.test +++ b/mysql-test/suite/innodb/t/blob-update-debug.test @@ -12,8 +12,8 @@ create table t1 (f1 int primary key, f2 blob) engine = innodb; insert into t1 values (1, repeat('*', 50000)); select f1, substring(f2, 1, 40) from t1; set @saved_debug = @@session.debug_dbug; -set debug_dbug = 'd,row_ins_index_entry_timeout'; +SET debug_dbug = 'd,row_ins_index_entry_timeout'; update t1 set f1 = 3; select f1, substring(f2, 1, 40) from t1; drop table t1; -set debug_dbug= @saved_debug; +SET debug_dbug= @saved_debug; diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test index 7e710ae154c..823712a01f1 100644 --- a/mysql-test/suite/innodb/t/innodb-replace-debug.test +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -9,8 +9,8 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); set @old_dbug= @@session.debug_dbug; -set debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +SET debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); select * from t1; drop table t1; -set debug_dbug = @old_dbug; +SET debug_dbug = @old_dbug; diff --git a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test index dc85aa6e892..d5d04190b8a 100644 --- a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test +++ b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test @@ -6,7 +6,7 @@ call mtr.add_suppression("InnoDB: Warning: Index.*"); # This caused crash earlier -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized'; create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb; @@ -37,4 +37,4 @@ select count(1) from t1 where c between 7 and 787; drop procedure innodb_insert_proc; drop table t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug11754376.test b/mysql-test/suite/innodb/t/innodb_bug11754376.test index 238c86194d6..64547d409b3 100644 --- a/mysql-test/suite/innodb/t/innodb_bug11754376.test +++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test @@ -8,8 +8,8 @@ CREATE TABLE bug11754376 (c INT) ENGINE=INNODB; # This will invoke test_normalize_table_name_low() in debug builds -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low'; DROP TABLE bug11754376; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug56947.test b/mysql-test/suite/innodb/t/innodb_bug56947.test index 98bca895e82..ce64f1a8322 100644 --- a/mysql-test/suite/innodb/t/innodb_bug56947.test +++ b/mysql-test/suite/innodb/t/innodb_bug56947.test @@ -7,7 +7,7 @@ SET GLOBAL innodb_file_per_table=0; create table bug56947(a int not null) engine = innodb; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename'; --replace_regex /"[^"]*"/"xxx"/ --error ER_GET_ERRNO @@ -16,4 +16,4 @@ check table bug56947; drop table bug56947; SET @@global.innodb_file_per_table=DEFAULT; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test index 1d723c0bbc3..f1fd7f3c56a 100644 --- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test +++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test @@ -36,7 +36,7 @@ select count(*) from corrupt_bit_test_ā; SET @save_dbug = @@SESSION.debug_dbug; SET debug_dbug = '+d,dict_set_index_corrupted'; check table corrupt_bit_test_ā; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; # Cannot create new indexes while corrupted indexes exist --error ER_INDEX_CORRUPT diff --git a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test index e7076527b2b..ccd9e3d70f4 100644 --- a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test +++ b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test @@ -17,7 +17,7 @@ eval create table t1 (id integer, x integer) engine = InnoDB; insert into t1 values(0, 0); # Enable the debug injection. -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set DEBUG_DBUG='+d,fatal-semaphore-timeout'; set autocommit=0; @@ -108,7 +108,7 @@ source include/wait_until_connected_again.inc; --echo # Cleaning up before exit --disable_warnings -set debug_dbug = @saved_dbug; +SET debug_dbug = @saved_dbug; drop table if exists t1; --enable_warnings diff --git a/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test b/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test index 9ff01739f60..f1d1537237e 100644 --- a/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test +++ b/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test @@ -33,8 +33,8 @@ while ($i) --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect --exec echo "wait" > $_expect_file_name -set debug_dbug = '+d,increase_mtr_checkpoint_size'; -set debug_dbug = '+d,crash_after_checkpoint'; +SET debug_dbug = '+d,increase_mtr_checkpoint_size'; +SET debug_dbug = '+d,crash_after_checkpoint'; --error 2013 set global innodb_log_checkpoint_now = 1; @@ -64,7 +64,7 @@ while ($i) --enable_query_log --exec echo "wait" > $_expect_file_name -set debug_dbug = '+d,crash_after_checkpoint'; +SET debug_dbug = '+d,crash_after_checkpoint'; --error 2013 set global innodb_log_checkpoint_now = 1; diff --git a/mysql-test/suite/innodb/t/truncate_inject.test b/mysql-test/suite/innodb/t/truncate_inject.test index 35e516324bb..25002bd2f7b 100644 --- a/mysql-test/suite/innodb/t/truncate_inject.test +++ b/mysql-test/suite/innodb/t/truncate_inject.test @@ -14,26 +14,26 @@ ENGINE = InnoDB; insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); check table t; # -SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_assigning_undo_log'; --error ER_GET_ERRNO truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; select * from t; --echo # 2. Error while preparing for truncate -SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_preparing_for_truncate'; --error ER_GET_ERRNO truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; select * from t; --echo # 3. Error while dropping/creating indexes -SET debug_dbug = '+d,ib_err_trunc_drop_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_drop_index'; --error ER_GET_ERRNO truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; --error ER_TABLE_CORRUPT,ER_GET_ERRNO select * from t; @@ -44,10 +44,10 @@ ENGINE = InnoDB; insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); check table t; -SET debug_dbug = '+d,ib_err_trunc_create_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_create_index'; --error ER_GET_ERRNO truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; --error ER_TABLE_CORRUPT,ER_GET_ERRNO select * from t; @@ -58,9 +58,9 @@ ENGINE = InnoDB; insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); check table t; -SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; select * from t; @@ -73,9 +73,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'), (2, 2.2, 'innodb is part of mysql'), (3, 3.3, 'innodb is default storage engine of mysql'); check table t; -SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; select * from t; @@ -88,9 +88,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'), (2, 2.2, 'innodb is part of mysql'), (3, 3.3, 'innodb is default storage engine of mysql'); check table t; -SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; +SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index'; truncate table t; -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; check table t; select * from t order by i; diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result index 31d832ba483..9be7ba35f30 100644 --- a/mysql-test/suite/innodb_fts/r/concurrent_insert.result +++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result @@ -17,7 +17,7 @@ INSERT INTO t1 VALUES('test'); CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB; INSERT INTO t2 VALUES('mariadb'); connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang'; SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL drop_index_start WAIT_FOR sync_op'; @@ -29,7 +29,7 @@ ALTER TABLE t2 drop index idx1; connection default; set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; drop table t1, t2; connection default; set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test index 881441b66b6..1505767d835 100644 --- a/mysql-test/suite/innodb_fts/t/concurrent_insert.test +++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test @@ -29,7 +29,7 @@ CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB; INSERT INTO t2 VALUES('mariadb'); connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang'; SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL drop_index_start WAIT_FOR sync_op'; @@ -46,7 +46,7 @@ set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; reap; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; drop table t1, t2; connection default; set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb_gis/t/rtree_debug.test b/mysql-test/suite/innodb_gis/t/rtree_debug.test index 2f7c2806c68..580f3cf48a1 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_debug.test +++ b/mysql-test/suite/innodb_gis/t/rtree_debug.test @@ -53,7 +53,7 @@ SET @save_dbug = @@SESSION.debug_dbug; SET debug_dbug='+d,row_merge_ins_spatial_fail'; --error ER_GET_ERRNO create spatial index idx2 on t1(c2); -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; show create table t1; # Check table. diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result index 1dd675bc8a9..a0be9e23818 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result @@ -1,4 +1,4 @@ -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; create table `t1` (`c1` char(1) default null,`c2` char(10) default null, key (`c1`)) @@ -8,4 +8,4 @@ select * from `t1` where `c1`='3' for update; c1 c2 3 NULL drop table `t1`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result index 3e6f4b2b4f1..59ab7607a40 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result @@ -1,7 +1,7 @@ # # Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on # -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t ( dummy INT PRIMARY KEY, @@ -14,4 +14,4 @@ dummy a b 3 3 3 5 5 5 DROP TABLE t; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result index ef0d8e7043a..acc18b06ea0 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result @@ -1,4 +1,4 @@ -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; drop table if exists `t1`; Warnings: @@ -7,4 +7,4 @@ create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb; insert into `t1` values(2,2); delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ; drop table `t1`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result index 018bb0dd6e0..f5554563a18 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result @@ -1,4 +1,4 @@ -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -253,4 +253,4 @@ Warning 1292 Truncated incorrect DOUBLE value: 'd' Warning 1292 Truncated incorrect DOUBLE value: 'd' Warning 1292 Truncated incorrect DOUBLE value: 'd' drop table `table5`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result index ca8b54dc1ae..f6f5cd7c6fd 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result @@ -1,4 +1,4 @@ -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY KEY(c1), UNIQUE INDEX(c2)) engine=innodb; @@ -10,4 +10,4 @@ SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; c1 c2 c3 08:29:45 NULL 2009-02-01 drop table `t1`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result index d2df789ccf0..7e838906114 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result @@ -1,7 +1,7 @@ # # Bug#43360 - Server crash with a simple multi-table update # -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1 ( a CHAR(2) NOT NULL PRIMARY KEY, @@ -43,4 +43,4 @@ AB Sweden MS United States of Ame JA USA DROP TABLE t1,t2; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result index 552c8629962..9b7a2c459c3 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result @@ -1,7 +1,7 @@ # # Bug#43448 - Server crashes on multi table delete with Innodb # -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1 ( id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -29,4 +29,4 @@ DELETE t1, t2, t3 FROM t1, t2, t3 WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5; DROP TABLE t1, t2, t3; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result index 388c88c1d05..11f915aaf8e 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result +++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result @@ -1,7 +1,7 @@ set storage_engine=innodb; set @save_time_zone= @@time_zone; set time_zone='+03:00'; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28'); @@ -101,4 +101,4 @@ c1 c2 c3 c4 2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00 DROP TABLE t1; set time_zone= @save_time_zone; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test index 63219c8172d..5c316c0a4d6 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test @@ -4,7 +4,7 @@ --source include/have_innodb.inc # crash requires this -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; create table `t1` (`c1` char(1) default null,`c2` char(10) default null, @@ -13,4 +13,4 @@ engine=innodb default charset=latin1; insert into `t1` values ('3',null); select * from `t1` where `c1`='3' for update; drop table `t1`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test index c442712cc62..41d38445095 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test @@ -5,7 +5,7 @@ --source include/have_debug.inc --source include/have_innodb.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; # Crash requires that we enable Index Condition Pushdown in InnoDB set session debug_dbug="+d,optimizer_innodb_icp"; @@ -20,4 +20,4 @@ INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5); SELECT * FROM t WHERE a > 2 FOR UPDATE; DROP TABLE t; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test index e7c04eec496..0eb7e34a9dd 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test @@ -5,7 +5,7 @@ --source include/have_innodb.inc # crash requires this -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; drop table if exists `t1`; @@ -13,4 +13,4 @@ create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb; insert into `t1` values(2,2); delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ; drop table `t1`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test index e768e775a01..d59e9e1fbeb 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test @@ -6,7 +6,7 @@ --source include/have_innodb.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; # Valgrind errors happen only with this: set session debug_dbug="+d,optimizer_innodb_icp"; @@ -247,4 +247,4 @@ UNLOCK TABLES; select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ; drop table `table5`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test index e727bc24763..c647b777059 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test @@ -4,7 +4,7 @@ --source include/have_debug.inc --source include/have_innodb.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY @@ -16,4 +16,4 @@ SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2; drop table `t1`; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test index 3bb6e79a784..0896caa7712 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test @@ -6,7 +6,7 @@ --source include/have_debug.inc --source include/have_innodb.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; # crash requires this set session debug_dbug="+d,optimizer_innodb_icp"; @@ -43,4 +43,4 @@ SELECT * FROM t1; SELECT * FROM t2; DROP TABLE t1,t2; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test index 9bc83195b73..4e1df63b45b 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test @@ -5,7 +5,7 @@ --source include/have_debug.inc --source include/have_innodb.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; # crash requires ICP support in InnoDB set session debug_dbug="+d,optimizer_innodb_icp"; @@ -59,4 +59,4 @@ FROM t1, t2, t3 WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5; DROP TABLE t1, t2, t3; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test index 6533025a7b6..02d0ab6d566 100644 --- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test +++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test @@ -6,7 +6,7 @@ set storage_engine=innodb; set @save_time_zone= @@time_zone; set time_zone='+03:00'; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,optimizer_innodb_icp"; ######## Running INSERT tests for TIMESTAMP ######## @@ -84,4 +84,4 @@ SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER DROP TABLE t1; set time_zone= @save_time_zone; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result index 24f6a448334..86cab03c4c6 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result index a4072a4681a..f824c319afa 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result index 277eb5a57f3..33948013822 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result index 716089f7022..096c5c3dbd5 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result index e7ef6c05d4b..f36e4604a7c 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN null LAST_ERROR_SEEN null revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result index a516f77a66d..d84ffe2e9df 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; ERROR HY000: Host 'santa.claus.ipv4.example.com' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result index d6212a009cb..ff2a93efec4 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -104,4 +104,4 @@ revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result index 08f4152fdcc..c300d6a50af 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result index 7dd56fffdca..1c34faa9457 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; uninstall plugin test_plugin_server; ERROR HY000: Plugin 'test_plugin_server' is not loaded @@ -195,5 +195,5 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com' FROM 'plug'@'santa.claus.ipv4.example.com'; DROP USER 'plug'@'santa.claus.ipv4.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result index 33000173925..2751dbd7edb 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result @@ -25,7 +25,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4,native_password_bad_reply"; ERROR 08S01: Bad handshake connection default; @@ -428,4 +428,4 @@ drop user 'root'@'santa.claus.ipv4.example.com'; revoke select on test.* from 'quota'@'santa.claus.ipv4.example.com'; drop user 'quota'@'santa.claus.ipv4.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result index 8af7cadda99..18e437559e4 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_format_ipv4"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result index 75d784e3381..3d41f013ba9 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result @@ -25,7 +25,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect con2a,"127.0.0.1",quota,,test,$MASTER_MYPORT,; select "Con2a is alive"; @@ -703,4 +703,4 @@ disconnect tmp_con7; set global max_connections = @saved_max_connections; set global max_user_connections = @saved_max_user_connections; drop user 'quota'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result index 6f80a0883a3..7bafd9e636f 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -179,4 +179,4 @@ revoke select on test.* from 'root'@'192.0.2.4'; revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result index 0a80efd3333..3896ed086ba 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -143,4 +143,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result index 9499789334b..236bc12d9bf 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result index 2592a003d59..5479393c29b 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result index fc20f4e1c2f..4c2a9d48a63 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; ERROR 28000: Access denied for user 'user_without'@'santa.claus.ipv4.example.com' (using password: YES) connection default; @@ -208,4 +208,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_with'@'santa.claus.ipv4.example.com'; drop user 'user_without'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result index c7ae1cdd12f..267f346836d 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result @@ -28,7 +28,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; ERROR 28000: Access denied for user 'user_ssl'@'santa.claus.ipv4.example.com' (using password: NO) connection default; @@ -152,4 +152,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_ssl'@'santa.claus.ipv4.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result index 330aaa57b1d..4325cfec6dc 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result index dd730123cc4..12435dd54f5 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result index c613bda07ba..57e14dfe913 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result index 32fcc37b75b..654ed7759b1 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result index 2558047ab62..f68d90978e7 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN null LAST_ERROR_SEEN null revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result index a4da4f54058..e63c84bf352 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result @@ -19,7 +19,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; ERROR HY000: Host 'santa.claus.ipv6.example.com' is not allowed to connect to this MariaDB server connection default; @@ -81,4 +81,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result index e4da1079176..50297797f6a 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -104,4 +104,4 @@ revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result index 2aeb0189da4..549e83369df 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result index 0897fdd1872..5312958bd91 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; uninstall plugin test_plugin_server; ERROR HY000: Plugin 'test_plugin_server' is not loaded @@ -195,5 +195,5 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com' FROM 'plug'@'santa.claus.ipv6.example.com'; DROP USER 'plug'@'santa.claus.ipv6.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result index c4d482a6b12..757285b1033 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result @@ -25,7 +25,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply"; ERROR 08S01: Bad handshake connection default; @@ -428,4 +428,4 @@ drop user 'root'@'santa.claus.ipv6.example.com'; revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com'; drop user 'quota'@'santa.claus.ipv6.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result index a77603b6e99..f2e25ab6ca1 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result @@ -25,7 +25,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect con2a,"::1",quota,,test,$MASTER_MYPORT,; select "Con2a is alive"; @@ -703,4 +703,4 @@ disconnect tmp_con7; set global max_connections = @saved_max_connections; set global max_user_connections = @saved_max_user_connections; drop user 'quota'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result index 3227b1eec67..2bb23e99203 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -179,4 +179,4 @@ revoke select on test.* from 'root'@'2001:db8::6:6'; revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result index b801010e0b7..5befbd98087 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -143,4 +143,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result index a17421161f9..f899cb935e9 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result @@ -22,7 +22,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; connect con2,"::1",root,,test,$MASTER_MYPORT,; select "Con2 is alive"; @@ -100,4 +100,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result index dd1b2f89ac3..6d50530ffa0 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result @@ -20,7 +20,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server connection default; @@ -82,4 +82,4 @@ COUNT_LOCAL_ERRORS 0 COUNT_UNKNOWN_ERRORS 0 FIRST_ERROR_SEEN set LAST_ERROR_SEEN set -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result index 6d6362b2874..670a3713d91 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result @@ -24,7 +24,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; ERROR 28000: Access denied for user 'user_without'@'santa.claus.ipv6.example.com' (using password: YES) connection default; @@ -208,4 +208,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_with'@'santa.claus.ipv6.example.com'; drop user 'user_without'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result index 61c98b0c868..9ec33df2fee 100644 --- a/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result +++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result @@ -28,7 +28,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; ERROR 28000: Access denied for user 'user_ssl'@'santa.claus.ipv6.example.com' (using password: NO) connection default; @@ -152,4 +152,4 @@ FIRST_ERROR_SEEN set LAST_ERROR_SEEN set drop user 'user_ssl'@'santa.claus.ipv6.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result index d88a240a2b7..6d15f2f5b25 100644 --- a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result +++ b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result @@ -27,7 +27,7 @@ current_user() root@localhost disconnect con1; connection default; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_error"; ERROR HY000: Can't get hostname for your address connection default; @@ -51,7 +51,7 @@ Connection_errors_peer_address 2 Connection_errors_select 0 Connection_errors_tcpwrap 0 "Dumping performance_schema.host_cache" -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; flush status; show global status like "connection_errors_%"; Variable_name Value diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test index 07a6f14f114..c96c8ea37c8 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test @@ -27,7 +27,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -49,5 +49,5 @@ disconnect con3; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test index 1218538d173..00f5d218e17 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test @@ -25,7 +25,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again"; --disable_query_log @@ -44,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test index 285563ddc62..d2dff92834e 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test @@ -30,7 +30,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -52,5 +52,5 @@ disconnect con3; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test index a7d197e03d1..f37e1ed3b90 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test @@ -27,7 +27,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4"; --disable_query_log @@ -46,5 +46,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test index 0f8881e3caa..d2b5352d3a6 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test @@ -28,7 +28,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -50,5 +50,5 @@ disconnect con3; revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test index dd2c7209e54..55afb6f0c4f 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test @@ -25,7 +25,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; --disable_query_log @@ -44,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test index 12f82b2a52c..a6bd4c751e2 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test @@ -30,7 +30,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -54,5 +54,5 @@ revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test index 28030802afb..41b8b25efc4 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test @@ -25,7 +25,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname"; --disable_query_log @@ -44,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test index 3e487f38636..6e149b838ef 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test @@ -30,7 +30,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; uninstall plugin test_plugin_server; @@ -87,6 +87,6 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com' DROP USER 'plug'@'santa.claus.ipv4.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test index 59cd855feaf..d304cc5a1b8 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test @@ -33,7 +33,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4,native_password_bad_reply"; --disable_query_log @@ -157,5 +157,5 @@ revoke select on test.* from 'quota'@'santa.claus.ipv4.example.com'; drop user 'quota'@'santa.claus.ipv4.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test index a7c0117284d..989c82ef0ad 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test @@ -24,7 +24,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_format_ipv4"; --disable_query_log @@ -43,5 +43,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test index 904de7335ee..6420b8b5300 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test @@ -31,7 +31,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; connect (con2a,"127.0.0.1",quota,,test,$MASTER_MYPORT,); @@ -260,5 +260,5 @@ set global max_user_connections = @saved_max_user_connections; # revoke all privileges on test.* from 'quota'@'santa.claus.ipv4.example.com'; drop user 'quota'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test index 0a83bc51f12..5a2caf5849e 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test @@ -30,7 +30,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -72,5 +72,5 @@ revoke select on test.* from 'root'@'santa.claus.ipv4.example.com'; drop user 'root'@'192.0.2.4'; drop user 'root'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test index 465133859d2..6cd2664a04f 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test @@ -25,7 +25,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again"; --disable_query_log @@ -62,5 +62,5 @@ connect (con5,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test index 15153dd07aa..19a3ebe9892 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test @@ -28,7 +28,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); @@ -50,5 +50,5 @@ disconnect con3; revoke select on test.* from 'root'@'192.0.2.4'; drop user 'root'@'192.0.2.4'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test index 9df41d429f2..28e5615d273 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test @@ -25,7 +25,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname"; --disable_query_log @@ -44,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test index 064200f80b8..c6ff89f0902 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test @@ -29,7 +29,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; --disable_query_log @@ -83,5 +83,5 @@ connect (con2f,"127.0.0.1",user_with,wrong_password,test,$MASTER_MYPORT,); drop user 'user_with'@'santa.claus.ipv4.example.com'; drop user 'user_without'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test index 116ad07dd68..bd8d48984e4 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test @@ -30,7 +30,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; --disable_query_log @@ -68,5 +68,5 @@ connect (con2d,"127.0.0.1",user_ssl_x509,good_password,test,$MASTER_MYPORT,,SSL) drop user 'user_ssl'@'santa.claus.ipv4.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv4.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test index a45da8c614a..100fdffa377 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test @@ -29,7 +29,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -51,5 +51,5 @@ disconnect con3; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test index c9102366a7d..8aafff745c4 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test @@ -26,7 +26,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again"; --disable_query_log @@ -45,5 +45,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test index e6c5c9c7d7b..eaf46a5c57e 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test @@ -31,7 +31,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -53,5 +53,5 @@ disconnect con3; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test index 7a9fa037079..6c4ede9da8e 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test @@ -28,7 +28,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6"; --disable_query_log @@ -47,5 +47,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test index 507e04f8d3f..e290a5f8ab4 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test @@ -29,7 +29,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -51,5 +51,5 @@ disconnect con3; revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test index 5bd4d8a7bd0..4feb0ffb7c8 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test @@ -22,7 +22,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; --disable_query_log @@ -41,5 +41,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test index dd790e77dbd..6b422a19dbd 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test @@ -31,7 +31,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -55,4 +55,4 @@ revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test index c6cb78da508..c81b799edd1 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test @@ -26,7 +26,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname"; --disable_query_log @@ -45,4 +45,4 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test index e8b8c42fd8a..d2e4ed69d79 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test @@ -31,7 +31,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; uninstall plugin test_plugin_server; @@ -88,6 +88,6 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com' DROP USER 'plug'@'santa.claus.ipv6.example.com'; DROP USER 'plug_dest'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; delete from mysql.plugin where name='test_plugin_server'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test index b28917d6ddd..6da99e02444 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test @@ -33,7 +33,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply"; --disable_query_log @@ -157,5 +157,5 @@ revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com'; drop user 'quota'@'santa.claus.ipv6.example.com'; set global max_connect_errors = @saved_max_connect_errors; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test index a2782619b15..6f83221c496 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test @@ -32,7 +32,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; connect (con2a,"::1",quota,,test,$MASTER_MYPORT,); @@ -242,5 +242,5 @@ set global max_user_connections = @saved_max_user_connections; # revoke all privileges on test.* from 'quota'@'santa.claus.ipv6.example.com'; drop user 'quota'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test index c1cc68a10e1..896b9bb4886 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test @@ -31,7 +31,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -73,5 +73,5 @@ revoke select on test.* from 'root'@'santa.claus.ipv6.example.com'; drop user 'root'@'2001:db8::6:6'; drop user 'root'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test index 80fccd6924f..17cc1ffa528 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test @@ -26,7 +26,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again"; --disable_query_log @@ -63,5 +63,5 @@ connect (con5,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test index af809674711..8e31420b6f1 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test @@ -29,7 +29,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; connect (con2,"::1",root,,test,$MASTER_MYPORT,); @@ -51,5 +51,5 @@ disconnect con3; revoke select on test.* from 'root'@'2001:db8::6:6'; drop user 'root'@'2001:db8::6:6'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test index 5e3f3b605d4..ddffc820a2b 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test @@ -26,7 +26,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname"; --disable_query_log @@ -45,5 +45,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,); --connection default --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test index a5d635d6133..7281a8b36ec 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test @@ -27,7 +27,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; --disable_query_log @@ -81,5 +81,5 @@ connect (con2f,"::1",user_with,wrong_password,test,$MASTER_MYPORT,); drop user 'user_with'@'santa.claus.ipv6.example.com'; drop user 'user_without'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test index 9821b4f8882..d822d9f9bed 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test @@ -31,7 +31,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6"; --disable_query_log @@ -69,5 +69,5 @@ connect (con2d,"::1",user_ssl_x509,good_password,test,$MASTER_MYPORT,,SSL); drop user 'user_ssl'@'santa.claus.ipv6.example.com'; drop user 'user_ssl_x509'@'santa.claus.ipv6.example.com'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test index cd36c88ffae..827421312dc 100644 --- a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test +++ b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test @@ -22,7 +22,7 @@ select current_user(); disconnect con1; --connection default -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_error"; --disable_query_log @@ -43,7 +43,7 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); show global status like "connection_errors_%"; --source ../include/hostcache_dump.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; flush status; show global status like "connection_errors_%"; diff --git a/mysql-test/suite/rpl/r/kill_race_condition.result b/mysql-test/suite/rpl/r/kill_race_condition.result index 4da61a78eb9..8e8645cdb58 100644 --- a/mysql-test/suite/rpl/r/kill_race_condition.result +++ b/mysql-test/suite/rpl/r/kill_race_condition.result @@ -4,7 +4,7 @@ connection master; create table t1 (a int); connection slave; connection slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug='d,rows_log_event_before_open_table'; connection master; insert t1 values (1),(2),(3); @@ -14,7 +14,7 @@ kill slave_sql_thread; set debug_sync='now SIGNAL go_ahead_sql'; include/wait_for_slave_sql_error.inc [errno=1927] Last_SQL_Error = Error executing row event: 'Connection was killed' -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; set debug_sync='RESET'; connection master; drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index a3d60a672a9..bdf2c707e9b 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -5,11 +5,11 @@ call mtr.add_suppression("Failed during slave I/O thread initialization"); call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* 1593"); include/stop_slave.inc reset slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Failed during slave thread initialization' -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; RESET SLAVE; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_bug41902.result b/mysql-test/suite/rpl/r/rpl_bug41902.result index de594d39a98..7d676ea73e3 100644 --- a/mysql-test/suite/rpl/r/rpl_bug41902.result +++ b/mysql-test/suite/rpl/r/rpl_bug41902.result @@ -2,7 +2,7 @@ include/master-slave.inc [connection master] connection slave; stop slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; reset slave; ERROR HY000: Target log not found in binlog index @@ -20,7 +20,7 @@ SET @@debug_dbug=""; reset slave; change master to master_host='dummy'; connection master; -set @saved_dbug_m = @@global.debug_dbug; +SET @saved_dbug_m = @@global.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; reset master; ERROR HY000: Target log not found in binlog index @@ -31,7 +31,7 @@ purge binary logs to 'master-bin.000001'; ERROR HY000: Target log not found in binlog index SET @@debug_dbug=""; purge binary logs to 'master-bin.000001'; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; ==== clean up ==== CHANGE MASTER TO MASTER_HOST = '127.0.0.1'; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index 7a8644f6bea..21d8ca22feb 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -93,7 +93,7 @@ set @save_dbug = @@session.debug_dbug; set @@session.debug_dbug='d,simulate_checksum_test_failure'; show binlog events; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error -set debug_dbug= @save_dbug; +SET debug_dbug= @save_dbug; set @@global.master_verify_checksum = default; connection slave; connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result index 8d22289370b..9a7a97e3d00 100644 --- a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result @@ -2,7 +2,7 @@ include/master-slave.inc [connection master] connection master; include/rpl_restart_server.inc [server_number=1] -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET @@debug_dbug="d,simulate_big_table_id"; CREATE TABLE t (a int); INSERT INTO t SET a= 0; @@ -43,6 +43,6 @@ master-bin.000002 # Query 1 # COMMIT connection slave; connection master; DROP TABLE t; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; connection slave; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result index 118266399fb..650f6eeee51 100644 --- a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result +++ b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result @@ -2,7 +2,7 @@ include/master-slave.inc [connection master] connection slave; include/stop_slave.inc -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL log_warnings = 2; SET GLOBAL debug_dbug="d,inject_long_find_row_note"; include/start_slave.inc @@ -18,7 +18,7 @@ connection slave; # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log Occurrences: update=1, delete=1 include/stop_slave.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; SET GLOBAL log_warnings = 2; include/start_slave.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result index 62d4ea896ef..d517d53c6da 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result @@ -11,7 +11,7 @@ SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1; include/start_slave.inc connection master; CREATE TABLE t1 (a INT) ENGINE=innodb; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB"; SET @@SESSION.skip_replication=1; INSERT INTO t1 SET a=1; @@ -21,7 +21,7 @@ SET @@GLOBAL.debug_dbug=""; FLUSH LOGS; connection slave; connection master; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; SET @@GLOBAL.rpl_semi_sync_master_timeout = 10000; SET @@GLOBAL.rpl_semi_sync_master_enabled = 0; connection master; diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_running.result b/mysql-test/suite/rpl/r/rpl_show_slave_running.result index a668b8b26f3..353ff379776 100644 --- a/mysql-test/suite/rpl/r/rpl_show_slave_running.result +++ b/mysql-test/suite/rpl/r/rpl_show_slave_running.result @@ -3,7 +3,7 @@ include/master-slave.inc connection slave; SET DEBUG_SYNC= 'RESET'; include/stop_slave.inc -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= 'd,dbug.before_get_running_status_yes'; Slave_running, Slave_IO_Running, Slave_SQL_Running, must be OFF, NO, NO in three following queries SHOW STATUS LIKE 'Slave_running'; @@ -35,7 +35,7 @@ Slave_running ON Slave_IO_Running= Yes Slave_SQL_Running= Yes connection slave; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; SET DEBUG_SYNC= 'RESET'; End of tests include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result index e5ef1224033..597df34c302 100644 --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@ -15,7 +15,7 @@ include/stop_slave.inc # Suspend the INSERT statement in current transaction on SQL thread. # It guarantees that SQL thread is applying the transaction when # STOP SLAVE command launchs. -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,after_mysql_insert,*'; include/start_slave.inc @@ -75,7 +75,7 @@ connection master; connection slave; # Test end -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; include/restart_slave.inc connection slave; call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); @@ -100,7 +100,7 @@ connection slave; include/stop_slave.inc connection master; include/stop_dump_threads.inc -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*'; connection slave; include/start_slave.inc @@ -123,7 +123,7 @@ connection slave; include/wait_for_slave_to_stop.inc connection slave1; connection master; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; include/stop_dump_threads.inc connection slave1; include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_view_debug.result b/mysql-test/suite/rpl/r/rpl_view_debug.result index 1f2f7f2ab15..e23f33c035f 100644 --- a/mysql-test/suite/rpl/r/rpl_view_debug.result +++ b/mysql-test/suite/rpl/r/rpl_view_debug.result @@ -21,7 +21,7 @@ Tables_in_test t1 v1 connection master; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug="d,simulate_register_view_failure"; CREATE VIEW v2 as SELECT * FROM t1; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space @@ -37,5 +37,5 @@ v1 connection master; DROP VIEW IF EXISTS v1; DROP TABLE t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/kill_race_condition.test b/mysql-test/suite/rpl/t/kill_race_condition.test index 79e1270b13c..25a7b18bac2 100644 --- a/mysql-test/suite/rpl/t/kill_race_condition.test +++ b/mysql-test/suite/rpl/t/kill_race_condition.test @@ -7,7 +7,7 @@ create table t1 (a int); --sync_slave_with_master connection slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug='d,rows_log_event_before_open_table'; connection master; @@ -23,7 +23,7 @@ set debug_sync='now SIGNAL go_ahead_sql'; --source include/wait_for_slave_sql_error.inc let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); --echo Last_SQL_Error = $error -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; set debug_sync='RESET'; connection master; drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index c5e88fd68bf..0b2cbb6365c 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -15,7 +15,7 @@ call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* reset slave; # Set debug flags on slave to force errors to occur -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; --disable_query_log @@ -40,7 +40,7 @@ start slave; # # Cleanup # -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; # Clear Last_SQL_Error RESET SLAVE; diff --git a/mysql-test/suite/rpl/t/rpl_bug41902.test b/mysql-test/suite/rpl/t/rpl_bug41902.test index 21a556b9c8e..bb6c572580f 100644 --- a/mysql-test/suite/rpl/t/rpl_bug41902.test +++ b/mysql-test/suite/rpl/t/rpl_bug41902.test @@ -15,7 +15,7 @@ source include/master-slave.inc; connection slave; stop slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; --error ER_UNKNOWN_TARGET_BINLOG @@ -36,7 +36,7 @@ reset slave; change master to master_host='dummy'; connection master; -set @saved_dbug_m = @@global.debug_dbug; +SET @saved_dbug_m = @@global.debug_dbug; SET @@debug_dbug="d,simulate_find_log_pos_error"; --error ER_UNKNOWN_TARGET_BINLOG reset master; @@ -59,7 +59,7 @@ connection slave; call mtr.add_suppression("Failed to locate old binlog or relay log files"); call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ..master-bin.000001 not listed in the index"); --enable_query_log -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; --echo ==== clean up ==== CHANGE MASTER TO MASTER_HOST = '127.0.0.1'; diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index ac625e0b21a..a61c06a92e5 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -26,7 +26,7 @@ call mtr.add_suppression("Fatal error: The slave I/O thread stops because master call mtr.add_suppression("Slave I/O thread .* register on master"); #Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; # set up two parameters to pass into extra/rpl_tests/rpl_get_master_version_and_clock let $dbug_sync_point= 'debug_lock.before_get_UNIX_TIMESTAMP'; @@ -42,7 +42,7 @@ source extra/rpl_tests/rpl_get_master_version_and_clock.test; # cleanup -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; # is not really necessary but avoids mtr post-run env check warnings SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test index 07e5aee4560..abf22cc876e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test @@ -17,7 +17,7 @@ --let $rpl_server_number= 1 --source include/rpl_restart_server.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET @@debug_dbug="d,simulate_big_table_id"; CREATE TABLE t (a int); @@ -52,7 +52,7 @@ if (`SELECT sum(a) != 6 FROM t`) --connection master DROP TABLE t; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; --sync_slave_with_master --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test index 41a107e217d..2753fd1f9e0 100644 --- a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test +++ b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test @@ -9,7 +9,7 @@ # - setup log_warnings and debug --connection slave --source include/stop_slave.inc -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; --let $log_warnings_save= `SELECT @@GLOBAL.log_warnings` SET GLOBAL log_warnings = 2; @@ -55,7 +55,7 @@ EOF # cleanup --source include/stop_slave.inc -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; --eval SET GLOBAL log_warnings = $log_warnings_save --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_index_choice.test b/mysql-test/suite/rpl/t/rpl_row_index_choice.test index 89b14add3b0..958fa2352c2 100644 --- a/mysql-test/suite/rpl/t/rpl_row_index_choice.test +++ b/mysql-test/suite/rpl/t/rpl_row_index_choice.test @@ -47,7 +47,7 @@ sync_slave_with_master; connection slave; ANALYZE TABLE t2; --echo # Slave will crash if using the wrong or no index -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan"; connection master; @@ -239,5 +239,5 @@ connection master; DROP TABLE t1; sync_slave_with_master; connection slave; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test index 2558792b438..0d2739e1937 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test @@ -33,7 +33,7 @@ source include/start_slave.inc; CREATE TABLE t1 (a INT) ENGINE=innodb; # Make the following events as if they offset over 2GB from the beginning of binlog -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB"; SET @@SESSION.skip_replication=1; INSERT INTO t1 SET a=1; @@ -51,7 +51,7 @@ FLUSH LOGS; # Clean up # --connection master -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; --eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master --eval SET @@GLOBAL.rpl_semi_sync_master_enabled = $sav_enabled_master diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test index 33151bb87a4..cb4a8819a5b 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_running.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_running.test @@ -11,7 +11,7 @@ connection slave; SET DEBUG_SYNC= 'RESET'; source include/stop_slave.inc; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= 'd,dbug.before_get_running_status_yes'; # to block due-started IO # Test 1. Slave is stopped @@ -77,7 +77,7 @@ echo Slave_SQL_Running= $status; connection slave; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; SET DEBUG_SYNC= 'RESET'; --echo End of tests --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 554ff564a0d..100514089d5 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -29,7 +29,7 @@ ########################################################################## connection slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write'; connection master; @@ -74,7 +74,7 @@ call mtr.add_suppression("Slave: File.* not found.*"); call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29"); --let $rpl_only_running_threads= 1 -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test index c1130f1955e..afe36334f18 100644 --- a/mysql-test/suite/rpl/t/rpl_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@ -22,7 +22,7 @@ source include/stop_slave.inc; --echo # Suspend the INSERT statement in current transaction on SQL thread. --echo # It guarantees that SQL thread is applying the transaction when --echo # STOP SLAVE command launchs. -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,after_mysql_insert,*'; source include/start_slave.inc; @@ -44,7 +44,7 @@ source extra/rpl_tests/rpl_stop_slave.test; --echo --echo # Test end -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; source include/restart_slave_sql.inc; connection slave; @@ -77,7 +77,7 @@ connection master; # make sure that there are no zombie threads --source include/stop_dump_threads.inc -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*'; connection slave; @@ -124,7 +124,7 @@ reap; # sure that we disable the DBUG_EXECUTE_IF # that would set the dump thread to wait connection master; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; # make sure that there are no zombie threads --source include/stop_dump_threads.inc diff --git a/mysql-test/suite/rpl/t/rpl_view_debug.test b/mysql-test/suite/rpl/t/rpl_view_debug.test index ef59d25bf45..0803692496e 100644 --- a/mysql-test/suite/rpl/t/rpl_view_debug.test +++ b/mysql-test/suite/rpl/t/rpl_view_debug.test @@ -18,7 +18,7 @@ sync_slave_with_master; # view already has to be on slave show tables; connection master; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug="d,simulate_register_view_failure"; --error ER_OUT_OF_RESOURCES @@ -31,5 +31,5 @@ show tables; connection master; DROP VIEW IF EXISTS v1; DROP TABLE t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/debug_dbug_func.result b/mysql-test/suite/sys_vars/r/debug_dbug_func.result index 1c7ae4e2832..64b9c1a759b 100644 --- a/mysql-test/suite/sys_vars/r/debug_dbug_func.result +++ b/mysql-test/suite/sys_vars/r/debug_dbug_func.result @@ -1,13 +1,13 @@ SET @old_debug = @@GLOBAL.debug; -set debug_dbug= 'T'; +SET debug_dbug= 'T'; select @@debug; @@debug T -set debug_dbug= '+P'; +SET debug_dbug= '+P'; select @@debug; @@debug P:T -set debug_dbug= '-P'; +SET debug_dbug= '-P'; select @@debug; @@debug T diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_func.test b/mysql-test/suite/sys_vars/t/debug_dbug_func.test index b4cd4aefd5e..136a4c5504d 100644 --- a/mysql-test/suite/sys_vars/t/debug_dbug_func.test +++ b/mysql-test/suite/sys_vars/t/debug_dbug_func.test @@ -6,11 +6,11 @@ SET @old_debug = @@GLOBAL.debug; # Bug#34678 @@debug variable's incremental mode # -set debug_dbug= 'T'; +SET debug_dbug= 'T'; select @@debug; -set debug_dbug= '+P'; +SET debug_dbug= '+P'; select @@debug; -set debug_dbug= '-P'; +SET debug_dbug= '-P'; select @@debug; # diff --git a/mysql-test/t/create_or_replace2.test b/mysql-test/t/create_or_replace2.test index 199e5523811..80c8b635d8d 100644 --- a/mysql-test/t/create_or_replace2.test +++ b/mysql-test/t/create_or_replace2.test @@ -19,9 +19,9 @@ SET @old_debug= @@session.debug; CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB; CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam; -set debug_dbug='+d,send_kill_after_delete'; +SET debug_dbug='+d,send_kill_after_delete'; CREATE OR REPLACE TABLE t1 LIKE tmp; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; SHOW TABLES; show create table t1; --sync_slave_with_master diff --git a/mysql-test/t/drop_bad_db_type.test b/mysql-test/t/drop_bad_db_type.test index aa729217e50..ebc732104d3 100644 --- a/mysql-test/t/drop_bad_db_type.test +++ b/mysql-test/t/drop_bad_db_type.test @@ -8,7 +8,7 @@ if (!$HA_ARCHIVE_SO) { let $mysqld_datadir= `select @@datadir`; SET @saved_dbug = @@debug_dbug; -set debug_dbug='+d,unstable_db_type'; +SET debug_dbug='+d,unstable_db_type'; install soname 'ha_archive'; create table t1 (a int) engine=archive; @@ -28,4 +28,4 @@ drop table t1; --list_files $mysqld_datadir/test uninstall soname 'ha_archive'; -set debug_dbug=@saved_dbug; +SET debug_dbug=@saved_dbug; diff --git a/mysql-test/t/engine_error_in_alter-8453.test b/mysql-test/t/engine_error_in_alter-8453.test index 915a47570a3..78e6de2d645 100644 --- a/mysql-test/t/engine_error_in_alter-8453.test +++ b/mysql-test/t/engine_error_in_alter-8453.test @@ -4,9 +4,9 @@ --source include/have_debug.inc create table t1 (a int, b int); -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,external_lock_failure'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,external_lock_failure'; --error ER_GET_ERRMSG alter table t1 add column c int; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test index c6ce8092029..f713e2da6ba 100644 --- a/mysql-test/t/error_simulation.test +++ b/mysql-test/t/error_simulation.test @@ -21,7 +21,7 @@ set tmp_table_size=1024; # Set debug flag so an error is returned when # tmp table in query is converted from heap to myisam -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,raise_error"; --error ER_DUP_KEY @@ -37,7 +37,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL); INSERT INTO t1 VALUES (1), (0), (2); SET SESSION debug_dbug='+d,alter_table_only_index_change'; ALTER TABLE t1 ADD INDEX a(a); -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; @@ -52,7 +52,7 @@ SET SESSION debug_dbug="+d,bug42064_simulate_oom"; # May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY --error ER_OUT_OF_RESOURCES, 5 INSERT INTO t1 VALUES(""); -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; DROP TABLE t1; @@ -85,7 +85,7 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; SET optimizer_switch=@save_optimizer_switch; @@ -102,7 +102,7 @@ INSERT INTO t2 VALUES (1),(2); SET SESSION debug_dbug="+d,bug11747970_raise_error"; --error ER_QUERY_INTERRUPTED INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; DROP TABLE t1,t2; @@ -157,4 +157,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory"; --error ER_OUT_OF_RESOURCES, 5 SELECT f1(1); DROP FUNCTION f1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test index 0513899e519..ab5f19f7093 100644 --- a/mysql-test/t/mdev6830.test +++ b/mysql-test/t/mdev6830.test @@ -2,7 +2,7 @@ # MDEV-6830 Server crashes in best_access_path after a sequence of SELECTs invollving a temptable view # --source include/have_debug.inc -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug= 'd,opt'; CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; @@ -60,4 +60,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; drop table t1,t2,t3,t4; drop view v2,v3; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/t/myisam_debug.test b/mysql-test/t/myisam_debug.test index 465ecd70895..2861c344b10 100644 --- a/mysql-test/t/myisam_debug.test +++ b/mysql-test/t/myisam_debug.test @@ -66,7 +66,7 @@ create table t1 (a int, index(a)); lock tables t1 write; insert t1 values (1),(2),(1); set @old_dbug=@@debug_dbug; -set debug_dbug='+d,mi_lock_database_failure'; +SET debug_dbug='+d,mi_lock_database_failure'; unlock tables; -set debug_dbug=@old_dbug; +SET debug_dbug=@old_dbug; drop table t1; diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test index 0682286274f..928ed74f784 100644 --- a/mysql-test/t/range_innodb.test +++ b/mysql-test/t/range_innodb.test @@ -80,11 +80,11 @@ create table t1 ( insert into t1 select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a from t0 A, t0 B, t0 C, t0 D where D.a<5; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; set @@global.debug_dbug="+d,ha_index_init_fail"; explain select * from t1 where a=10 and b=10; --error ER_TABLE_DEF_CHANGED select * from t1 where a=10 and b=10; DROP TABLE t0,t1; -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/t/range_interrupted-13751.test b/mysql-test/t/range_interrupted-13751.test index 8b2c1834ee5..b0793edeb9d 100644 --- a/mysql-test/t/range_interrupted-13751.test +++ b/mysql-test/t/range_interrupted-13751.test @@ -14,14 +14,14 @@ INSERT INTO t1 (c) SELECT c FROM t1; INSERT INTO t1 (c) SELECT c FROM t1; set @old_dbug=@@session.debug_dbug; -set debug_dbug="+d,kill_join_init_read_record"; +SET debug_dbug="+d,kill_join_init_read_record"; --error ER_QUERY_INTERRUPTED SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.c = alias2.c OR alias1.i <= 1 ; -set debug_dbug=@old_dbug; +SET debug_dbug=@old_dbug; DROP TABLE t1; diff --git a/mysql-test/t/select_debug.test b/mysql-test/t/select_debug.test index dba0576f945..922cec7ed7a 100644 --- a/mysql-test/t/select_debug.test +++ b/mysql-test/t/select_debug.test @@ -10,7 +10,7 @@ create table t2 (a int); insert into t2 values (2), (3); set session join_cache_level=3; -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; @@ -18,4 +18,4 @@ select t1.b from t1,t2 where t1.b=t2.a; set session join_cache_level=default; drop table t1,t2; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test index 6615ff66737..2a87d24cf6d 100644 --- a/mysql-test/t/show_explain.test +++ b/mysql-test/t/show_explain.test @@ -15,7 +15,7 @@ SET @old_debug= @@session.debug; # is that we use the following commands for synchronization: # # set @show_explain_probe_select_id=1; -# set debug_dbug='d,show_explain_probe_join_exec_start'; +# SET debug_dbug='d,show_explain_probe_join_exec_start'; # send select count(*) from t1 where a < 100000; # # When ran with mysqltest_embedded, this translates into: @@ -75,7 +75,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr # connection con1; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select count(*) from t1 where a < 100000; connection default; @@ -103,109 +103,109 @@ evalp show explain for $thr2; connection con1; reap; set optimizer_switch= @show_expl_tmp; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # UNION, first branch set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send explain select a from t0 A union select a+1 from t0 B; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # UNION, second branch set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send explain select a from t0 A union select a+1 from t0 B; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # Uncorrelated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 B) from t0 A where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # Uncorrelated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send explain select a, (select max(a) from t0 B) from t0 A where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # correlated subquery, select set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # correlated subquery, explain set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # correlated subquery, select, while inside the subquery set @show_explain_probe_select_id=2; # <--- -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # correlated subquery, explain, while inside the subquery set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; # TODO: explain in the parent subuqery when the un-correlated child has been # run (and have done irreversible cleanups) @@ -218,7 +218,7 @@ set debug_dbug=@old_debug; --echo # I've found experimentally that select_id==2 here... --echo # set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send set @foo= (select max(a) from t0 where sin(a) >0); connection default; --source include/wait_condition.inc @@ -228,14 +228,14 @@ evalp kill query $thr2; connection con1; --error ER_QUERY_INTERRUPTED reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # Attempt SHOW EXPLAIN for an UPDATE --echo # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; --source include/wait_condition.inc @@ -247,14 +247,14 @@ evalp show explain for $thr2; connection con1; reap; drop table t2; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # Attempt SHOW EXPLAIN for a DELETE (UPD: now works) --echo # create table t2 as select a as a, a as dummy from t0 limit 2; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; --source include/wait_condition.inc @@ -266,14 +266,14 @@ evalp show explain for $thr2; connection con1; reap; drop table t2; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # Multiple SHOW EXPLAIN calls for one select --echo # create table t2 as select a as a, a as dummy from t0 limit 3; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; --source include/wait_condition.inc @@ -285,14 +285,14 @@ evalp show explain for $thr2; connection con1; reap; drop table t2; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort" --echo # explain select * from t0 order by a; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; send select * from t0 order by a; connection default; @@ -300,7 +300,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # SHOW EXPLAIN for SELECT ... with "Using temporary" @@ -309,7 +309,7 @@ connection default; explain select distinct a from t0; connection con1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; send select distinct a from t0; connection default; @@ -317,7 +317,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort" @@ -326,7 +326,7 @@ connection default; explain select distinct a from t0; connection con1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; send select distinct a from t0; connection default; @@ -334,7 +334,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY @@ -343,7 +343,7 @@ CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES (1),(2),(1),(4),(2); explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; -set debug_dbug='+d,show_explain_in_find_all_keys'; +SET debug_dbug='+d,show_explain_in_find_all_keys'; send SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; connection default; @@ -354,7 +354,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t2; @@ -370,7 +370,7 @@ INSERT INTO t2 VALUES (1),(2),(1),(4),(2); EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; connection default; @@ -378,7 +378,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t2; @@ -394,7 +394,7 @@ INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9); explain SELECT * FROM v1, t2; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send SELECT * FROM v1, t2; connection default; @@ -405,7 +405,7 @@ evalp kill query $thr2; connection con1; --error ER_QUERY_INTERRUPTED reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t2, t3; @@ -413,21 +413,21 @@ DROP TABLE t2, t3; --echo # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries --echo # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send select sleep(1); connection default; --source include/wait_condition.inc evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # Same as above, but try another reason for JOIN to be degenerate --echo # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send select * from t0 where 1>10; connection default; --source include/wait_condition.inc @@ -435,7 +435,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # Same as above, but try another reason for JOIN to be degenerate (2) @@ -443,7 +443,7 @@ set debug_dbug=@old_debug; create table t3(a int primary key); insert into t3 select a from t0; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send select * from t0,t3 where t3.a=112233; connection default; --source include/wait_condition.inc @@ -451,7 +451,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t3; --echo # @@ -470,7 +470,7 @@ explain SELECT * FROM t2 WHERE a = ); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; send SELECT * FROM t2 WHERE a = (SELECT MAX(a) FROM t2 WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) @@ -480,7 +480,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t2; @@ -513,7 +513,7 @@ WHERE a1 < ALL ( ); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; send SELECT count(*) FROM t2, t3 WHERE a1 < ALL ( @@ -526,7 +526,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t2, t3, t4; --echo # @@ -538,7 +538,7 @@ INSERT INTO t2 VALUES (11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_end'; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; send SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`); connection default; @@ -547,7 +547,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t2; DROP TABLE t1; @@ -559,7 +559,7 @@ CREATE TABLE t1(a INT, KEY(a)); INSERT INTO t1 VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send SELECT 'test' FROM t1 WHERE a=1; connection default; @@ -567,7 +567,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1; @@ -591,7 +591,7 @@ set join_cache_level=0; explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_test_if_quick_select'; +SET debug_dbug='+d,show_explain_probe_test_if_quick_select'; send select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; @@ -608,7 +608,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1; --echo # @@ -619,7 +619,7 @@ CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c)); INSERT INTO t1 (a) VALUES (3),(1),(5),(1); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send SHOW INDEX FROM t1; connection default; @@ -627,7 +627,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1; @@ -641,7 +641,7 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT a + 1 FROM v1; -set debug_dbug='+d,show_explain_probe_join_tab_preread'; +SET debug_dbug='+d,show_explain_probe_join_tab_preread'; set @show_explain_probe_select_id=1; send @@ -651,7 +651,7 @@ connection default; evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP VIEW v1; DROP TABLE t1; @@ -667,7 +667,7 @@ INSERT INTO t1 VALUES (4),(6); EXPLAIN SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); -set debug_dbug='+d,show_explain_probe_union_read'; +SET debug_dbug='+d,show_explain_probe_union_read'; send SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); @@ -681,7 +681,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1; --echo # @@ -703,7 +703,7 @@ SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); @@ -714,7 +714,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1, t2; --echo # @@ -737,7 +737,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; --send select distinct t1.a from t1,t3 where t1.a=t3.a; connection default; @@ -746,7 +746,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1,t3,t4; @@ -756,7 +756,7 @@ drop table t1,t3,t4; create user test2@localhost; grant ALL on test.* to test2@localhost; -# Give the user SUPER privilege so it can set debug_dbug variable. +# Give the user SUPER privilege so it can SET debug_dbug variable. grant super on *.* to test2@localhost; connect (con2, localhost, test2,,); connection con1; @@ -765,7 +765,7 @@ connection con1; --echo # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us --echo # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where a < 3; @@ -781,7 +781,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; --echo # --echo # Check that user test2 can do SHOW EXPLAIN on its own queries @@ -791,7 +791,7 @@ connect (con3, localhost, test2,,); connection con2; let $thr_con2=`select connection_id()`; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where a < 3; @@ -817,10 +817,10 @@ disconnect con2; grant process on *.* to test2@localhost; connect (con2, localhost, test2,,); connection con1; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where a < 3; @@ -832,7 +832,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; revoke all privileges on test.* from test2@localhost; drop user test2@localhost; @@ -912,7 +912,7 @@ WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -924,10 +924,10 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; --send SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -940,7 +940,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1; @@ -956,7 +956,7 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13; EXPLAIN SELECT a FROM t1 GROUP BY a; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT a FROM t1 GROUP BY a; @@ -967,7 +967,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1; @@ -983,7 +983,7 @@ INSERT INTO t2 VALUES (86,'English'),(87,'Russian'); explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; --send SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; @@ -994,7 +994,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; drop table t1, t2; --echo # @@ -1033,7 +1033,7 @@ explain SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; send SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; @@ -1045,7 +1045,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1,t2,t3; @@ -1069,7 +1069,7 @@ SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10; set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias @@ -1082,7 +1082,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1,t2,t3; --echo # @@ -1109,7 +1109,7 @@ select charset(' select hex(''); set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send select * from t0 where length('') = a; @@ -1124,7 +1124,7 @@ connection con1; # The constant should be two letters, the last looking like 'bl' reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set names default; --echo # @@ -1151,7 +1151,7 @@ WHERE b <= ANY ( set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_join_exec_start'; +SET debug_dbug='+d,show_explain_probe_join_exec_start'; send SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2 @@ -1166,7 +1166,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; DROP TABLE t1,t2; drop table t0; @@ -1182,7 +1182,7 @@ insert into t1 select a,a from t0; create table t2 as select * from t1; set @show_explain_probe_select_id=2; -set debug_dbug='+d,show_explain_probe_best_ext_lim_search'; +SET debug_dbug='+d,show_explain_probe_best_ext_lim_search'; send explain select * from t0 diff --git a/mysql-test/t/show_explain_non_select.test b/mysql-test/t/show_explain_non_select.test index 21b16739141..505e9296222 100644 --- a/mysql-test/t/show_explain_non_select.test +++ b/mysql-test/t/show_explain_non_select.test @@ -38,7 +38,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr --echo # Test SHOW EXPLAIN for single-table DELETE --echo # connection con2; -set debug_dbug='+d,show_explain_probe_delete_exec_start'; +SET debug_dbug='+d,show_explain_probe_delete_exec_start'; send delete from t1 where a<10 and b+1>1000; connection default; @@ -51,7 +51,7 @@ reap; --echo # Test SHOW EXPLAIN for multi-table DELETE --echo # set @show_explain_probe_select_id=1; -set debug_dbug='+d,show_explain_probe_do_select'; +SET debug_dbug='+d,show_explain_probe_do_select'; send delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000; connection default; --source include/wait_condition.inc @@ -63,7 +63,7 @@ reap; --echo # Test SHOW EXPLAIN for single-table UPDATE --echo # connection con2; -set debug_dbug='+d,show_explain_probe_update_exec_start'; +SET debug_dbug='+d,show_explain_probe_update_exec_start'; send update t1 set filler='filler-data-2' where a<10 and b+1>1000; connection default; @@ -74,5 +74,5 @@ reap; drop table t0,t1; -set debug_dbug=@old_debug; +SET debug_dbug=@old_debug; set debug_sync='RESET'; diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test index f4e6bd12426..cbff0f50f96 100644 --- a/mysql-test/t/show_explain_ps.test +++ b/mysql-test/t/show_explain_ps.test @@ -38,8 +38,8 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr # connection con1; set @show_explain_probe_select_id=1; -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='d,show_explain_probe_join_exec_start'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='d,show_explain_probe_join_exec_start'; send select count(*) from t0 where a < 100000; connection default; @@ -48,7 +48,7 @@ evalp show explain for $thr2; connection con1; reap; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; evalp select event_name from diff --git a/mysql-test/t/slowlog_enospace-10508.test b/mysql-test/t/slowlog_enospace-10508.test index ef49700f0c9..74dca21f8ec 100644 --- a/mysql-test/t/slowlog_enospace-10508.test +++ b/mysql-test/t/slowlog_enospace-10508.test @@ -9,8 +9,8 @@ create table t1 (a int, b int) engine=memory; insert t1 select seq, seq+1 from seq_1_to_1000; set global general_log=0; set global log_queries_not_using_indexes=1; -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,simulate_file_write_error'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_write_error'; --disable_result_log --let $run= 50 while ($run) @@ -19,7 +19,7 @@ while ($run) dec $run; } --enable_result_log -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; set global general_log=1; set global log_queries_not_using_indexes=default; drop table t1; diff --git a/mysql-test/t/stat_tables-enospc.test b/mysql-test/t/stat_tables-enospc.test index b2b4c071a70..fe8fe3590ae 100644 --- a/mysql-test/t/stat_tables-enospc.test +++ b/mysql-test/t/stat_tables-enospc.test @@ -16,10 +16,10 @@ while ($i) { } --enable_query_log set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3; -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,simulate_file_write_error'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_write_error'; set @@max_heap_table_size=128*1024; --replace_regex /'.*'/'tmp-file'/ analyze table t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; drop table t1; diff --git a/mysql-test/t/union_crash-714.test b/mysql-test/t/union_crash-714.test index 97f0c90d854..90b849037f2 100644 --- a/mysql-test/t/union_crash-714.test +++ b/mysql-test/t/union_crash-714.test @@ -3,9 +3,9 @@ # --source include/have_debug.inc create table t1 (i tinyint); -set @saved_dbug = @@session.debug_dbug; -set debug_dbug='+d,bug11747970_raise_error'; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,bug11747970_raise_error'; --error ER_QUERY_INTERRUPTED insert into t1 (i) select i from t1 union select i from t1; drop table t1; -set debug_dbug= @saved_dbug; \ No newline at end of file +SET debug_dbug= @saved_dbug; \ No newline at end of file diff --git a/mysql-test/t/warnings_debug.test b/mysql-test/t/warnings_debug.test index 53573f8a8d6..6605daf875d 100644 --- a/mysql-test/t/warnings_debug.test +++ b/mysql-test/t/warnings_debug.test @@ -9,7 +9,7 @@ create table t1 (a int primary key) engine=innodb; # Test that warnings produced during autocommit (after calling # set_ok_status()) are still reported to the client. -set @saved_dbug = @@session.debug_dbug; +SET @saved_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,warn_during_ha_commit_trans"; INSERT INTO t1 VALUES (1); # The warning will be shown automatically by mysqltest; there was a bug where @@ -18,4 +18,4 @@ INSERT INTO t1 VALUES (1); SHOW WARNINGS; drop table t1; -set debug_dbug= @saved_dbug; +SET debug_dbug= @saved_dbug; From 60d7011c5f6ebda057d3e730c6f67519a1fb7f0c Mon Sep 17 00:00:00 2001 From: Alice Sherepa Date: Fri, 10 Jan 2020 10:44:39 +0100 Subject: [PATCH 16/43] MDEV-21360 global debug_dbug pre-test value restoration issues --- mysql-test/suite/innodb/r/redo_log_during_checkpoint.result | 6 +++--- mysql-test/suite/innodb_gis/r/rtree_debug.result | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result b/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result index efe48682a6f..3915b07f12e 100644 --- a/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result +++ b/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result @@ -4,8 +4,8 @@ SET GLOBAL innodb_master_thread_disabled_debug = 1; SET GLOBAL innodb_log_checkpoint_now = 1; CREATE DATABASE very_long_database_name; USE very_long_database_name; -set debug_dbug = '+d,increase_mtr_checkpoint_size'; -set debug_dbug = '+d,crash_after_checkpoint'; +SET debug_dbug = '+d,increase_mtr_checkpoint_size'; +SET debug_dbug = '+d,crash_after_checkpoint'; set global innodb_log_checkpoint_now = 1; ERROR HY000: Lost connection to MySQL server during query # Skip MLOG_FILE_NAME redo records during recovery @@ -18,7 +18,7 @@ SET GLOBAL innodb_log_checkpoint_now = 1; # exceeds LOG_CHECKPOINT_FREE_PER_THREAD size during checkpoint. CREATE DATABASE very_long_database_name; USE very_long_database_name; -set debug_dbug = '+d,crash_after_checkpoint'; +SET debug_dbug = '+d,crash_after_checkpoint'; set global innodb_log_checkpoint_now = 1; ERROR HY000: Lost connection to MySQL server during query # Skip MLOG_FILE_NAME redo records during recovery diff --git a/mysql-test/suite/innodb_gis/r/rtree_debug.result b/mysql-test/suite/innodb_gis/r/rtree_debug.result index 11e2cd40e25..e8d2418af57 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_debug.result +++ b/mysql-test/suite/innodb_gis/r/rtree_debug.result @@ -42,7 +42,7 @@ SET @save_dbug = @@SESSION.debug_dbug; SET debug_dbug='+d,row_merge_ins_spatial_fail'; create spatial index idx2 on t1(c2); ERROR HY000: Got error 1000 "Unknown error 1000" from storage engine InnoDB -SET debug_dbug = @save_dbug; +SET @@SESSION.debug_dbug = @save_dbug; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( From 1c97cd339e9513b152727f386573c8c048db0281 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 3 Jan 2020 11:15:00 -0800 Subject: [PATCH 17/43] MDEV-21184 Assertion `used_tables_cache == 0' failed in Item_func::fix_fields with condition_pushdown_from_having This bug could manifest itself for queries with GROUP BY and HAVING clauses when the HAVING clause was a conjunctive condition that depended exclusively on grouping fields and at least one conjunct contained an equality of the form fld=sq where fld is a grouping field and sq is a constant subquery. In this case the optimizer tries to perform a pushdown of the HAVING condition into WHERE. To construct the pushable condition the optimizer first transforms all multiple equalities in HAVING into simple equalities. This has to be done for a proper processing of the pushed conditions in WHERE. The multiple equalities at all AND/OR levels must be converted to simple equalities because any multiple equality may refer to a multiple equality at the upper level. Before this patch the conversion was performed like this: multiple_equality(x,f1,...,fn) => x=f1 and ... and x=fn. When an equality item for x=fi was constructed both the items for x and fi were cloned. If x happened to be a constant subquery that could not be cloned the conversion failed. If the conversions of multiple equalities previously performed had succeeded then the whole condition became in an inconsistent state that could cause different failures. The solution provided by the patch is: 1. to use a different conversion rule if x is a constant multiple_equality(x,f1,...,fn) => f1=x and f2=f1 and ... and fn=f1 2. not to clone x if it's a constant. Such conversions cannot fail and besides the result of the conversion preserves the equivalence of f1,...,fn that can be used for other optimizations. This patch also made sure that expensive predicates are not pushed from HAVING to WHERE. --- mysql-test/main/derived_cond_pushdown.result | 8 +- mysql-test/main/having_cond_pushdown.result | 148 +++++++++++++++++++ mysql-test/main/having_cond_pushdown.test | 39 +++++ sql/item.cc | 14 +- sql/item.h | 7 +- sql/item_cmpfunc.cc | 105 +++++++------ sql/item_cmpfunc.h | 3 +- sql/sql_lex.cc | 14 +- 8 files changed, 280 insertions(+), 58 deletions(-) diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 9203a3ddf1b..fe074c2a8fd 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -8937,13 +8937,13 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "t1.b = 1 and max_c > 37 and max_c > 30", + "having_condition": "max_c > 37 and max_c > 30", "table": { "table_name": "t1", "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "t1.a = 1" + "attached_condition": "t1.a = 1 and t1.b = 1" } } } @@ -9012,13 +9012,13 @@ EXPLAIN "materialized": { "query_block": { "select_id": 2, - "having_condition": "t1.b = 1 and max_c > 37 and max_c > 30", + "having_condition": "max_c > 37 and max_c > 30", "table": { "table_name": "t1", "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "t1.a = 1 and t1.d = 1" + "attached_condition": "t1.a = 1 and t1.b = 1 and t1.d = 1" } } } diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 82a4813b156..9b124296e3d 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -4776,3 +4776,151 @@ WHERE t1.a = 3 AND (t1.a < 2 AND t1.b > 3) GROUP BY t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; +# +# MDEV-21184: Constant subquery in condition movable to WHERE +# +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES +(1,10), (2,20), (1,11), (1,15), (2,20), (1,10), (2,21); +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (2),(3); +EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a HAVING a = 8 OR a = ( SELECT MIN(c) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a = 8 or t1.a = (subquery#2)" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a FROM t1 GROUP BY a HAVING a = 8 OR a = ( SELECT MIN(c) FROM t2 ); +a +2 +EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a,b +HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and b < 20; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "(t1.a = 8 or t1.a = (subquery#2)) and t1.b < 20" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a FROM t1 GROUP BY a,b +HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and b < 20; +a +EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a +HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and SUM(b) > 20; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "having_condition": "sum(t1.b) > 20", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a = 8 or t1.a = (subquery#2)" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } + } + } +} +SELECT a FROM t1 GROUP BY a +HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and SUM(b) > 20; +a +2 +EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a = (subquery#2)" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } +} +SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 ); +a +2 +DROP TABLE t1,t2; diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index f1bf70627f6..fc75122615c 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1401,3 +1401,42 @@ EXPLAIN SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE t1.a = 3 AND (t1.a < 2 AND t1.b > 3) GROUP BY t1.a; DROP TABLE t1; + +--echo # +--echo # MDEV-21184: Constant subquery in condition movable to WHERE +--echo # + +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES + (1,10), (2,20), (1,11), (1,15), (2,20), (1,10), (2,21); + +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (2),(3); + +let $q= +SELECT a FROM t1 GROUP BY a HAVING a = 8 OR a = ( SELECT MIN(c) FROM t2 ); + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +let $q= +SELECT a FROM t1 GROUP BY a,b + HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and b < 20; + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +let $q= +SELECT a FROM t1 GROUP BY a + HAVING ( a = 8 OR a = ( SELECT MIN(c) FROM t2 ) ) and SUM(b) > 20; + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +let $q= +SELECT a FROM t1 GROUP BY a HAVING a = ( SELECT MIN(c) FROM t2 ); + +eval EXPLAIN FORMAT=JSON $q; +eval $q; + +DROP TABLE t1,t2; diff --git a/sql/item.cc b/sql/item.cc index 897d6cdbd69..9b721266e9d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7353,7 +7353,7 @@ Item *Item::build_pushable_cond(THD *thd, List equalities; Item *new_cond= NULL; if (((Item_equal *)this)->create_pushable_equalities(thd, &equalities, - checker, arg) || + checker, arg, true) || (equalities.elements == 0)) return 0; @@ -10555,3 +10555,15 @@ void Item::register_in(THD *thd) next= thd->free_list; thd->free_list= this; } + + +bool Item::cleanup_excluding_immutables_processor (void *arg) +{ + if (!(get_extraction_flag() == IMMUTABLE_FL)) + return cleanup_processor(arg); + else + { + clear_extraction_flag(); + return false; + } +} diff --git a/sql/item.h b/sql/item.h index 42ad6ba35fe..990ca0ec887 100644 --- a/sql/item.h +++ b/sql/item.h @@ -152,8 +152,10 @@ bool mark_unsupported_function(const char *w1, const char *w2, #define NO_EXTRACTION_FL (1 << 6) #define FULL_EXTRACTION_FL (1 << 7) #define DELETION_FL (1 << 8) -#define SUBSTITUTION_FL (1 << 9) -#define EXTRACTION_MASK (NO_EXTRACTION_FL | FULL_EXTRACTION_FL | DELETION_FL) +#define IMMUTABLE_FL (1 << 9) +#define SUBSTITUTION_FL (1 << 10) +#define EXTRACTION_MASK \ + (NO_EXTRACTION_FL | FULL_EXTRACTION_FL | DELETION_FL | IMMUTABLE_FL) extern const char *item_empty_name; @@ -1867,6 +1869,7 @@ public: virtual bool cleanup_processor(void *arg); virtual bool cleanup_excluding_fields_processor (void *arg) { return cleanup_processor(arg); } + bool cleanup_excluding_immutables_processor (void *arg); virtual bool cleanup_excluding_const_fields_processor (void *arg) { return cleanup_processor(arg); } virtual bool collect_item_field_processor(void *arg) { return 0; } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 7a1d721ca48..b23aca2c5f3 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -7410,6 +7410,7 @@ Item_equal::excl_dep_on_grouping_fields(st_select_lex *sel) of the tree of the object to check if multiple equality elements can be used to create equalities @param arg parameter to be passed to the checker + @param clone_const true <=> clone the constant member if there is any @details How the method works on examples: @@ -7420,36 +7421,31 @@ Item_equal::excl_dep_on_grouping_fields(st_select_lex *sel) Example 2: It takes MULT_EQ(1,a,b) and tries to create from its elements a set of - equalities {(1=a),(1=b)}. + equalities {(a=1),(a=b)}. How it is done: - 1. The method finds the left part of the equalities to be built. It will - be the same for all equalities. It is either: - a. A constant if there is any - b. A first element in the multiple equality that satisfies - checker function + 1. If there is a constant member c the first non-constant member x for + which the function checker returns true is taken and an item for + the equality x=c is created. When constructing the equality item + the left part of the equality is always taken as a clone of x while + the right part is taken as a clone of c only if clone_const == true. - For the example 1 the left element is field 'x'. - For the example 2 it is constant '1'. + 2. After this all equalities of the form x=a (where x designates the first + non-constant member for which checker returns true and a is some other + such member of the multiplle equality) are created. When constructing + an equality item both its parts are taken as clones of x and a. - 2. If the left element is found the rest elements of the multiple equality - are checked with the checker function if they can be right parts - of equalities. - If the element can be a right part of the equality, equality is built. - It is built with the left part element found at the step 1 and - the right part element found at this step (step 2). - - Suppose for the example above that both 'a' and 'b' fields can be used - to build equalities: + Suppose in the examples above that for 'x', 'a', and 'b' the function + checker returns true. Example 1: - for 'a' field (x=a) is built - for 'b' field (x=b) is built + the equality (x=a) is built + the equality (x=b) is built Example 2: - for 'a' field (1=a) is built - for 'b' field (1=b) is built + the equality (a=1) is built + the equality (a=b) is built 3. As a result we get a set of equalities built with the elements of this multiple equality. They are saved in the equality list. @@ -7458,15 +7454,17 @@ Item_equal::excl_dep_on_grouping_fields(st_select_lex *sel) {(x=a),(x=b)} Example 2: - {(1=a),(1=b)} + {(a=1),(a=b)} @note This method is called for condition pushdown into materialized derived table/view, and IN subquery, and pushdown from HAVING into WHERE. When it is called for pushdown from HAVING the empty checker is passed. - It happens because elements of this multiple equality don't need to be - checked if they can be used to build equalities. There are no elements - that can't be used to build equalities. + This is because in this case the elements of the multiple equality don't + need to be checked if they can be used to build equalities: either all + equalities can be pushed or none of them can be pushed. + When the function is called for pushdown from HAVING the value of the + parameter clone_const is always false. In other cases it's always true. @retval true if an error occurs @retval false otherwise @@ -7475,24 +7473,42 @@ Item_equal::excl_dep_on_grouping_fields(st_select_lex *sel) bool Item_equal::create_pushable_equalities(THD *thd, List *equalities, Pushdown_checker checker, - uchar *arg) + uchar *arg, + bool clone_const) { Item *item; + Item *left_item= NULL; + Item *right_item = get_const(); Item_equal_fields_iterator it(*this); - Item *left_item = get_const(); - if (!left_item) + + while ((item=it++)) { - while ((item=it++)) - { - left_item= item; - if (checker && !((item->*checker) (arg))) - continue; - break; - } + left_item= item; + if (checker && !((item->*checker) (arg))) + continue; + break; } + if (!left_item) return false; + if (right_item) + { + Item_func_eq *eq= 0; + Item *left_item_clone= left_item->build_clone(thd); + Item *right_item_clone= !clone_const ? + right_item : right_item->build_clone(thd); + if (!left_item_clone || !right_item_clone) + return true; + eq= new (thd->mem_root) Item_func_eq(thd, + left_item_clone, + right_item_clone); + if (!eq || equalities->push_back(eq, thd->mem_root)) + return true; + if (!clone_const) + right_item->set_extraction_flag(IMMUTABLE_FL); + } + while ((item=it++)) { if (checker && !((item->*checker) (arg))) @@ -7500,15 +7516,14 @@ bool Item_equal::create_pushable_equalities(THD *thd, Item_func_eq *eq= 0; Item *left_item_clone= left_item->build_clone(thd); Item *right_item_clone= item->build_clone(thd); - if (left_item_clone && right_item_clone) - { - left_item_clone->set_item_equal(NULL); - right_item_clone->set_item_equal(NULL); - eq= new (thd->mem_root) Item_func_eq(thd, - right_item_clone, - left_item_clone); - } - if (eq && equalities->push_back(eq, thd->mem_root)) + if (!(left_item_clone && right_item_clone)) + return true; + left_item_clone->set_item_equal(NULL); + right_item_clone->set_item_equal(NULL); + eq= new (thd->mem_root) Item_func_eq(thd, + right_item_clone, + left_item_clone); + if (!eq || equalities->push_back(eq, thd->mem_root)) return true; } return false; @@ -7533,7 +7548,7 @@ bool Item_equal::create_pushable_equalities(THD *thd, Item *Item_equal::multiple_equality_transformer(THD *thd, uchar *arg) { List equalities; - if (create_pushable_equalities(thd, &equalities, 0, 0)) + if (create_pushable_equalities(thd, &equalities, 0, 0, false)) return 0; switch (equalities.elements) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 8eaa0ab7c36..178ed8360dd 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -3209,7 +3209,8 @@ public: bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); bool excl_dep_on_grouping_fields(st_select_lex *sel); bool create_pushable_equalities(THD *thd, List *equalities, - Pushdown_checker checker, uchar *arg); + Pushdown_checker checker, uchar *arg, + bool clone_const); /* Return the number of elements in this multiple equality */ uint elements_count() { return equal_items.elements; } friend class Item_equal_fields_iterator; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ff40a46d7fd..6539b1e471f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -7988,7 +7988,7 @@ st_select_lex::check_cond_extraction_for_grouping_fields(THD *thd, Item *cond) } else { - int fl= cond->excl_dep_on_grouping_fields(this) ? + int fl= cond->excl_dep_on_grouping_fields(this) && !cond->is_expensive() ? FULL_EXTRACTION_FL : NO_EXTRACTION_FL; cond->set_extraction_flag(fl); } @@ -9819,7 +9819,7 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond) { List_iterator li(*((Item_cond*) result)->argument_list()); Item *item; - while ((item=li++)) + while ((item= li++)) { if (attach_to_conds.push_back(item, thd->mem_root)) return true; @@ -9839,8 +9839,13 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond) */ if (cond->type() != Item::COND_ITEM) return false; + if (((Item_cond *)cond)->functype() != Item_cond::COND_AND_FUNC) { + /* + cond is not a conjunctive formula and it cannot be pushed into WHERE. + Try to extract a formula that can be pushed. + */ Item *fix= cond->build_pushable_cond(thd, 0, 0); if (!fix) return false; @@ -9860,7 +9865,6 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond) Item *result= item->transform(thd, &Item::multiple_equality_transformer, (uchar *)item); - if (!result) return true; if (result->type() == Item::COND_ITEM && @@ -10188,8 +10192,8 @@ Item *st_select_lex::pushdown_from_having_into_where(THD *thd, Item *having) &Item::field_transformer_for_having_pushdown, (uchar *)this); - if (item->walk(&Item:: cleanup_processor, 0, STOP_PTR) || - item->fix_fields(thd, NULL)) + if (item->walk(&Item::cleanup_excluding_immutables_processor, 0, STOP_PTR) + || item->fix_fields(thd, NULL)) { attach_to_conds.empty(); goto exit; From a382f69e240b3fa0e4d58c83459263984c6bd87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Jan 2020 08:45:29 +0200 Subject: [PATCH 18/43] MDEV-21498 : wsrep.binlog_format test failed on Azure Waiting wsrep_ready is possible only if wsrep_on=ON. --- mysql-test/suite/galera/disabled.def | 6 ++++++ mysql-test/suite/wsrep/disabled.def | 2 +- mysql-test/suite/wsrep/t/binlog_format.opt | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index c810cfa2db9..8a507fb0dad 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -15,6 +15,7 @@ MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B MW-329 : MDEV-19962 Galera test failure on MW-329 MW-336 : MDEV-17062 Test failure on galera.MW-336 +galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults galera_account_management : MariaDB 10.0 does not support ALTER USER galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID @@ -25,6 +26,7 @@ galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 fro galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc +galera_events2 : MDEV-21492 galera.galera_events2 galera_flush : MariaDB does not have global.thread_statistics galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_ist_mariabackup : MDEV-18829 test leaves port open @@ -32,10 +34,14 @@ galera_ist_progress : MDEV-15236 fails when trying to read transfer status galera_load_data : MDEV-19968 galera.galera_load_data galera_migrate : MariaDB does not support START SLAVE USER galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails +galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key galera_sst_mariabackup_table_options: MDEV-19741 Galera test failure on galera.galera_sst_mariabackup_table_options +galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow_writes galera_var_node_address : MDEV-20485 Galera test failure +galera_var_notify_cmd : MDEV-21488 galera.galera_var_notify_cmd galera_wan : MDEV-17259 Test failure on galera.galera_wan partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache +sql_log_bin : MDEV-21491 galera.sql_log_bin diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index f4145211680..ab3f9fe3604 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -10,4 +10,4 @@ # ############################################################################## - +variables : MDEV-17585 wsrep.variables diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt index e3f2470c6e5..6504506e267 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.opt +++ b/mysql-test/suite/wsrep/t/binlog_format.opt @@ -1 +1 @@ ---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// +--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 From f0ca9bc669c742bab5a122e4caddb4b12a8c6c45 Mon Sep 17 00:00:00 2001 From: Gagan Goel Date: Mon, 30 Dec 2019 15:11:01 -0500 Subject: [PATCH 19/43] MDEV-20732 Correctly set the length of the FORMAT() result for float data type as argument. --- mysql-test/main/func_math.result | 16 ++++++++++++++++ mysql-test/main/func_math.test | 7 +++++++ mysql-test/main/func_str.result | 2 +- sql/item_strfunc.cc | 5 ++--- sql/sql_type.cc | 2 +- sql/sql_type.h | 1 + 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index d50abe00e72..5770859c377 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -2723,6 +2723,22 @@ t2 CREATE TABLE `t2` ( `c1` varchar(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; +CREATE OR REPLACE TABLE t1 (f float); +INSERT INTO t1 VALUES (3e38), (-3e38), (0), (12.34), (-12.34); +CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(f,0) FROM t1; +SELECT * FROM t2; +FORMAT(f,0) +300,000,000,549,775,580,000,000,000,000,000,000,000 +-300,000,000,549,775,580,000,000,000,000,000,000,000 +0 +12 +-12 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `FORMAT(f,0)` varchar(53) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; # # End of 10.4 tests # diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index 5f333c06b78..15c27076ba3 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -1733,6 +1733,13 @@ SELECT HEX(c1) FROM t2; SHOW CREATE TABLE t2; DROP TABLE t1,t2; +CREATE OR REPLACE TABLE t1 (f float); +INSERT INTO t1 VALUES (3e38), (-3e38), (0), (12.34), (-12.34); +CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(f,0) FROM t1; +SELECT * FROM t2; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 5de77f18a24..b4e3f27eda6 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -2708,7 +2708,7 @@ create table t1(a float); insert into t1 values (1.33); select format(a, 2) from t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def format(a, 2) 253 4 4 Y 0 39 8 +def format(a, 2) 253 56 4 Y 0 39 8 format(a, 2) 1.33 drop table t1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d31f47e68fd..0baa762d25f 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2668,11 +2668,10 @@ bool Item_func_format::fix_length_and_dec() { uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]); uint dec= FORMAT_MAX_DECIMALS; - if (args[1]->const_item() && !args[1]->is_expensive()) + if (args[1]->const_item() && !args[1]->is_expensive() && !args[1]->null_value) { Longlong_hybrid tmp= args[1]->to_longlong_hybrid(); - if (!args[1]->null_value) - dec= tmp.to_uint(FORMAT_MAX_DECIMALS); + dec= tmp.to_uint(FORMAT_MAX_DECIMALS); } uint32 max_sep_count= (char_length / 3) + (dec ? 1 : 0) + /*sign*/1; collation.set(default_charset()); diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 31b85c2e858..f1f6ecfb046 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -3550,7 +3550,7 @@ Type_handler_general_purpose_int::Item_decimal_notation_int_digits( /*************************************************************************/ /* - Decimal to binary digits ratio converges to log2(10) thus using 3 as + Binary to Decimal digits ratio converges to log2(10) thus using 3 as a divisor. */ uint32 diff --git a/sql/sql_type.h b/sql/sql_type.h index 04eb5a25891..2be651a2f2f 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -5147,6 +5147,7 @@ public: } bool type_can_have_auto_increment_attribute() const { return true; } uint32 max_display_length(const Item *item) const { return 25; } + uint32 Item_decimal_notation_int_digits(const Item *item) const { return 39; } uint32 calc_pack_length(uint32 length) const { return sizeof(float); } Item *create_typecast_item(THD *thd, Item *item, const Type_cast_attributes &attr) const; From 0f0c284ec046c735388bcff1b7c9f09dfa7bc953 Mon Sep 17 00:00:00 2001 From: Alice Sherepa Date: Thu, 16 Jan 2020 10:23:30 +0100 Subject: [PATCH 20/43] fix for rpl_slave_load_remove_tmpfile.test --- mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index aac0d956e6c..8f855813554 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,7 +1,7 @@ include/master-slave.inc [connection master] connection slave; -set @saved_dbug = @@global.debug_dbug; +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write'; connection master; create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; @@ -22,5 +22,5 @@ call mtr.add_suppression("Slave: Can't get stat of .*"); call mtr.add_suppression("Slave SQL: Error .Can.t get stat of.* error.* 13"); call mtr.add_suppression("Slave: File.* not found.*"); call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29"); -set @@global.debug_dbug = @saved_dbug; +SET @@GLOBAL.debug_dbug = @saved_dbug; include/rpl_end.inc From bde7e0ba6e94d576c4563022f38e8d81b1f6d54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 16 Jan 2020 11:40:21 +0200 Subject: [PATCH 21/43] MDEV-21500 Server hang when using simulated AIO The write-heavy test innodb_zip.wl6501_scale_1 timed out on 10.2 60d7011c5f6ebda057d3e730c6f67519a1fb7f0c for me. Out of os_aio_n_segments=6, 5 are waiting for an event in os_aio_simulated_handler(). One thread is waiting for a write to complete in buf_dblwr_add_to_batch(), but that would never happen, because nothing is waking up the simulated AIO handler threads. This hang appears to have been introduced in MySQL 5.6.12 in mysql/mysql-server@26cfde776cdf5ce61bd5cc494dfc1df28c76977f. --- storage/innobase/buf/buf0dblwr.cc | 4 +++- storage/xtradb/buf/buf0dblwr.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 36054dbf9fe..32b4399b41d 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -963,6 +963,7 @@ try_again: ib_int64_t sig_count = os_event_reset(buf_dblwr->b_event); mutex_exit(&buf_dblwr->mutex); + os_aio_simulated_wake_handler_threads(); os_event_wait_low(buf_dblwr->b_event, sig_count); goto try_again; } @@ -1096,6 +1097,7 @@ try_again: checkpoint. */ ib_int64_t sig_count = os_event_reset(buf_dblwr->b_event); mutex_exit(&buf_dblwr->mutex); + os_aio_simulated_wake_handler_threads(); os_event_wait_low(buf_dblwr->b_event, sig_count); goto try_again; diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc index c3a169d45ef..5df40b5f4e8 100644 --- a/storage/xtradb/buf/buf0dblwr.cc +++ b/storage/xtradb/buf/buf0dblwr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -963,6 +963,7 @@ try_again: ib_int64_t sig_count = os_event_reset(buf_dblwr->b_event); mutex_exit(&buf_dblwr->mutex); + os_aio_simulated_wake_handler_threads(); os_event_wait_low(buf_dblwr->b_event, sig_count); goto try_again; } @@ -1112,6 +1113,7 @@ try_again: checkpoint. */ ib_int64_t sig_count = os_event_reset(buf_dblwr->b_event); mutex_exit(&buf_dblwr->mutex); + os_aio_simulated_wake_handler_threads(); os_event_wait_low(buf_dblwr->b_event, sig_count); goto try_again; From bb8226deabd177d70151d5e0729bf08533954ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Jan 2020 11:59:56 +0200 Subject: [PATCH 22/43] MDEV-21492 : Galera test sporadic failure on galera.galera_events2 Add wait condition for event creation. --- mysql-test/suite/galera/disabled.def | 3 ++- mysql-test/suite/galera/r/galera_events2.result | 1 + mysql-test/suite/galera/t/galera_events2.test | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 8a507fb0dad..8efb75b0160 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -26,13 +26,13 @@ galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 fro galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc -galera_events2 : MDEV-21492 galera.galera_events2 galera_flush : MariaDB does not have global.thread_statistics galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_ist_mariabackup : MDEV-18829 test leaves port open galera_ist_progress : MDEV-15236 fails when trying to read transfer status galera_load_data : MDEV-19968 galera.galera_load_data galera_migrate : MariaDB does not support START SLAVE USER +galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade @@ -42,6 +42,7 @@ galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow galera_var_node_address : MDEV-20485 Galera test failure galera_var_notify_cmd : MDEV-21488 galera.galera_var_notify_cmd galera_wan : MDEV-17259 Test failure on galera.galera_wan +mysql-wsrep#33 : MDEV-21420 galera.mysql-wsrep#33 partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache sql_log_bin : MDEV-21491 galera.sql_log_bin diff --git a/mysql-test/suite/galera/r/galera_events2.result b/mysql-test/suite/galera/r/galera_events2.result index fa33e75ff57..36441e15f7d 100644 --- a/mysql-test/suite/galera/r/galera_events2.result +++ b/mysql-test/suite/galera/r/galera_events2.result @@ -14,6 +14,7 @@ SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFIN EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND ENABLED NOT PRESERVE connection node_2; +set global wsrep_sync_wait=15; # node_2 event should be there SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT diff --git a/mysql-test/suite/galera/t/galera_events2.test b/mysql-test/suite/galera/t/galera_events2.test index 54b90386851..3dfbe406fc4 100644 --- a/mysql-test/suite/galera/t/galera_events2.test +++ b/mysql-test/suite/galera/t/galera_events2.test @@ -23,6 +23,7 @@ DO SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; --connection node_2 +set global wsrep_sync_wait=15; --echo # node_2 event should be there SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2'; @@ -66,6 +67,9 @@ ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND; SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +--source include/wait_condition.inc + use events_test; --echo "The definer should be ev_test@localhost" SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; From 7e378a8d3140e8b8eec9f13a29b4e25ebcad3288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 17 Jan 2020 11:58:03 +0200 Subject: [PATCH 23/43] Test requires debug build from galera library. --- mysql-test/suite/galera/t/MDEV-20793.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera/t/MDEV-20793.test b/mysql-test/suite/galera/t/MDEV-20793.test index 9f0fa3e1cb6..13ff3cbe77b 100644 --- a/mysql-test/suite/galera/t/MDEV-20793.test +++ b/mysql-test/suite/galera/t/MDEV-20793.test @@ -13,6 +13,7 @@ --source include/galera_cluster.inc --source include/have_debug.inc --source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT); INSERT INTO t1 VALUES (1, 0), (5, 0); From c4195305b2a8431f39a4c75cc1c66ba43685f7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Jan 2020 13:18:44 +0200 Subject: [PATCH 24/43] MDEV-17062 : Test failure on galera.MW-336 Add mutex protection while we calculate required slave thread change and create them. Add error handling. --- mysql-test/suite/galera/disabled.def | 1 - sql/wsrep_thd.cc | 49 ++++++++++++++++++++-------- sql/wsrep_thd.h | 2 +- sql/wsrep_var.cc | 10 ++++-- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 8efb75b0160..581e9e80daa 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -14,7 +14,6 @@ MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B MW-329 : MDEV-19962 Galera test failure on MW-329 -MW-336 : MDEV-17062 Test failure on galera.MW-336 galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults galera_account_management : MariaDB 10.0 does not support ALTER USER galera_as_master_gtid : Requires MySQL GTID diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 413d7f97214..de2ad6d1a1f 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -416,29 +416,46 @@ static void wsrep_replication_process(THD *thd) DBUG_VOID_RETURN; } -static bool create_wsrep_THD(wsrep_thread_args* args) +static bool create_wsrep_THD(wsrep_thread_args* args, bool thread_count_lock) { - mysql_mutex_lock(&LOCK_thread_count); + if (!thread_count_lock) + mysql_mutex_lock(&LOCK_thread_count); + ulong old_wsrep_running_threads= wsrep_running_threads; + DBUG_ASSERT(args->thread_type == WSREP_APPLIER_THREAD || args->thread_type == WSREP_ROLLBACKER_THREAD); + bool res= mysql_thread_create(args->thread_type == WSREP_APPLIER_THREAD ? key_wsrep_applier : key_wsrep_rollbacker, &args->thread_id, &connection_attrib, start_wsrep_THD, (void*)args); + + if (res) + { + WSREP_ERROR("Can't create wsrep thread"); + } + /* if starting a thread on server startup, wait until the this thread's THD is fully initialized (otherwise a THD initialization code might try to access a partially initialized server data structure - MDEV-8208). */ if (!mysqld_server_initialized) + { while (old_wsrep_running_threads == wsrep_running_threads) + { mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); - mysql_mutex_unlock(&LOCK_thread_count); + } + } + + if (!thread_count_lock) + mysql_mutex_unlock(&LOCK_thread_count); + return res; } -void wsrep_create_appliers(long threads) +bool wsrep_create_appliers(long threads, bool thread_count_lock) { if (!wsrep_connected) { @@ -450,26 +467,32 @@ void wsrep_create_appliers(long threads) "connection at '%s'", wsrep_cluster_address); assert(0); } - return; + return false; } - long wsrep_threads=0; + long wsrep_threads= 0; + while (wsrep_threads++ < threads) { wsrep_thread_args* arg; - if((arg = (wsrep_thread_args*)my_malloc(sizeof(wsrep_thread_args), MYF(0))) == NULL) { + + if((arg= (wsrep_thread_args*)my_malloc(sizeof(wsrep_thread_args), MYF(0))) == NULL) + { WSREP_ERROR("Can't allocate memory for wsrep replication thread %ld\n", wsrep_threads); assert(0); } - arg->thread_type = WSREP_APPLIER_THREAD; - arg->processor = wsrep_replication_process; + arg->thread_type= WSREP_APPLIER_THREAD; + arg->processor= wsrep_replication_process; - if (create_wsrep_THD(arg)) { - WSREP_WARN("Can't create thread to manage wsrep replication"); + if (create_wsrep_THD(arg, thread_count_lock)) + { + WSREP_ERROR("Can't create thread to manage wsrep replication"); my_free(arg); - return; + return true; } } + + return false; } static void wsrep_rollback_process(THD *thd) @@ -565,7 +588,7 @@ void wsrep_create_rollbacker() arg->processor = wsrep_rollback_process; /* create rollbacker */ - if (create_wsrep_THD(arg)) { + if (create_wsrep_THD(arg, false)) { WSREP_WARN("Can't create thread to manage wsrep rollback"); my_free(arg); return; diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index 6ce14a4eb0e..8d928014518 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -26,7 +26,7 @@ int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff, enum enum_var_type scope); void wsrep_client_rollback(THD *thd); void wsrep_replay_transaction(THD *thd); -void wsrep_create_appliers(long threads); +bool wsrep_create_appliers(long threads, bool thread_count_lock=false); void wsrep_create_rollbacker(); int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 0f7f7ef2acf..9777cc6ec62 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -602,16 +602,22 @@ static void wsrep_slave_count_change_update () bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) { + mysql_mutex_lock(&LOCK_thread_count); + bool res= false; + wsrep_slave_count_change_update(); if (wsrep_slave_count_change > 0) { WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads); - wsrep_create_appliers(wsrep_slave_count_change); + res= wsrep_create_appliers(wsrep_slave_count_change, true); WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads); wsrep_slave_count_change = 0; } - return false; + + mysql_mutex_unlock(&LOCK_thread_count); + + return res; } bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) From 9cae7bdcc0055776064b3ba08830b1577b18f5c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 16 Jan 2020 12:05:26 +0200 Subject: [PATCH 25/43] MDEV-13626: Add the WL#6326 tests --- .../suite/innodb/r/innodb_wl6326.result | 372 +++++++++ .../suite/innodb/r/innodb_wl6326_big.result | 449 +++++++++++ mysql-test/suite/innodb/t/innodb_wl6326.opt | 1 + mysql-test/suite/innodb/t/innodb_wl6326.test | 500 ++++++++++++ .../suite/innodb/t/innodb_wl6326_big.test | 716 ++++++++++++++++++ 5 files changed, 2038 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb_wl6326.result create mode 100644 mysql-test/suite/innodb/r/innodb_wl6326_big.result create mode 100644 mysql-test/suite/innodb/t/innodb_wl6326.opt create mode 100644 mysql-test/suite/innodb/t/innodb_wl6326.test create mode 100644 mysql-test/suite/innodb/t/innodb_wl6326_big.test diff --git a/mysql-test/suite/innodb/r/innodb_wl6326.result b/mysql-test/suite/innodb/r/innodb_wl6326.result new file mode 100644 index 00000000000..84620ddc04d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_wl6326.result @@ -0,0 +1,372 @@ +DROP TABLE IF EXISTS t1; +SET GLOBAL innodb_adaptive_hash_index = false; +SET GLOBAL innodb_stats_persistent = false; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connect con3,localhost,root,,; +CREATE TABLE t1 ( +a00 CHAR(255) NOT NULL DEFAULT 'a', +a01 CHAR(255) NOT NULL DEFAULT 'a', +a02 CHAR(255) NOT NULL DEFAULT 'a', +a03 CHAR(255) NOT NULL DEFAULT 'a', +a04 CHAR(255) NOT NULL DEFAULT 'a', +a05 CHAR(255) NOT NULL DEFAULT 'a', +a06 CHAR(255) NOT NULL DEFAULT 'a', +b INT NOT NULL DEFAULT 0 +) ENGINE = InnoDB; +ALTER TABLE t1 ADD CONSTRAINT pkey PRIMARY KEY( +a00, +a01, +a02, +a03, +a04, +a05, +a06 +); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1 +SET GLOBAL innodb_limit_optimistic_insert_debug = 7; +INSERT INTO t1 (a00) VALUES ('aa'); +INSERT INTO t1 (a00) VALUES ('ab'); +INSERT INTO t1 (a00) VALUES ('ac'); +INSERT INTO t1 (a00) VALUES ('ad'); +INSERT INTO t1 (a00) VALUES ('ae'); +INSERT INTO t1 (a00) VALUES ('af'); +INSERT INTO t1 (a00) VALUES ('ag'); +INSERT INTO t1 (a00) VALUES ('ah'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +3 +INSERT INTO t1 (a00) VALUES ('ai'); +INSERT INTO t1 (a00) VALUES ('aj'); +INSERT INTO t1 (a00) VALUES ('ak'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +4 +INSERT INTO t1 (a00) VALUES ('al'); +INSERT INTO t1 (a00) VALUES ('am'); +INSERT INTO t1 (a00) VALUES ('an'); +INSERT INTO t1 (a00) VALUES ('ao'); +INSERT INTO t1 (a00) VALUES ('ap'); +INSERT INTO t1 (a00) VALUES ('aq'); +INSERT INTO t1 (a00) VALUES ('ar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +5 +INSERT INTO t1 (a00) VALUES ('as'); +INSERT INTO t1 (a00) VALUES ('at'); +INSERT INTO t1 (a00) VALUES ('au'); +INSERT INTO t1 (a00) VALUES ('av'); +INSERT INTO t1 (a00) VALUES ('aw'); +INSERT INTO t1 (a00) VALUES ('ax'); +INSERT INTO t1 (a00) VALUES ('ay'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +6 +INSERT INTO t1 (a00) VALUES ('az'); +INSERT INTO t1 (a00) VALUES ('ba'); +INSERT INTO t1 (a00) VALUES ('bb'); +INSERT INTO t1 (a00) VALUES ('bc'); +INSERT INTO t1 (a00) VALUES ('bd'); +INSERT INTO t1 (a00) VALUES ('be'); +INSERT INTO t1 (a00) VALUES ('bf'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +7 +INSERT INTO t1 (a00) VALUES ('bg'); +INSERT INTO t1 (a00) VALUES ('bh'); +INSERT INTO t1 (a00) VALUES ('bi'); +INSERT INTO t1 (a00) VALUES ('bj'); +INSERT INTO t1 (a00) VALUES ('bk'); +INSERT INTO t1 (a00) VALUES ('bl'); +INSERT INTO t1 (a00) VALUES ('bm'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +8 +INSERT INTO t1 (a00) VALUES ('bn'); +INSERT INTO t1 (a00) VALUES ('bo'); +INSERT INTO t1 (a00) VALUES ('bp'); +INSERT INTO t1 (a00) VALUES ('bq'); +INSERT INTO t1 (a00) VALUES ('br'); +INSERT INTO t1 (a00) VALUES ('bs'); +INSERT INTO t1 (a00) VALUES ('bt'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +11 +INSERT INTO t1 (a00) VALUES ('bu'); +INSERT INTO t1 (a00) VALUES ('bv'); +INSERT INTO t1 (a00) VALUES ('bw'); +INSERT INTO t1 (a00) VALUES ('bx'); +INSERT INTO t1 (a00) VALUES ('by'); +INSERT INTO t1 (a00) VALUES ('bz'); +INSERT INTO t1 (a00) VALUES ('ca'); +INSERT INTO t1 (a00) VALUES ('cb'); +INSERT INTO t1 (a00) VALUES ('cc'); +INSERT INTO t1 (a00) VALUES ('cd'); +INSERT INTO t1 (a00) VALUES ('ce'); +INSERT INTO t1 (a00) VALUES ('cf'); +INSERT INTO t1 (a00) VALUES ('cg'); +INSERT INTO t1 (a00) VALUES ('ch'); +INSERT INTO t1 (a00) VALUES ('ci'); +INSERT INTO t1 (a00) VALUES ('cj'); +INSERT INTO t1 (a00) VALUES ('ck'); +INSERT INTO t1 (a00) VALUES ('cl'); +INSERT INTO t1 (a00) VALUES ('cm'); +INSERT INTO t1 (a00) VALUES ('cn'); +INSERT INTO t1 (a00) VALUES ('co'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +15 +INSERT INTO t1 (a00) VALUES ('cp'); +INSERT INTO t1 (a00) VALUES ('cq'); +INSERT INTO t1 (a00) VALUES ('cr'); +INSERT INTO t1 (a00) VALUES ('cs'); +INSERT INTO t1 (a00) VALUES ('ct'); +INSERT INTO t1 (a00) VALUES ('cu'); +INSERT INTO t1 (a00) VALUES ('cv'); +INSERT INTO t1 (a00) VALUES ('cw'); +INSERT INTO t1 (a00) VALUES ('cx'); +INSERT INTO t1 (a00) VALUES ('cy'); +INSERT INTO t1 (a00) VALUES ('cz'); +INSERT INTO t1 (a00) VALUES ('da'); +INSERT INTO t1 (a00) VALUES ('db'); +INSERT INTO t1 (a00) VALUES ('dc'); +INSERT INTO t1 (a00) VALUES ('dd'); +INSERT INTO t1 (a00) VALUES ('de'); +INSERT INTO t1 (a00) VALUES ('df'); +INSERT INTO t1 (a00) VALUES ('dg'); +INSERT INTO t1 (a00) VALUES ('dh'); +INSERT INTO t1 (a00) VALUES ('di'); +INSERT INTO t1 (a00) VALUES ('dj'); +INSERT INTO t1 (a00) VALUES ('dk'); +INSERT INTO t1 (a00) VALUES ('dl'); +INSERT INTO t1 (a00) VALUES ('dm'); +INSERT INTO t1 (a00) VALUES ('dn'); +INSERT INTO t1 (a00) VALUES ('do'); +INSERT INTO t1 (a00) VALUES ('dp'); +INSERT INTO t1 (a00) VALUES ('dq'); +INSERT INTO t1 (a00) VALUES ('dr'); +INSERT INTO t1 (a00) VALUES ('ds'); +INSERT INTO t1 (a00) VALUES ('dt'); +INSERT INTO t1 (a00) VALUES ('du'); +INSERT INTO t1 (a00) VALUES ('dv'); +INSERT INTO t1 (a00) VALUES ('dw'); +INSERT INTO t1 (a00) VALUES ('dx'); +INSERT INTO t1 (a00) VALUES ('dy'); +INSERT INTO t1 (a00) VALUES ('dz'); +INSERT INTO t1 (a00) VALUES ('ea'); +INSERT INTO t1 (a00) VALUES ('eb'); +INSERT INTO t1 (a00) VALUES ('ec'); +INSERT INTO t1 (a00) VALUES ('ed'); +INSERT INTO t1 (a00) VALUES ('ee'); +INSERT INTO t1 (a00) VALUES ('ef'); +INSERT INTO t1 (a00) VALUES ('eg'); +INSERT INTO t1 (a00) VALUES ('eh'); +INSERT INTO t1 (a00) VALUES ('ei'); +INSERT INTO t1 (a00) VALUES ('ej'); +INSERT INTO t1 (a00) VALUES ('ek'); +INSERT INTO t1 (a00) VALUES ('el'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +23 +INSERT INTO t1 (a00) VALUES ('em'); +INSERT INTO t1 (a00) VALUES ('en'); +INSERT INTO t1 (a00) VALUES ('eo'); +INSERT INTO t1 (a00) VALUES ('ep'); +INSERT INTO t1 (a00) VALUES ('eq'); +INSERT INTO t1 (a00) VALUES ('er'); +INSERT INTO t1 (a00) VALUES ('es'); +INSERT INTO t1 (a00) VALUES ('et'); +INSERT INTO t1 (a00) VALUES ('eu'); +INSERT INTO t1 (a00) VALUES ('ev'); +INSERT INTO t1 (a00) VALUES ('ew'); +INSERT INTO t1 (a00) VALUES ('ex'); +INSERT INTO t1 (a00) VALUES ('ey'); +INSERT INTO t1 (a00) VALUES ('ez'); +INSERT INTO t1 (a00) VALUES ('fa'); +INSERT INTO t1 (a00) VALUES ('fb'); +INSERT INTO t1 (a00) VALUES ('fc'); +INSERT INTO t1 (a00) VALUES ('fd'); +INSERT INTO t1 (a00) VALUES ('fe'); +INSERT INTO t1 (a00) VALUES ('ff'); +INSERT INTO t1 (a00) VALUES ('fg'); +INSERT INTO t1 (a00) VALUES ('fh'); +INSERT INTO t1 (a00) VALUES ('fi'); +INSERT INTO t1 (a00) VALUES ('fj'); +INSERT INTO t1 (a00) VALUES ('fk'); +INSERT INTO t1 (a00) VALUES ('fl'); +INSERT INTO t1 (a00) VALUES ('fm'); +INSERT INTO t1 (a00) VALUES ('fn'); +INSERT INTO t1 (a00) VALUES ('fo'); +INSERT INTO t1 (a00) VALUES ('fp'); +INSERT INTO t1 (a00) VALUES ('fq'); +INSERT INTO t1 (a00) VALUES ('fr'); +INSERT INTO t1 (a00) VALUES ('fs'); +INSERT INTO t1 (a00) VALUES ('ft'); +INSERT INTO t1 (a00) VALUES ('fu'); +INSERT INTO t1 (a00) VALUES ('fv'); +INSERT INTO t1 (a00) VALUES ('fw'); +INSERT INTO t1 (a00) VALUES ('fx'); +INSERT INTO t1 (a00) VALUES ('fy'); +INSERT INTO t1 (a00) VALUES ('fz'); +INSERT INTO t1 (a00) VALUES ('ga'); +INSERT INTO t1 (a00) VALUES ('gb'); +INSERT INTO t1 (a00) VALUES ('gc'); +INSERT INTO t1 (a00) VALUES ('gd'); +INSERT INTO t1 (a00) VALUES ('ge'); +INSERT INTO t1 (a00) VALUES ('gf'); +INSERT INTO t1 (a00) VALUES ('gg'); +INSERT INTO t1 (a00) VALUES ('gh'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +29 +SET GLOBAL innodb_limit_optimistic_insert_debug = 0; +# Test start +SET DEBUG_SYNC = 'RESET'; +INSERT INTO t1 (a00) VALUES ('bfa'); +connection con1; +SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; +INSERT INTO t1 (a00) VALUES ('bfb'); +connection con2; +SET DEBUG_SYNC = 'now WAIT_FOR reached'; +SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; +a00 a01 +aa a +SELECT a00,a01 FROM t1 WHERE a00 = 'aq'; +a00 a01 +aq a +SELECT a00,a01 FROM t1 WHERE a00 = 'cp'; +a00 a01 +cp a +SELECT a00,a01 FROM t1 WHERE a00 = 'el'; +a00 a01 +el a +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +SELECT a00,a01 FROM t1 WHERE a00 = 'ar'; +connection con3; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection con1; +connection con2; +a00 a01 +ar a +connection con3; +a00 a01 +cn a +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +30 +SET DEBUG_SYNC = 'RESET'; +INSERT INTO t1 (a00) VALUES ('cva'); +connection con1; +SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; +INSERT INTO t1 (a00) VALUES ('cvb'); +connection con2; +SET DEBUG_SYNC = 'now WAIT_FOR reached'; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; +connection con3; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +SELECT a00,a01 FROM t1 WHERE a00 = 'el'; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection con1; +connection con2; +a00 a01 +aa a +connection con3; +a00 a01 +el a +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +31 +SET DEBUG_SYNC = 'RESET'; +INSERT INTO t1 (a00) VALUES ('gba'); +connection con1; +SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; +INSERT INTO t1 (a00) VALUES ('gbb'); +connection con2; +SET DEBUG_SYNC = 'now WAIT_FOR reached'; +SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; +a00 a01 +aa a +SELECT a00,a01 FROM t1 WHERE a00 = 'ek'; +a00 a01 +ek a +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +SELECT a00,a01 FROM t1 WHERE a00 = 'el'; +connection con3; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection con1; +connection con2; +a00 a01 +el a +connection con3; +a00 a01 +gb a +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +32 +SET DEBUG_SYNC = 'RESET'; +connection default; +disconnect con1; +disconnect con2; +disconnect con3; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_wl6326_big.result b/mysql-test/suite/innodb/r/innodb_wl6326_big.result new file mode 100644 index 00000000000..3ff6d0d0b5c --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_wl6326_big.result @@ -0,0 +1,449 @@ +CREATE SCHEMA my_schema; +USE my_schema; +CREATE FUNCTION f_thread_id (i INT) RETURNS CHAR(4) DETERMINISTIC +RETURN CONCAT(LPAD(CAST(i AS CHAR),3,'_'),'_') ; +SELECT CONCAT('->', f_thread_id( 1), '<-'); +CONCAT('->', f_thread_id( 1), '<-') +->__1_<- +SELECT CONCAT('->', f_thread_id(12), '<-'); +CONCAT('->', f_thread_id(12), '<-') +->_12_<- +SET @extra_int = 1; +SET @extra_string = f_thread_id(@extra_int); +SELECT @extra_int , @extra_string; +@extra_int @extra_string +1 __1_ +CREATE FUNCTION f_col_int1 (i INT) RETURNS INT(20) DETERMINISTIC +RETURN i * 1000 + @extra_int ; +SELECT f_col_int1(my_col) AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +1001 +12001 +123001 +1234001 +12345001 +CREATE FUNCTION f_col_int2 (i INT) RETURNS INT(20) DETERMINISTIC +RETURN @extra_int * 10000000 + i ; +SELECT f_col_int2(my_col) AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +10000001 +10000012 +10000123 +10001234 +10012345 +CREATE FUNCTION f_col_int3 (i INT) RETURNS INT(20) DETERMINISTIC +RETURN @extra_int ; +SELECT f_col_int3(my_col) AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +1 +1 +1 +1 +1 +CREATE FUNCTION f_col_blob (i INT) RETURNS BLOB DETERMINISTIC +RETURN RPAD(@extra_string,(@@innodb_page_size / 2 ) + 1,'a'); +SELECT CONCAT('->', SUBSTR(f_col_blob(my_col) FROM 1 FOR 10), +'<-.....->', SUBSTR(f_col_blob(my_col) FROM -10 FOR 10), '<-') AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +->__1_aaaaaa<-.....->aaaaaaaaaa<- +->__1_aaaaaa<-.....->aaaaaaaaaa<- +->__1_aaaaaa<-.....->aaaaaaaaaa<- +->__1_aaaaaa<-.....->aaaaaaaaaa<- +->__1_aaaaaa<-.....->aaaaaaaaaa<- +CREATE FUNCTION f_col_char0 (i INT) RETURNS CHAR(255) DETERMINISTIC +RETURN LPAD(CAST(i AS CHAR),255,' '); +SELECT CONCAT('->', f_col_char0(my_col), '<-') AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +-> 1<- +-> 12<- +-> 123<- +-> 1234<- +-> 12345<- +CREATE FUNCTION f_col_char1 (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B', +LPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '), +@extra_string, +RPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '), +'E') ; +SELECT CONCAT('->', f_col_char1(my_col), '<-') AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +->B __1_1 E<- +->B 1__1_2 E<- +->B 1__1_23 E<- +->B 12__1_34 E<- +->B 12__1_345 E<- +CREATE FUNCTION f_col_char2 (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B', +RPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '), +@extra_string, +LPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '), +'E'); +SELECT CONCAT('->', f_col_char2(my_col), '<-') AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +->B __1_ 1E<- +->B1 __1_ 2E<- +->B1 __1_ 23E<- +->B12 __1_ 34E<- +->B12 __1_ 345E<- +CREATE FUNCTION f_col_char3 (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B',@extra_string,LPAD(CAST(i AS CHAR),20,' '),'E'); +SELECT CONCAT('->', f_col_char3(my_col), '<-') AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +->B__1_ 1E<- +->B__1_ 12E<- +->B__1_ 123E<- +->B__1_ 1234E<- +->B__1_ 12345E<- +CREATE FUNCTION f_col_char4 (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B',RPAD(CAST(i AS CHAR),20,' '),@extra_string,'E'); +SELECT CONCAT('->', f_col_char4(my_col), '<-') AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; +my_result +->B1 __1_E<- +->B12 __1_E<- +->B123 __1_E<- +->B1234 __1_E<- +->B12345 __1_E<- +CREATE TABLE my_metrics LIKE information_schema.innodb_metrics; +ALTER TABLE my_metrics ADD COLUMN phase ENUM('after', 'before'), +DROP COLUMN SUBSYSTEM, DROP COLUMN TYPE, DROP COLUMN COMMENT, +ADD PRIMARY KEY (NAME,phase); +CREATE TABLE t1 ( +col_int0 BIGINT, +col_int1 BIGINT, +col_int2 BIGINT, +col_int3 BIGINT, +col_blob BLOB, +col_char0 VARCHAR(255), +col_char1 VARCHAR(30), +col_char2 VARCHAR(30), +col_char3 VARCHAR(30), +col_char4 VARCHAR(30) +) ENGINE = InnoDB; +ALTER TABLE t1 ADD UNIQUE KEY uidx_col_int0 (col_int0), +ADD UNIQUE KEY uidx1 (col_int1, col_char0), +ADD UNIQUE KEY uidx2 (col_int2, col_char0, col_int1), +ADD UNIQUE KEY uidx3 (col_int3, col_int2, col_char0), +ADD UNIQUE KEY uidx4 (col_char1, col_char0), +ADD UNIQUE KEY uidx5 (col_char2, col_char0, col_char1), +ADD UNIQUE KEY uidx6 (col_char3, col_char2, col_char0), +ADD UNIQUE KEY uidx7 (col_int1, col_int2, col_int3, col_char4, +col_char1, col_char2, col_char3, col_char0), +ADD KEY idx8 (col_blob(10), col_char4); +CREATE PROCEDURE proc_fill_t1 (max_row_count INT, load_unit INT) +BEGIN +DECLARE my_count INTEGER DEFAULT 0; +DECLARE max_load_count INTEGER DEFAULT 0; +DROP TABLE IF EXISTS t0; +CREATE TEMPORARY TABLE t0 (col_int0 BIGINT, PRIMARY KEY(col_int0)); +WHILE (my_count < load_unit ) DO +SET my_count = my_count + 1; +INSERT INTO t0 SET col_int0 = my_count; +END WHILE; +SET max_load_count = (SELECT (max_row_count DIV load_unit) + 1 ); +SELECT COUNT(col_int0) INTO @val FROM t1; +SET my_count = 0; +REPEAT +INSERT INTO t1 (col_int0, col_int1, col_int2, col_int3, col_blob, +col_char0, col_char1, col_char2,col_char3,col_char4) +SELECT col_int0 + @val, +f_col_int1(col_int0 + @val), +f_col_int2(col_int0 + @val), +f_col_int3(col_int0 + @val), +f_col_blob(col_int0 + @val), +f_col_char0(col_int0 + @val), +f_col_char1(col_int0 + @val), +f_col_char2(col_int0 + @val), +f_col_char3(col_int0 + @val), +f_col_char4(col_int0 + @val) +FROM t0; +COMMIT; +SELECT MAX(col_int0) INTO @val FROM t1; +SET my_count = my_count + 1; +UNTIL( my_count > max_load_count OR @val >= max_row_count ) +END REPEAT; +DROP TEMPORARY TABLE t0; +END| +CREATE PROCEDURE proc_dml (max_duration INT, t1_stripe_half INT) +BEGIN +DECLARE aux INTEGER DEFAULT 0; +DECLARE start_time INT; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND BEGIN END; +SET @extra_int = CONNECTION_ID(); +SET @extra_string = f_thread_id(@extra_int); +SELECT ROUND(MAX(col_int0) / 2 ) INTO @t1_half FROM t1; +# The user lock 'Blocker' should be already set by some other session S1. +# S1 starts the race by releasing that lock. +# Wait till the lock is released and the lock can be obtained. +# In order to prevent endless waiting in case of non foreseen problems +# limit the timespan to 30 seconds. +SELECT GET_LOCK('Blocker', 30) INTO @aux; +# Release the lock immediate so that the other "runner" sessions start too. +SELECT RELEASE_LOCK('Blocker') INTO @aux; +SET start_time = UNIX_TIMESTAMP(); +WHILE (UNIX_TIMESTAMP() - start_time < max_duration) DO +SET @aux = @t1_half - t1_stripe_half + ROUND(RAND() * t1_stripe_half * 2); +UPDATE t1 SET +col_int1 = f_col_int1(col_int0), +col_int2 = f_col_int2(col_int0), +col_int3 = f_col_int3(col_int0), +col_blob = f_col_blob(col_int0), +col_char0 = f_col_char0(col_int0), +col_char1 = f_col_char1(col_int0), +col_char2 = f_col_char2(col_int0), +col_char3 = f_col_char3(col_int0), +col_char4 = f_col_char4(col_int0) +WHERE col_int0 = @aux; +COMMIT; +END WHILE; +END| +SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%"; +SET @pre_reset_ts = NOW(); +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; +SET @pre_enable_ts = NOW(); +SET GLOBAL innodb_monitor_enable = "innodb_rwlock_sx_%"; +SET @pre_collect_ts = NOW(); +DELETE FROM my_metrics; +INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'before' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +# TC-01 There are exact three entries "innodb_rwlock_sx_%" with the +# with the name which follow in innodb_metrics. +# pass +SELECT COUNT(*) INTO @sx_count FROM my_metrics; +# TC-02 Counting is now enabled. ALL = @sx_count entries show that. +# pass +# TC-03 @pre_reset_ts < TIME_RESET. ALL = @sx_count entries show that. +# pass +# TC-04 @pre_enable_ts < TIME_ENABLED. ALL = @sx_count entries show that. +# pass +# TC-05 TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts +# AND TIME_ELAPSED > 0. ALL = @sx_count entries show that. +# pass +# TC-06 COUNT_RESET = MAX_COUNT_RESET. ALL = @sx_count entries show that. +# pass +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; +SHOW ENGINE INNODB STATUS; +DELETE FROM my_metrics; +INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'before' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +SET @extra_string = '__0_'; +SET @extra_int = 0; +# TC-07 One session inserts some significant amount of rows into t1. +# The system MUST survive that. +SET @max_row_count = ; +SET @load_unit = ; +SET @start_time = UNIX_TIMESTAMP(); +SET AUTOCOMMIT = OFF; +CALL proc_fill_t1 (@max_row_count, @load_unit); +# pass +SET AUTOCOMMIT = ON; +SELECT col_int0 INTO @t1_half FROM t1 +WHERE col_int0 >= (@val DIV 2) ORDER BY col_int0 LIMIT 1; +SHOW ENGINE INNODB STATUS; +SELECT col_int0, col_int1, col_int2, col_int3, +CONCAT('->', SUBSTR(col_blob FROM 1 FOR 10), +'<-.....->', SUBSTR(col_blob FROM -10 FOR 10), '<-') AS col_blobx, +CONCAT('->',col_char0,'<-') AS col_char0x, +CONCAT('->',col_char1,'<-') AS col_char1x, +CONCAT('->',col_char2,'<-') AS col_char2x, +CONCAT('->',col_char3,'<-') AS col_char3x, +CONCAT('->',col_char4,'<-') AS col_char4x +FROM t1 WHERE col_int0 between 98 AND 102; +col_int0 98 +col_int1 98000 +col_int2 98 +col_int3 0 +col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<- +col_char0x -> 98<- +col_char1x ->B 9__0_8 E<- +col_char2x ->B9 __0_ 8E<- +col_char3x ->B__0_ 98E<- +col_char4x ->B98 __0_E<- +col_int0 99 +col_int1 99000 +col_int2 99 +col_int3 0 +col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<- +col_char0x -> 99<- +col_char1x ->B 9__0_9 E<- +col_char2x ->B9 __0_ 9E<- +col_char3x ->B__0_ 99E<- +col_char4x ->B99 __0_E<- +col_int0 100 +col_int1 100000 +col_int2 100 +col_int3 0 +col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<- +col_char0x -> 100<- +col_char1x ->B 1__0_00 E<- +col_char2x ->B1 __0_ 00E<- +col_char3x ->B__0_ 100E<- +col_char4x ->B100 __0_E<- +col_int0 101 +col_int1 101000 +col_int2 101 +col_int3 0 +col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<- +col_char0x -> 101<- +col_char1x ->B 1__0_01 E<- +col_char2x ->B1 __0_ 01E<- +col_char3x ->B__0_ 101E<- +col_char4x ->B101 __0_E<- +col_int0 102 +col_int1 102000 +col_int2 102 +col_int3 0 +col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<- +col_char0x -> 102<- +col_char1x ->B 1__0_02 E<- +col_char2x ->B1 __0_ 02E<- +col_char3x ->B__0_ 102E<- +col_char4x ->B102 __0_E<- +# TC-11 Several concurrent sessions perform updates in t1 like mad. +# The system MUST survive this. +# Printing of statements is partially suppressed. +SET @start_time = UNIX_TIMESTAMP(); +SELECT 1 FROM t1 WHERE col_int0 = @t1_half FOR UPDATE; +1 +1 +SELECT GET_LOCK('Blocker', 1000) ; +GET_LOCK('Blocker', 1000) +1 +RELEASE_LOCK('Blocker') +1 +# pass +SHOW ENGINE INNODB STATUS; +# TC-13 One session performs ALTER TABLE t1 ADD KEY ... on the fat table t1. +# The system MUST survive this. +SET @start_time = UNIX_TIMESTAMP(); +ALTER TABLE t1 ADD KEY idx_col_char4_col_char0 (col_char4,col_char0); +SHOW ENGINE INNODB STATUS; +# pass +# TC-15 One session performs a fat update on the fat table t1. +# The system MUST survive this. +SET @start_time = UNIX_TIMESTAMP(); +SET @extra_int = 13; +SET @extra_string = f_thread_id(@extra_int); +UPDATE t1 SET +col_int1 = f_col_int1(col_int0), col_int2 = f_col_int2(col_int0), +col_int3 = f_col_int3(col_int0), col_blob = f_col_blob(col_int0), +col_char0 = f_col_char0(col_int0), col_char1 = f_col_char1(col_int0), +col_char2 = f_col_char2(col_int0), col_char3 = f_col_char3(col_int0), +col_char4 = f_col_char4(col_int0) +WHERE col_int0 BETWEEN @t1_half - 2500 AND @t1_half + 2500; +COMMIT; +SHOW ENGINE INNODB STATUS; +# pass +INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'after' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +# TC-16 The following activities happend after reset in innodb_metrics +# - Insert some significant amount of rows into t1. +# - Several concurrent users perform excessive updates in t1. +# - ALTER TABLE ... ADD KEY +# - One UPDATE statement modifying a huge slice of t1. +# Any of them causes heavy use of SX lock and therefore COUNT_RESET +# must have grown for ALL = @sx_count entries. +# pass +# TC-09 Heavy activity after reset. +# COUNT_RESET = MAX_COUNT_RESET for ALL = @sx_count entries +# needs to stay valid though he counters will have grown. +# pass +DELETE FROM my_metrics; +INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'before' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; +INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'after' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +# TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL +# = @sx_count entries. +# pass +# TC-17 We had heavy activity causing big counters and after that a reset. +# Reset causes COUNT > COUNT_RESET AND MAX_COUNT > MAX_COUNT_RESET +# for ALL @sx_count entries. +# pass +# TC-18 We had some reset but this must not decrease COUNT or MAX_COUNT +# after.COUNT >= before.COUNT AND +# after.MAX_COUNT >= before.MAX_COUNT for ALL @sx_count entries. +# pass +# TC-19 We had some reset after heavy activity and this must cause +# after.COUNT_RESET < before.COUNT_RESET +# AND after.MAX_COUNT_RESET < before.MAX_COUNT_RESET AND +# for ALL @sx_count entries. +# pass +connection con10; +disconnect con10; +connection con9; +disconnect con9; +connection con8; +disconnect con8; +connection con7; +disconnect con7; +connection con6; +disconnect con6; +connection con5; +disconnect con5; +connection con4; +disconnect con4; +connection con3; +disconnect con3; +connection con2; +disconnect con2; +connection con1; +disconnect con1; +connection default; +USE test; +DROP SCHEMA my_schema; +SET GLOBAL innodb_monitor_disable = all; +SET GLOBAL innodb_monitor_reset_all = all; +SET GLOBAL innodb_monitor_enable = default; +SET GLOBAL innodb_monitor_disable = default; +SET GLOBAL innodb_monitor_reset = default; +SET GLOBAL innodb_monitor_reset_all = default; +SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%"; +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.opt b/mysql-test/suite/innodb/t/innodb_wl6326.opt new file mode 100644 index 00000000000..99bf0e5a28b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_wl6326.opt @@ -0,0 +1 @@ +--innodb-sys-tablestats diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.test b/mysql-test/suite/innodb/t/innodb_wl6326.test new file mode 100644 index 00000000000..7f4c5421b18 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_wl6326.test @@ -0,0 +1,500 @@ +# +# WL#6326: InnoDB: fix index->lock contention +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_innodb_16k.inc + +--disable_query_log +SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; +SET @old_innodb_stats_persistent = @@innodb_stats_persistent; +--enable_query_log +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +SET GLOBAL innodb_adaptive_hash_index = false; +SET GLOBAL innodb_stats_persistent = false; + +--connect (con1,localhost,root,,) +--connect (con2,localhost,root,,) +--connect (con3,localhost,root,,) + +CREATE TABLE t1 ( + a00 CHAR(255) NOT NULL DEFAULT 'a', + a01 CHAR(255) NOT NULL DEFAULT 'a', + a02 CHAR(255) NOT NULL DEFAULT 'a', + a03 CHAR(255) NOT NULL DEFAULT 'a', + a04 CHAR(255) NOT NULL DEFAULT 'a', + a05 CHAR(255) NOT NULL DEFAULT 'a', + a06 CHAR(255) NOT NULL DEFAULT 'a', + b INT NOT NULL DEFAULT 0 +) ENGINE = InnoDB; + +ALTER TABLE t1 ADD CONSTRAINT pkey PRIMARY KEY( + a00, + a01, + a02, + a03, + a04, + a05, + a06 +); + +# +# Prepare primary key index tree to be used for this test. +# + +# Only root (1) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +# Make the first records sparse artificially, +# not to cause modify_tree by single node_ptr insert operation. +# * (7 - 2) records should be larger than a half of the page size +# * (7 + 2) records should be fit to the page +# (above t1 definition is already adjusted) +SET GLOBAL innodb_limit_optimistic_insert_debug = 7; + +INSERT INTO t1 (a00) VALUES ('aa'); +INSERT INTO t1 (a00) VALUES ('ab'); +INSERT INTO t1 (a00) VALUES ('ac'); +INSERT INTO t1 (a00) VALUES ('ad'); +INSERT INTO t1 (a00) VALUES ('ae'); +INSERT INTO t1 (a00) VALUES ('af'); +INSERT INTO t1 (a00) VALUES ('ag'); +INSERT INTO t1 (a00) VALUES ('ah'); +# Raise root (1-2) +# (aa,ad) +# (aa,ab,ac)(ad,ae,af,ag,ah) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +INSERT INTO t1 (a00) VALUES ('ai'); +INSERT INTO t1 (a00) VALUES ('aj'); +INSERT INTO t1 (a00) VALUES ('ak'); +# Split leaf (1-3) +# (aa,ad,ak) +# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +INSERT INTO t1 (a00) VALUES ('al'); +INSERT INTO t1 (a00) VALUES ('am'); +INSERT INTO t1 (a00) VALUES ('an'); +INSERT INTO t1 (a00) VALUES ('ao'); +INSERT INTO t1 (a00) VALUES ('ap'); +INSERT INTO t1 (a00) VALUES ('aq'); +INSERT INTO t1 (a00) VALUES ('ar'); +# Split leaf (1-4) +# (aa,ad,ak,ar) +# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak,al,am,an,ao,ap,aq)(ar) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +INSERT INTO t1 (a00) VALUES ('as'); +INSERT INTO t1 (a00) VALUES ('at'); +INSERT INTO t1 (a00) VALUES ('au'); +INSERT INTO t1 (a00) VALUES ('av'); +INSERT INTO t1 (a00) VALUES ('aw'); +INSERT INTO t1 (a00) VALUES ('ax'); +INSERT INTO t1 (a00) VALUES ('ay'); +# Split leaf (1-5) +# (aa,ad,ak,ar,ay) +# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak,al,am,an,ao,ap,aq)(ar,as,at,au,av,aw,ax)(ay) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +INSERT INTO t1 (a00) VALUES ('az'); +INSERT INTO t1 (a00) VALUES ('ba'); +INSERT INTO t1 (a00) VALUES ('bb'); +INSERT INTO t1 (a00) VALUES ('bc'); +INSERT INTO t1 (a00) VALUES ('bd'); +INSERT INTO t1 (a00) VALUES ('be'); +INSERT INTO t1 (a00) VALUES ('bf'); +# Split leaf (1-6) +# (aa,ad,ak,ar,ay,bf) +# (aa,ab,ac)(ad..)(ak..)(ar,as,at,au,av,aw,ax)(ay,az,ba,bb,bc,bd,be)(bf) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + +INSERT INTO t1 (a00) VALUES ('bg'); +INSERT INTO t1 (a00) VALUES ('bh'); +INSERT INTO t1 (a00) VALUES ('bi'); +INSERT INTO t1 (a00) VALUES ('bj'); +INSERT INTO t1 (a00) VALUES ('bk'); +INSERT INTO t1 (a00) VALUES ('bl'); +INSERT INTO t1 (a00) VALUES ('bm'); +# Split leaf (1-7) +# (aa,ad,ak,ar,ay,bf,bm) +# (aa,ab,ac)(ad..)(ak..)(ar..)(ay,az,ba,bb,bc,bd,be)(bf,bg,bh,bi,bj,bk,bl)(bm) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +INSERT INTO t1 (a00) VALUES ('bn'); +INSERT INTO t1 (a00) VALUES ('bo'); +INSERT INTO t1 (a00) VALUES ('bp'); +INSERT INTO t1 (a00) VALUES ('bq'); +INSERT INTO t1 (a00) VALUES ('br'); +INSERT INTO t1 (a00) VALUES ('bs'); +INSERT INTO t1 (a00) VALUES ('bt'); +# Raise root (1-2-8) +# (aa,ar) +# (aa,ad,ak) (ar,ay,bf,bm,bt) +# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + +INSERT INTO t1 (a00) VALUES ('bu'); +INSERT INTO t1 (a00) VALUES ('bv'); +INSERT INTO t1 (a00) VALUES ('bw'); +INSERT INTO t1 (a00) VALUES ('bx'); +INSERT INTO t1 (a00) VALUES ('by'); +INSERT INTO t1 (a00) VALUES ('bz'); +INSERT INTO t1 (a00) VALUES ('ca'); + +INSERT INTO t1 (a00) VALUES ('cb'); +INSERT INTO t1 (a00) VALUES ('cc'); +INSERT INTO t1 (a00) VALUES ('cd'); +INSERT INTO t1 (a00) VALUES ('ce'); +INSERT INTO t1 (a00) VALUES ('cf'); +INSERT INTO t1 (a00) VALUES ('cg'); +INSERT INTO t1 (a00) VALUES ('ch'); + +INSERT INTO t1 (a00) VALUES ('ci'); +INSERT INTO t1 (a00) VALUES ('cj'); +INSERT INTO t1 (a00) VALUES ('ck'); +INSERT INTO t1 (a00) VALUES ('cl'); +INSERT INTO t1 (a00) VALUES ('cm'); +INSERT INTO t1 (a00) VALUES ('cn'); +INSERT INTO t1 (a00) VALUES ('co'); +# Split also at level 1 (1-3-11) +# (aa,ar,co) +# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co) +# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + +INSERT INTO t1 (a00) VALUES ('cp'); +INSERT INTO t1 (a00) VALUES ('cq'); +INSERT INTO t1 (a00) VALUES ('cr'); +INSERT INTO t1 (a00) VALUES ('cs'); +INSERT INTO t1 (a00) VALUES ('ct'); +INSERT INTO t1 (a00) VALUES ('cu'); +INSERT INTO t1 (a00) VALUES ('cv'); + +INSERT INTO t1 (a00) VALUES ('cw'); +INSERT INTO t1 (a00) VALUES ('cx'); +INSERT INTO t1 (a00) VALUES ('cy'); +INSERT INTO t1 (a00) VALUES ('cz'); +INSERT INTO t1 (a00) VALUES ('da'); +INSERT INTO t1 (a00) VALUES ('db'); +INSERT INTO t1 (a00) VALUES ('dc'); + +INSERT INTO t1 (a00) VALUES ('dd'); +INSERT INTO t1 (a00) VALUES ('de'); +INSERT INTO t1 (a00) VALUES ('df'); +INSERT INTO t1 (a00) VALUES ('dg'); +INSERT INTO t1 (a00) VALUES ('dh'); +INSERT INTO t1 (a00) VALUES ('di'); +INSERT INTO t1 (a00) VALUES ('dj'); + +INSERT INTO t1 (a00) VALUES ('dk'); +INSERT INTO t1 (a00) VALUES ('dl'); +INSERT INTO t1 (a00) VALUES ('dm'); +INSERT INTO t1 (a00) VALUES ('dn'); +INSERT INTO t1 (a00) VALUES ('do'); +INSERT INTO t1 (a00) VALUES ('dp'); +INSERT INTO t1 (a00) VALUES ('dq'); + +INSERT INTO t1 (a00) VALUES ('dr'); +INSERT INTO t1 (a00) VALUES ('ds'); +INSERT INTO t1 (a00) VALUES ('dt'); +INSERT INTO t1 (a00) VALUES ('du'); +INSERT INTO t1 (a00) VALUES ('dv'); +INSERT INTO t1 (a00) VALUES ('dw'); +INSERT INTO t1 (a00) VALUES ('dx'); + +INSERT INTO t1 (a00) VALUES ('dy'); +INSERT INTO t1 (a00) VALUES ('dz'); +INSERT INTO t1 (a00) VALUES ('ea'); +INSERT INTO t1 (a00) VALUES ('eb'); +INSERT INTO t1 (a00) VALUES ('ec'); +INSERT INTO t1 (a00) VALUES ('ed'); +INSERT INTO t1 (a00) VALUES ('ee'); + +INSERT INTO t1 (a00) VALUES ('ef'); +INSERT INTO t1 (a00) VALUES ('eg'); +INSERT INTO t1 (a00) VALUES ('eh'); +INSERT INTO t1 (a00) VALUES ('ei'); +INSERT INTO t1 (a00) VALUES ('ej'); +INSERT INTO t1 (a00) VALUES ('ek'); +INSERT INTO t1 (a00) VALUES ('el'); +# Split also at level 1 (1-4-18) +# (aa,ar,co,el) +# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co,cv,dc,dj,dq,dx,ee) (el) +# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co..)(cv..)(dc..)(dj..)(dq..)(dx..)(ee..)(el) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +INSERT INTO t1 (a00) VALUES ('em'); +INSERT INTO t1 (a00) VALUES ('en'); +INSERT INTO t1 (a00) VALUES ('eo'); +INSERT INTO t1 (a00) VALUES ('ep'); +INSERT INTO t1 (a00) VALUES ('eq'); +INSERT INTO t1 (a00) VALUES ('er'); +INSERT INTO t1 (a00) VALUES ('es'); + +INSERT INTO t1 (a00) VALUES ('et'); +INSERT INTO t1 (a00) VALUES ('eu'); +INSERT INTO t1 (a00) VALUES ('ev'); +INSERT INTO t1 (a00) VALUES ('ew'); +INSERT INTO t1 (a00) VALUES ('ex'); +INSERT INTO t1 (a00) VALUES ('ey'); +INSERT INTO t1 (a00) VALUES ('ez'); + +INSERT INTO t1 (a00) VALUES ('fa'); +INSERT INTO t1 (a00) VALUES ('fb'); +INSERT INTO t1 (a00) VALUES ('fc'); +INSERT INTO t1 (a00) VALUES ('fd'); +INSERT INTO t1 (a00) VALUES ('fe'); +INSERT INTO t1 (a00) VALUES ('ff'); +INSERT INTO t1 (a00) VALUES ('fg'); + +INSERT INTO t1 (a00) VALUES ('fh'); +INSERT INTO t1 (a00) VALUES ('fi'); +INSERT INTO t1 (a00) VALUES ('fj'); +INSERT INTO t1 (a00) VALUES ('fk'); +INSERT INTO t1 (a00) VALUES ('fl'); +INSERT INTO t1 (a00) VALUES ('fm'); +INSERT INTO t1 (a00) VALUES ('fn'); + +INSERT INTO t1 (a00) VALUES ('fo'); +INSERT INTO t1 (a00) VALUES ('fp'); +INSERT INTO t1 (a00) VALUES ('fq'); +INSERT INTO t1 (a00) VALUES ('fr'); +INSERT INTO t1 (a00) VALUES ('fs'); +INSERT INTO t1 (a00) VALUES ('ft'); +INSERT INTO t1 (a00) VALUES ('fu'); + +INSERT INTO t1 (a00) VALUES ('fv'); +INSERT INTO t1 (a00) VALUES ('fw'); +INSERT INTO t1 (a00) VALUES ('fx'); +INSERT INTO t1 (a00) VALUES ('fy'); +INSERT INTO t1 (a00) VALUES ('fz'); +INSERT INTO t1 (a00) VALUES ('ga'); +INSERT INTO t1 (a00) VALUES ('gb'); + +INSERT INTO t1 (a00) VALUES ('gc'); +INSERT INTO t1 (a00) VALUES ('gd'); +INSERT INTO t1 (a00) VALUES ('ge'); +INSERT INTO t1 (a00) VALUES ('gf'); +INSERT INTO t1 (a00) VALUES ('gg'); +INSERT INTO t1 (a00) VALUES ('gh'); + + +# Current tree form (1-4-24) +# (aa,ar,co,el) +# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co,cv,dc,dj,dq,dx,ee) (el..,gb) +# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co..)(cv..)(dc..)(dj..)(dq..)(dx..)(ee..)(el..)..(gb..) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + + +# Insert the rest of records normally +SET GLOBAL innodb_limit_optimistic_insert_debug = 0; + + +--echo # Test start + +# (1) Insert records to leaf page (bf..) and cause modify_page. +# - root page is not X latched +# - latched from level 1 page (ar,ay,bf,bm,bt,ca,ch) + +SET DEBUG_SYNC = 'RESET'; + +# Filling leaf page (bf..) +INSERT INTO t1 (a00) VALUES ('bfa'); + +--connection con1 +SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; +# Cause modify_tree +--send +INSERT INTO t1 (a00) VALUES ('bfb'); + +--connection con2 +SET DEBUG_SYNC = 'now WAIT_FOR reached'; +# Not blocked searches +SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; +SELECT a00,a01 FROM t1 WHERE a00 = 'aq'; +# "where a00 = 'co'" is blocked because searching from smaller ('co','a','a',..). +SELECT a00,a01 FROM t1 WHERE a00 = 'cp'; +SELECT a00,a01 FROM t1 WHERE a00 = 'el'; + +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +# Blocked +--send +SELECT a00,a01 FROM t1 WHERE a00 = 'ar'; + +--connection con3 +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +# Blocked +--send +SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; + +--connection default +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection con1 +--reap + +--connection con2 +--reap + +--connection con3 +--reap + +--connection default + +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + + +# (2) Insert records to leaf page (cv..) and cause modify_page +# - root page is X latched, because node_ptr for 'cv' +# is 2nd record for (co,cv,dc,dj,dq,dx,ee) +# +# * ordinary pessimitic insert might be done by pessistic update +# and we should consider possibility node_ptr to be deleted. + +SET DEBUG_SYNC = 'RESET'; + +# Filling leaf page (cv..) +INSERT INTO t1 (a00) VALUES ('cva'); + +--connection con1 +SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; +# Cause modify_tree +--send +INSERT INTO t1 (a00) VALUES ('cvb'); + +--connection con2 +SET DEBUG_SYNC = 'now WAIT_FOR reached'; +# All searches are blocked because root page is X latched + +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +# Blocked +--send +SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; + +--connection con3 +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +# Blocked +--send +SELECT a00,a01 FROM t1 WHERE a00 = 'el'; + +--connection default +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection con1 +--reap + +--connection con2 +--reap + +--connection con3 +--reap + +--connection default + +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + + +# (3) Insert records to rightmost leaf page (gb..) and cause modify_page +# - root page is not X latched, because node_ptr for 'gb' is the last record +# of the level 1 though it is last record in the page. +# - lathed from level 1 page (el..,gb) + +SET DEBUG_SYNC = 'RESET'; + +# Filling leaf page (gb..) +INSERT INTO t1 (a00) VALUES ('gba'); + +--connection con1 +SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; +# Cause modify_tree +--send +INSERT INTO t1 (a00) VALUES ('gbb'); + +--connection con2 +SET DEBUG_SYNC = 'now WAIT_FOR reached'; +# Not blocked searches +SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; +SELECT a00,a01 FROM t1 WHERE a00 = 'ek'; + +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +# Blocked +--send +SELECT a00,a01 FROM t1 WHERE a00 = 'el'; + +--connection con3 +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +# Blocked +--send +SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; + +--connection default +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection con1 +--reap + +--connection con2 +--reap + +--connection con3 +--reap + +--connection default +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + + +# Cleanup +SET DEBUG_SYNC = 'RESET'; + +--connection default +--disconnect con1 +--disconnect con2 +--disconnect con3 + +DROP TABLE t1; + +--disable_query_log +SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; +SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent; +--enable_query_log + +# Wait till all disconnects are completed. +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/innodb_wl6326_big.test b/mysql-test/suite/innodb/t/innodb_wl6326_big.test new file mode 100644 index 00000000000..6d4b07e7cb6 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_wl6326_big.test @@ -0,0 +1,716 @@ +# This is a script for MTR with hybrid use. +# a) As regression test +# Mostly some brute force attempt to stress the internal sx locks of +# InnoDB which were introduced by WL#6326+WL#6363. +# The file with expected results fits to this variant. +# The impact on code coverage is quite good. +# b) As testbed for attempts to extend or improve the RQG test wl6326_sql.yy. +# The MTR based test uses +# - a table t1 with the same layout +# - the same stored functions +# - the same stored procedure proc_fill_t1 for inserting a configurable +# amount of records into t1 +# like the RQG test wl6326_sql.yy. +# Feel free to modify parameters like $max_row_count, $max_con, +# $high_load_duration or switch debugging on (let $test_debug= 1). +# But please be aware that MTR will most probably report that the test +# failed because it got a difference to expected results. +# Reasons: +# - In general: The file with expected results fits to a) only. +# - The actual results might dependend on $max_row_count. +# - Additional result sets might be printed. +# + +# WL#6326 is about the sx locks (InnoDB feature only). +--source include/have_innodb.inc +# Runtime properties: +# Notebook i5 dual core with HT, MySQL binaries compiled with debug, +# max_row_count=10000 rows +# vardir on tmpfs : ~ 375 +# vardir on disk : ~ 546 +--source include/big_test.inc +# We go with "--send" and "--reap" and that fails with the embedded server. +--source include/not_embedded.inc +# Its intentional to not take the risk that a run with valgrind times out. +--source include/not_valgrind.inc + +# FIXME: +# Increase the code coverage provided by the current test by +# trying "InnoDB Tablespace Monitor" as soon as some bug is fixed +# or wait till the deprecated "InnoDB Tablespace Monitor" is +# removed. + +# Setup of some parameters +# ------------------------ +# Number of records within every chunk to be added to t1. +let $load_unit= 10000; +# +# Rough number of records in t1 to achieve. +# We add chunks of $load_unit rows till the actual number +# of rows in the table t1 exceeds $max_row_count. +# let $max_row_count= 1000000; +# let $max_row_count= 300000; +# let $max_row_count= 100000; +# let $max_row_count= 30000; + let $max_row_count= 10000; # ~ 322s on tmpfs (NB) +# +# Determine which variant to run. +let $test_debug= 0; +# +# Number of concurrent sessions to be used in the high load test. +let $max_con= 10; +# Duration of the high load test in seconds. +let $high_load_duration= 60; + +# Putting all objects into the SCHEMA my_schema makes the final cleanup easier. +# We simply run than DROP SCHEMA my_schema. +CREATE SCHEMA my_schema; +USE my_schema; +CREATE FUNCTION f_thread_id (i INT) RETURNS CHAR(4) DETERMINISTIC +RETURN CONCAT(LPAD(CAST(i AS CHAR),3,'_'),'_') ; +SELECT CONCAT('->', f_thread_id( 1), '<-'); +SELECT CONCAT('->', f_thread_id(12), '<-'); + +# Definition of parameters used in functions. +# We use here a "1" in order to make the impact on the results of the functions +# good visible. +SET @extra_int = 1; +SET @extra_string = f_thread_id(@extra_int); +SELECT @extra_int , @extra_string; + +# The different functions are used later when filling t1 and also during +# RQG testing. They serve to generate the difference between column values +# in different rows in different areas of the column. +# Fictional example: +# row 1 col_int0=1 colx='1abcdefgh' coly='abcd1efgh' colz='abcdefgh1' +# row 2 col_int0=2 colx='2abcdefgh' coly='abcd2efgh' colz='abcdefgh2' +# The function f_ is for the column with the name . +# There is a function +# - for every column except col_int0 +# - even if the SQL for generating the value is simple. +# The reason for this is the architecture of the RQG test. + +let $part= AS my_result +FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123 +UNION SELECT 1234 UNION SELECT 12345) AS tx; + +let $function_name= f_col_int1; +eval CREATE FUNCTION $function_name (i INT) RETURNS INT(20) DETERMINISTIC +RETURN i * 1000 + @extra_int ; +eval SELECT $function_name(my_col) $part; + +let $function_name= f_col_int2; +eval CREATE FUNCTION $function_name (i INT) RETURNS INT(20) DETERMINISTIC +RETURN @extra_int * 10000000 + i ; +eval SELECT $function_name(my_col) $part; + +let $function_name= f_col_int3; +eval CREATE FUNCTION $function_name (i INT) RETURNS INT(20) DETERMINISTIC +RETURN @extra_int ; +eval SELECT $function_name(my_col) $part; + +let $function_name= f_col_blob; +eval CREATE FUNCTION $function_name (i INT) RETURNS BLOB DETERMINISTIC +RETURN RPAD(@extra_string,(@@innodb_page_size / 2 ) + 1,'a'); +eval SELECT CONCAT('->', SUBSTR($function_name(my_col) FROM 1 FOR 10), + '<-.....->', SUBSTR($function_name(my_col) FROM -10 FOR 10), '<-') $part; + +let $function_name= f_col_char0; +eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(255) DETERMINISTIC +RETURN LPAD(CAST(i AS CHAR),255,' '); +eval SELECT CONCAT('->', $function_name(my_col), '<-') $part; + +let $function_name= f_col_char1; +eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B', + LPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '), + @extra_string, + RPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '), + 'E') ; +eval SELECT CONCAT('->', $function_name(my_col), '<-') $part; + +let $function_name= f_col_char2; +eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B', + RPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '), + @extra_string, + LPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '), + 'E'); +eval SELECT CONCAT('->', $function_name(my_col), '<-') $part; + +let $function_name= f_col_char3; +eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B',@extra_string,LPAD(CAST(i AS CHAR),20,' '),'E'); +eval SELECT CONCAT('->', $function_name(my_col), '<-') $part; + +let $function_name= f_col_char4; +eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC +RETURN +CONCAT('B',RPAD(CAST(i AS CHAR),20,' '),@extra_string,'E'); +eval SELECT CONCAT('->', $function_name(my_col), '<-') $part; + +# Auxiliary table for figuring out the impact of scenarios on +# information_schema.innodb_metrics content. +CREATE TABLE my_metrics LIKE information_schema.innodb_metrics; +ALTER TABLE my_metrics ADD COLUMN phase ENUM('after', 'before'), +DROP COLUMN SUBSYSTEM, DROP COLUMN TYPE, DROP COLUMN COMMENT, +ADD PRIMARY KEY (NAME,phase); +let $empty_my_metrics= DELETE FROM my_metrics; +let $before_my_metrics= INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'before' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +let $after_my_metrics= INSERT INTO my_metrics +SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, +STATUS, 'after' +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%'; +let $print_metrics= SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, +COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, +TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, STATUS +FROM information_schema.innodb_metrics +WHERE NAME LIKE 'innodb_rwlock_sx_%' +ORDER BY NAME; + +# The main table for testing. +CREATE TABLE t1 ( + col_int0 BIGINT, + col_int1 BIGINT, + col_int2 BIGINT, + col_int3 BIGINT, + col_blob BLOB, + col_char0 VARCHAR(255), + col_char1 VARCHAR(30), + col_char2 VARCHAR(30), + col_char3 VARCHAR(30), + col_char4 VARCHAR(30) +) ENGINE = InnoDB; + +# Use many indexes with mostly significant size in order to cause +# some heavy use of sx locks during data generation. +ALTER TABLE t1 ADD UNIQUE KEY uidx_col_int0 (col_int0), +ADD UNIQUE KEY uidx1 (col_int1, col_char0), +ADD UNIQUE KEY uidx2 (col_int2, col_char0, col_int1), +ADD UNIQUE KEY uidx3 (col_int3, col_int2, col_char0), +ADD UNIQUE KEY uidx4 (col_char1, col_char0), +ADD UNIQUE KEY uidx5 (col_char2, col_char0, col_char1), +ADD UNIQUE KEY uidx6 (col_char3, col_char2, col_char0), +ADD UNIQUE KEY uidx7 (col_int1, col_int2, col_int3, col_char4, + col_char1, col_char2, col_char3, col_char0), +ADD KEY idx8 (col_blob(10), col_char4); + +delimiter |; +CREATE PROCEDURE proc_fill_t1 (max_row_count INT, load_unit INT) +BEGIN + DECLARE my_count INTEGER DEFAULT 0; + DECLARE max_load_count INTEGER DEFAULT 0; + DROP TABLE IF EXISTS t0; + CREATE TEMPORARY TABLE t0 (col_int0 BIGINT, PRIMARY KEY(col_int0)); + WHILE (my_count < load_unit ) DO + SET my_count = my_count + 1; + INSERT INTO t0 SET col_int0 = my_count; + END WHILE; + SET max_load_count = (SELECT (max_row_count DIV load_unit) + 1 ); + SELECT COUNT(col_int0) INTO @val FROM t1; + SET my_count = 0; + REPEAT + INSERT INTO t1 (col_int0, col_int1, col_int2, col_int3, col_blob, + col_char0, col_char1, col_char2,col_char3,col_char4) + SELECT col_int0 + @val, + f_col_int1(col_int0 + @val), + f_col_int2(col_int0 + @val), + f_col_int3(col_int0 + @val), + f_col_blob(col_int0 + @val), + f_col_char0(col_int0 + @val), + f_col_char1(col_int0 + @val), + f_col_char2(col_int0 + @val), + f_col_char3(col_int0 + @val), + f_col_char4(col_int0 + @val) + FROM t0; + COMMIT; + SELECT MAX(col_int0) INTO @val FROM t1; + SET my_count = my_count + 1; + UNTIL( my_count > max_load_count OR @val >= max_row_count ) + END REPEAT; + DROP TEMPORARY TABLE t0; +END| +delimiter ;| + +delimiter |; +CREATE PROCEDURE proc_dml (max_duration INT, t1_stripe_half INT) +BEGIN + DECLARE aux INTEGER DEFAULT 0; + DECLARE start_time INT; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND BEGIN END; + + SET @extra_int = CONNECTION_ID(); + SET @extra_string = f_thread_id(@extra_int); + SELECT ROUND(MAX(col_int0) / 2 ) INTO @t1_half FROM t1; + # The user lock 'Blocker' should be already set by some other session S1. + # S1 starts the race by releasing that lock. + # Wait till the lock is released and the lock can be obtained. + # In order to prevent endless waiting in case of non foreseen problems + # limit the timespan to 30 seconds. + SELECT GET_LOCK('Blocker', 30) INTO @aux; + # Release the lock immediate so that the other "runner" sessions start too. + SELECT RELEASE_LOCK('Blocker') INTO @aux; + SET start_time = UNIX_TIMESTAMP(); + + WHILE (UNIX_TIMESTAMP() - start_time < max_duration) DO + SET @aux = @t1_half - t1_stripe_half + ROUND(RAND() * t1_stripe_half * 2); + UPDATE t1 SET + col_int1 = f_col_int1(col_int0), + col_int2 = f_col_int2(col_int0), + col_int3 = f_col_int3(col_int0), + col_blob = f_col_blob(col_int0), + col_char0 = f_col_char0(col_int0), + col_char1 = f_col_char1(col_int0), + col_char2 = f_col_char2(col_int0), + col_char3 = f_col_char3(col_int0), + col_char4 = f_col_char4(col_int0) + WHERE col_int0 = @aux; + COMMIT; + END WHILE; +END| +delimiter ;| + +SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%"; +SET @pre_reset_ts = NOW(); +--sleep 1.1 +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; +SET @pre_enable_ts = NOW(); +--sleep 1.1 +SET GLOBAL innodb_monitor_enable = "innodb_rwlock_sx_%"; +--sleep 1.1 +SET @pre_collect_ts = NOW(); +eval $empty_my_metrics; +eval $before_my_metrics; +--echo # TC-01 There are exact three entries "innodb_rwlock_sx_%" with the +--echo # with the name which follow in innodb_metrics. +let $check_statement= +SELECT COUNT(*) <> 3 FROM my_metrics +WHERE NAME IN ('innodb_rwlock_sx_spin_waits', + 'innodb_rwlock_sx_spin_rounds', + 'innodb_rwlock_sx_os_waits'); +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT NAME FROM my_metrics + ORDER BY NAME; + exit; +} +--echo # pass + +SELECT COUNT(*) INTO @sx_count FROM my_metrics; + +--echo # TC-02 Counting is now enabled. ALL = @sx_count entries show that. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE STATUS = 'enabled'; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT NAME, STATUS FROM my_metrics + ORDER BY NAME; + exit; +} +--echo # pass + +--echo # TC-03 @pre_reset_ts < TIME_RESET. ALL = @sx_count entries show that. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE @pre_reset_ts < TIME_RESET; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT NAME, @pre_reset_ts, TIME_RESET FROM my_metrics + ORDER BY NAME; + exit; +} +--echo # pass + +--echo # TC-04 @pre_enable_ts < TIME_ENABLED. ALL = @sx_count entries show that. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE @pre_enable_ts < TIME_ENABLED; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT NAME, @pre_enable_ts, TIME_ENABLED FROM my_metrics + ORDER BY NAME; + exit; +} +--echo # pass + +--echo # TC-05 TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts +--echo # AND TIME_ELAPSED > 0. ALL = @sx_count entries show that. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts + AND TIME_ELAPSED > 0; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT NAME, @pre_collect_ts, TIME_RESET, TIME_ENABLED, TIME_ELAPSED + FROM my_metrics + ORDER BY NAME; + exit; +} +--echo # pass + +--echo # TC-06 COUNT_RESET = MAX_COUNT_RESET. ALL = @sx_count entries show that. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE COUNT_RESET = MAX_COUNT_RESET; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT NAME, COUNT_RESET, MAX_COUNT_RESET FROM my_metrics + ORDER BY NAME; + exit; +} +--echo # pass + +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; +--disable_result_log +if($test_debug) +{ + --enable_result_log + eval $print_metrics; +} +SHOW ENGINE INNODB STATUS; +--enable_result_log + +eval $empty_my_metrics; +eval $before_my_metrics; +# These values (the "0") help to identify later if some record is in its +# initial state or already modified. +SET @extra_string = '__0_'; +SET @extra_int = 0; + +--echo # TC-07 One session inserts some significant amount of rows into t1. +--echo # The system MUST survive that. +--replace_result $max_row_count +eval SET @max_row_count = $max_row_count; +--replace_result $load_unit +eval SET @load_unit = $load_unit; +SET @start_time = UNIX_TIMESTAMP(); +SET AUTOCOMMIT = OFF; +CALL proc_fill_t1 (@max_row_count, @load_unit); +--echo # pass +SET AUTOCOMMIT = ON; +SELECT col_int0 INTO @t1_half FROM t1 +WHERE col_int0 >= (@val DIV 2) ORDER BY col_int0 LIMIT 1; + +--disable_result_log +if($test_debug) +{ + --enable_result_log + SELECT COUNT(*) AS table_row_count, + UNIX_TIMESTAMP() - @start_time AS fill_run_time + FROM t1; + eval $print_metrics; +} +SHOW ENGINE INNODB STATUS; +--enable_result_log + +# Show that the value distribution is according to the plan. +--vertical_results +SELECT col_int0, col_int1, col_int2, col_int3, + CONCAT('->', SUBSTR(col_blob FROM 1 FOR 10), + '<-.....->', SUBSTR(col_blob FROM -10 FOR 10), '<-') AS col_blobx, + CONCAT('->',col_char0,'<-') AS col_char0x, + CONCAT('->',col_char1,'<-') AS col_char1x, + CONCAT('->',col_char2,'<-') AS col_char2x, + CONCAT('->',col_char3,'<-') AS col_char3x, + CONCAT('->',col_char4,'<-') AS col_char4x +FROM t1 WHERE col_int0 between 98 AND 102; +--horizontal_results + +# For experiments/interest only. Please do not remove that. +if (0) +{ + ANALYZE TABLE t1; + SELECT n_rows, clustered_index_size, sum_of_other_index_sizes + FROM mysql.innodb_table_stats; + + # SELECT * FROM mysql.innodb_index_stats; + # idx_col_int3_int0 n_diff_pfx01 1 col_int3 + # idx_col_int3_int0 n_diff_pfx02 10000 col_int3,col_int0 + # idx_col_int3_int0 n_diff_pfx03 10000 col_int3,col_int0,DB_ROW_ID + # idx_col_int3_int0 n_leaf_pages 19 Number of leaf pages in the index + # idx_col_int3_int0 size 20 Number of pages in the index + + --vertical_results + SELECT t1.index_name, t1.stat_value AS idx_pages, t2.stat_value AS idx_leaf_pages, + (t1.stat_value - t2.stat_value - 1) / t1.stat_value AS sx_page_ratio + FROM mysql.innodb_index_stats t1, mysql.innodb_index_stats t2 + WHERE t1.index_name = t2.index_name + AND t1.stat_name = 'size' AND t2.stat_name = 'n_leaf_pages' + ORDER BY t1.index_name; + --horizontal_results +} + +--echo # TC-11 Several concurrent sessions perform updates in t1 like mad. +--echo # The system MUST survive this. +--echo # Printing of statements is partially suppressed. +SET @start_time = UNIX_TIMESTAMP(); +SELECT 1 FROM t1 WHERE col_int0 = @t1_half FOR UPDATE; +SELECT GET_LOCK('Blocker', 1000) ; +--disable_query_log +let $num= $max_con; +while ($num) +{ + --connect (con$num,localhost,root,,) + USE my_schema; + # The second parameter of the procedure is size of the affected stripe / 2. + # A smaller stripe causes some smaller counter growth but most probably + # also more stress around locking in general. + # Example # (nnnn) = half stripe size + # NAME | COUNT_RESET (5000) | COUNT_RESET (100) + # -----------------------------+--------------------+---------------- + # innodb_rwlock_sx_os_waits | 1412 | 486 + # innodb_rwlock_sx_spin_rounds | 44061 | 17031 + # innodb_rwlock_sx_spin_waits | 996 | 515 + --send + eval CALL proc_dml($high_load_duration,@t1_half); + dec $num; +} +--connection default +SELECT RELEASE_LOCK('Blocker') ; +--sleep 3 +COMMIT; +let $num= $max_con; +while ($num) +{ + --connection con$num + --reap + dec $num; +} +--echo # pass +--connection default +--enable_query_log + +# let $wait_timeout= 181; +# --source include/wait_condition.inc +# eval $after_my_metrics; +--disable_result_log +if($test_debug) +{ + --enable_result_log + SELECT UNIX_TIMESTAMP() - @start_time AS update_battle_run_time; + eval $print_metrics; +} +SHOW ENGINE INNODB STATUS; +--enable_result_log + +--echo # TC-13 One session performs ALTER TABLE t1 ADD KEY ... on the fat table t1. +--echo # The system MUST survive this. +SET @start_time = UNIX_TIMESTAMP(); +ALTER TABLE t1 ADD KEY idx_col_char4_col_char0 (col_char4,col_char0); +--disable_result_log +if($test_debug) +{ + --enable_result_log + SELECT UNIX_TIMESTAMP() - @start_time AS add_key_run_time; + eval $print_metrics; +} +SHOW ENGINE INNODB STATUS; +--enable_result_log +--echo # pass + +--echo # TC-15 One session performs a fat update on the fat table t1. +--echo # The system MUST survive this. +SET @start_time = UNIX_TIMESTAMP(); +SET @extra_int = 13; +SET @extra_string = f_thread_id(@extra_int); +eval UPDATE t1 SET + col_int1 = f_col_int1(col_int0), col_int2 = f_col_int2(col_int0), + col_int3 = f_col_int3(col_int0), col_blob = f_col_blob(col_int0), + col_char0 = f_col_char0(col_int0), col_char1 = f_col_char1(col_int0), + col_char2 = f_col_char2(col_int0), col_char3 = f_col_char3(col_int0), + col_char4 = f_col_char4(col_int0) +WHERE col_int0 BETWEEN @t1_half - 2500 AND @t1_half + 2500; +COMMIT; +--disable_result_log +if($test_debug) +{ + --enable_result_log + SELECT UNIX_TIMESTAMP() - @start_time AS total_update_run_time; + eval $print_metrics; +} +SHOW ENGINE INNODB STATUS; +--enable_result_log +--echo # pass + +# Basically every of the big activities causes some counter growth. +# But caused by +# - the architecture of InnoDB (certain things happen asynchronous) +# - the actual test configuration (server/InnoDB options) +# - conditions like parallel (./mtr --parallel=auto?) load on the testing box +# this might be not fulfilled per single big activity every time except +# we go with huge waits or similar. +# Observation: +# - non debug binaries: expectation frequent not fulfilled +# - debug binaries: expectation rare not fulfilled +# +let $wait_timeout= 121; +let $wait_condition= +SELECT COUNT(*) = @sx_count +FROM information_schema.innodb_metrics t_after +JOIN my_metrics t_before +ON t_after.COUNT_RESET > t_before.COUNT_RESET AND t_after.NAME = t_before.NAME; +--source include/wait_condition.inc +eval $after_my_metrics; + +--echo # TC-16 The following activities happend after reset in innodb_metrics +--echo # - Insert some significant amount of rows into t1. +--echo # - Several concurrent users perform excessive updates in t1. +--echo # - ALTER TABLE ... ADD KEY +--echo # - One UPDATE statement modifying a huge slice of t1. +--echo # Any of them causes heavy use of SX lock and therefore COUNT_RESET +--echo # must have grown for ALL = @sx_count entries. +# The former testcases TC-10 and TC12 had to be made a part of this testcase +# because their results were unstable. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics t_after JOIN my_metrics t_before +ON t_after.COUNT_RESET > t_before.COUNT_RESET AND t_after.NAME = t_before.NAME +WHERE t_after.phase = 'after' AND t_before.phase = 'before'; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT * FROM my_metrics + ORDER BY NAME, phase; + exit; +} +--echo # pass + +--echo # TC-09 Heavy activity after reset. +--echo # COUNT_RESET = MAX_COUNT_RESET for ALL = @sx_count entries +--echo # needs to stay valid though he counters will have grown. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE phase = 'after' AND COUNT_RESET = MAX_COUNT_RESET; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT * FROM my_metrics + ORDER BY NAME, phase; + exit; +} +--echo # pass + +eval $empty_my_metrics; +eval $before_my_metrics; +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; +eval $after_my_metrics; +--echo # TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL +--echo # = @sx_count entries. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE phase = 'before' AND COUNT_RESET = MAX_COUNT_RESET; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT * FROM my_metrics + ORDER BY NAME, phase; + exit; +} +--echo # pass + +--echo # TC-17 We had heavy activity causing big counters and after that a reset. +--echo # Reset causes COUNT > COUNT_RESET AND MAX_COUNT > MAX_COUNT_RESET +--echo # for ALL @sx_count entries. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics +WHERE phase = 'after' + AND COUNT > COUNT_RESET + AND MAX_COUNT > MAX_COUNT_RESET; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT * FROM my_metrics + ORDER BY NAME, phase; + exit; +} +--echo # pass + +--echo # TC-18 We had some reset but this must not decrease COUNT or MAX_COUNT +--echo # after.COUNT >= before.COUNT AND +--echo # after.MAX_COUNT >= before.MAX_COUNT for ALL @sx_count entries. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics t_after JOIN my_metrics t_before +ON t_after.COUNT >= t_before.COUNT AND t_after.MAX_COUNT >= t_before.MAX_COUNT + AND t_after.NAME = t_before.NAME +WHERE t_after.phase = 'after' AND t_before.phase = 'before'; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT * FROM my_metrics + ORDER BY NAME, phase; + exit; +} +--echo # pass + +--echo # TC-19 We had some reset after heavy activity and this must cause +--echo # after.COUNT_RESET < before.COUNT_RESET +--echo # AND after.MAX_COUNT_RESET < before.MAX_COUNT_RESET AND +--echo # for ALL @sx_count entries. +let $check_statement= +SELECT COUNT(*) <> @sx_count FROM my_metrics t_after JOIN my_metrics t_before +ON t_after.COUNT_RESET < t_before.COUNT_RESET + AND t_after.MAX_COUNT_RESET < t_before.MAX_COUNT_RESET + AND t_after.NAME = t_before.NAME +WHERE t_after.phase = 'after' AND t_before.phase = 'before'; +if(`$check_statement`) +{ + --echo # fail + eval $check_statement; + SELECT * FROM my_metrics + ORDER BY NAME, phase; + exit; +} +--echo # pass + +# Cleanup +let $num= $max_con; +while ($num) +{ + --connection con$num + --disconnect con$num + --source include/wait_until_disconnected.inc + dec $num; +} +--connection default +USE test; +DROP SCHEMA my_schema; +SET GLOBAL innodb_monitor_disable = all; +SET GLOBAL innodb_monitor_reset_all = all; +--disable_warnings +SET GLOBAL innodb_monitor_enable = default; +SET GLOBAL innodb_monitor_disable = default; +SET GLOBAL innodb_monitor_reset = default; +SET GLOBAL innodb_monitor_reset_all = default; +--enable_warnings +SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%"; +SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; + From 3e38d15585f03e794a83a1d141ead33e8c878f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Jan 2020 10:37:25 +0200 Subject: [PATCH 26/43] MDEV-21509 Possible hang during purge of history, or rollback WL#6326 in MariaDB 10.2.2 introduced a potential hang on purge or rollback when an index tree is being shrunk by multiple levels. This fix is based on mysql/mysql-server@f2c58526300c0d84837effa26d37cbd5d2694967 with the main difference that our version of the test case uses DEBUG_SYNC instrumentation on ROLLBACK, not on purge. btr_cur_will_modify_tree(): Simplify the check further. This is the actual bug fix. row_undo_mod_remove_clust_low(), row_undo_mod_clust(): Add DEBUG_SYNC instrumentation for the test case. --- .../suite/innodb/r/innodb_bug30113362.result | 119 +++++++++ .../suite/innodb/r/innodb_wl6326.result | 4 +- .../suite/innodb/t/innodb_bug30113362.opt | 1 + .../suite/innodb/t/innodb_bug30113362.test | 236 ++++++++++++++++++ mysql-test/suite/innodb/t/innodb_wl6326.test | 12 +- storage/innobase/btr/btr0cur.cc | 80 +++--- storage/innobase/include/page0page.h | 20 +- storage/innobase/include/page0page.ic | 24 +- storage/innobase/row/row0umod.cc | 16 +- 9 files changed, 464 insertions(+), 48 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug30113362.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug30113362.opt create mode 100644 mysql-test/suite/innodb/t/innodb_bug30113362.test diff --git a/mysql-test/suite/innodb/r/innodb_bug30113362.result b/mysql-test/suite/innodb/r/innodb_bug30113362.result new file mode 100644 index 00000000000..64f20650a6b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug30113362.result @@ -0,0 +1,119 @@ +SET GLOBAL innodb_adaptive_hash_index = false; +SET GLOBAL innodb_stats_persistent = false; +connect purge_control,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect con2,localhost,root,,; +CREATE TABLE t1 ( +a00 CHAR(255) NOT NULL DEFAULT 'a', +a01 CHAR(255) NOT NULL DEFAULT 'a', +a02 CHAR(255) NOT NULL DEFAULT 'a', +b INT NOT NULL DEFAULT 0, +CONSTRAINT pkey PRIMARY KEY(a00, a01, a02) +) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45'; +SET GLOBAL innodb_limit_optimistic_insert_debug = 3; +CREATE PROCEDURE data_load_t1() +BEGIN +DECLARE c1 INT DEFAULT 97; +DECLARE c2 INT DEFAULT 97; +DECLARE c3 INT DEFAULT 97; +WHILE c1 < 102 DO +WHILE c2 < 123 DO +WHILE c3 < 123 DO +INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3)); +SET c3 = c3 + 1; +END WHILE; +SET c3 = 97; +SET c2 = c2 + 1; +END WHILE; +SET c2 = 97; +SET c1 = c1 + 1; +END WHILE; +END | +call data_load_t1(); +DROP PROCEDURE data_load_t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1856 +connection con2; +DELETE FROM t1 WHERE a00 = 'cnm'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'cnm'; +connection purge_control; +COMMIT; +connection con2; +SET GLOBAL innodb_limit_optimistic_insert_debug = 0; +ROLLBACK; +# Test start +connection purge_control; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con2; +DELETE FROM t1 WHERE a00 = 'bii'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'bii'; +SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2'; +SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume'; +ROLLBACK; +connection purge_control; +SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; +COMMIT; +SET DEBUG_SYNC = 'now SIGNAL roll2'; +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting'; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +SELECT a00 FROM t1 WHERE a00 = 'bii'; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now SIGNAL resume'; +connection con1; +a00 +connection con2; +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1856 +DELETE FROM t1 WHERE a00 = 'dpn'; +COMMIT; +INSERT INTO t1 SET a00 = 'dpn'; +ROLLBACK; +ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35'; +connection purge_control; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con2; +DELETE FROM t1 WHERE a00 = 'cnd'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'cnd'; +SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2'; +SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2'; +ROLLBACK; +connection purge_control; +SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SET DEBUG_SYNC = 'now SIGNAL roll2'; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +SET DEBUG_SYNC = 'now SIGNAL resume'; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +disconnect purge_control; +connection default; +SET DEBUG_SYNC = 'now SIGNAL resume'; +disconnect con1; +connection con2; +disconnect con2; +connection default; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; +CLUST_INDEX_SIZE +1856 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_wl6326.result b/mysql-test/suite/innodb/r/innodb_wl6326.result index 84620ddc04d..8abd42be36f 100644 --- a/mysql-test/suite/innodb/r/innodb_wl6326.result +++ b/mysql-test/suite/innodb/r/innodb_wl6326.result @@ -299,10 +299,10 @@ SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME CLUST_INDEX_SIZE 30 SET DEBUG_SYNC = 'RESET'; -INSERT INTO t1 (a00) VALUES ('cva'); +INSERT INTO t1 (a00) VALUES ('coa'); connection con1; SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; -INSERT INTO t1 (a00) VALUES ('cvb'); +INSERT INTO t1 (a00) VALUES ('cob'); connection con2; SET DEBUG_SYNC = 'now WAIT_FOR reached'; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; diff --git a/mysql-test/suite/innodb/t/innodb_bug30113362.opt b/mysql-test/suite/innodb/t/innodb_bug30113362.opt new file mode 100644 index 00000000000..99bf0e5a28b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug30113362.opt @@ -0,0 +1 @@ +--innodb-sys-tablestats diff --git a/mysql-test/suite/innodb/t/innodb_bug30113362.test b/mysql-test/suite/innodb/t/innodb_bug30113362.test new file mode 100644 index 00000000000..7c3888aaec5 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug30113362.test @@ -0,0 +1,236 @@ +# +# Test for Bug#30113362 : BTR_CUR_WILL_MODIFY_TREE() IS INSUFFICIENT FOR HIGHER TREE LEVEL +# + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_innodb_16k.inc + +--disable_query_log +SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; +SET @old_innodb_stats_persistent = @@innodb_stats_persistent; +--enable_query_log + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +SET GLOBAL innodb_adaptive_hash_index = false; +SET GLOBAL innodb_stats_persistent = false; + +connect (purge_control,localhost,root,,); +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +--connect (con2,localhost,root,,) + +CREATE TABLE t1 ( + a00 CHAR(255) NOT NULL DEFAULT 'a', + a01 CHAR(255) NOT NULL DEFAULT 'a', + a02 CHAR(255) NOT NULL DEFAULT 'a', + b INT NOT NULL DEFAULT 0, + CONSTRAINT pkey PRIMARY KEY(a00, a01, a02) +) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45'; + +# +# Prepare primary key index tree to be used for this test. +# + +SET GLOBAL innodb_limit_optimistic_insert_debug = 3; + +delimiter |; +CREATE PROCEDURE data_load_t1() +BEGIN + DECLARE c1 INT DEFAULT 97; + DECLARE c2 INT DEFAULT 97; + DECLARE c3 INT DEFAULT 97; + + WHILE c1 < 102 DO + WHILE c2 < 123 DO + WHILE c3 < 123 DO + INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3)); + SET c3 = c3 + 1; + END WHILE; + SET c3 = 97; + SET c2 = c2 + 1; + END WHILE; + SET c2 = 97; + SET c1 = c1 + 1; + END WHILE; +END | +delimiter ;| +call data_load_t1(); +DROP PROCEDURE data_load_t1; + +# all node pages are sparse (max 3 node_ptrs) +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +connection con2; +DELETE FROM t1 WHERE a00 = 'cnm'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'cnm'; +# causes "domino falling" merges to upper level +connection purge_control; +COMMIT; +connection con2; +SET GLOBAL innodb_limit_optimistic_insert_debug = 0; +ROLLBACK; + +# at this moment, in the tree, +# ... +# level 4: ...(ast,avw,ayz)(bcc,bff,bii,bll,boo,brr,buu,bxx,cba,ced,cqp,cts)(cwv,czy,ddb)... +# ... + +--echo # Test start + +# (1) Similar case to the first reported corefile at bug#30113362 +# - Deleting 'bii' causes "domino falling" merges and the node_ptr becomes left_most of level 4. +# So, the operation needs upper level pages' X-latch, though doesn't cause merge more. + +connection purge_control; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection con2; +DELETE FROM t1 WHERE a00 = 'bii'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'bii'; +SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2'; +SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume'; +send ROLLBACK; + +connection purge_control; +SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; +COMMIT; +SET DEBUG_SYNC = 'now SIGNAL roll2'; + +connect (con1,localhost,root,,); +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting'; +SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +send SELECT a00 FROM t1 WHERE a00 = 'bii'; + +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +# bug#30113362 caused deadlock +SET DEBUG_SYNC = 'now SIGNAL resume'; + +connection con1; +reap; +connection con2; +reap; +connection default; + +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + +# (2) Confirm blocking domain caused by DELETE modify_tree for tall index tree + +# at this moment, in the tree, +# ... +# level 4: ...(ajk,amn,apq)(ast,avw,ayz,bll,boo,brr,buu,bxx,cba,ced,cqp,cts)(cwv,czy,ddb)(dge,djh,dmk)(dpn,dsq,dvt)(dyw,ebz,efc)... +# ... + +# makes >17 records in level4 [(2^(4-1))*2 + 1]. (causes never left_most records) +DELETE FROM t1 WHERE a00 = 'dpn'; +COMMIT; +INSERT INTO t1 SET a00 = 'dpn'; +ROLLBACK; + +# at this moment, in the tree, +# (* before "]" and after "[" records are treated as left_most possible records) +# ... +# level 4: ...(ajk,amn,apq)(ast,avw,ayz,bll,boo,brr,buu,bxx],cba,ced,[cqp,cts,cwv,czy,ddb,dge,dsq,dvt)(dyw,ebz,efc)... +# level 3: ...(cba,ccb,cdc)(ced,cfe,cgf,chg],cih,cji,[ckj,clk,con,cpo)(cqp,crq,csr)... +# level 2: ...(ckj,cks,clb)(clk,clt],cmc,cml,cmu,cnd,[cnv,coe)(con,cow,cpf)... +# level 1: ...(cmu,cmx,cna)(cnd],cng,cnj,cnp,[cns)(cnv,cny,cob)... +# level 0: ...(cnd,cne,cnf)(cng,cnh,cni)(cnj,cnk,cnl,cnn,cno)(cnp,cnq,cnr)... + +# deletes just 'ced' node_ptr only from level 4. doesn't cause merge and never left_most. +# adjusts MERGE_THRESHOLD to do so. +ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35'; + +connection purge_control; +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +connection con2; +DELETE FROM t1 WHERE a00 = 'cnd'; +COMMIT; +BEGIN; +INSERT INTO t1 SET a00 = 'cnd'; +SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2'; +SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2'; +send ROLLBACK; + +connection purge_control; +SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SET DEBUG_SYNC = 'now SIGNAL roll2'; + +connection con1; +# FIXME: For some reason, we will not always receive these signals! +--disable_warnings +# An optimistic row_undo_mod_remove_clust_low() will fail. +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +SET DEBUG_SYNC = 'now SIGNAL resume'; +# Wait for the pessimistic row_undo_mod_remove_clust_low() attempt. +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +--enable_warnings +disconnect purge_control; + +# The expectation should be... +# level 0: (#cnd#,cne,cnf): causes merge +# level 1: (#cnd#],cng,cnj,cnp,[cns): left_most +# level 2: (clk,clt],cmc,cml,cmu,#cnd#,[cnv,coe): causes merge +# level 3: (ced,cfe,cgf,chg],cih,cji,[ckj,#clk#,con,cpo): left_most possible (not cause merge) +# level 4: (ast,avw,ayz,bll,boo,brr,buu,bxx],cba,#ced#,[cqp,cts,cwv,czy,ddb,dge,dsq,dvt): no merge, not left_most possible +# So, the top X-latch page is at level4. (ast~dvt) + +# blocking domain based on whether its ancestor is latched or not. +# (*[]: ancestor is X-latched) +# level 0: ...(asq,asr,ass) [(ast,asu,asv)...(dyt,dyu,dyv)] (dyw,dyx,dyy)... + +# Not blocked searches +## In MariaDB, both these will block, because we use different DEBUG_SYNC +## instrumentation (in rollback, not purge) and the root page (number 3) +## is being latched in row_undo_mod_remove_clust_low(). +## SELECT a00 FROM t1 WHERE a00 = 'ass'; +## SELECT a00 FROM t1 WHERE a00 = 'dyx'; + +## SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; +## send SELECT a00 FROM t1 WHERE a00 = 'ast'; + +## connection con2; +## SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; +## send SELECT a00 FROM t1 WHERE a00 = 'dyw'; + +connection default; +## SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +## SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now SIGNAL resume'; + +## connection con1; +## reap; +disconnect con1; + +connection con2; +reap; +disconnect con2; + +connection default; +ANALYZE TABLE t1; +SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1'; + + +# Cleanup +SET DEBUG_SYNC = 'RESET'; + +DROP TABLE t1; + +--disable_query_log +SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; +SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent; +--enable_query_log + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.test b/mysql-test/suite/innodb/t/innodb_wl6326.test index 7f4c5421b18..939dc1edcc8 100644 --- a/mysql-test/suite/innodb/t/innodb_wl6326.test +++ b/mysql-test/suite/innodb/t/innodb_wl6326.test @@ -373,23 +373,23 @@ SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME -# (2) Insert records to leaf page (cv..) and cause modify_page -# - root page is X latched, because node_ptr for 'cv' -# is 2nd record for (co,cv,dc,dj,dq,dx,ee) +# (2) Insert records to leaf page (co..) and cause modify_page +# - root page is X latched, because node_ptr for 'co' +# is 1st record for (co,cv,dc,dj,dq,dx,ee) # # * ordinary pessimitic insert might be done by pessistic update # and we should consider possibility node_ptr to be deleted. SET DEBUG_SYNC = 'RESET'; -# Filling leaf page (cv..) -INSERT INTO t1 (a00) VALUES ('cva'); +# Filling leaf page (co..) +INSERT INTO t1 (a00) VALUES ('coa'); --connection con1 SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; # Cause modify_tree --send -INSERT INTO t1 (a00) VALUES ('cvb'); +INSERT INTO t1 (a00) VALUES ('cob'); --connection con2 SET DEBUG_SYNC = 'now WAIT_FOR reached'; diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index f8498fa1748..97e7e3d47a2 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -583,46 +583,66 @@ btr_cur_will_modify_tree( const ulint n_recs = page_get_n_recs(page); if (lock_intention <= BTR_INTENTION_BOTH) { - ulint margin; + compile_time_assert(BTR_INTENTION_DELETE < BTR_INTENTION_BOTH); + compile_time_assert(BTR_INTENTION_BOTH < BTR_INTENTION_INSERT); - /* check delete will cause. (BTR_INTENTION_BOTH - or BTR_INTENTION_DELETE) */ - /* first, 2nd, 2nd-last and last records are 4 records */ - if (n_recs < 5) { - return(true); + if (!page_has_siblings(page)) { + return true; } - /* is first, 2nd or last record */ - if (page_rec_is_first(rec, page) - || (page_has_next(page) - && (page_rec_is_last(rec, page) - || page_rec_is_second_last(rec, page))) - || (page_has_prev(page) - && page_rec_is_second(rec, page))) { - return(true); - } + ulint margin = rec_size; if (lock_intention == BTR_INTENTION_BOTH) { + ulint level = btr_page_get_level(page, mtr); + + /* This value is the worst expectation for the node_ptr + records to be deleted from this page. It is used to + expect whether the cursor position can be the left_most + record in this page or not. */ + ulint max_nodes_deleted = 0; + + /* By modifying tree operations from the under of this + level, logically (2 ^ (level - 1)) opportunities to + deleting records in maximum even unreally rare case. */ + if (level > 7) { + /* TODO: adjust this practical limit. */ + max_nodes_deleted = 64; + } else if (level > 0) { + max_nodes_deleted = (ulint)1 << (level - 1); + } + /* check delete will cause. (BTR_INTENTION_BOTH + or BTR_INTENTION_DELETE) */ + if (n_recs <= max_nodes_deleted * 2 + || page_rec_is_first(rec, page)) { + /* The cursor record can be the left most record + in this page. */ + return true; + } + + if (page_has_prev(page) + && page_rec_distance_is_at_most( + page_get_infimum_rec(page), rec, + max_nodes_deleted)) { + return true; + } + + if (page_has_next(page) + && page_rec_distance_is_at_most( + rec, page_get_supremum_rec(page), + max_nodes_deleted)) { + return true; + } + /* Delete at leftmost record in a page causes delete & insert at its parent page. After that, the delete might cause btr_compress() and delete record at its - parent page. Thus we should consider max 2 deletes. */ - - margin = rec_size * 2; - } else { - ut_ad(lock_intention == BTR_INTENTION_DELETE); - - margin = rec_size; + parent page. Thus we should consider max deletes. */ + margin *= max_nodes_deleted; } - /* NOTE: call mach_read_from_4() directly to avoid assertion - failure. It is safe because we already have SX latch of the - index tree */ + + /* Safe because we already have SX latch of the index tree */ if (page_get_data_size(page) - < margin + BTR_CUR_PAGE_COMPRESS_LIMIT(index) - || (mach_read_from_4(page + FIL_PAGE_NEXT) - == FIL_NULL - && mach_read_from_4(page + FIL_PAGE_PREV) - == FIL_NULL)) { + < margin + BTR_CUR_PAGE_COMPRESS_LIMIT(index)) { return(true); } } diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 87de16f9abf..54edf034ac6 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -813,6 +813,22 @@ page_rec_is_last( const page_t* page) /*!< in: page */ MY_ATTRIBUTE((warn_unused_result)); +/************************************************************//** +true if distance between the records (measured in number of times we have to +move to the next record) is at most the specified value +@param[in] left_rec lefter record +@param[in] right_rec righter record +@param[in] val specified value to compare +@return true if the distance is smaller than the value */ +UNIV_INLINE +bool +page_rec_distance_is_at_most( +/*=========================*/ + const rec_t* left_rec, + const rec_t* right_rec, + ulint val) + MY_ATTRIBUTE((warn_unused_result)); + /************************************************************//** true if the record is the second last user record on a page. @return true if the second last user record */ diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 98b518187b5..75bfa56e2a6 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2019, MariaDB Corporation. +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -358,6 +358,26 @@ page_rec_is_last( return(page_rec_get_next_const(rec) == page_get_supremum_rec(page)); } +/************************************************************//** +true if distance between the records (measured in number of times we have to +move to the next record) is at most the specified value */ +UNIV_INLINE +bool +page_rec_distance_is_at_most( +/*=========================*/ + const rec_t* left_rec, + const rec_t* right_rec, + ulint val) +{ + for (ulint i = 0; i <= val; i++) { + if (left_rec == right_rec) { + return (true); + } + left_rec = page_rec_get_next_const(left_rec); + } + return (false); +} + /************************************************************//** true if the record is the second last user record on a page. @return true if the second last user record */ diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index 4598e8959d6..8e2775a050b 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -169,12 +169,15 @@ row_undo_mod_remove_clust_low( /* Find out if the record has been purged already or if we can remove it. */ - if (!btr_pcur_restore_position(mode, &node->pcur, mtr) - || row_vers_must_preserve_del_marked(node->new_trx_id, - node->table->name, - mtr)) { + if (!btr_pcur_restore_position(mode, &node->pcur, mtr)) { + return DB_SUCCESS; + } - return(DB_SUCCESS); + DEBUG_SYNC_C("rollback_purge_clust"); + + if (row_vers_must_preserve_del_marked(node->new_trx_id, + node->table->name, mtr)) { + return DB_SUCCESS; } btr_cur = btr_pcur_get_btr_cur(&node->pcur); @@ -361,6 +364,7 @@ row_undo_mod_clust( == node->new_trx_id); btr_pcur_commit_specify_mtr(pcur, &mtr); + DEBUG_SYNC_C("rollback_undo_pk"); if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) { From 5838b52743423a2f9cf8d1a80e21c502cd308604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Jan 2020 10:46:33 +0200 Subject: [PATCH 27/43] MDEV-21511 Wrong estimate of affected BLOB columns in update During update, rollback, or MVCC read, we may miscalculate the number of off-page columns, and thus the size of the clustered index record. The function btr_push_update_extern_fields() is mostly redundant, because the off-page columns would also be moved by row_upd_index_replace_new_col_val(), which is invoked via row_upd_index_replace_new_col_vals(). btr_push_update_extern_fields(): Remove. This is based on mysql/mysql-server@1fa475b85d24de4b9ce2958c0eed738c221fc82c which refines a fix for a recovery bug fix mysql/mysql-server@ce0a1e85e24e48b8171f767b44330da635a6ea0a in MySQL 5.7.5. No test case was provided by Oracle. Some of the changed code is being covered by the existing test innodb.blob-crash. --- storage/innobase/btr/btr0cur.cc | 86 ++--------------------------- storage/innobase/include/btr0cur.h | 16 +----- storage/innobase/include/rem0rec.ic | 5 +- storage/innobase/trx/trx0rec.cc | 8 ++- 4 files changed, 15 insertions(+), 100 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 97e7e3d47a2..72f061f2a5f 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1,9 +1,9 @@ /***************************************************************************** -Copyright (c) 1994, 2018, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -4374,7 +4374,9 @@ btr_cur_pessimistic_update( ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec)); ut_ad(rec_offs_validate(rec, index, *offsets)); - n_ext += btr_push_update_extern_fields(new_entry, update, entry_heap); + + /* Get number of externally stored columns in updated record */ + n_ext = dtuple_get_n_ext(new_entry); if ((flags & BTR_NO_UNDO_LOG_FLAG) && rec_offs_any_extern(*offsets)) { @@ -6593,84 +6595,6 @@ btr_cur_unmark_extern_fields( } } -/*******************************************************************//** -Flags the data tuple fields that are marked as extern storage in the -update vector. We use this function to remember which fields we must -mark as extern storage in a record inserted for an update. -@return number of flagged external columns */ -ulint -btr_push_update_extern_fields( -/*==========================*/ - dtuple_t* tuple, /*!< in/out: data tuple */ - const upd_t* update, /*!< in: update vector */ - mem_heap_t* heap) /*!< in: memory heap */ -{ - ulint n_pushed = 0; - ulint n; - const upd_field_t* uf; - - uf = update->fields; - n = upd_get_n_fields(update); - - for (; n--; uf++) { - if (dfield_is_ext(&uf->new_val)) { - dfield_t* field - = dtuple_get_nth_field(tuple, uf->field_no); - - if (!dfield_is_ext(field)) { - dfield_set_ext(field); - n_pushed++; - } - - switch (uf->orig_len) { - byte* data; - ulint len; - byte* buf; - case 0: - break; - case BTR_EXTERN_FIELD_REF_SIZE: - /* Restore the original locally stored - part of the column. In the undo log, - InnoDB writes a longer prefix of externally - stored columns, so that column prefixes - in secondary indexes can be reconstructed. */ - dfield_set_data(field, - (byte*) dfield_get_data(field) - + dfield_get_len(field) - - BTR_EXTERN_FIELD_REF_SIZE, - BTR_EXTERN_FIELD_REF_SIZE); - dfield_set_ext(field); - break; - default: - /* Reconstruct the original locally - stored part of the column. The data - will have to be copied. */ - ut_a(uf->orig_len > BTR_EXTERN_FIELD_REF_SIZE); - - data = (byte*) dfield_get_data(field); - len = dfield_get_len(field); - - buf = (byte*) mem_heap_alloc(heap, - uf->orig_len); - /* Copy the locally stored prefix. */ - memcpy(buf, data, - uf->orig_len - - BTR_EXTERN_FIELD_REF_SIZE); - /* Copy the BLOB pointer. */ - memcpy(buf + uf->orig_len - - BTR_EXTERN_FIELD_REF_SIZE, - data + len - BTR_EXTERN_FIELD_REF_SIZE, - BTR_EXTERN_FIELD_REF_SIZE); - - dfield_set_data(field, buf, uf->orig_len); - dfield_set_ext(field); - } - } - } - - return(n_pushed); -} - /*******************************************************************//** Returns the length of a BLOB part stored on the header page. @return part length */ diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 0f2fd48004b..63338579064 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -755,18 +755,6 @@ btr_rec_copy_externally_stored_field( ulint* len, mem_heap_t* heap); -/*******************************************************************//** -Flags the data tuple fields that are marked as extern storage in the -update vector. We use this function to remember which fields we must -mark as extern storage in a record inserted for an update. -@return number of flagged external columns */ -ulint -btr_push_update_extern_fields( -/*==========================*/ - dtuple_t* tuple, /*!< in/out: data tuple */ - const upd_t* update, /*!< in: update vector */ - mem_heap_t* heap) /*!< in: memory heap */ - MY_ATTRIBUTE((nonnull)); /***********************************************************//** Sets a secondary index record's delete mark to the given value. This function is only used by the insert buffer merge mechanism. */ diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic index 27df29e61d6..7a9b31648da 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.ic @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1626,6 +1626,7 @@ rec_get_converted_size( data_size = dtuple_get_data_size(dtuple, 0); + ut_ad(n_ext == dtuple_get_n_ext(dtuple)); extra_size = rec_get_converted_extra_size( data_size, dtuple_get_n_fields(dtuple), n_ext); diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index b4ac685a267..0987d294ca8 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2448,12 +2448,14 @@ trx_undo_prev_version_build( entry = row_rec_to_index_entry( rec, index, offsets, &n_ext, heap); - n_ext += btr_push_update_extern_fields(entry, update, heap); /* The page containing the clustered index record corresponding to entry is latched in mtr. Thus the following call is safe. */ row_upd_index_replace_new_col_vals(entry, index, update, heap); + /* Get number of externally stored columns in updated record */ + n_ext = dtuple_get_n_ext(entry); + buf = static_cast(mem_heap_alloc( heap, rec_get_converted_size(index, entry, n_ext))); From c3695b4058ea9a8849c22aabeabc76448fe548f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Jan 2020 11:11:19 +0200 Subject: [PATCH 28/43] MDEV-21511: Remove unnecessary code Now that we will be invoking dtuple_get_n_ext() instead of letting btr_push_update_extern_fields() update an already calculated value, it is unnecessary to calculate the n_ext upfront. row_rec_to_index_entry(), row_rec_to_index_entry_low(): Remove the output parameter n_ext. --- storage/innobase/btr/btr0cur.cc | 15 +++++---------- storage/innobase/include/row0row.h | 6 +----- storage/innobase/row/row0ftsort.cc | 5 ++--- storage/innobase/row/row0log.cc | 7 +++---- storage/innobase/row/row0merge.cc | 12 +++--------- storage/innobase/row/row0mysql.cc | 3 +-- storage/innobase/row/row0row.cc | 11 ++--------- storage/innobase/row/row0upd.cc | 9 +++------ storage/innobase/row/row0vers.cc | 6 ++---- storage/innobase/trx/trx0rec.cc | 7 ++----- 10 files changed, 24 insertions(+), 57 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 72f061f2a5f..b764f103a46 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3969,7 +3969,6 @@ btr_cur_optimistic_update( dtuple_t* new_entry; roll_ptr_t roll_ptr; ulint i; - ulint n_ext; block = btr_cur_get_block(cursor); page = buf_block_get_frame(block); @@ -4042,10 +4041,8 @@ any_extern: + DTUPLE_EST_ALLOC(rec_offs_n_fields(*offsets))); } - new_entry = row_rec_to_index_entry(rec, index, *offsets, - &n_ext, *heap); - /* We checked above that there are no externally stored fields. */ - ut_a(!n_ext); + new_entry = row_rec_to_index_entry(rec, index, *offsets, *heap); + ut_ad(!dtuple_get_n_ext(new_entry)); /* The page containing the clustered index record corresponding to new_entry is latched in mtr. @@ -4293,7 +4290,6 @@ btr_cur_pessimistic_update( roll_ptr_t roll_ptr; ibool was_first; ulint n_reserved = 0; - ulint n_ext; ulint max_ins_size = 0; *offsets = NULL; @@ -4358,7 +4354,7 @@ btr_cur_pessimistic_update( ut_ad(rec_offs_validate(rec, index, *offsets)); dtuple_t* new_entry = row_rec_to_index_entry( - rec, index, *offsets, &n_ext, entry_heap); + rec, index, *offsets, entry_heap); /* The page containing the clustered index record corresponding to new_entry is latched in mtr. If the @@ -4375,9 +4371,6 @@ btr_cur_pessimistic_update( ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec)); ut_ad(rec_offs_validate(rec, index, *offsets)); - /* Get number of externally stored columns in updated record */ - n_ext = dtuple_get_n_ext(new_entry); - if ((flags & BTR_NO_UNDO_LOG_FLAG) && rec_offs_any_extern(*offsets)) { /* We are in a transaction rollback undoing a row @@ -4397,6 +4390,8 @@ btr_cur_pessimistic_update( index, rec, page_zip, *offsets, update, true, mtr); } + ulint n_ext = dtuple_get_n_ext(new_entry); + if (page_zip_rec_needs_ext( rec_get_converted_size(index, new_entry, n_ext), page_is_comp(page), diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index a4d3f2cf03d..b7030e91098 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -207,8 +207,6 @@ row_rec_to_index_entry_low( const rec_t* rec, /*!< in: record in the index */ const dict_index_t* index, /*!< in: index */ const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ - ulint* n_ext, /*!< out: number of externally - stored columns */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ MY_ATTRIBUTE((warn_unused_result)); @@ -222,8 +220,6 @@ row_rec_to_index_entry( const rec_t* rec, /*!< in: record in the index */ const dict_index_t* index, /*!< in: index */ const offset_t* offsets,/*!< in/out: rec_get_offsets(rec) */ - ulint* n_ext, /*!< out: number of externally - stored columns */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ MY_ATTRIBUTE((warn_unused_result)); diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 68ac044416f..e3b608769e1 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1720,7 +1720,6 @@ row_fts_merge_insert( corresponding FTS index auxiliary tables */ for (;;) { dtuple_t* dtuple; - ulint n_ext; int min_rec = 0; if (fts_sort_pll_degree <= 2) { @@ -1763,7 +1762,7 @@ row_fts_merge_insert( } dtuple = row_rec_to_index_entry_low( - mrec[min_rec], index, offsets[min_rec], &n_ext, + mrec[min_rec], index, offsets[min_rec], tuple_heap); row_fts_insert_tuple( diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 6c28919555b..87eb9a7a8ff 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -3314,7 +3314,6 @@ row_log_apply_op( enum row_op op; ulint extra_size; ulint data_size; - ulint n_ext; dtuple_t* entry; trx_id_t trx_id; @@ -3392,10 +3391,10 @@ corrupted: } entry = row_rec_to_index_entry_low( - mrec - data_size, index, offsets, &n_ext, heap); + mrec - data_size, index, offsets, heap); /* Online index creation is only implemented for secondary indexes, which never contain off-page columns. */ - ut_ad(n_ext == 0); + ut_ad(dtuple_get_n_ext(entry) == 0); row_log_apply_op_low(index, dup, error, offsets_heap, has_index_lock, op, trx_id, entry); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index c4689e9a377..d218c166a1b 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -3393,7 +3393,6 @@ row_merge_insert_index_tuples( double curr_progress = 0; dict_index_t* old_index = NULL; const mrec_t* mrec = NULL; - ulint n_ext = 0; mtr_t mtr; @@ -3459,8 +3458,6 @@ row_merge_insert_index_tuples( row buffer to data tuple record */ row_merge_mtuple_to_dtuple( index, dtuple, &row_buf->tuples[n_rows]); - - n_ext = dtuple_get_n_ext(dtuple); n_rows++; /* BLOB pointers must be copied from dtuple */ mrec = NULL; @@ -3479,7 +3476,7 @@ row_merge_insert_index_tuples( } dtuple = row_rec_to_index_entry_low( - mrec, index, offsets, &n_ext, tuple_heap); + mrec, index, offsets, tuple_heap); } old_index = dict_table_get_first_index(old_table); @@ -3492,10 +3489,7 @@ row_merge_insert_index_tuples( } } - if (!n_ext) { - /* There are no externally stored columns. */ - } else { - ut_ad(dict_index_is_clust(index)); + if (dict_index_is_clust(index) && dtuple_get_n_ext(dtuple)) { /* Off-page columns can be fetched safely when concurrent modifications to the table are disabled. (Purge can process delete-marked diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index f1019bd7f0d..708d2724595 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -4652,7 +4652,6 @@ row_scan_index_for_mysql( ulint i; ulint cnt; mem_heap_t* heap = NULL; - ulint n_ext; offset_t offsets_[REC_OFFS_NORMAL_SIZE]; offset_t* offsets; rec_offs_init(offsets_); @@ -4793,7 +4792,7 @@ not_ok: mem_heap_empty(heap); prev_entry = row_rec_to_index_entry( - rec, index, offsets, &n_ext, heap); + rec, index, offsets, heap); if (UNIV_LIKELY_NULL(tmp_heap)) { mem_heap_free(tmp_heap); diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index c6aedbe2eb5..816e53a8d5e 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2019, MariaDB Corporation. +Copyright (c) 2018, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -653,8 +653,6 @@ row_rec_to_index_entry_low( const rec_t* rec, /*!< in: record in the index */ const dict_index_t* index, /*!< in: index */ const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ - ulint* n_ext, /*!< out: number of externally - stored columns */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ { @@ -672,8 +670,6 @@ row_rec_to_index_entry_low( /* Because this function may be invoked by row0merge.cc on a record whose header is in different format, the check rec_offs_validate(rec, index, offsets) must be avoided here. */ - ut_ad(n_ext); - *n_ext = 0; rec_len = rec_offs_n_fields(offsets); @@ -698,7 +694,6 @@ row_rec_to_index_entry_low( if (rec_offs_nth_extern(offsets, i)) { dfield_set_ext(dfield); - (*n_ext)++; } } @@ -717,8 +712,6 @@ row_rec_to_index_entry( const rec_t* rec, /*!< in: record in the index */ const dict_index_t* index, /*!< in: index */ const offset_t* offsets,/*!< in: rec_get_offsets(rec) */ - ulint* n_ext, /*!< out: number of externally - stored columns */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ { @@ -739,7 +732,7 @@ row_rec_to_index_entry( rec_offs_make_valid(copy_rec, index, const_cast(offsets)); entry = row_rec_to_index_entry_low( - copy_rec, index, offsets, n_ext, heap); + copy_rec, index, offsets, heap); rec_offs_make_valid(rec, index, const_cast(offsets)); dtuple_set_info_bits(entry, diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 367e6c8e263..fd7d622aa69 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -223,7 +223,6 @@ row_upd_check_references_constraints( dtuple_t* entry; trx_t* trx; const rec_t* rec; - ulint n_ext; dberr_t err; ibool got_s_lock = FALSE; @@ -240,7 +239,7 @@ row_upd_check_references_constraints( heap = mem_heap_create(500); - entry = row_rec_to_index_entry(rec, index, offsets, &n_ext, heap); + entry = row_rec_to_index_entry(rec, index, offsets, heap); mtr_commit(mtr); @@ -373,7 +372,6 @@ wsrep_row_upd_check_foreign_constraints( dtuple_t* entry; trx_t* trx; const rec_t* rec; - ulint n_ext; dberr_t err; ibool got_s_lock = FALSE; ibool opened = FALSE; @@ -391,8 +389,7 @@ wsrep_row_upd_check_foreign_constraints( heap = mem_heap_create(500); - entry = row_rec_to_index_entry(rec, index, offsets, - &n_ext, heap); + entry = row_rec_to_index_entry(rec, index, offsets, heap); mtr_commit(mtr); diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index c977a58c340..3a4b560670f 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -136,15 +136,13 @@ row_vers_impl_x_locked_low( const ulint rec_del = rec_get_deleted_flag(rec, comp); if (dict_index_has_virtual(index)) { - ulint n_ext; ulint est_size = DTUPLE_EST_ALLOC(index->n_fields); /* Allocate the dtuple for virtual columns extracted from undo log with its own heap, so to avoid it being freed as we iterating in the version loop below. */ v_heap = mem_heap_create(est_size); - ientry = row_rec_to_index_entry( - rec, index, offsets, &n_ext, v_heap); + ientry = row_rec_to_index_entry(rec, index, offsets, v_heap); } /* We look up if some earlier version, which was modified by diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 0987d294ca8..3e41cb5ad1f 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -2404,8 +2404,6 @@ trx_undo_prev_version_build( ut_a(ptr); if (row_upd_changes_field_size_or_external(index, offsets, update)) { - ulint n_ext; - /* We should confirm the existence of disowned external data, if the previous version record is delete marked. If the trx_id of the previous record is seen by purge view, we should treat @@ -2446,15 +2444,14 @@ trx_undo_prev_version_build( those fields that update updates to become externally stored fields. Store the info: */ - entry = row_rec_to_index_entry( - rec, index, offsets, &n_ext, heap); + entry = row_rec_to_index_entry(rec, index, offsets, heap); /* The page containing the clustered index record corresponding to entry is latched in mtr. Thus the following call is safe. */ row_upd_index_replace_new_col_vals(entry, index, update, heap); /* Get number of externally stored columns in updated record */ - n_ext = dtuple_get_n_ext(entry); + const ulint n_ext = dtuple_get_n_ext(entry); buf = static_cast(mem_heap_alloc( heap, rec_get_converted_size(index, entry, n_ext))); From 457ce97ef2868c19fc8c9b7d6cd3d12bb78becf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Jan 2020 13:13:03 +0200 Subject: [PATCH 29/43] MDEV-21512 InnoDB may hang due to SPATIAL INDEX MySQL 5.7.29 includes the following fix: Bug #30287668 INNODB: A LONG SEMAPHORE WAIT mysql/mysql-server@5cdbb22b51cf2b35dbdf5666a251ffbec2f84dec There is no test case. It seems that the problem could occur when a spatial index is large and peculiar enough so that multiple R-tree leaf pages will have the exactly same maximum bounding rectangle (MBR). The commit message suggests that the hang can occur when R-tree non-leaf pages are being merged, which should only be possible during transaction rollback or the purge of transaction history, when the R-tree index is at least 2 levels high and very many records are being deleted. The message says that a comparison result that two spatial index node pointer records are equal will cause an infinite loop in rtr_page_copy_rec_list_end_no_locks(). Hence, we must include the child page number in the comparison to be consistent with mysql/mysql-server@2e11fe0e152e34d73579e1a9ec19aedc3f6010f6. We fix this bug in a simpler way, involving fewer code changes. cmp_rec_rec(): Renamed from cmp_rec_rec_with_match(). Assert that rec2 always resides in an index page. Treat non-leaf spatial index pages specially. --- storage/innobase/btr/btr0cur.cc | 18 +++--- storage/innobase/dict/dict0stats.cc | 17 ++---- storage/innobase/gis/gis0rtree.cc | 17 +++--- storage/innobase/include/rem0cmp.h | 48 +++++---------- storage/innobase/include/rem0cmp.ic | 35 +---------- storage/innobase/rem/rem0cmp.cc | 90 ++++++++++++++++------------- 6 files changed, 87 insertions(+), 138 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index b764f103a46..a47121399d2 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1826,9 +1826,9 @@ need_opposite_intention: offsets2 = rec_get_offsets( first_rec, index, offsets2, false, ULINT_UNDEFINED, &heap); - cmp_rec_rec_with_match(node_ptr, first_rec, - offsets, offsets2, index, FALSE, - &matched_fields); + cmp_rec_rec(node_ptr, first_rec, + offsets, offsets2, index, false, + &matched_fields); if (matched_fields >= rec_offs_n_fields(offsets) - 1) { @@ -1844,10 +1844,10 @@ need_opposite_intention: offsets2 = rec_get_offsets( last_rec, index, offsets2, false, ULINT_UNDEFINED, &heap); - cmp_rec_rec_with_match( + cmp_rec_rec( node_ptr, last_rec, offsets, offsets2, index, - FALSE, &matched_fields); + false, &matched_fields); if (matched_fields >= rec_offs_n_fields(offsets) - 1) { detected_same_key_root = true; @@ -6307,10 +6307,10 @@ btr_estimate_number_of_different_key_vals( ULINT_UNDEFINED, &heap); - cmp_rec_rec_with_match(rec, next_rec, - offsets_rec, offsets_next_rec, - index, stats_null_not_equal, - &matched_fields); + cmp_rec_rec(rec, next_rec, + offsets_rec, offsets_next_rec, + index, stats_null_not_equal, + &matched_fields); for (j = matched_fields; j < n_cols; j++) { /* We add one if this index record has diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index f3cd26f5527..2e2156865ef 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1166,13 +1166,9 @@ dict_stats_analyze_index_level( prev_rec, index, prev_rec_offsets, !level, n_uniq, &heap); - cmp_rec_rec_with_match(rec, - prev_rec, - rec_offsets, - prev_rec_offsets, - index, - FALSE, - &matched_fields); + cmp_rec_rec(prev_rec, rec, + prev_rec_offsets, rec_offsets, index, + false, &matched_fields); for (i = matched_fields; i < n_uniq; i++) { @@ -1392,9 +1388,8 @@ dict_stats_scan_page( /* check whether rec != next_rec when looking at the first n_prefix fields */ - cmp_rec_rec_with_match(rec, next_rec, - offsets_rec, offsets_next_rec, - index, FALSE, &matched_fields); + cmp_rec_rec(rec, next_rec, offsets_rec, offsets_next_rec, + index, false, &matched_fields); if (matched_fields < n_prefix) { /* rec != next_rec, => rec is non-boring */ diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 8e602d127cf..1808fe851b8 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2019, MariaDB Corporation. +Copyright (c) 2019, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1449,10 +1449,9 @@ rtr_page_copy_rec_list_end_no_locks( offsets2 = rec_get_offsets(cur_rec, index, offsets2, is_leaf, ULINT_UNDEFINED, &heap); - cmp = cmp_rec_rec_with_match(cur1_rec, cur_rec, - offsets1, offsets2, - index, FALSE, - &cur_matched_fields); + cmp = cmp_rec_rec(cur1_rec, cur_rec, + offsets1, offsets2, index, false, + &cur_matched_fields); if (cmp < 0) { page_cur_move_to_prev(&page_cur); break; @@ -1564,15 +1563,13 @@ rtr_page_copy_rec_list_start_no_locks( while (!page_rec_is_supremum(cur_rec)) { ulint cur_matched_fields = 0; - int cmp; offsets2 = rec_get_offsets(cur_rec, index, offsets2, is_leaf, ULINT_UNDEFINED, &heap); - cmp = cmp_rec_rec_with_match(cur1_rec, cur_rec, - offsets1, offsets2, - index, FALSE, - &cur_matched_fields); + int cmp = cmp_rec_rec(cur1_rec, cur_rec, + offsets1, offsets2, index, false, + &cur_matched_fields); if (cmp < 0) { page_cur_move_to_prev(&page_cur); cur_rec = page_cur_get_rec(&page_cur); diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h index 0877c7b5b6a..af1b145b0d9 100644 --- a/storage/innobase/include/rem0cmp.h +++ b/storage/innobase/include/rem0cmp.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -80,7 +80,7 @@ cmp_dfield_dfield( /** Compare a GIS data tuple to a physical record. @param[in] dtuple data tuple -@param[in] rec B-tree record +@param[in] rec R-tree record @param[in] offsets rec_get_offsets(rec) @param[in] mode compare mode @retval negative if dtuple is less than rec */ @@ -190,43 +190,23 @@ cmp_rec_rec_simple( duplicate key value if applicable, or NULL */ MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result)); -/** Compare two B-tree records. -@param[in] rec1 B-tree record -@param[in] rec2 B-tree record -@param[in] offsets1 rec_get_offsets(rec1, index) -@param[in] offsets2 rec_get_offsets(rec2, index) -@param[in] index B-tree index -@param[in] nulls_unequal true if this is for index cardinality -statistics estimation, and innodb_stats_method=nulls_unequal -or innodb_stats_method=nulls_ignored -@param[out] matched_fields number of completely matched fields -within the first field not completely matched -@return the comparison result -@retval 0 if rec1 is equal to rec2 -@retval negative if rec1 is less than rec2 -@retval positive if rec2 is greater than rec2 */ -int -cmp_rec_rec_with_match( - const rec_t* rec1, - const rec_t* rec2, - const offset_t* offsets1, - const offset_t* offsets2, - const dict_index_t* index, - bool nulls_unequal, - ulint* matched_fields); -/** Compare two B-tree records. +/** Compare two B-tree or R-tree records. Only the common first fields are compared, and externally stored field are treated as equal. -@param[in] rec1 B-tree record -@param[in] rec2 B-tree record +@param[in] rec1 record (possibly not on an index page) +@param[in] rec2 B-tree or R-tree record in an index page @param[in] offsets1 rec_get_offsets(rec1, index) @param[in] offsets2 rec_get_offsets(rec2, index) +@param[in] nulls_unequal true if this is for index cardinality + statistics estimation with + innodb_stats_method=nulls_unequal + or innodb_stats_method=nulls_ignored @param[out] matched_fields number of completely matched fields within the first field not completely matched -@return positive, 0, negative if rec1 is greater, equal, less, than rec2, -respectively */ -UNIV_INLINE +@retval 0 if rec1 is equal to rec2 +@retval negative if rec1 is less than rec2 +@retval positive if rec1 is greater than rec2 */ int cmp_rec_rec( const rec_t* rec1, @@ -234,7 +214,9 @@ cmp_rec_rec( const offset_t* offsets1, const offset_t* offsets2, const dict_index_t* index, - ulint* matched_fields = NULL); + bool nulls_unequal = false, + ulint* matched_fields = NULL) + MY_ATTRIBUTE((nonnull(1,2,3,4,5))); /** Compare two data fields. @param[in] dfield1 data field diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic index 5ac3838f244..4230543615a 100644 --- a/storage/innobase/include/rem0cmp.ic +++ b/storage/innobase/include/rem0cmp.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -52,40 +53,6 @@ cmp_dfield_dfield( dfield_get_len(dfield2))); } -/** Compare two B-tree records. -Only the common first fields are compared, and externally stored field -are treated as equal. -@param[in] rec1 B-tree record -@param[in] rec2 B-tree record -@param[in] offsets1 rec_get_offsets(rec1, index) -@param[in] offsets2 rec_get_offsets(rec2, index) -@param[out] matched_fields number of completely matched fields - within the first field not completely matched -@return positive, 0, negative if rec1 is greater, equal, less, than rec2, -respectively */ -UNIV_INLINE -int -cmp_rec_rec( - const rec_t* rec1, - const rec_t* rec2, - const offset_t* offsets1, - const offset_t* offsets2, - const dict_index_t* index, - ulint* matched_fields) -{ - ulint match_f; - int ret; - - ret = cmp_rec_rec_with_match( - rec1, rec2, offsets1, offsets2, index, false, &match_f); - - if (matched_fields != NULL) { - *matched_fields = match_f; - } - - return(ret); -} - /** Compare two data fields. @param[in] dfield1 data field @param[in] dfield2 data field diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index 48927b02963..cda286ef503 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -1,6 +1,7 @@ /***************************************************************************** -Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -25,6 +26,7 @@ Created 7/1/1994 Heikki Tuuri #include "rem0cmp.h" #include "rem0rec.h" +#include "page0page.h" #include "dict0mem.h" #include "handler0alter.h" @@ -534,7 +536,7 @@ cmp_data( /** Compare a GIS data tuple to a physical record. @param[in] dtuple data tuple -@param[in] rec B-tree record +@param[in] rec R-tree record @param[in] offsets rec_get_offsets(rec) @param[in] mode compare mode @retval negative if dtuple is less than rec */ @@ -1086,23 +1088,24 @@ cmp_rec_rec_simple( return(0); } -/** Compare two B-tree records. -@param[in] rec1 B-tree record -@param[in] rec2 B-tree record -@param[in] offsets1 rec_get_offsets(rec1, index) -@param[in] offsets2 rec_get_offsets(rec2, index) -@param[in] index B-tree index -@param[in] nulls_unequal true if this is for index cardinality -statistics estimation, and innodb_stats_method=nulls_unequal -or innodb_stats_method=nulls_ignored -@param[out] matched_fields number of completely matched fields -within the first field not completely matched -@return the comparison result +/** Compare two B-tree or R-tree records. +Only the common first fields are compared, and externally stored field +are treated as equal. +@param[in] rec1 record (possibly not on an index page) +@param[in] rec2 B-tree or R-tree record in an index page +@param[in] offsets1 rec_get_offsets(rec1, index) +@param[in] offsets2 rec_get_offsets(rec2, index) +@param[in] nulls_unequal true if this is for index cardinality + statistics estimation with + innodb_stats_method=nulls_unequal + or innodb_stats_method=nulls_ignored +@param[out] matched_fields number of completely matched fields + within the first field not completely matched @retval 0 if rec1 is equal to rec2 @retval negative if rec1 is less than rec2 -@retval positive if rec2 is greater than rec2 */ +@retval positive if rec1 is greater than rec2 */ int -cmp_rec_rec_with_match( +cmp_rec_rec( const rec_t* rec1, const rec_t* rec2, const offset_t* offsets1, @@ -1111,17 +1114,14 @@ cmp_rec_rec_with_match( bool nulls_unequal, ulint* matched_fields) { - ulint rec1_n_fields; /* the number of fields in rec */ ulint rec1_f_len; /* length of current field in rec */ const byte* rec1_b_ptr; /* pointer to the current byte in rec field */ - ulint rec2_n_fields; /* the number of fields in rec */ ulint rec2_f_len; /* length of current field in rec */ const byte* rec2_b_ptr; /* pointer to the current byte in rec field */ ulint cur_field = 0; /* current field number */ int ret = 0; /* return value */ - ulint comp; ut_ad(rec1 != NULL); ut_ad(rec2 != NULL); @@ -1129,10 +1129,12 @@ cmp_rec_rec_with_match( ut_ad(rec_offs_validate(rec1, index, offsets1)); ut_ad(rec_offs_validate(rec2, index, offsets2)); ut_ad(rec_offs_comp(offsets1) == rec_offs_comp(offsets2)); + ut_ad(fil_page_index_page_check(page_align(rec2))); + ut_ad(!!dict_index_is_spatial(index) + == (fil_page_get_type(page_align(rec2)) == FIL_PAGE_RTREE)); - comp = rec_offs_comp(offsets1); - rec1_n_fields = rec_offs_n_fields(offsets1); - rec2_n_fields = rec_offs_n_fields(offsets2); + ulint comp = rec_offs_comp(offsets1); + ulint n_fields; /* Test if rec is the predefined minimum record */ if (UNIV_UNLIKELY(rec_get_info_bits(rec1, comp) @@ -1149,37 +1151,41 @@ cmp_rec_rec_with_match( goto order_resolved; } - /* Match fields in a loop */ + /* For non-leaf spatial index records, the + dict_index_get_n_unique_in_tree() does include the child page + number, because spatial index node pointers only contain + the MBR (minimum bounding rectangle) and the child page number. - for (; cur_field < rec1_n_fields && cur_field < rec2_n_fields; - cur_field++) { + For B-tree node pointers, the key alone (secondary index + columns and PRIMARY KEY columns) must be unique, and there is + no need to compare the child page number. */ + n_fields = std::min(rec_offs_n_fields(offsets1), + rec_offs_n_fields(offsets2)); + n_fields = std::min(n_fields, dict_index_get_n_unique_in_tree(index)); + for (; cur_field < n_fields; cur_field++) { ulint mtype; ulint prtype; - /* If this is node-ptr records then avoid comparing node-ptr - field. Only key field needs to be compared. */ - if (cur_field == dict_index_get_n_unique_in_tree(index)) { - break; - } - - if (dict_index_is_ibuf(index)) { + if (UNIV_UNLIKELY(dict_index_is_ibuf(index))) { /* This is for the insert buffer B-tree. */ mtype = DATA_BINARY; prtype = 0; } else { - const dict_col_t* col; - - col = dict_index_get_nth_col(index, cur_field); - + const dict_col_t* col = dict_index_get_nth_col( + index, cur_field); mtype = col->mtype; prtype = col->prtype; - /* If the index is spatial index, we mark the - prtype of the first field as MBR field. */ - if (cur_field == 0 && dict_index_is_spatial(index)) { + if (UNIV_LIKELY(!dict_index_is_spatial(index))) { + } else if (cur_field == 0) { ut_ad(DATA_GEOMETRY_MTYPE(mtype)); prtype |= DATA_GIS_MBR; + } else if (!page_rec_is_leaf(rec2)) { + /* Compare the child page number. */ + ut_ad(cur_field == 1); + mtype = DATA_SYS_CHILD; + prtype = 0; } } @@ -1215,8 +1221,10 @@ cmp_rec_rec_with_match( to the common fields */ ut_ad(ret == 0); order_resolved: - *matched_fields = cur_field; - return(ret); + if (matched_fields) { + *matched_fields = cur_field; + } + return ret; } #ifdef UNIV_COMPILE_TEST_FUNCS From 08b0b2b6fb849e7b440bfd104f8121b5d7d819e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Jan 2020 16:22:13 +0200 Subject: [PATCH 30/43] MDEV-21513: Avoid some crashes in ALTER TABLE...IMPORT TABLESPACE IndexPurge::next(): Replace btr_pcur_move_to_next_user_rec() with some equivalent code that performs sanity checks without killing the server. Perform some additional sanity checks as well. This change is motivated by mysql/mysql-server@48de4d74f4d2f10cd01b129753c7dfa908cf36b5 which unnecessarily introduces storage overhead to btr_pcur_t and uses a test case that injects a fault somewhere else, not in the code path that was modified. --- storage/innobase/row/row0import.cc | 67 +++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index e8933ea5419..751cd4e5293 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1524,13 +1524,70 @@ IndexPurge::next() UNIV_NOTHROW mtr_set_log_mode(&m_mtr, MTR_LOG_NO_REDO); btr_pcur_restore_position(BTR_MODIFY_LEAF, &m_pcur, &m_mtr); + /* The following is based on btr_pcur_move_to_next_user_rec(). */ + m_pcur.old_stored = false; + ut_ad(m_pcur.latch_mode == BTR_MODIFY_LEAF); + do { + if (btr_pcur_is_after_last_on_page(&m_pcur)) { + if (btr_pcur_is_after_last_in_tree(&m_pcur, &m_mtr)) { + return DB_END_OF_INDEX; + } - if (!btr_pcur_move_to_next_user_rec(&m_pcur, &m_mtr)) { + buf_block_t* block = btr_pcur_get_block(&m_pcur); + uint32_t next_page = btr_page_get_next(block->frame); - return(DB_END_OF_INDEX); - } + /* MDEV-13542 FIXME: Make these checks part of + btr_pcur_move_to_next_page(), and introduce a + return status that will be checked in all callers! */ + switch (next_page) { + default: + if (next_page != block->page.id.page_no()) { + break; + } + /* MDEV-20931 FIXME: Check that + next_page is within the tablespace + bounds! Also check that it is not a + change buffer bitmap page. */ + /* fall through */ + case 0: + case 1: + case FIL_NULL: + return DB_CORRUPTION; + } - return(DB_SUCCESS); + dict_index_t* index = m_pcur.btr_cur.index; + buf_block_t* next_block = btr_block_get( + page_id_t(block->page.id.space(), next_page), + block->page.size, BTR_MODIFY_LEAF, index, + &m_mtr); + + if (UNIV_UNLIKELY(!next_block + || !fil_page_index_page_check( + next_block->frame) + || !!dict_index_is_spatial(index) + != (fil_page_get_type( + next_block->frame) + == FIL_PAGE_RTREE) + || page_is_comp(next_block->frame) + != page_is_comp(block->frame) + || btr_page_get_prev( + next_block->frame) + != block->page.id.page_no())) { + return DB_CORRUPTION; + } + + btr_leaf_page_release(block, BTR_MODIFY_LEAF, &m_mtr); + + page_cur_set_before_first(next_block, + &m_pcur.btr_cur.page_cur); + + ut_d(page_check_dir(next_block->frame)); + } else { + btr_pcur_move_to_next_on_page(&m_pcur); + } + } while (!btr_pcur_is_on_user_rec(&m_pcur)); + + return DB_SUCCESS; } /** From c25a0662b3f169340faccbee306f84cefe2ca54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nik=C5=A1a=20Skeled=C5=BEija?= Date: Fri, 8 Nov 2019 09:24:38 +0100 Subject: [PATCH 31/43] Bug #30499288 - GCC 9.2.1 REPORTS A NEW WARNING FOR OS_FILE_GET_PARENT_DIR - Fixed a warning visible in optimized build related to calling memcpy with length parameters larger than ptrdiff_t max. rb#23333 approved by Annamalai Gurusami --- storage/innobase/os/os0file.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index b32a2fa77ef..065b3118413 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1,8 +1,8 @@ /*********************************************************************** -Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -1474,6 +1474,12 @@ os_file_get_parent_dir( return(NULL); } + if (last_slash - path < 0) { + /* Sanity check, it prevents gcc from trying to handle this case which + * results in warnings for some optimized builds */ + return (NULL); + } + /* Non-trivial directory component */ return(mem_strdupl(path, last_slash - path)); From d595a91bc6bfb9f9c38bf91738b2a563d80c62e0 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 17 Jan 2020 18:39:00 +0300 Subject: [PATCH 32/43] Fix a merge typo --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 44ac1056a8a..59bb4ac1e81 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13874,7 +13874,7 @@ static int compare_fields_by_table_order(Item *field1, Item_field *f2= (Item_field *) field2_real; if (f1->used_tables() & OUTER_REF_TABLE_BIT) { - outer_ref= -1; + outer_ref= 1; cmp= -1; } if (f2->used_tables() & OUTER_REF_TABLE_BIT) From 9d18b6246755472c8324bf3e20e234e08ac45618 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 15 Jan 2020 18:08:02 +0100 Subject: [PATCH 33/43] rpm/deb and auth_pam_tool_dir/auth_pam_tool don't let mysql_install_db set SUID bit for auth_pam_tool in rpm/deb packages - instead package files with correct permissions and only fix the ownership of auth_pam_tool_dir (which can only be done after mysql user is created, so in post-install). keep old mysql_install_db behavior for bintars --- debian/mariadb-server-10.4.postinst | 3 +++ debian/rules | 4 ++++ scripts/mysql_install_db.sh | 18 +++++++++--------- support-files/rpm/server-postin.sh | 7 ++----- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/debian/mariadb-server-10.4.postinst b/debian/mariadb-server-10.4.postinst index fbb2584f2df..3db4d50ea08 100644 --- a/debian/mariadb-server-10.4.postinst +++ b/debian/mariadb-server-10.4.postinst @@ -94,6 +94,9 @@ EOF chmod 2750 $mysql_logdir set -e + # Set the correct filesystem ownership for the PAM v2 plugin + chown mysql /usr/lib/mysql/plugin/auth_pam_tool_dir + # This is important to avoid dataloss when there is a removed # mysql-server version from Woody lying around which used the same # data directory and then somewhen gets purged by the admin. diff --git a/debian/rules b/debian/rules index 9914bae721b..ac85ef7dc26 100755 --- a/debian/rules +++ b/debian/rules @@ -146,6 +146,10 @@ endif ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.19 ln -s libmariadb.so.3 $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqlclient.so.20 +override_dh_fixperms: + dh_fixperms + chmod 04755 debian/mariadb-server-10.4/usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool + chmod 0700 debian/mariadb-server-10.4/usr/lib/mysql/plugin/auth_pam_tool_dir override_dh_installlogrotate-arch: dh_installlogrotate --name mysql-server diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index caa575dc091..e9744333af5 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -478,16 +478,8 @@ do fi done -if test -n "$user" +if test -n "$user" -a "$in_rpm" -eq 0 then - chown $user "$pamtooldir/auth_pam_tool_dir" && \ - chmod 0700 "$pamtooldir/auth_pam_tool_dir" - if test $? -ne 0 - then - echo "Cannot change ownership of the '$pamtooldir/auth_pam_tool_dir' directory" - echo " to the '$user' user. Check that you have the necessary permissions and try again." - exit 1 - fi if test -z "$srcdir" then chown 0 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" && \ @@ -499,6 +491,14 @@ then echo fi fi + chown $user "$pamtooldir/auth_pam_tool_dir" && \ + chmod 0700 "$pamtooldir/auth_pam_tool_dir" + if test $? -ne 0 + then + echo "Cannot change ownership of the '$pamtooldir/auth_pam_tool_dir' directory" + echo " to the '$user' user. Check that you have the necessary permissions and try again." + exit 1 + fi args="$args --user=$user" fi diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index bccda7fbb8b..db249c326a6 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -69,11 +69,8 @@ if [ $1 = 1 ] ; then chmod -R og-rw $datadir/mysql fi -# Set correct filesystem ownership/permissions for the PAM v2 plugin -chown %{mysqld_group} /usr/lib*/mysql/plugin/auth_pam_tool_dir -chmod 0700 /usr/lib*/mysql/plugin/auth_pam_tool_dir -chown 0 /usr/lib*/mysql/plugin/auth_pam_tool_dir/auth_pam_tool -chmod 04755 /usr/lib*/mysql/plugin/auth_pam_tool_dir/auth_pam_tool +# Set the correct filesystem ownership for the PAM v2 plugin +chown %{mysqld_user} /usr/lib*/mysql/plugin/auth_pam_tool_dir # install SELinux files - but don't override existing ones SETARGETDIR=/etc/selinux/targeted/src/policy From 51a9571256204ca81de0148dfb7f9ec73614e31c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 15 Jan 2020 22:40:56 +0100 Subject: [PATCH 34/43] MDEV-20205 mysql_install_db shouldn't execute chown Make chown error non-fatal. Just print a warning. --- scripts/mysql_install_db.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index e9744333af5..0de1fe45014 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -487,7 +487,7 @@ then if test $? -ne 0 then echo "Couldn't set an owner to '$pamtooldir/auth_pam_tool_dir/auth_pam_tool'." - echo " It must be root, the PAM authentication plugin doesn't work otherwise.." + echo "It must be root, the PAM authentication plugin doesn't work otherwise.." echo fi fi @@ -496,8 +496,8 @@ then if test $? -ne 0 then echo "Cannot change ownership of the '$pamtooldir/auth_pam_tool_dir' directory" - echo " to the '$user' user. Check that you have the necessary permissions and try again." - exit 1 + echo "to the '$user' user. Check that you have the necessary permissions and try again." + echo fi args="$args --user=$user" fi From 057fbfa3563d1161ce9400fb4368035d84334f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sat, 18 Jan 2020 09:38:01 +0200 Subject: [PATCH 35/43] Disable Galera tests failing on bb and Azure until they are fixed. --- mysql-test/suite/galera/disabled.def | 28 ++++++++++++++++++++++--- mysql-test/suite/galera_sr/disabled.def | 19 +++++++++++++++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index f888cb9d789..437b5358792 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -11,39 +11,61 @@ ############################################################################## GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081 +GCF-939 : MDEV-21520 galera.GCF-939 +MDEV-16509 : MDEV-21523 galera.MDEV-16509 +MDEV-20225 : MDEV-20886 galera.MDEV-20225 MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill +MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B +MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B MW-329 : MDEV-19962 Galera test failure on MW-329 MW-336 : MDEV-21409: Galera test failure on MW-336 MW-360 : needs rewrite to be MariaDB gtid compatible MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388 +galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults galera_account_management : MariaDB 10.0 does not support ALTER USER galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID +galera_as_slave_gtid_myisam : MDEV-21421 galera.galera_as_slave_gtid_myisam galera_as_slave_gtid_replicate_do_db_cc : Requires MySQL GTID galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() -galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions +galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events -galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc +galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_concurrent_ctas : MDEV-18180 Galera test failure on galera.galera_concurrent_ctas galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files galera_flush : MariaDB does not have global.thread_statistics +galera_ftwrl : MDEV-21525 galera.galera_ftwrl galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_ist_mariabackup : MDEV-18829 test leaves port open galera_ist_progress : MDEV-15236 fails when trying to read transfer status galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges +galera_load_data : MDEV-19968 galera.galera_load_data galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk +galera_mdl_race : MDEV-21524 galera.galera_mdl_race galera_migrate : MariaDB does not support START SLAVE USER +galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx +galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails +galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb +galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade +galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key +galera_sst_mariabackup_table_options: MDEV-19741 Galera test failure on galera.galera_sst_mariabackup_table_options +galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting +galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow_writes galera_var_node_address : MDEV-20485 Galera test failure galera_var_notify_cmd : MDEV-20600 Galera test galera_var_notify_cmd causes hang galera_var_reject_queries : assertion in inline_mysql_socket_send galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit galera_wan : MDEV-17259 Test failure on galera.galera_wan +galera_wan_restart_sst : MDEV-21514 galera.galera_wan_restart_sst +galera_wsrep_new_cluster : MDEV-21515 galera.galera_wsrep_new_cluster mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed. +mysql-wsrep#33 : MDEV-21420 galera.mysql-wsrep#33 partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache - +sql_log_bin : MDEV-21491 galera.sql_log_bin +versioning_trx_id : MDEV-18590 galera.versioning_trx_id diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index ab22c746cd0..efc1b73d4e7 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -1,3 +1,18 @@ -galera_sr_table_contents : missing file -GCF-437 : test relies on InnoDB redo log size limitation +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# : MDEV- +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + GCF-1043A : MDEV-21170 Galera test failure on galera_sr.GCF-1043A +GCF-437 : test relies on InnoDB redo log size limitation +GCF-561 : MDEV-21517 galera_sr.GCF-561 +GCF_1060 : MDEV-20848 galera_sr.GCF_1060 +galera-features#56 : MDEV-18542 galera_sr.galera-features#56 +galera_sr_table_contents : missing file From 4de32015be82d0f484a7b49a427853ea7b6da5fd Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 18 Jan 2020 13:26:03 -0800 Subject: [PATCH 36/43] MDEV-21356 ERROR 1032 Can't find record when running simple, single-table query This bug could happen when both optimizer switches 'mrr' and 'mrr_sort_keys' are enabled and the optimizer decided to use a rowid filter when accessing an InnoDB table by a secondary key. With the above setting any access by a secondary is converted to the rndpos access. In InnoDB the rndpos access uses the primary key. Currently usage of a rowid filter within InnoDB engine is not supported if the table is accessed by the primary key. Do not use pushed rowid filter if the table is accessed actually by the primary key. Use the rowid filter outside the egine code instead. --- mysql-test/main/rowid_filter_innodb.result | 114 ++++++++++++++++++++ mysql-test/main/rowid_filter_innodb.test | 117 +++++++++++++++++++++ sql/multi_range_read.cc | 24 +++++ 3 files changed, 255 insertions(+) diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 2f57ee0de35..36a59b8047e 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -2355,3 +2355,117 @@ count(0) 0 drop table t1; set global innodb_stats_persistent= @stats.save; +# +# MDEV-21356: usage of range filter with range access employing +# optimizer_switch='mrr=on,mrr_sort_keys=on'; +# +CREATE TABLE t1 ( +id int(11) unsigned NOT NULL AUTO_INCREMENT, +domain varchar(255) NOT NULL, +registrant_name varchar(255) DEFAULT NULL, +registrant_organization varchar(255) DEFAULT NULL, +registrant_street1 varchar(255) DEFAULT NULL, +registrant_street2 varchar(255) DEFAULT NULL, +registrant_street3 varchar(255) DEFAULT NULL, +registrant_street4 varchar(255) DEFAULT NULL, +registrant_street5 varchar(255) DEFAULT NULL, +registrant_city varchar(255) DEFAULT NULL, +registrant_postal_code varchar(255) DEFAULT NULL, +registrant_country varchar(255) DEFAULT NULL, +registrant_email varchar(255) DEFAULT NULL, +registrant_telephone varchar(255) DEFAULT NULL, +administrative_name varchar(255) DEFAULT NULL, +administrative_organization varchar(255) DEFAULT NULL, +administrative_street1 varchar(255) DEFAULT NULL, +administrative_street2 varchar(255) DEFAULT NULL, +administrative_street3 varchar(255) DEFAULT NULL, +administrative_street4 varchar(255) DEFAULT NULL, +administrative_street5 varchar(255) DEFAULT NULL, +administrative_city varchar(255) DEFAULT NULL, +administrative_postal_code varchar(255) DEFAULT NULL, +administrative_country varchar(255) DEFAULT NULL, +administrative_email varchar(255) DEFAULT NULL, +administrative_telephone varchar(255) DEFAULT NULL, +technical_name varchar(255) DEFAULT NULL, +technical_organization varchar(255) DEFAULT NULL, +technical_street1 varchar(255) DEFAULT NULL, +technical_street2 varchar(255) DEFAULT NULL, +technical_street3 varchar(255) DEFAULT NULL, +technical_street4 varchar(255) DEFAULT NULL, +technical_street5 varchar(255) DEFAULT NULL, +technical_city varchar(255) DEFAULT NULL, +technical_postal_code varchar(255) DEFAULT NULL, +technical_country varchar(255) DEFAULT NULL, +technical_email varchar(255) DEFAULT NULL, +technical_telephone varchar(255) DEFAULT NULL, +json longblob NOT NULL, +timestamp timestamp NOT NULL DEFAULT current_timestamp(), +PRIMARY KEY (id), +KEY ixEventWhoisDomainDomain (domain), +KEY ixEventWhoisDomainTimestamp (timestamp) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO t1 ( +id, domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) VALUES +(60380, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:18:28'), +(60383, 'www.bestwestern.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2016-12-22 09:27:06'), +(80392, 'www.dfinitions.fr', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, '', '2017-01-30 08:02:01'), +(80407, 'www.firma.o2.pl', null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, 'AZ.pl Sp. z o.o.', 'Al. Papieza Jana Pawla II 19/2', +null, null, null, null, '70-453 Szczecin', null, 'POLAND', null, +'48914243780', '', '2017-01-30 08:24:51'), +(80551, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, '', '2017-01-30 10:00:56'), +(80560, 'www.blackmer-mouvex.com', 'MARIE-PIERRE PRODEAU', 'MOUVEX', +'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE', +'PRODEAU@MOUVEX.COM', null, 'MARIE-PIERRE PRODEAU', 'MOUVEX', +'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE', +'PRODEAU@MOUVEX.COM', '33 386498630', 'LAURENT SOUCHELEAU', 'MOUVEX', +'2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE', +'SOUCHELEAU@MOUVEX.COM', '33 386498643', '', '2017-01-30 10:04:38'), +(80566, 'www.inup.com', 'MAXIMILIAN V. KETELHODT', null, +'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', 'GERMANY', +'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', 'MAXIMILIAN V. KETELHODT', +null, 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', +'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', +'MAXIMILIAN V. KETELHODT', null, 'SUELZBURGSTRASSE 158A', null, null, null, +null, 'KOELN', '50937', 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', +'492214307580', '', '2017-01-30 10:08:29'); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='mrr=on,mrr_sort_keys=on'; +SELECT * FROM t1 +WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND +timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) +ORDER BY timestamp DESC; +id domain registrant_name registrant_organization registrant_street1 registrant_street2 registrant_street3 registrant_street4 registrant_street5 registrant_city registrant_postal_code registrant_country registrant_email registrant_telephone administrative_name administrative_organization administrative_street1 administrative_street2 administrative_street3 administrative_street4 administrative_street5 administrative_city administrative_postal_code administrative_country administrative_email administrative_telephone technical_name technical_organization technical_street1 technical_street2 technical_street3 technical_street4 technical_street5 technical_city technical_postal_code technical_country technical_email technical_telephone json timestamp +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND +timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) +ORDER BY timestamp DESC; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref|filter ixEventWhoisDomainDomain,ixEventWhoisDomainTimestamp ixEventWhoisDomainDomain|ixEventWhoisDomainTimestamp 767|4 const 2 (14%) 14.29 Using index condition; Using where; Using filesort; Using rowid filter +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`domain` AS `domain`,`test`.`t1`.`registrant_name` AS `registrant_name`,`test`.`t1`.`registrant_organization` AS `registrant_organization`,`test`.`t1`.`registrant_street1` AS `registrant_street1`,`test`.`t1`.`registrant_street2` AS `registrant_street2`,`test`.`t1`.`registrant_street3` AS `registrant_street3`,`test`.`t1`.`registrant_street4` AS `registrant_street4`,`test`.`t1`.`registrant_street5` AS `registrant_street5`,`test`.`t1`.`registrant_city` AS `registrant_city`,`test`.`t1`.`registrant_postal_code` AS `registrant_postal_code`,`test`.`t1`.`registrant_country` AS `registrant_country`,`test`.`t1`.`registrant_email` AS `registrant_email`,`test`.`t1`.`registrant_telephone` AS `registrant_telephone`,`test`.`t1`.`administrative_name` AS `administrative_name`,`test`.`t1`.`administrative_organization` AS `administrative_organization`,`test`.`t1`.`administrative_street1` AS `administrative_street1`,`test`.`t1`.`administrative_street2` AS `administrative_street2`,`test`.`t1`.`administrative_street3` AS `administrative_street3`,`test`.`t1`.`administrative_street4` AS `administrative_street4`,`test`.`t1`.`administrative_street5` AS `administrative_street5`,`test`.`t1`.`administrative_city` AS `administrative_city`,`test`.`t1`.`administrative_postal_code` AS `administrative_postal_code`,`test`.`t1`.`administrative_country` AS `administrative_country`,`test`.`t1`.`administrative_email` AS `administrative_email`,`test`.`t1`.`administrative_telephone` AS `administrative_telephone`,`test`.`t1`.`technical_name` AS `technical_name`,`test`.`t1`.`technical_organization` AS `technical_organization`,`test`.`t1`.`technical_street1` AS `technical_street1`,`test`.`t1`.`technical_street2` AS `technical_street2`,`test`.`t1`.`technical_street3` AS `technical_street3`,`test`.`t1`.`technical_street4` AS `technical_street4`,`test`.`t1`.`technical_street5` AS `technical_street5`,`test`.`t1`.`technical_city` AS `technical_city`,`test`.`t1`.`technical_postal_code` AS `technical_postal_code`,`test`.`t1`.`technical_country` AS `technical_country`,`test`.`t1`.`technical_email` AS `technical_email`,`test`.`t1`.`technical_telephone` AS `technical_telephone`,`test`.`t1`.`json` AS `json`,`test`.`t1`.`timestamp` AS `timestamp` from `test`.`t1` where `test`.`t1`.`domain` = 'www.mailhost.i-dev.fr' and `test`.`t1`.`timestamp` >= (current_timestamp() + interval -1 month) order by `test`.`t1`.`timestamp` desc +SET optimizer_switch=@save_optimizer_switch; +DROP TABLE t1; diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index f1b7b0dbbb0..1a5c8fe73d5 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -215,3 +215,120 @@ eval $q; drop table t1; set global innodb_stats_persistent= @stats.save; + +--echo # +--echo # MDEV-21356: usage of range filter with range access employing +--echo # optimizer_switch='mrr=on,mrr_sort_keys=on'; +--echo # + +CREATE TABLE t1 ( + id int(11) unsigned NOT NULL AUTO_INCREMENT, + domain varchar(255) NOT NULL, + registrant_name varchar(255) DEFAULT NULL, + registrant_organization varchar(255) DEFAULT NULL, + registrant_street1 varchar(255) DEFAULT NULL, + registrant_street2 varchar(255) DEFAULT NULL, + registrant_street3 varchar(255) DEFAULT NULL, + registrant_street4 varchar(255) DEFAULT NULL, + registrant_street5 varchar(255) DEFAULT NULL, + registrant_city varchar(255) DEFAULT NULL, + registrant_postal_code varchar(255) DEFAULT NULL, + registrant_country varchar(255) DEFAULT NULL, + registrant_email varchar(255) DEFAULT NULL, + registrant_telephone varchar(255) DEFAULT NULL, + administrative_name varchar(255) DEFAULT NULL, + administrative_organization varchar(255) DEFAULT NULL, + administrative_street1 varchar(255) DEFAULT NULL, + administrative_street2 varchar(255) DEFAULT NULL, + administrative_street3 varchar(255) DEFAULT NULL, + administrative_street4 varchar(255) DEFAULT NULL, + administrative_street5 varchar(255) DEFAULT NULL, + administrative_city varchar(255) DEFAULT NULL, + administrative_postal_code varchar(255) DEFAULT NULL, + administrative_country varchar(255) DEFAULT NULL, + administrative_email varchar(255) DEFAULT NULL, + administrative_telephone varchar(255) DEFAULT NULL, + technical_name varchar(255) DEFAULT NULL, + technical_organization varchar(255) DEFAULT NULL, + technical_street1 varchar(255) DEFAULT NULL, + technical_street2 varchar(255) DEFAULT NULL, + technical_street3 varchar(255) DEFAULT NULL, + technical_street4 varchar(255) DEFAULT NULL, + technical_street5 varchar(255) DEFAULT NULL, + technical_city varchar(255) DEFAULT NULL, + technical_postal_code varchar(255) DEFAULT NULL, + technical_country varchar(255) DEFAULT NULL, + technical_email varchar(255) DEFAULT NULL, + technical_telephone varchar(255) DEFAULT NULL, + json longblob NOT NULL, + timestamp timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (id), + KEY ixEventWhoisDomainDomain (domain), + KEY ixEventWhoisDomainTimestamp (timestamp) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO t1 ( +id, domain, registrant_name, registrant_organization, registrant_street1, +registrant_street2, registrant_street3, registrant_street4, registrant_street5, +registrant_city, registrant_postal_code, registrant_country, registrant_email, +registrant_telephone, administrative_name, administrative_organization, +administrative_street1, administrative_street2, administrative_street3, +administrative_street4, administrative_street5, administrative_city, +administrative_postal_code, administrative_country, administrative_email, +administrative_telephone, technical_name, technical_organization, +technical_street1, technical_street2, technical_street3, technical_street4, +technical_street5, technical_city, technical_postal_code, technical_country, +technical_email, technical_telephone, json, timestamp) VALUES +(60380, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, '', '2016-12-22 09:18:28'), +(60383, 'www.bestwestern.fr', null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, '', '2016-12-22 09:27:06'), +(80392, 'www.dfinitions.fr', null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, '', '2017-01-30 08:02:01'), +(80407, 'www.firma.o2.pl', null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, 'AZ.pl Sp. z o.o.', 'Al. Papieza Jana Pawla II 19/2', + null, null, null, null, '70-453 Szczecin', null, 'POLAND', null, + '48914243780', '', '2017-01-30 08:24:51'), +(80551, 'www.mailhost.i-dev.fr', null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, '', '2017-01-30 10:00:56'), +(80560, 'www.blackmer-mouvex.com', 'MARIE-PIERRE PRODEAU', 'MOUVEX', + '2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE', + 'PRODEAU@MOUVEX.COM', null, 'MARIE-PIERRE PRODEAU', 'MOUVEX', + '2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE', + 'PRODEAU@MOUVEX.COM', '33 386498630', 'LAURENT SOUCHELEAU', 'MOUVEX', + '2 RUE DES CAILLOTES', null, null, null, null, 'AUXERRE', '89000', 'FRANCE', + 'SOUCHELEAU@MOUVEX.COM', '33 386498643', '', '2017-01-30 10:04:38'), +(80566, 'www.inup.com', 'MAXIMILIAN V. KETELHODT', null, + 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', 'GERMANY', + 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', 'MAXIMILIAN V. KETELHODT', + null, 'SUELZBURGSTRASSE 158A', null, null, null, null, 'KOELN', '50937', + 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', '492214307580', + 'MAXIMILIAN V. KETELHODT', null, 'SUELZBURGSTRASSE 158A', null, null, null, + null, 'KOELN', '50937', 'GERMANY', 'ICANN@EXPIRES-2009.WEBCARE24.COM', + '492214307580', '', '2017-01-30 10:08:29'); + +SET @save_optimizer_switch=@@optimizer_switch; + +SET optimizer_switch='mrr=on,mrr_sort_keys=on'; + +let $q= +SELECT * FROM t1 + WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND + timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) +ORDER BY timestamp DESC; + +eval $q; +eval EXPLAIN EXTENDED $q; + +SET optimizer_switch=@save_optimizer_switch; + +DROP TABLE t1; diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 4fc386a0afe..7e4c2ed1f53 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -19,6 +19,7 @@ #include "sql_select.h" #include "key.h" #include "sql_statistics.h" +#include "rowid_filter.h" static ulonglong key_block_no(TABLE *table, uint keyno, ha_rows keyentry_pos) { @@ -709,6 +710,20 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg, is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION); index_reader_exhausted= FALSE; index_reader_needs_refill= TRUE; + + /* + Currently usage of a rowid filter within InnoDB engine is not supported + if the table is accessed by the primary key. + With optimizer switches ''mrr' and 'mrr_sort_keys' are both enabled + any access by a secondary index is converted to the rndpos access. In + InnoDB the rndpos access is always uses the primary key. + Do not use pushed rowid filter if the table is accessed actually by the + primary key. Use the rowid filter outside the engine code (see + Mrr_ordered_rndpos_reader::refill_from_index_reader). + */ + if (file->pushed_rowid_filter && file->primary_key_is_clustered()) + file->cancel_pushed_rowid_filter(); + return 0; } @@ -801,6 +816,15 @@ int Mrr_ordered_rndpos_reader::refill_from_index_reader() index_reader->position(); + /* + If the built rowid filter cannot be used at the engine level use it here. + */ + Rowid_filter *rowid_filter= + file->get_table()->reginfo.join_tab->rowid_filter; + if (rowid_filter && !file->pushed_rowid_filter && + !rowid_filter->check((char *)index_rowid)) + continue; + /* Put rowid, or {rowid, range_id} pair into the buffer */ rowid_buffer->write_ptr1= index_rowid; rowid_buffer->write_ptr2= (uchar*)&range_info; From 74a0cde1c612a1549320c5c74146a0763d5916fb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 18 Jan 2020 02:02:29 +0100 Subject: [PATCH 37/43] mysql_install_db always has to pass --user=$user to the mysqld followup for 9d18b624675 strangely enough it only failed upgrade test on eoan --- scripts/mysql_install_db.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 0de1fe45014..5226c183d46 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -478,9 +478,9 @@ do fi done -if test -n "$user" -a "$in_rpm" -eq 0 +if test -n "$user" then - if test -z "$srcdir" + if test -z "$srcdir" -a "$in_rpm" -eq 0 then chown 0 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" && \ chmod 04755 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" @@ -490,14 +490,14 @@ then echo "It must be root, the PAM authentication plugin doesn't work otherwise.." echo fi - fi - chown $user "$pamtooldir/auth_pam_tool_dir" && \ - chmod 0700 "$pamtooldir/auth_pam_tool_dir" - if test $? -ne 0 - then - echo "Cannot change ownership of the '$pamtooldir/auth_pam_tool_dir' directory" - echo "to the '$user' user. Check that you have the necessary permissions and try again." - echo + chown $user "$pamtooldir/auth_pam_tool_dir" && \ + chmod 0700 "$pamtooldir/auth_pam_tool_dir" + if test $? -ne 0 + then + echo "Cannot change ownership of the '$pamtooldir/auth_pam_tool_dir' directory" + echo "to the '$user' user. Check that you have the necessary permissions and try again." + echo + fi fi args="$args --user=$user" fi From 9be5c19c3458963ccf82450b198567976275d599 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 19 Jan 2020 21:16:15 +0300 Subject: [PATCH 38/43] Fix another trivial merge error --- sql/sp_head.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 3a113de9dd5..ba130881d68 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -493,8 +493,8 @@ void sp_head::destroy(sp_head *sp) { /* Make a copy of main_mem_root as free_root will free the sp */ MEM_ROOT own_root= sp->main_mem_root; - DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx", - (ulong) &sp->mem_root, (ulong) &own_root)); + DBUG_PRINT("info", ("mem_root %p moved to %p", + &sp->mem_root, &own_root)); delete sp; From 7ea413ac2d80c7f03d1dbad90ac30ecddd8b2835 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sun, 19 Jan 2020 20:03:25 -0800 Subject: [PATCH 39/43] MDEV-21446 Assertion `!prebuilt->index->is_primary()' failed in row_search_idx_cond_check with rowid_filter upon concurrent access to table This bug has nothing to do with the concurrent access to table. Rather it concerns queries for which the optimizer decides to employ a rowid filter when accessing an InnoDB table by a secondary index, but later when calling test_if_skip_sort_order() changes its mind to access the table by the primary key. Currently usage of rowid filters is not supported in InnoDB if the table is accessed by the primary key. So in this case usage of a rowid filter to access the table must be prohibited. --- mysql-test/main/rowid_filter_innodb.result | 53 ++++++++++++++++++++++ mysql-test/main/rowid_filter_innodb.test | 49 ++++++++++++++++++++ sql/sql_select.cc | 13 ++++++ 3 files changed, 115 insertions(+) diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 36a59b8047e..c59b95bf877 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -2469,3 +2469,56 @@ Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`domain` AS `domain`,`test`.`t1`.`registrant_name` AS `registrant_name`,`test`.`t1`.`registrant_organization` AS `registrant_organization`,`test`.`t1`.`registrant_street1` AS `registrant_street1`,`test`.`t1`.`registrant_street2` AS `registrant_street2`,`test`.`t1`.`registrant_street3` AS `registrant_street3`,`test`.`t1`.`registrant_street4` AS `registrant_street4`,`test`.`t1`.`registrant_street5` AS `registrant_street5`,`test`.`t1`.`registrant_city` AS `registrant_city`,`test`.`t1`.`registrant_postal_code` AS `registrant_postal_code`,`test`.`t1`.`registrant_country` AS `registrant_country`,`test`.`t1`.`registrant_email` AS `registrant_email`,`test`.`t1`.`registrant_telephone` AS `registrant_telephone`,`test`.`t1`.`administrative_name` AS `administrative_name`,`test`.`t1`.`administrative_organization` AS `administrative_organization`,`test`.`t1`.`administrative_street1` AS `administrative_street1`,`test`.`t1`.`administrative_street2` AS `administrative_street2`,`test`.`t1`.`administrative_street3` AS `administrative_street3`,`test`.`t1`.`administrative_street4` AS `administrative_street4`,`test`.`t1`.`administrative_street5` AS `administrative_street5`,`test`.`t1`.`administrative_city` AS `administrative_city`,`test`.`t1`.`administrative_postal_code` AS `administrative_postal_code`,`test`.`t1`.`administrative_country` AS `administrative_country`,`test`.`t1`.`administrative_email` AS `administrative_email`,`test`.`t1`.`administrative_telephone` AS `administrative_telephone`,`test`.`t1`.`technical_name` AS `technical_name`,`test`.`t1`.`technical_organization` AS `technical_organization`,`test`.`t1`.`technical_street1` AS `technical_street1`,`test`.`t1`.`technical_street2` AS `technical_street2`,`test`.`t1`.`technical_street3` AS `technical_street3`,`test`.`t1`.`technical_street4` AS `technical_street4`,`test`.`t1`.`technical_street5` AS `technical_street5`,`test`.`t1`.`technical_city` AS `technical_city`,`test`.`t1`.`technical_postal_code` AS `technical_postal_code`,`test`.`t1`.`technical_country` AS `technical_country`,`test`.`t1`.`technical_email` AS `technical_email`,`test`.`t1`.`technical_telephone` AS `technical_telephone`,`test`.`t1`.`json` AS `json`,`test`.`t1`.`timestamp` AS `timestamp` from `test`.`t1` where `test`.`t1`.`domain` = 'www.mailhost.i-dev.fr' and `test`.`t1`.`timestamp` >= (current_timestamp() + interval -1 month) order by `test`.`t1`.`timestamp` desc SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1; +# +# MDEV-21446: index to access the table is changed for primary key +# +SET @stats.save= @@innodb_stats_persistent; +SET global innodb_stats_persistent=on; +CREATE TABLE t1 ( +pk int auto_increment, +a int, +b int, +primary key (pk), +key (a), +key (b) +) ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES +(0,0), (0,9), (0,NULL), (1,2), (4,0), (2,9), (1,0), (NULL,0), (5,NULL), (5,1), +(0,7), (NULL,5), (NULL,0), (2,1), (2,5), (6,NULL), (0,NULL), (NULL,8), (8,5), +(2,NULL), (2,3), (NULL,8), (NULL,6), (1,1), (5,1), (NULL,5), (4,4), (2,4), +(2,5), (1,9), (NULL,0), (3,7), (0,4), (2,8), (1,2), (1,4), (2,1), +(NULL,7), (6,6), (3,0), (4,5), (5,2), (8,2), (NULL,NULL), (8,NULL), +(0,1),(0,7); +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN EXTENDED +SELECT * FROM t1 +WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range|filter a,b b|a 5|5 NULL 192 (21%) 21.31 Using index condition; Using where; Using rowid filter +Warnings: +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9) +EXPLAIN EXTENDED +SELECT * FROM t1 +WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) +ORDER BY pk LIMIT 1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 index a,b PRIMARY 4 NULL 75 54.55 Using where +Warnings: +Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9) order by `test`.`t1`.`pk` limit 1 +ANALYZE +SELECT * FROM t1 +WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) +ORDER BY pk LIMIT 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 index a,b PRIMARY 4 NULL 3008 3008.00 1.36 0.00 Using where +DROP TABLE t1; +SET global innodb_stats_persistent= @stats.save; diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index 1a5c8fe73d5..30e0edeb75a 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -332,3 +332,52 @@ eval EXPLAIN EXTENDED $q; SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1; + +--echo # +--echo # MDEV-21446: index to access the table is changed for primary key +--echo # + +SET @stats.save= @@innodb_stats_persistent; +SET global innodb_stats_persistent=on; + +CREATE TABLE t1 ( + pk int auto_increment, + a int, + b int, + primary key (pk), + key (a), + key (b) +) ENGINE=InnoDB; + +INSERT INTO t1 (a,b) VALUES +(0,0), (0,9), (0,NULL), (1,2), (4,0), (2,9), (1,0), (NULL,0), (5,NULL), (5,1), +(0,7), (NULL,5), (NULL,0), (2,1), (2,5), (6,NULL), (0,NULL), (NULL,8), (8,5), +(2,NULL), (2,3), (NULL,8), (NULL,6), (1,1), (5,1), (NULL,5), (4,4), (2,4), +(2,5), (1,9), (NULL,0), (3,7), (0,4), (2,8), (1,2), (1,4), (2,1), +(NULL,7), (6,6), (3,0), (4,5), (5,2), (8,2), (NULL,NULL), (8,NULL), +(0,1),(0,7); +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; +INSERT INTO t1(a,b) SELECT a, b FROM t1; + +ANALYZE TABLE t1; + +EXPLAIN EXTENDED +SELECT * FROM t1 + WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9); + +EXPLAIN EXTENDED +SELECT * FROM t1 + WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) +ORDER BY pk LIMIT 1; + +ANALYZE +SELECT * FROM t1 + WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) +ORDER BY pk LIMIT 1; + +DROP TABLE t1; +SET global innodb_stats_persistent= @stats.save; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d9d9c229c2f..0e0c5c94387 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -23241,6 +23241,19 @@ check_reverse_order: join_read_first:join_read_last; tab->type=JT_NEXT; // Read with index_first(), index_next() + /* + Currently usage of rowid filters is not supported in InnoDB + if the table is accessed by the primary key + */ + if (tab->rowid_filter && + tab->index == table->s->primary_key && + table->file->primary_key_is_clustered()) + { + tab->range_rowid_filter_info= 0; + delete tab->rowid_filter; + tab->rowid_filter= 0; + } + if (tab->pre_idx_push_select_cond) { tab->set_cond(tab->pre_idx_push_select_cond); From e47b78028652224e941c361deaee7a4431abe081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Jan 2020 08:38:55 +0200 Subject: [PATCH 40/43] MDEV-13626: Work around DEBUG_SYNC timeouts --- .../suite/innodb/r/innodb_wl6326.result | 13 +++++----- mysql-test/suite/innodb/t/innodb_wl6326.test | 24 ++++++++++++------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_wl6326.result b/mysql-test/suite/innodb/r/innodb_wl6326.result index 8abd42be36f..fa093581e56 100644 --- a/mysql-test/suite/innodb/r/innodb_wl6326.result +++ b/mysql-test/suite/innodb/r/innodb_wl6326.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1; SET GLOBAL innodb_adaptive_hash_index = false; SET GLOBAL innodb_stats_persistent = false; connect con1,localhost,root,,; @@ -281,8 +280,8 @@ connection con3; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection con1; connection con2; @@ -311,8 +310,8 @@ connection con3; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'el'; connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection con1; connection con2; @@ -347,8 +346,8 @@ connection con3; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection con1; connection con2; diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.test b/mysql-test/suite/innodb/t/innodb_wl6326.test index 939dc1edcc8..74fa931edf1 100644 --- a/mysql-test/suite/innodb/t/innodb_wl6326.test +++ b/mysql-test/suite/innodb/t/innodb_wl6326.test @@ -12,9 +12,6 @@ SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; SET @old_innodb_stats_persistent = @@innodb_stats_persistent; --enable_query_log ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings # Save the initial number of concurrent sessions --source include/count_sessions.inc @@ -353,8 +350,11 @@ SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; --connection default -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +# FIXME: These occasionally time out! +--disable_warnings +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; +--enable_warnings SET DEBUG_SYNC = 'now SIGNAL continue'; --connection con1 @@ -407,8 +407,11 @@ SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'el'; --connection default -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +# FIXME: These occasionally time out! +--disable_warnings +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; +--enable_warnings SET DEBUG_SYNC = 'now SIGNAL continue'; --connection con1 @@ -461,8 +464,11 @@ SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; --connection default -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait2'; +# FIXME: These occasionally time out! +--disable_warnings +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; +--enable_warnings SET DEBUG_SYNC = 'now SIGNAL continue'; --connection con1 From ceffabc421fa9473c0d0e55b038103bcf76e3bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Jan 2020 08:40:32 +0200 Subject: [PATCH 41/43] Enable tests for --embedded --- mysql-test/suite/innodb_gis/t/rtree_rollback1.test | 3 --- mysql-test/suite/innodb_gis/t/rtree_rollback2.test | 3 --- 2 files changed, 6 deletions(-) diff --git a/mysql-test/suite/innodb_gis/t/rtree_rollback1.test b/mysql-test/suite/innodb_gis/t/rtree_rollback1.test index 123bccf76a1..3dea75bc026 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_rollback1.test +++ b/mysql-test/suite/innodb_gis/t/rtree_rollback1.test @@ -1,9 +1,6 @@ # WL#6745 InnoDB R-tree support # This test case will test R-tree split. -# Not supported in embedded ---source include/not_embedded.inc - --source include/have_innodb.inc --source include/big_test.inc --source include/not_valgrind.inc diff --git a/mysql-test/suite/innodb_gis/t/rtree_rollback2.test b/mysql-test/suite/innodb_gis/t/rtree_rollback2.test index cddbaf5592d..78b251bd696 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_rollback2.test +++ b/mysql-test/suite/innodb_gis/t/rtree_rollback2.test @@ -1,9 +1,6 @@ # WL#6745 InnoDB R-tree support # This test case will test R-tree split. -# Not supported in embedded ---source include/not_embedded.inc - --source include/have_innodb.inc --source include/big_test.inc --source include/not_valgrind.inc From 57ec527841c170f49a79fc34f3dcf68e48e24483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 16 Jan 2020 13:18:44 +0200 Subject: [PATCH 42/43] MDEV-17062 : Test failure on galera.MW-336 Add mutex protection while we calculate required slave thread change and create them. Add error handling. --- mysql-test/suite/galera/disabled.def | 1 - sql/wsrep_thd.cc | 36 +++++++++++++++++++++------- sql/wsrep_thd.h | 2 +- sql/wsrep_var.cc | 11 +++++++-- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 22b3d081087..e00ce9e5d6f 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -18,7 +18,6 @@ MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B MW-329 : MDEV-19962 Galera test failure on MW-329 -MW-336 : MDEV-21409: Galera test failure on MW-336 MW-360 : needs rewrite to be MariaDB gtid compatible galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults galera_account_management : MariaDB 10.0 does not support ALTER USER diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 7f1818def73..36a58b3c9b0 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -84,42 +84,59 @@ static void wsrep_replication_process(THD *thd, DBUG_VOID_RETURN; } -static bool create_wsrep_THD(Wsrep_thd_args* args) +static bool create_wsrep_THD(Wsrep_thd_args* args, bool mutex_protected) { + if (!mutex_protected) + mysql_mutex_lock(&LOCK_wsrep_slave_threads); + ulong old_wsrep_running_threads= wsrep_running_threads; + DBUG_ASSERT(args->thread_type() == WSREP_APPLIER_THREAD || args->thread_type() == WSREP_ROLLBACKER_THREAD); + bool res= mysql_thread_create(args->thread_type() == WSREP_APPLIER_THREAD ? key_wsrep_applier : key_wsrep_rollbacker, args->thread_id(), &connection_attrib, start_wsrep_THD, (void*)args); + + if (res) + { + WSREP_ERROR("Canät create wsrep thread"); + } + /* if starting a thread on server startup, wait until the this thread's THD is fully initialized (otherwise a THD initialization code might try to access a partially initialized server data structure - MDEV-8208). */ - mysql_mutex_lock(&LOCK_wsrep_slave_threads); if (!mysqld_server_initialized) + { while (old_wsrep_running_threads == wsrep_running_threads) + { mysql_cond_wait(&COND_wsrep_slave_threads, &LOCK_wsrep_slave_threads); - mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + } + } + + if (!mutex_protected) + mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + return res; } -void wsrep_create_appliers(long threads) +bool wsrep_create_appliers(long threads, bool mutex_protected) { /* Dont' start slave threads if wsrep-provider or wsrep-cluster-address is not set. */ if (!WSREP_PROVIDER_EXISTS) { - return; + return false; } if (!wsrep_cluster_address || wsrep_cluster_address[0]== 0) { WSREP_DEBUG("wsrep_create_appliers exit due to empty address"); - return; + return false; } long wsrep_threads=0; @@ -129,11 +146,14 @@ void wsrep_create_appliers(long threads) Wsrep_thd_args* args(new Wsrep_thd_args(wsrep_replication_process, WSREP_APPLIER_THREAD, pthread_self())); - if (create_wsrep_THD(args)) + if (create_wsrep_THD(args, mutex_protected)) { WSREP_WARN("Can't create thread to manage wsrep replication"); + return true; } } + + return false; } static void wsrep_remove_streaming_fragments(THD* thd, const char* ctx) @@ -279,7 +299,7 @@ void wsrep_create_rollbacker() pthread_self())); /* create rollbacker */ - if (create_wsrep_THD(args)) + if (create_wsrep_THD(args, false)) WSREP_WARN("Can't create thread to manage wsrep rollback"); } } diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index f98c15a5a85..d24d8e6358f 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -84,7 +84,7 @@ private: int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff, enum enum_var_type scope); -void wsrep_create_appliers(long threads); +bool wsrep_create_appliers(long threads, bool mutex_protected=false); void wsrep_create_rollbacker(); bool wsrep_bf_abort(const THD*, THD*); diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 315cfe2c53e..5f76f650b34 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -594,15 +594,22 @@ static void wsrep_slave_count_change_update () bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) { + mysql_mutex_lock(&LOCK_wsrep_slave_threads); + bool res= false; + wsrep_slave_count_change_update(); + if (wsrep_slave_count_change > 0) { WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads); - wsrep_create_appliers(wsrep_slave_count_change); + res= wsrep_create_appliers(wsrep_slave_count_change, true); WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads); wsrep_slave_count_change = 0; } - return false; + + mysql_mutex_unlock(&LOCK_wsrep_slave_threads); + + return res; } bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) From 259185764ba949bbe0cfa6bbef4673f61155cb90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Jan 2020 16:08:18 +0200 Subject: [PATCH 43/43] MDEV-17062: Fix a typo in an error message --- sql/wsrep_thd.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 36a58b3c9b0..5ae583212f3 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -100,9 +100,7 @@ static bool create_wsrep_THD(Wsrep_thd_args* args, bool mutex_protected) start_wsrep_THD, (void*)args); if (res) - { - WSREP_ERROR("Canät create wsrep thread"); - } + WSREP_ERROR("Can't create wsrep thread"); /* if starting a thread on server startup, wait until the this thread's THD