diff options
90 files changed, 1504 insertions, 732 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b1adbce5565..d93c09218a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,7 +228,7 @@ ENDIF() OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF) IF (WITH_UBSAN) - MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) + MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE -DWITH_UBSAN" DEBUG RELWITHDEBINFO) ENDIF() OPTION(WITH_MSAN "Enable memory sanitizer" OFF) diff --git a/include/my_pthread.h b/include/my_pthread.h index 0d9b9d61616..175731a7b0b 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB Corporation. + Copyright (c) 2009, 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 @@ -684,7 +684,7 @@ extern void my_mutex_end(void); We need to have at least 256K stack to handle calls to myisamchk_init() with the current number of keys and key parts. */ -#ifdef __SANITIZE_ADDRESS__ +#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) #define DEFAULT_THREAD_STACK (383*1024L) /* 392192 */ #else #define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */ diff --git a/include/span.h b/include/span.h new file mode 100644 index 00000000000..0ed0158088c --- /dev/null +++ b/include/span.h @@ -0,0 +1,141 @@ +/***************************************************************************** + +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 +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA + +*****************************************************************************/ + +#pragma once + +#include <cstddef> +#include <iterator> + +namespace st_ +{ + +template <class ElementType> class span +{ +public: + typedef ElementType element_type; + typedef ElementType value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef element_type *pointer; + typedef const element_type *const_pointer; + typedef element_type &reference; + typedef const element_type &const_reference; + typedef pointer iterator; + typedef const_pointer const_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + + span() : data_(NULL), size_(0) {} + + span(pointer ptr, size_type count) : data_(ptr), size_(count) {} + + span(pointer first, pointer last) : data_(first), size_(last - first) {} + + template <size_t N> span(element_type (&arr)[N]) : data_(arr), size_(N) {} + + template <class Container> + span(Container &cont) : data_(cont.data()), size_(cont.size()) + { + } + + template <class Container> + span(const Container &cont) : data_(cont.data()), size_(cont.size()) + { + } + + span(const span &other) : data_(other.data_), size_(other.size_) {} + + ~span(){}; + + span &operator=(const span &other) + { + data_= other.data_; + size_= other.size_; + return *this; + } + + template <size_t Count> span<element_type> first() const + { + assert(!empty()); + return span(data_, 1); + } + template <size_t Count> span<element_type> last() const + { + assert(!empty()); + return span(data_ + size() - 1, 1); + } + + span<element_type> first(size_type count) const + { + assert(!empty()); + return span(data_, 1); + } + span<element_type> last(size_type count) const + { + assert(!empty()); + return span(data_ + size() - 1, 1); + } + span<element_type> subspan(size_type offset, size_type count) const + { + assert(!empty()); + assert(size() >= offset + count); + return span(data_ + offset, count); + } + + size_type size() const { return size_; } + size_type size_bytes() const { return size_ * sizeof(ElementType); } + bool empty() const __attribute__((warn_unused_result)) { return size_ == 0; } + + reference operator[](size_type idx) const + { + assert(size() > idx); + return data_[idx]; + } + reference front() const + { + assert(!empty()); + return data_[0]; + } + reference back() const + { + assert(!empty()); + return data_[size() - 1]; + } + pointer data() const + { + assert(!empty()); + return data_; + } + + iterator begin() const { return data_; } + iterator end() const { return data_ + size_; } + reverse_iterator rbegin() const + { + return std::reverse_iterator<iterator>(std::advance(end(), -1)); + } + reverse_iterator rend() const + { + return std::reverse_iterator<iterator>(std::advance(begin(), -1)); + } + +private: + pointer data_; + size_type size_; +}; + +} // namespace st_ diff --git a/mysql-test/include/io_thd_fault_injection.inc b/mysql-test/include/io_thd_fault_injection.inc index 11479b3a66c..67b41371913 100644 --- a/mysql-test/include/io_thd_fault_injection.inc +++ b/mysql-test/include/io_thd_fault_injection.inc @@ -1,20 +1,19 @@ # # Takes the flag as an argument: -# -- let $io_thd_injection_fault_flag=+d,fault_injection_new_file_rotate_event +# -- let $io_thd_injection_fault_flag=d,fault_injection_new_file_rotate_event # -- source include/io_thd_fault_injection.inc # -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; -- disable_warnings -- source include/stop_slave.inc -- enable_warnings --- eval SET GLOBAL debug_dbug="+d,$io_thd_injection_fault_flag" +-- eval SET @@global.debug_dbug="d,$io_thd_injection_fault_flag" START SLAVE io_thread; -- source include/wait_for_slave_io_error.inc --- eval SET GLOBAL debug_dbug="-d,$io_thd_injection_fault_flag" -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; # restart because slave is in bad shape --let $rpl_server_number= 2 diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index c7f6448f2d8..68b54d0729a 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -10554,6 +10554,18 @@ a b max_c a b dayname(v1.b) DROP VIEW v1; DROP TABLE t1, t2; SET optimizer_switch=DEFAULT; +# +# MDEV-17177: an attempt to push down IN predicate when one of +# the arguments is too complex to be cloned +# +CREATE TABLE t1 (a VARCHAR(8)); +INSERT INTO t1 VALUES ('abc'),('def'); +CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a; +SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar'); +a +abc +DROP VIEW v1; +DROP TABLE t1; # End of 10.2 tests # # MDEV-14579: pushdown conditions into materialized views/derived tables @@ -16888,6 +16900,91 @@ Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`ro_id` = `test`.`t1`.`id` and `test`.`t2`.`flag` = 1) where `test`.`t1`.`id` = `test`.`t1`.`id` group by `test`.`t1`.`id`) `dt`) where `dt`.`id` = `test`.`t1`.`id` drop view v1; drop table t1,t2; +# +# MDEV-21883: potentially splittable materialized derived +# that uses a join of 32 tables +# +CREATE TABLE t (id INT NOT NULL PRIMARY KEY); +INSERT INTO t values (1),(2),(3); +set statement optimizer_switch='split_materialized=off' for SELECT t.id FROM t +LEFT JOIN ( +SELECT t0.id FROM t AS t0 +LEFT JOIN t AS t1 ON 0=1 +LEFT JOIN t AS t2 ON 0=1 +LEFT JOIN t AS t3 ON 0=1 +LEFT JOIN t AS t4 ON 0=1 +LEFT JOIN t AS t5 ON 0=1 +LEFT JOIN t AS t6 ON 0=1 +LEFT JOIN t AS t7 ON 0=1 +LEFT JOIN t AS t8 ON 0=1 +LEFT JOIN t AS t9 ON 0=1 +LEFT JOIN t AS t10 ON 0=1 +LEFT JOIN t AS t11 ON 0=1 +LEFT JOIN t AS t12 ON 0=1 +LEFT JOIN t AS t13 ON 0=1 +LEFT JOIN t AS t14 ON 0=1 +LEFT JOIN t AS t15 ON 0=1 +LEFT JOIN t AS t16 ON 0=1 +LEFT JOIN t AS t17 ON 0=1 +LEFT JOIN t AS t18 ON 0=1 +LEFT JOIN t AS t19 ON 0=1 +LEFT JOIN t AS t20 ON 0=1 +LEFT JOIN t AS t21 ON 0=1 +LEFT JOIN t AS t22 ON 0=1 +LEFT JOIN t AS t23 ON 0=1 +LEFT JOIN t AS t24 ON 0=1 +LEFT JOIN t AS t25 ON 0=1 +LEFT JOIN t AS t26 ON 0=1 +LEFT JOIN t AS t27 ON 0=1 +LEFT JOIN t AS t28 ON 0=1 +LEFT JOIN t AS t29 ON 0=1 +LEFT JOIN t AS t30 ON 0=1 +LEFT JOIN t AS t31 ON 0=1 +GROUP BY t0.id) AS dt ON dt.id = t.id; +id +1 +2 +3 +set statement optimizer_switch='split_materialized=on' for SELECT t.id FROM t +LEFT JOIN ( +SELECT t0.id FROM t AS t0 +LEFT JOIN t AS t1 ON 0=1 +LEFT JOIN t AS t2 ON 0=1 +LEFT JOIN t AS t3 ON 0=1 +LEFT JOIN t AS t4 ON 0=1 +LEFT JOIN t AS t5 ON 0=1 +LEFT JOIN t AS t6 ON 0=1 +LEFT JOIN t AS t7 ON 0=1 +LEFT JOIN t AS t8 ON 0=1 +LEFT JOIN t AS t9 ON 0=1 +LEFT JOIN t AS t10 ON 0=1 +LEFT JOIN t AS t11 ON 0=1 +LEFT JOIN t AS t12 ON 0=1 +LEFT JOIN t AS t13 ON 0=1 +LEFT JOIN t AS t14 ON 0=1 +LEFT JOIN t AS t15 ON 0=1 +LEFT JOIN t AS t16 ON 0=1 +LEFT JOIN t AS t17 ON 0=1 +LEFT JOIN t AS t18 ON 0=1 +LEFT JOIN t AS t19 ON 0=1 +LEFT JOIN t AS t20 ON 0=1 +LEFT JOIN t AS t21 ON 0=1 +LEFT JOIN t AS t22 ON 0=1 +LEFT JOIN t AS t23 ON 0=1 +LEFT JOIN t AS t24 ON 0=1 +LEFT JOIN t AS t25 ON 0=1 +LEFT JOIN t AS t26 ON 0=1 +LEFT JOIN t AS t27 ON 0=1 +LEFT JOIN t AS t28 ON 0=1 +LEFT JOIN t AS t29 ON 0=1 +LEFT JOIN t AS t30 ON 0=1 +LEFT JOIN t AS t31 ON 0=1 +GROUP BY t0.id) AS dt ON dt.id = t.id; +id +1 +2 +3 +DROP TABLE t; # End of 10.3 tests # # MDEV-18679: materialized view with SELECT S containing materialized diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index 152a130b8af..b2f97029ede 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -2169,6 +2169,22 @@ DROP TABLE t1, t2; SET optimizer_switch=DEFAULT; + + +--echo # +--echo # MDEV-17177: an attempt to push down IN predicate when one of +--echo # the arguments is too complex to be cloned +--echo # + +CREATE TABLE t1 (a VARCHAR(8)); +INSERT INTO t1 VALUES ('abc'),('def'); +CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a; + +SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar'); + +DROP VIEW v1; +DROP TABLE t1; + --echo # End of 10.2 tests --echo # @@ -3371,6 +3387,57 @@ eval explain extended $q2; drop view v1; drop table t1,t2; +--echo # +--echo # MDEV-21883: potentially splittable materialized derived +--echo # that uses a join of 32 tables +--echo # + +CREATE TABLE t (id INT NOT NULL PRIMARY KEY); +INSERT INTO t values (1),(2),(3); + +let $q= +SELECT t.id FROM t +LEFT JOIN ( + SELECT t0.id FROM t AS t0 + LEFT JOIN t AS t1 ON 0=1 + LEFT JOIN t AS t2 ON 0=1 + LEFT JOIN t AS t3 ON 0=1 + LEFT JOIN t AS t4 ON 0=1 + LEFT JOIN t AS t5 ON 0=1 + LEFT JOIN t AS t6 ON 0=1 + LEFT JOIN t AS t7 ON 0=1 + LEFT JOIN t AS t8 ON 0=1 + LEFT JOIN t AS t9 ON 0=1 + LEFT JOIN t AS t10 ON 0=1 + LEFT JOIN t AS t11 ON 0=1 + LEFT JOIN t AS t12 ON 0=1 + LEFT JOIN t AS t13 ON 0=1 + LEFT JOIN t AS t14 ON 0=1 + LEFT JOIN t AS t15 ON 0=1 + LEFT JOIN t AS t16 ON 0=1 + LEFT JOIN t AS t17 ON 0=1 + LEFT JOIN t AS t18 ON 0=1 + LEFT JOIN t AS t19 ON 0=1 + LEFT JOIN t AS t20 ON 0=1 + LEFT JOIN t AS t21 ON 0=1 + LEFT JOIN t AS t22 ON 0=1 + LEFT JOIN t AS t23 ON 0=1 + LEFT JOIN t AS t24 ON 0=1 + LEFT JOIN t AS t25 ON 0=1 + LEFT JOIN t AS t26 ON 0=1 + LEFT JOIN t AS t27 ON 0=1 + LEFT JOIN t AS t28 ON 0=1 + LEFT JOIN t AS t29 ON 0=1 + LEFT JOIN t AS t30 ON 0=1 + LEFT JOIN t AS t31 ON 0=1 + GROUP BY t0.id) AS dt ON dt.id = t.id; + +eval set statement optimizer_switch='split_materialized=off' for $q; + +eval set statement optimizer_switch='split_materialized=on' for $q; + +DROP TABLE t; + --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index 3a49c075ddd..a06c539f27b 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -2879,6 +2879,20 @@ GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAV 1 drop table t1; # +# MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double +# GROUP BY leads to crash +# +CALL mtr.add_suppression("Out of sort memory"); +CALL mtr.add_suppression("Sort aborted"); +SET @save_max_sort_length= @@max_sort_length; +SET max_sort_length=2000000; +SELECT * FROM information_schema.tables t JOIN information_schema.columns c +ON t.table_schema=c.table_schema +WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) +GROUP BY t.table_name; +ERROR HY001: Out of sort memory, consider increasing server sort buffer size +SET max_sort_length= @save_max_sort_length; +# # MDEV-16170 # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP # @@ -2889,3 +2903,4 @@ f COUNT(*) 1 1 NULL 1 DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 4d84eaa7fe3..15bc1791022 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -1990,6 +1990,23 @@ GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAV drop table t1; --echo # +--echo # MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double +--echo # GROUP BY leads to crash +--echo # + + +CALL mtr.add_suppression("Out of sort memory"); +CALL mtr.add_suppression("Sort aborted"); +SET @save_max_sort_length= @@max_sort_length; +SET max_sort_length=2000000; +--error ER_OUT_OF_SORTMEMORY +SELECT * FROM information_schema.tables t JOIN information_schema.columns c +ON t.table_schema=c.table_schema +WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) +GROUP BY t.table_name; +SET max_sort_length= @save_max_sort_length; + +--echo # --echo # MDEV-16170 --echo # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP --echo # @@ -1998,3 +2015,5 @@ CREATE TABLE t1 (d DATE); INSERT INTO t1 VALUES ('2032-10-08'); SELECT d != '2023-03-04' AS f, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP; DROP TABLE t1; + +--echo # End of 10.3 tests diff --git a/mysql-test/main/innodb_mysql_lock.result b/mysql-test/main/innodb_mysql_lock.result index 584ab19b2ee..25cf2882cd0 100644 --- a/mysql-test/main/innodb_mysql_lock.result +++ b/mysql-test/main/innodb_mysql_lock.result @@ -21,6 +21,7 @@ connection con3; set @@autocommit=0; DROP TABLE t1; connection con1; +# Waiting for until transaction will be locked inside innodb subsystem # Connection 1 is now holding the lock. # Issuing insert from connection 1 while connection 2&3 # is waiting for the lock should give a deadlock error. diff --git a/mysql-test/main/innodb_mysql_lock.test b/mysql-test/main/innodb_mysql_lock.test index 24ace437c50..6e746468dba 100644 --- a/mysql-test/main/innodb_mysql_lock.test +++ b/mysql-test/main/innodb_mysql_lock.test @@ -1,3 +1,4 @@ +--source include/have_metadata_lock_info.inc -- source include/have_innodb.inc # Save the initial number of concurrent sessions. @@ -36,10 +37,12 @@ set @@autocommit=0; --send DROP TABLE t1 connection con1; +--echo # Waiting for until transaction will be locked inside innodb subsystem let $wait_condition= - SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE info = "INSERT INTO t1 VALUES (1)" and - state = "update"; + SELECT COUNT(*) = 1 FROM information_schema.innodb_trx + WHERE trx_query = 'INSERT INTO t1 VALUES (1)' AND + trx_operation_state = 'inserting' AND + trx_state = 'LOCK WAIT'; --source include/wait_condition.inc let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result index eb58dd06997..c8a10577517 100644 --- a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result +++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result @@ -22,7 +22,7 @@ master-bin.000001 # master-bin.000002 # ###################### TEST #2 RESET MASTER; -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) @@ -30,7 +30,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) show binary logs; Log_name File_size master-bin.000001 # -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; ###################### TEST #3 CREATE TABLE t1 (a INT); @@ -44,11 +44,11 @@ show binary logs; Log_name File_size master-bin.000001 # master-bin.000002 # -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #4 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) @@ -56,21 +56,21 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) SELECT count(*) FROM t2; count(*) 1 -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #5 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; # assert: must show one entry SELECT count(*) FROM t2; count(*) 1 -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #6 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET AUTOCOMMIT=0; INSERT INTO t2 VALUES ('muse'); LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; @@ -83,11 +83,11 @@ SELECT count(*) FROM t2; count(*) 3 SET AUTOCOMMIT= 1; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #7 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET @@binlog_annotate_row_events= 0; SELECT count(*) FROM t4; count(*) @@ -100,14 +100,14 @@ SELECT count(*) FROM t4; count(*) 1 ### check that the incident event is written to the current log -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Incident # # #1 (LOST_EVENTS) DELETE FROM t4; RESET MASTER; ###################### TEST #8 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; # must show 0 entries SELECT count(*) FROM t4; count(*) @@ -147,9 +147,9 @@ count(*) SELECT count(*) FROM t2; count(*) 0 -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; ###################### TEST #9 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET SQL_LOG_BIN=0; INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); @@ -170,17 +170,17 @@ SELECT count(*) FROM t4; count(*) 0 SET SQL_LOG_BIN=1; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; ###################### TEST #10 call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("Could not use .*"); RESET MASTER; SHOW WARNINGS; Level Code Message -SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +SET @@global.debug_dbug="d,fault_injection_registering_index"; FLUSH LOGS; ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted") -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; SHOW BINARY LOGS; ERROR HY000: You are not using binary logging CREATE TABLE t5 (a INT); @@ -192,10 +192,10 @@ DROP TABLE t5; flush tables; ###################### TEST #11 include/rpl_restart_server.inc [server_number=1] -SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +SET @@global.debug_dbug="d,fault_injection_openning_index"; FLUSH LOGS; ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted") -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; ERROR HY000: Binlog closed, cannot RESET MASTER CREATE TABLE t5 (a INT); @@ -207,10 +207,10 @@ DROP TABLE t5; flush tables; include/rpl_restart_server.inc [server_number=1] ###################### TEST #12 -SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; FLUSH LOGS; ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory") -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; ERROR HY000: Binlog closed, cannot RESET MASTER CREATE TABLE t5 (a INT); @@ -237,44 +237,40 @@ call mtr.add_suppression("Could not use .*"); call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("Can't generate a unique log-filename .*"); ###################### TEST #13 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,error_unique_log_filename"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] ###################### TEST #14 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] ###################### TEST #15 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +SET @@global.debug_dbug="d,fault_injection_registering_index"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] ###################### TEST #16 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +SET @@global.debug_dbug="d,fault_injection_openning_index"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] include/stop_slave_sql.inc Warnings: diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.result b/mysql-test/suite/binlog_encryption/rpl_corruption.result index f32b7c58ad1..73bb373d6be 100644 --- a/mysql-test/suite/binlog_encryption/rpl_corruption.result +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.result @@ -13,42 +13,40 @@ 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"; +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 -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; +SET @@global.debug_dbug=@saved_dbug; # 3. Master read a corrupted event from binlog and send the error to slave -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; connection slave; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1236] connection master; -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug=@saved_dbug; # 4. Master read a corrupted event from binlog and send it to slave connection master; SET GLOBAL master_verify_checksum=0; -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; connection slave; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] connection master; -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug=@saved_dbug; +SET @@global.debug_dbug=@saved_dbug; SET GLOBAL master_verify_checksum=1; # 5. Slave. Corruption in network connection slave; SET @saved_dbug_slave = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,corrupt_queue_event"; +SET @@global.debug_dbug="d,corrupt_queue_event"; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] -SET GLOBAL debug_dbug="-d,corrupt_queue_event"; +SET @@global.debug_dbug=@saved_dbug_slave; # 6. Slave. Corruption in relay log -SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; +SET @@global.debug_dbug="d,corrupt_read_log_event_char"; START SLAVE SQL_THREAD; include/wait_for_slave_sql_error.inc [errno=1593] -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug=@saved_dbug_slave; +SET @@global.debug_dbug=@saved_dbug_slave; # 7. Seek diff for tables on master and slave connection slave; include/start_slave.inc 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 552805110b1..3658e38125f 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result @@ -12,7 +12,7 @@ CREATE TABLE `t` ( INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1); INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); -SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +SET global debug_dbug="d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; InnoDB 0 transactions not purged SET global debug_dbug=@old_dbug; @@ -27,7 +27,7 @@ i INT INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1); INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); -SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +SET global debug_dbug="d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; InnoDB 0 transactions not purged SET global debug_dbug=@old_dbug; @@ -48,7 +48,7 @@ insert into t1 values(3, 4, default); insert into t1 values(3, 12, default); insert into t1 values(4, 18, default); CREATE INDEX idx ON t1(x); -SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +SET global debug_dbug="d,ib_purge_virtual_index_callback"; UPDATE t1 SET id = 10 WHERE id = 1; InnoDB 0 transactions not purged SET global debug_dbug=@old_dbug; @@ -138,7 +138,7 @@ DROP TABLE t0, t1; create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); -set global debug_dbug="+d,ib_purge_virtual_index_callback"; +set global debug_dbug="d,ib_purge_virtual_index_callback"; connect prevent_purge, localhost, root; start transaction with consistent snapshot; connection default; @@ -181,7 +181,7 @@ CREATE TABLE t1 (y YEAR, vy YEAR AS (y) VIRTUAL UNIQUE, pk INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 (pk,y) VALUES (1,2022); CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; -SET GLOBAL debug_dbug = '+d,ib_purge_virtual_index_callback'; +SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback'; BEGIN; INSERT INTO t2(f1) VALUES(1); connection prevent_purge; 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 8568c66eccc..50fd7e3ddb5 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -22,7 +22,7 @@ INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); -SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +SET global debug_dbug="d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; --source ../../innodb/include/wait_all_purged.inc SET global debug_dbug=@old_dbug; @@ -41,7 +41,7 @@ INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); -SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +SET global debug_dbug="d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; --source ../../innodb/include/wait_all_purged.inc SET global debug_dbug=@old_dbug; @@ -68,7 +68,7 @@ insert into t1 values(4, 18, default); CREATE INDEX idx ON t1(x); -SET global debug_dbug="+d,ib_purge_virtual_index_callback"; +SET global debug_dbug="d,ib_purge_virtual_index_callback"; UPDATE t1 SET id = 10 WHERE id = 1; --source ../../innodb/include/wait_all_purged.inc SET global debug_dbug=@old_dbug; @@ -179,7 +179,7 @@ DROP TABLE t0, t1; create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); -set global debug_dbug="+d,ib_purge_virtual_index_callback"; +set global debug_dbug="d,ib_purge_virtual_index_callback"; connect(prevent_purge, localhost, root); start transaction with consistent snapshot; connection default; @@ -228,7 +228,7 @@ ENGINE=InnoDB; INSERT INTO t1 (pk,y) VALUES (1,2022); CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; -SET GLOBAL debug_dbug = '+d,ib_purge_virtual_index_callback'; +SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback'; BEGIN; INSERT INTO t2(f1) VALUES(1); diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result index ee4db08fc85..951233ced3c 100644 --- a/mysql-test/suite/innodb/r/corrupted_during_recovery.result +++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result @@ -17,3 +17,19 @@ CHECK TABLE t2; Table Op Msg_type Msg_text test.t2 check status OK DROP TABLE t1, t2; +CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3); +connect con1,localhost,root,,; +BEGIN; +DELETE FROM t1 WHERE pk=1; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE pk=3; +# Kill the server +disconnect con1; +# Corrupt the pages +SELECT * FROM t1; +pk +1 +2 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index b8ca1164489..f78615ea3a6 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -1,6 +1,6 @@ --- instant_alter.result +++ instant_alter,4k.result -@@ -242,7 +242,7 @@ +@@ -244,7 +244,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -9,7 +9,7 @@ connection default; ROLLBACK; connection analyze; -@@ -253,7 +253,7 @@ +@@ -255,7 +255,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -18,7 +18,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -265,7 +265,7 @@ +@@ -267,7 +267,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -27,7 +27,7 @@ connection default; ROLLBACK; connection analyze; -@@ -276,11 +276,17 @@ +@@ -278,11 +278,17 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -47,7 +47,7 @@ SELECT * FROM t2; id c1 d1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf -@@ -324,8 +330,14 @@ +@@ -326,8 +332,14 @@ affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; @@ -63,7 +63,7 @@ INSERT INTO t3 SET id=4; ERROR HY000: Field 'c2' doesn't have a default value INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; -@@ -338,7 +350,9 @@ +@@ -340,7 +352,9 @@ ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; affected rows: 4 @@ -74,7 +74,7 @@ INSERT INTO t3 SET id=5, c2=9; Warnings: Note 1265 Data truncated for column 'c7' at row 1 -@@ -352,7 +366,9 @@ +@@ -354,7 +368,9 @@ 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 @@ -85,7 +85,7 @@ SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog -@@ -380,6 +396,8 @@ +@@ -382,6 +398,8 @@ (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; @@ -94,7 +94,7 @@ BEGIN; INSERT INTO big SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); -@@ -398,13 +416,15 @@ +@@ -400,13 +418,15 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -112,7 +112,7 @@ CHECKSUM TABLE big; Table Checksum test.big 1705165209 -@@ -422,7 +442,7 @@ +@@ -424,7 +444,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -121,7 +121,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -436,7 +456,7 @@ +@@ -438,7 +458,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -130,7 +130,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -1119,7 +1139,7 @@ +@@ -1162,7 +1182,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -139,7 +139,7 @@ connection default; ROLLBACK; connection analyze; -@@ -1130,7 +1150,7 @@ +@@ -1173,7 +1193,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -148,7 +148,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -1142,7 +1162,7 @@ +@@ -1185,7 +1205,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -157,7 +157,7 @@ connection default; ROLLBACK; connection analyze; -@@ -1153,11 +1173,13 @@ +@@ -1196,11 +1216,13 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -173,7 +173,7 @@ SELECT * FROM t2; id c1 d1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf -@@ -1202,7 +1224,9 @@ +@@ -1245,7 +1267,9 @@ info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; affected rows: 0 @@ -184,7 +184,7 @@ INSERT INTO t3 SET id=4; ERROR HY000: Field 'c2' doesn't have a default value INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; -@@ -1215,7 +1239,9 @@ +@@ -1258,7 +1282,9 @@ ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; affected rows: 4 @@ -195,7 +195,7 @@ INSERT INTO t3 SET id=5, c2=9; Warnings: Note 1265 Data truncated for column 'c7' at row 1 -@@ -1229,7 +1255,9 @@ +@@ -1272,7 +1298,9 @@ 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 @@ -206,7 +206,7 @@ SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog -@@ -1257,6 +1285,8 @@ +@@ -1300,6 +1328,8 @@ (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) ENGINE=InnoDB ROW_FORMAT=COMPACT; @@ -215,7 +215,7 @@ BEGIN; INSERT INTO big SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); -@@ -1275,13 +1305,15 @@ +@@ -1318,13 +1348,15 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -233,7 +233,7 @@ CHECKSUM TABLE big; Table Checksum test.big 1705165209 -@@ -1299,7 +1331,7 @@ +@@ -1342,7 +1374,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -242,7 +242,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1313,7 +1345,7 @@ +@@ -1356,7 +1388,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -251,7 +251,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -1996,7 +2028,7 @@ +@@ -2080,7 +2112,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -260,7 +260,7 @@ connection default; ROLLBACK; connection analyze; -@@ -2007,7 +2039,7 @@ +@@ -2091,7 +2123,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -269,7 +269,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -2019,7 +2051,7 @@ +@@ -2103,7 +2135,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -278,7 +278,7 @@ connection default; ROLLBACK; connection analyze; -@@ -2030,7 +2062,7 @@ +@@ -2114,7 +2146,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -287,7 +287,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -2152,7 +2184,7 @@ +@@ -2236,7 +2268,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -296,7 +296,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -2176,7 +2208,7 @@ +@@ -2260,7 +2292,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -305,7 +305,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -2190,7 +2222,7 @@ +@@ -2274,7 +2306,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -314,12 +314,12 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -2691,7 +2723,7 @@ +@@ -2816,7 +2848,7 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants --202 -+204 +-208 ++210 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; + SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; # - # 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 0393c8a63c2..004f535291b 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -1,6 +1,8 @@ # # MDEV-11369: Instant ADD COLUMN for InnoDB # +SET @saved_allowance = @@GLOBAL.innodb_instant_alter_column_allowed; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPACT; ALTER TABLE t ADD e INT, ROW_FORMAT=COMPRESSED; @@ -526,6 +528,44 @@ ALTER TABLE t1 ADD PRIMARY KEY (b,a); ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; DROP TABLE t1; SET innodb_strict_mode = OFF; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; INSERT INTO t1 (a) VALUES (NULL), (NULL); ALTER TABLE t1 DROP a, ADD COLUMN a INT; @@ -1418,6 +1458,44 @@ ALTER TABLE t1 ADD PRIMARY KEY (b,a); ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; DROP TABLE t1; SET innodb_strict_mode = OFF; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT; INSERT INTO t1 (a) VALUES (NULL), (NULL); ALTER TABLE t1 DROP a, ADD COLUMN a INT; @@ -2310,6 +2388,44 @@ ALTER TABLE t1 ADD PRIMARY KEY (b,a); ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; DROP TABLE t1; SET innodb_strict_mode = OFF; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; CREATE TABLE t1 (a INT, b INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; INSERT INTO t1 (a) VALUES (NULL), (NULL); ALTER TABLE t1 DROP a, ADD COLUMN a INT; @@ -2736,8 +2852,9 @@ SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants -202 +208 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; +SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; # # MDEV-18266: Changing an index comment unnecessarily rebuilds index # diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test index 155a09845a0..5f1de1bedf9 100644 --- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test +++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test @@ -63,3 +63,31 @@ SELECT * FROM t2; CHECK TABLE t2; DROP TABLE t1, t2; + +# MDEV-21572 buf_page_get_gen() should apply buffered page +# initialized redo log during recovery +--source ../include/no_checkpoint_start.inc +CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3); +connect (con1,localhost,root,,); +BEGIN; +DELETE FROM t1 WHERE pk=1; +connection default; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +DELETE FROM t1 WHERE pk=3; +--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1; +--source ../include/no_checkpoint_end.inc +disconnect con1; + +--echo # Corrupt the pages +perl; +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek"; +print FILE "junk"; +close FILE or die "close"; +EOF +--source include/start_mysqld.inc +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 8fc7a8bfaf8..5f859d7f9a8 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -4,6 +4,9 @@ --echo # MDEV-11369: Instant ADD COLUMN for InnoDB --echo # +SET @saved_allowance = @@GLOBAL.innodb_instant_alter_column_allowed; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; + call mtr.add_suppression("Cannot add field `.*` in table `test`.`.*` because after adding it, the row size is"); let $format= `SELECT CASE WHEN @@GLOBAL.innodb_page_size>16384 @@ -418,6 +421,46 @@ ALTER TABLE t1 ADD va INT AS (a) VIRTUAL; DROP TABLE t1; SET innodb_strict_mode = OFF; +# MDEV-20950 innodb_instant_alter_column_allowed +eval CREATE TABLE t1 (a INT PRIMARY KEY) $engine; +INSERT INTO t1 SET a=42; +SET GLOBAL innodb_instant_alter_column_allowed = never; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +ALTER TABLE t1 ADD b TEXT, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = never; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +--enable_info +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +--disable_info +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; +ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; +SET GLOBAL innodb_instant_alter_column_allowed = add_last; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; +--enable_info +ALTER TABLE t1 MODIFY a INT DEFAULT 0; +--disable_info +ALTER TABLE t1 MODIFY a INT DEFAULT NULL, ALGORITHM=INSTANT; +DROP TABLE t1; +SET GLOBAL innodb_instant_alter_column_allowed = DEFAULT; + # MDEV-15562 Instant DROP/ADD/reorder columns eval CREATE TABLE t1 (a INT, b INT UNIQUE) $engine; @@ -850,6 +893,7 @@ SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; +SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; --echo # --echo # MDEV-18266: Changing an index comment unnecessarily rebuilds index diff --git a/mysql-test/suite/parts/r/partition_alter_instant.result b/mysql-test/suite/parts/r/partition_alter_instant.result new file mode 100644 index 00000000000..e5ef57db992 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_alter_instant.result @@ -0,0 +1,34 @@ +CREATE TABLE t1 ( +id INT NOT NULL, +name VARCHAR(30))ENGINE=InnoDB ROW_FORMAT=COMPACT CHARACTER SET=latin1 +PARTITION BY RANGE (id) ( +PARTITION p0 VALUES LESS THAN (50), +PARTITION p1 VALUES LESS THAN (MAXVALUE) +); +INSERT INTO t1(id, name) VALUES(16, 'Me'), (337, 'ROFL'); +# Add and drop 31 Instant columns +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `name` varchar(30) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT + PARTITION BY RANGE (`id`) +(PARTITION `p0` VALUES LESS THAN (50) ENGINE = InnoDB, + PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +ALTER TABLE t2 REMOVE PARTITIONING; +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `name` varchar(30) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +SET ALTER_ALGORITHM=INSTANT; +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE +SET ALTER_ALGORITHM=INPLACE; +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +DROP TABLE t1, t2; +SET ALTER_ALGORITHM=DEFAULT; diff --git a/mysql-test/suite/parts/t/partition_alter_instant.test b/mysql-test/suite/parts/t/partition_alter_instant.test new file mode 100644 index 00000000000..3d798791517 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_alter_instant.test @@ -0,0 +1,43 @@ +--source include/have_partition.inc +--source include/have_innodb.inc +--source include/have_innodb_16k.inc + +# MDEV-21832 FORCE all partition to rebuild if any one of the +# partition does rebuild +CREATE TABLE t1 ( + id INT NOT NULL, + name VARCHAR(30))ENGINE=InnoDB ROW_FORMAT=COMPACT CHARACTER SET=latin1 + PARTITION BY RANGE (id) ( + PARTITION p0 VALUES LESS THAN (50), + PARTITION p1 VALUES LESS THAN (MAXVALUE) +); + +INSERT INTO t1(id, name) VALUES(16, 'Me'), (337, 'ROFL'); + +--echo # Add and drop 31 Instant columns +--disable_query_log +let $i = 1; +while ($i < 32) { +--eval ALTER TABLE t1 ADD COLUMN col$i VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +inc $i; +} + +let $i = 31; +while ($i > 0) { +--eval ALTER TABLE t1 DROP COLUMN col$i +dec $i; +} +--enable_query_log + +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +ALTER TABLE t2 REMOVE PARTITIONING; +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +SHOW CREATE TABLE t2; +SET ALTER_ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +SET ALTER_ALGORITHM=INPLACE; +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +DROP TABLE t1, t2; +SET ALTER_ALGORITHM=DEFAULT; diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def index 77b01bd8d1d..ef1630f87eb 100644 --- a/mysql-test/suite/rpl/disabled.def +++ b/mysql-test/suite/rpl/disabled.def @@ -11,7 +11,7 @@ ############################################################################## rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux -rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock +#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table rpl_row_binlog_max_cache_size : MDEV-11092 rpl_row_index_choice : MDEV-11666 diff --git a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc index 72f8bc053e3..7dd09ad1a24 100644 --- a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc +++ b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc @@ -84,14 +84,14 @@ FLUSH LOGS; ### (should show just one binlog) RESET MASTER; -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; -- error ER_NO_UNIQUE_LOGFILE FLUSH LOGS; -- echo # assert: must show one binlog -- source include/show_binary_logs.inc ### ACTION: clean up and move to next test -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; -- echo ###################### TEST #3 @@ -116,7 +116,7 @@ RESET MASTER; -- source include/show_binary_logs.inc # clean up the table and the binlog to be used in next part of test -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; @@ -127,7 +127,7 @@ RESET MASTER; ### changes performed despite the fact that it reported an ### error. -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- error ER_NO_UNIQUE_LOGFILE -- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 @@ -137,7 +137,7 @@ SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SELECT count(*) FROM t2; # clean up the table and the binlog to be used in next part of test -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; @@ -146,7 +146,7 @@ RESET MASTER; ### ASSERTION: load the small file into a transactional table and ### check that it succeeds -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 @@ -155,7 +155,7 @@ SET GLOBAL debug_dbug="+d,error_unique_log_filename"; SELECT count(*) FROM t2; # clean up the table and the binlog to be used in next part of test -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; @@ -166,7 +166,7 @@ RESET MASTER; ### fails we get the error. Transaction is not rolledback ### because rotation happens after the commit. -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET AUTOCOMMIT=0; INSERT INTO t2 VALUES ('muse'); -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -181,7 +181,7 @@ SELECT count(*) FROM t2; ### ACTION: clean up and move to the next test SET AUTOCOMMIT= 1; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; @@ -191,7 +191,7 @@ RESET MASTER; ### fails then an error is reported and an incident event ### is written to the current binary log. -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; # Disable logging Annotate_rows events to preserve events count. let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`; @@ -206,7 +206,7 @@ SELECT count(*) FROM t4; SELECT count(*) FROM t4; -- echo ### check that the incident event is written to the current log -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; if (!$binlog_limit) { -- let $binlog_limit= 4,1 @@ -227,7 +227,7 @@ RESET MASTER; ### ASSERTION: check that statements end up in error but they succeed ### on changing the data. -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; -- echo # must show 0 entries SELECT count(*) FROM t4; SELECT count(*) FROM t2; @@ -258,13 +258,13 @@ SELECT count(*) FROM t4; SELECT count(*) FROM t2; # remove fault injection -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; -- echo ###################### TEST #9 ### ASSERTION: check that if we disable binlogging, then statements ### succeed. -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET SQL_LOG_BIN=0; INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); @@ -277,7 +277,7 @@ DELETE FROM t4; SELECT count(*) FROM t2; SELECT count(*) FROM t4; SET SQL_LOG_BIN=1; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; -- echo ###################### TEST #10 @@ -292,11 +292,11 @@ RESET MASTER; SHOW WARNINGS; # +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open -SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +SET @@global.debug_dbug="d,fault_injection_registering_index"; -- replace_regex /\.[\\\/]master/master/ -- error ER_CANT_OPEN_FILE FLUSH LOGS; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; -- error ER_NO_BINARY_LOGGING SHOW BINARY LOGS; @@ -321,11 +321,11 @@ flush tables; --source include/rpl_restart_server.inc # +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file -SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +SET @@global.debug_dbug="d,fault_injection_openning_index"; -- replace_regex /\.[\\\/]master/master/ -- error ER_CANT_OPEN_FILE FLUSH LOGS; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; -- error ER_FLUSH_MASTER_BINLOG_CLOSED RESET MASTER; @@ -350,10 +350,10 @@ flush tables; ### file. # +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl -SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; -- error ER_ERROR_ON_WRITE FLUSH LOGS; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; -- error ER_FLUSH_MASTER_BINLOG_CLOSED RESET MASTER; diff --git a/mysql-test/suite/rpl/include/rpl_corruption.inc b/mysql-test/suite/rpl/include/rpl_corruption.inc index 4106bb45eef..c7a913af9d7 100644 --- a/mysql-test/suite/rpl/include/rpl_corruption.inc +++ b/mysql-test/suite/rpl/include/rpl_corruption.inc @@ -73,8 +73,8 @@ 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"; +SET @saved_dbug = @@global.debug_dbug; +SET @@global.debug_dbug="d,corrupt_read_log_event_char"; --echo SHOW BINLOG EVENTS; --disable_query_log send_eval SHOW BINLOG EVENTS FROM $pos; @@ -82,7 +82,7 @@ send_eval SHOW BINLOG EVENTS FROM $pos; --error ER_ERROR_WHEN_EXECUTING_COMMAND reap; -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; +SET @@global.debug_dbug=@saved_dbug; # Emulate corruption on master with crc checking on master --echo # 3. Master read a corrupted event from binlog and send the error to slave @@ -107,20 +107,20 @@ let $wait_condition= SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump'; --source include/wait_condition.inc -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; --connection slave START SLAVE IO_THREAD; let $slave_io_errno= 1236; --let $slave_timeout= 10 --source include/wait_for_slave_io_error.inc --connection master -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug=@saved_dbug; # Emulate corruption on master without crc checking on master --echo # 4. Master read a corrupted event from binlog and send it to slave --connection master SET GLOBAL master_verify_checksum=0; -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; --connection slave START SLAVE IO_THREAD; # When the checksum error is detected, the slave sets error code 1743 @@ -130,31 +130,29 @@ START SLAVE IO_THREAD; let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE --source include/wait_for_slave_io_error.inc --connection master -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug=@saved_dbug; +SET @@global.debug_dbug=@saved_dbug; SET GLOBAL master_verify_checksum=1; # Emulate corruption in network --echo # 5. Slave. Corruption in network --connection slave SET @saved_dbug_slave = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,corrupt_queue_event"; +SET @@global.debug_dbug="d,corrupt_queue_event"; START SLAVE IO_THREAD; let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE --source include/wait_for_slave_io_error.inc -SET GLOBAL debug_dbug="-d,corrupt_queue_event"; +SET @@global.debug_dbug=@saved_dbug_slave; # Emulate corruption in relay log --echo # 6. Slave. Corruption in relay log -SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; +SET @@global.debug_dbug="d,corrupt_read_log_event_char"; START SLAVE SQL_THREAD; let $slave_sql_errno= 1593; --source include/wait_for_slave_sql_error.inc -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug=@saved_dbug_slave; +SET @@global.debug_dbug=@saved_dbug_slave; # Start normal replication and compare same table on master # and slave diff --git a/mysql-test/suite/rpl/include/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/include/rpl_get_master_version_and_clock.test index eb0e5e21d62..181759283e2 100644 --- a/mysql-test/suite/rpl/include/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/include/rpl_get_master_version_and_clock.test @@ -41,8 +41,8 @@ if (!$debug_sync_action) # Restart slave --source include/stop_slave.inc - -eval SET @@global.debug_dbug= "+d,$dbug_sync_point"; +SET @old_dbug = @@global.debug_dbug; +eval SET @@global.debug_dbug= "d,$dbug_sync_point"; --source include/start_slave.inc --echo slave is going to hang in get_master_version_and_clock @@ -70,7 +70,7 @@ source include/wait_for_slave_io_error.inc; # now to avoid restarting IO-thread to re-enter it. # There will be a new IO thread forked out with its @@session.debug # unset. -eval set @@global.debug_dbug= "-d,$dbug_sync_point"; +set @@global.debug_dbug= @old_dbug; --let $rpl_server_number= 1 --source include/rpl_start_server.inc diff --git a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test index 5c88c14d9b5..ac01fb04d16 100644 --- a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test +++ b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test @@ -14,7 +14,7 @@ create table ti (a int auto_increment primary key) engine=innodb; sync_slave_with_master; SET @saved_dbug = @@GLOBAL.debug_dbug; -set @@global.debug_dbug="+d,stop_slave_middle_group"; +set @@global.debug_dbug="d,stop_slave_middle_group"; connection master; @@ -44,7 +44,7 @@ eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as one from ti; -set @@global.debug_dbug="-d"; +set @@global.debug_dbug=@saved_dbug; # # bug#45940 issues around rli->last_event_start_time @@ -68,8 +68,7 @@ truncate table ti; #connection slave; sync_slave_with_master; -set @@global.debug_dbug="+d,stop_slave_middle_group"; -set @@global.debug_dbug="+d,incomplete_group_in_relay_log"; +set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log"; connection master; @@ -97,7 +96,7 @@ eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as zero from ti; -set @@global.debug_dbug="-d"; +set @@global.debug_dbug=@saved_dbug; # # The mixed multi-table update @@ -110,8 +109,7 @@ connection master; #connection slave; sync_slave_with_master; -set @@global.debug_dbug="+d,stop_slave_middle_group"; -set @@global.debug_dbug="+d,incomplete_group_in_relay_log"; +set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log"; connection master; update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; diff --git a/mysql-test/suite/rpl/r/circular_serverid0.result b/mysql-test/suite/rpl/r/circular_serverid0.result index 928a0a48888..19c800cf01b 100644 --- a/mysql-test/suite/rpl/r/circular_serverid0.result +++ b/mysql-test/suite/rpl/r/circular_serverid0.result @@ -3,8 +3,8 @@ include/rpl_connect.inc [creating M4] include/rpl_connect.inc [creating M2] connection M2; STOP SLAVE; -SET @old_debug= @@global.debug; -SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging"; +SET @old_debug= @@global.debug_dbug; +SET GLOBAL debug_dbug= "d,dbug.rows_events_to_delay_relay_logging"; START SLAVE IO_THREAD; include/wait_for_slave_io_to_start.inc connection M2; diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result index eb58dd06997..c8a10577517 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result @@ -22,7 +22,7 @@ master-bin.000001 # master-bin.000002 # ###################### TEST #2 RESET MASTER; -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) @@ -30,7 +30,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) show binary logs; Log_name File_size master-bin.000001 # -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; ###################### TEST #3 CREATE TABLE t1 (a INT); @@ -44,11 +44,11 @@ show binary logs; Log_name File_size master-bin.000001 # master-bin.000002 # -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #4 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) @@ -56,21 +56,21 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) SELECT count(*) FROM t2; count(*) 1 -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #5 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2; # assert: must show one entry SELECT count(*) FROM t2; count(*) 1 -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #6 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET AUTOCOMMIT=0; INSERT INTO t2 VALUES ('muse'); LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; @@ -83,11 +83,11 @@ SELECT count(*) FROM t2; count(*) 3 SET AUTOCOMMIT= 1; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; DELETE FROM t2; RESET MASTER; ###################### TEST #7 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET @@binlog_annotate_row_events= 0; SELECT count(*) FROM t4; count(*) @@ -100,14 +100,14 @@ SELECT count(*) FROM t4; count(*) 1 ### check that the incident event is written to the current log -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Incident # # #1 (LOST_EVENTS) DELETE FROM t4; RESET MASTER; ###################### TEST #8 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; # must show 0 entries SELECT count(*) FROM t4; count(*) @@ -147,9 +147,9 @@ count(*) SELECT count(*) FROM t2; count(*) 0 -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; ###################### TEST #9 -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; SET SQL_LOG_BIN=0; INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); @@ -170,17 +170,17 @@ SELECT count(*) FROM t4; count(*) 0 SET SQL_LOG_BIN=1; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; ###################### TEST #10 call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("Could not use .*"); RESET MASTER; SHOW WARNINGS; Level Code Message -SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +SET @@global.debug_dbug="d,fault_injection_registering_index"; FLUSH LOGS; ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted") -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; SHOW BINARY LOGS; ERROR HY000: You are not using binary logging CREATE TABLE t5 (a INT); @@ -192,10 +192,10 @@ DROP TABLE t5; flush tables; ###################### TEST #11 include/rpl_restart_server.inc [server_number=1] -SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +SET @@global.debug_dbug="d,fault_injection_openning_index"; FLUSH LOGS; ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted") -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; ERROR HY000: Binlog closed, cannot RESET MASTER CREATE TABLE t5 (a INT); @@ -207,10 +207,10 @@ DROP TABLE t5; flush tables; include/rpl_restart_server.inc [server_number=1] ###################### TEST #12 -SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; FLUSH LOGS; ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory") -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@old_debug; RESET MASTER; ERROR HY000: Binlog closed, cannot RESET MASTER CREATE TABLE t5 (a INT); @@ -237,44 +237,40 @@ call mtr.add_suppression("Could not use .*"); call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); call mtr.add_suppression("Can't generate a unique log-filename .*"); ###################### TEST #13 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,error_unique_log_filename"; +SET @@global.debug_dbug="d,error_unique_log_filename"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,error_unique_log_filename"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] ###################### TEST #14 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event"; +SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] ###################### TEST #15 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,fault_injection_registering_index"; +SET @@global.debug_dbug="d,fault_injection_registering_index"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,fault_injection_registering_index"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] ###################### TEST #16 -SET @old_debug=@@global.debug; +SET @saved_debug=@@global.debug_dbug; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,fault_injection_openning_index"; +SET @@global.debug_dbug="d,fault_injection_openning_index"; START SLAVE io_thread; include/wait_for_slave_io_error.inc [errno=1595] Last_IO_Error = 'Relay log write failure: could not queue event from master' -SET GLOBAL debug_dbug="-d,fault_injection_openning_index"; -SET GLOBAL debug_dbug=@old_debug; +SET @@global.debug_dbug=@saved_debug; include/rpl_restart_server.inc [server_number=2] include/stop_slave_sql.inc Warnings: diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result index f32b7c58ad1..73bb373d6be 100644 --- a/mysql-test/suite/rpl/r/rpl_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_corruption.result @@ -13,42 +13,40 @@ 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"; +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 -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; +SET @@global.debug_dbug=@saved_dbug; # 3. Master read a corrupted event from binlog and send the error to slave -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; connection slave; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1236] connection master; -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug=@saved_dbug; # 4. Master read a corrupted event from binlog and send it to slave connection master; SET GLOBAL master_verify_checksum=0; -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; +SET @@global.debug_dbug="d,corrupt_read_log_event2_set"; connection slave; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] connection master; -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug=@saved_dbug; +SET @@global.debug_dbug=@saved_dbug; SET GLOBAL master_verify_checksum=1; # 5. Slave. Corruption in network connection slave; SET @saved_dbug_slave = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,corrupt_queue_event"; +SET @@global.debug_dbug="d,corrupt_queue_event"; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] -SET GLOBAL debug_dbug="-d,corrupt_queue_event"; +SET @@global.debug_dbug=@saved_dbug_slave; # 6. Slave. Corruption in relay log -SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; +SET @@global.debug_dbug="d,corrupt_read_log_event_char"; START SLAVE SQL_THREAD; include/wait_for_slave_sql_error.inc [errno=1593] -SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug=@saved_dbug_slave; +SET @@global.debug_dbug=@saved_dbug_slave; # 7. Seek diff for tables on master and slave connection slave; include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result index b8415977154..feef82a57fc 100644 --- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result +++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result @@ -27,7 +27,7 @@ include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : SET @saved_dbug = @@GLOBAL.debug_dbug; -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; START TRANSACTION; INSERT INTO t1 VALUES(2); @@ -43,7 +43,7 @@ include/wait_for_slave_io_error.inc [errno=1595] SELECT * FROM t1; i 1 -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; START SLAVE io_thread; include/wait_for_slave_io_to_start.inc SELECT * FROM t1; @@ -61,7 +61,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos; include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : 1 -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; START TRANSACTION; INSERT INTO t1 VALUES(4); @@ -81,7 +81,7 @@ i 1 2 3 -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; START SLAVE io_thread; include/wait_for_slave_io_to_start.inc SELECT * FROM t1; @@ -99,7 +99,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos; include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; START TRANSACTION; INSERT INTO t1 VALUES(6); @@ -134,7 +134,7 @@ i 1 2 3 -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; include/stop_slave.inc DO_DOMAIN_IDS (BEFORE) : IGNORE_DOMAIN_IDS (BEFORE) : @@ -159,7 +159,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos; include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : 1 -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; SET @@session.gtid_domain_id= 1; START TRANSACTION; @@ -203,7 +203,7 @@ i 3 10 11 -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; include/stop_slave.inc DO_DOMAIN_IDS (BEFORE) : IGNORE_DOMAIN_IDS (BEFORE) : 1 @@ -232,7 +232,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos; include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : 1 -SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; +SET @@global.debug_dbug="d,kill_slave_io_after_2_events"; connection master; SET @@session.gtid_domain_id= 1; START TRANSACTION; @@ -286,7 +286,7 @@ i 15 16 17 -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; include/stop_slave.inc DO_DOMAIN_IDS (BEFORE) : IGNORE_DOMAIN_IDS (BEFORE) : 1 @@ -319,7 +319,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos; include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : -SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; +SET @@global.debug_dbug="d,kill_slave_io_after_2_events"; connection master; SET @@session.gtid_domain_id= 1; START TRANSACTION; @@ -383,7 +383,7 @@ i 21 22 23 -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; include/stop_slave.inc DO_DOMAIN_IDS (BEFORE) : IGNORE_DOMAIN_IDS (BEFORE) : diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result index e7f4e566566..deea7caa12a 100644 --- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result +++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result @@ -1,33 +1,42 @@ include/master-slave.inc [connection master] +connection slave; call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'"); call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); call mtr.add_suppression("Slave I/O thread .* register on master"); +SET @saved_dbug = @@GLOBAL.debug_dbug; +connection slave; include/stop_slave.inc -SET @@global.debug= "+d,'debug_lock.before_get_UNIX_TIMESTAMP'"; +SET @old_dbug = @@global.debug_dbug; +SET @@global.debug_dbug= "d,'debug_lock.before_get_UNIX_TIMESTAMP'"; include/start_slave.inc slave is going to hang in get_master_version_and_clock include/rpl_stop_server.inc [server_number=1] slave is unblocked SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp'; +connection slave; Check network error happened here include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013] -set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'"; +set @@global.debug_dbug= @old_dbug; include/rpl_start_server.inc [server_number=1] include/wait_for_slave_param.inc [Slave_IO_Running] +connection slave; +connection slave; include/stop_slave.inc -SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'"; +SET @old_dbug = @@global.debug_dbug; +SET @@global.debug_dbug= "d,'debug_lock.before_get_SERVER_ID'"; include/start_slave.inc slave is going to hang in get_master_version_and_clock include/rpl_stop_server.inc [server_number=1] slave is unblocked SET DEBUG_SYNC='now SIGNAL signal.get_server_id'; +connection slave; Check network error happened here include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013] -set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'"; +set @@global.debug_dbug= @old_dbug; include/rpl_start_server.inc [server_number=1] include/wait_for_slave_param.inc [Slave_IO_Running] -set global debug= ''; +SET @@GLOBAL.debug_dbug = @saved_dbug; SET DEBUG_SYNC= 'RESET'; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_strict.result b/mysql-test/suite/rpl/r/rpl_gtid_strict.result index 528c4c5b5c1..27e7d105125 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_strict.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_strict.result @@ -27,16 +27,17 @@ master-bin.000001 # Xid # # COMMIT /* XID */ SET server_id= 3; SET gtid_seq_no= 3; ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET @old_dbug = @@session.debug_dbug; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 3; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; INSERT INTO t1 VALUES (2); ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled SET gtid_seq_no= 2; ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 2; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; INSERT INTO t1 VALUES (3); ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled SET server_id= 1; @@ -62,9 +63,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */ SET server_id= 3; SET gtid_seq_no= 1; ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 1; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled SET sql_log_bin= 0; @@ -73,9 +74,9 @@ SET sql_log_bin= 1; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; SET gtid_seq_no= 1; ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 1; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; INSERT INTO t2 VALUES (1); ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled SET server_id= 1; diff --git a/mysql-test/suite/rpl/r/rpl_row_corruption.result b/mysql-test/suite/rpl/r/rpl_row_corruption.result index b5bdc32200a..24535460418 100644 --- a/mysql-test/suite/rpl/r/rpl_row_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_row_corruption.result @@ -7,15 +7,15 @@ INSERT INTO t2_11753004 VALUES (2); connection slave; call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*"); include/stop_slave.inc -SET @save_debug= @@global.debug; -SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; +SET @saved_debug= @@global.debug_dbug; +SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table"; include/start_slave.inc connection master; UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2; connection slave; include/wait_for_slave_sql_error.inc [errno=1593 ] include/stop_slave.inc -SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug=@saved_debug; include/start_slave.inc connection master; include/rpl_reset.inc @@ -23,7 +23,7 @@ DROP TABLE t1_11753004, t2_11753004; connection slave; connection slave; include/stop_slave.inc -SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table"; include/start_slave.inc include/rpl_reset.inc connection master; @@ -41,7 +41,7 @@ BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8= '/*!*/; -SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table"; BINLOG ' SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE= SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE= @@ -51,10 +51,10 @@ SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA== ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings. DROP TABLE t1,t2; connection slave; -SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug=@saved_debug; connection master; DROP TABLE t1_11753004; DROP TABLE t2_11753004_ign; connection slave; -SET GLOBAL debug_dbug= @save_debug; +SET @@global.debug_dbug= @save_debug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result index b670a16bfcd..0afe1992fb9 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result +++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result @@ -7,7 +7,7 @@ create table tm (a int auto_increment primary key) engine=myisam; create table ti (a int auto_increment primary key) engine=innodb; connection slave; SET @saved_dbug = @@GLOBAL.debug_dbug; -set @@global.debug_dbug="+d,stop_slave_middle_group"; +set @@global.debug_dbug="d,stop_slave_middle_group"; connection master; begin; insert into ti set a=null; @@ -28,14 +28,13 @@ one select count(*) as one from ti; one 1 -set @@global.debug_dbug="-d"; +set @@global.debug_dbug=@saved_dbug; include/start_slave.inc connection master; truncate table tm; truncate table ti; connection slave; -set @@global.debug_dbug="+d,stop_slave_middle_group"; -set @@global.debug_dbug="+d,incomplete_group_in_relay_log"; +set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log"; connection master; begin; insert into ti set a=null; @@ -54,14 +53,13 @@ one select count(*) as zero from ti; zero 0 -set @@global.debug_dbug="-d"; +set @@global.debug_dbug=@saved_dbug; stop slave; truncate table tm; include/start_slave.inc connection master; connection slave; -set @@global.debug_dbug="+d,stop_slave_middle_group"; -set @@global.debug_dbug="+d,incomplete_group_in_relay_log"; +set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log"; connection master; update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; connection slave; diff --git a/mysql-test/suite/rpl/t/circular_serverid0.test b/mysql-test/suite/rpl/t/circular_serverid0.test index 097a2932404..64cf231c2c2 100644 --- a/mysql-test/suite/rpl/t/circular_serverid0.test +++ b/mysql-test/suite/rpl/t/circular_serverid0.test @@ -24,8 +24,8 @@ --connection M2 STOP SLAVE; -SET @old_debug= @@global.debug; -SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging"; +SET @old_debug= @@global.debug_dbug; +SET GLOBAL debug_dbug= "d,dbug.rows_events_to_delay_relay_logging"; START SLAVE IO_THREAD; --source include/wait_for_slave_io_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt b/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt deleted file mode 100644 index 37fc56036fb..00000000000 --- a/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-debug=-d,simulate_find_log_pos_error diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test index f3ba39fb330..a949da0cc25 100644 --- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test +++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test @@ -36,7 +36,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after SET @saved_dbug = @@GLOBAL.debug_dbug; -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; @@ -51,7 +51,7 @@ connection slave; --let $slave_io_errno= 1595 --source include/wait_for_slave_io_error.inc SELECT * FROM t1; -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; START SLAVE io_thread; --source include/wait_for_slave_io_to_start.inc @@ -77,7 +77,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; @@ -93,7 +93,7 @@ connection slave; --let $slave_io_errno= 1595 --source include/wait_for_slave_io_error.inc SELECT * FROM t1; -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; START SLAVE io_thread; --source include/wait_for_slave_io_to_start.inc @@ -119,7 +119,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; @@ -148,7 +148,7 @@ connection slave; --source include/wait_for_slave_io_error.inc SELECT * FROM t1; -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; --source include/stop_slave.inc let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); @@ -186,7 +186,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after -SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; +SET @@global.debug_dbug="d,kill_slave_io_before_commit"; connection master; @@ -216,7 +216,7 @@ connection slave; --source include/wait_for_slave_io_error.inc SELECT * FROM t1; -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; --source include/stop_slave.inc let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); @@ -254,7 +254,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after -SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; +SET @@global.debug_dbug="d,kill_slave_io_after_2_events"; connection master; @@ -284,7 +284,7 @@ connection slave; --source include/wait_for_slave_io_error.inc SELECT * FROM t1; -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; --source include/stop_slave.inc let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); @@ -322,7 +322,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after -SET @@global.debug_dbug="+d,kill_slave_io_after_2_events"; +SET @@global.debug_dbug="d,kill_slave_io_after_2_events"; connection master; @@ -352,7 +352,7 @@ connection slave; --source include/wait_for_slave_io_error.inc SELECT * FROM t1; -SET @@global.debug_dbug="-d"; +SET @@global.debug_dbug=@saved_dbug; --source include/stop_slave.inc let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); diff --git a/mysql-test/suite/rpl/t/rpl_gtid_strict.test b/mysql-test/suite/rpl/t/rpl_gtid_strict.test index afcb179da78..56ebba824c4 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_strict.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_strict.test @@ -29,17 +29,18 @@ INSERT INTO t1 VALUES (1); SET server_id= 3; --error ER_GTID_STRICT_OUT_OF_ORDER SET gtid_seq_no= 3; -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET @old_dbug = @@session.debug_dbug; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 3; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; --error ER_GTID_STRICT_OUT_OF_ORDER INSERT INTO t1 VALUES (2); --error ER_GTID_STRICT_OUT_OF_ORDER SET gtid_seq_no= 2; -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 2; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; --error ER_GTID_STRICT_OUT_OF_ORDER INSERT INTO t1 VALUES (3); SET server_id= 1; @@ -52,9 +53,9 @@ SELECT * FROM t1 ORDER BY 1; SET server_id= 3; --error ER_GTID_STRICT_OUT_OF_ORDER SET gtid_seq_no= 1; -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 1; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; --error ER_GTID_STRICT_OUT_OF_ORDER CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; # The table is still created, DDL cannot be rolled back. @@ -66,9 +67,9 @@ CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; --error ER_GTID_STRICT_OUT_OF_ORDER SET gtid_seq_no= 1; -SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; SET gtid_seq_no= 1; -SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check"; +SET SESSION debug_dbug=@old_dbug; --error ER_GTID_STRICT_OUT_OF_ORDER INSERT INTO t2 VALUES (1); # The value is still inserted, cannot be rolled back. diff --git a/mysql-test/suite/rpl/t/rpl_row_corruption.test b/mysql-test/suite/rpl/t/rpl_row_corruption.test index acf3964f0c5..d78df905ccb 100644 --- a/mysql-test/suite/rpl/t/rpl_row_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_row_corruption.test @@ -27,8 +27,8 @@ call mtr.add_suppression(".*Found table map event mapping table id 0 which was a # stop the slave and inject corruption --source include/stop_slave.inc -SET @save_debug= @@global.debug; -SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; +SET @saved_debug= @@global.debug_dbug; +SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table"; --source include/start_slave.inc --connection master # both tables get mapped to 0 (in a way, simulating scenario @@ -42,7 +42,7 @@ SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; --source include/stop_slave.inc # clean up -SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug=@saved_debug; --source include/start_slave.inc --connection master --source include/rpl_reset.inc @@ -55,7 +55,7 @@ SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; --connection slave --source include/stop_slave.inc -SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table"; --source include/start_slave.inc --source include/rpl_reset.inc --connection master @@ -92,7 +92,7 @@ AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8= #110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66 # at 855 #110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F -SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table"; --error ER_SLAVE_FATAL_ERROR BINLOG ' SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE= @@ -105,11 +105,11 @@ SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA== # clean up DROP TABLE t1,t2; --connection slave -SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table"; +SET @@global.debug_dbug=@saved_debug; --connection master --eval DROP TABLE $t1 --eval DROP TABLE $t2_ign --sync_slave_with_master -SET GLOBAL debug_dbug= @save_debug; +SET @@global.debug_dbug= @save_debug; --source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/innodb_instant_alter_column_allowed_basic.result b/mysql-test/suite/sys_vars/r/innodb_instant_alter_column_allowed_basic.result new file mode 100644 index 00000000000..0c25c788dbe --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_instant_alter_column_allowed_basic.result @@ -0,0 +1,49 @@ +SET @start_global_value = @@global.innodb_instant_alter_column_allowed; +SET GLOBAL innodb_instant_alter_column_allowed=never; +select @@session.innodb_instant_alter_column_allowed; +ERROR HY000: Variable 'innodb_instant_alter_column_allowed' is a GLOBAL variable +show global variables like 'innodb_instant_alter_column_allowed'; +Variable_name Value +innodb_instant_alter_column_allowed never +show session variables like 'innodb_instant_alter_column_allowed'; +Variable_name Value +innodb_instant_alter_column_allowed never +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_instant_alter_column_allowed'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_INSTANT_ALTER_COLUMN_ALLOWED never +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_instant_alter_column_allowed'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_INSTANT_ALTER_COLUMN_ALLOWED never +set global innodb_instant_alter_column_allowed=no; +ERROR 42000: Variable 'innodb_instant_alter_column_allowed' can't be set to the value of 'no' +set global innodb_instant_alter_column_allowed=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_instant_alter_column_allowed' +set global innodb_instant_alter_column_allowed=-1; +ERROR 42000: Variable 'innodb_instant_alter_column_allowed' can't be set to the value of '-1' +select @@global.innodb_instant_alter_column_allowed; +@@global.innodb_instant_alter_column_allowed +never +set global innodb_instant_alter_column_allowed=3; +ERROR 42000: Variable 'innodb_instant_alter_column_allowed' can't be set to the value of '3' +select @@global.innodb_instant_alter_column_allowed; +@@global.innodb_instant_alter_column_allowed +never +set global innodb_instant_alter_column_allowed=2; +select @@global.innodb_instant_alter_column_allowed; +@@global.innodb_instant_alter_column_allowed +add_drop_reorder +set global innodb_instant_alter_column_allowed=1; +select @@global.innodb_instant_alter_column_allowed; +@@global.innodb_instant_alter_column_allowed +add_last +set global innodb_instant_alter_column_allowed=0; +select @@global.innodb_instant_alter_column_allowed; +@@global.innodb_instant_alter_column_allowed +never +set global innodb_instant_alter_column_allowed=default; +select @@global.innodb_instant_alter_column_allowed; +@@global.innodb_instant_alter_column_allowed +add_drop_reorder +SET GLOBAL innodb_instant_alter_column_allowed = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 0872b29b283..8d93f02e61b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1089,6 +1089,18 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_INSTANT_ALTER_COLUMN_ALLOWED +SESSION_VALUE NULL +DEFAULT_VALUE add_drop_reorder +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE ENUM +VARIABLE_COMMENT File format constraint for ALTER TABLE +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST never,add_last,add_drop_reorder +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_IO_CAPACITY SESSION_VALUE NULL DEFAULT_VALUE 200 diff --git a/mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test b/mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test new file mode 100644 index 00000000000..c9921b18f96 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test @@ -0,0 +1,34 @@ +--source include/have_innodb.inc + +SET @start_global_value = @@global.innodb_instant_alter_column_allowed; +SET GLOBAL innodb_instant_alter_column_allowed=never; + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_instant_alter_column_allowed; +show global variables like 'innodb_instant_alter_column_allowed'; +show session variables like 'innodb_instant_alter_column_allowed'; +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_instant_alter_column_allowed'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_instant_alter_column_allowed'; + +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_instant_alter_column_allowed=no; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_instant_alter_column_allowed=1.1; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_instant_alter_column_allowed=-1; +select @@global.innodb_instant_alter_column_allowed; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_instant_alter_column_allowed=3; +select @@global.innodb_instant_alter_column_allowed; +set global innodb_instant_alter_column_allowed=2; +select @@global.innodb_instant_alter_column_allowed; +set global innodb_instant_alter_column_allowed=1; +select @@global.innodb_instant_alter_column_allowed; +set global innodb_instant_alter_column_allowed=0; +select @@global.innodb_instant_alter_column_allowed; +set global innodb_instant_alter_column_allowed=default; +select @@global.innodb_instant_alter_column_allowed; + +SET GLOBAL innodb_instant_alter_column_allowed = @start_global_value; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index de7f9855499..271355e45d6 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -10094,7 +10094,8 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_info *ha_alter_info) { uint index= 0; - enum_alter_inplace_result result= HA_ALTER_INPLACE_NO_LOCK; + enum_alter_inplace_result result; + alter_table_operations orig_ops; ha_partition_inplace_ctx *part_inplace_ctx; bool first_is_set= false; THD *thd= ha_thd(); @@ -10121,33 +10122,35 @@ ha_partition::check_if_supported_inplace_alter(TABLE *altered_table, if (!part_inplace_ctx->handler_ctx_array) DBUG_RETURN(HA_ALTER_ERROR); - /* Set all to NULL, including the terminating one. */ - for (index= 0; index <= m_tot_parts; index++) - part_inplace_ctx->handler_ctx_array[index]= NULL; + do { + result= HA_ALTER_INPLACE_NO_LOCK; + /* Set all to NULL, including the terminating one. */ + for (index= 0; index <= m_tot_parts; index++) + part_inplace_ctx->handler_ctx_array[index]= NULL; - ha_alter_info->handler_flags |= ALTER_PARTITIONED; - for (index= 0; index < m_tot_parts; index++) - { - enum_alter_inplace_result p_result= - m_file[index]->check_if_supported_inplace_alter(altered_table, - ha_alter_info); - part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx; - - if (index == 0) + ha_alter_info->handler_flags |= ALTER_PARTITIONED; + orig_ops= ha_alter_info->handler_flags; + for (index= 0; index < m_tot_parts; index++) { - first_is_set= (ha_alter_info->handler_ctx != NULL); - } - else if (first_is_set != (ha_alter_info->handler_ctx != NULL)) - { - /* Either none or all partitions must set handler_ctx! */ - DBUG_ASSERT(0); - DBUG_RETURN(HA_ALTER_ERROR); + enum_alter_inplace_result p_result= + m_file[index]->check_if_supported_inplace_alter(altered_table, + ha_alter_info); + part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx; + + if (index == 0) + first_is_set= (ha_alter_info->handler_ctx != NULL); + else if (first_is_set != (ha_alter_info->handler_ctx != NULL)) + { + /* Either none or all partitions must set handler_ctx! */ + DBUG_ASSERT(0); + DBUG_RETURN(HA_ALTER_ERROR); + } + if (p_result < result) + result= p_result; + if (result == HA_ALTER_ERROR) + break; } - if (p_result < result) - result= p_result; - if (result == HA_ALTER_ERROR) - break; - } + } while (orig_ops != ha_alter_info->handler_flags); ha_alter_info->handler_ctx= part_inplace_ctx; /* diff --git a/sql/item.cc b/sql/item.cc index 89e23173b0e..4c1fe99e222 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation + Copyright (c) 2010, 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 @@ -2560,42 +2560,46 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, /** @brief Building clone for Item_func_or_sum - + @param thd thread handle - @param mem_root part of the memory for the clone + @param mem_root part of the memory for the clone @details - This method gets copy of the current item and also - build clones for its referencies. For the referencies - build_copy is called again. - - @retval - clone of the item - 0 if an error occurred -*/ + This method first builds clones of the arguments. If it is successful with + buiding the clones then it constructs a copy of this Item_func_or_sum object + and attaches to it the built clones of the arguments. + + @return clone of the item + @retval 0 on a failure +*/ Item* Item_func_or_sum::build_clone(THD *thd) { - Item_func_or_sum *copy= (Item_func_or_sum *) get_copy(thd); - if (unlikely(!copy)) - return 0; + Item *copy_tmp_args[2]= {0,0}; + Item **copy_args= copy_tmp_args; if (arg_count > 2) { - copy->args= - (Item**) alloc_root(thd->mem_root, sizeof(Item*) * arg_count); - if (unlikely(!copy->args)) + copy_args= static_cast<Item**> + (alloc_root(thd->mem_root, sizeof(Item*) * arg_count)); + if (unlikely(!copy_args)) return 0; } - else if (arg_count > 0) - copy->args= copy->tmp_arg; - - for (uint i= 0; i < arg_count; i++) { Item *arg_clone= args[i]->build_clone(thd); - if (!arg_clone) + if (unlikely(!arg_clone)) return 0; - copy->args[i]= arg_clone; + copy_args[i]= arg_clone; + } + Item_func_or_sum *copy= static_cast<Item_func_or_sum *>(get_copy(thd)); + if (unlikely(!copy)) + return 0; + if (arg_count > 2) + copy->args= copy_args; + else if (arg_count > 0) + { + copy->args= copy->tmp_arg; + memcpy(copy->args, copy_args, sizeof(Item *) * arg_count); } return copy; } diff --git a/sql/item_row.cc b/sql/item_row.cc index def1458df1b..767787497ce 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -1,5 +1,6 @@ /* Copyright (c) 2002, 2011, Oracle and/or its affiliates. + Copyright (c) 2011, 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 @@ -184,16 +185,20 @@ void Item_row::bring_value() Item* Item_row::build_clone(THD *thd) { - Item_row *copy= (Item_row *) get_copy(thd); - if (!copy) + Item **copy_args= static_cast<Item**> + (alloc_root(thd->mem_root, sizeof(Item*) * arg_count)); + if (unlikely(!copy_args)) return 0; - copy->args= (Item**) alloc_root(thd->mem_root, sizeof(Item*) * arg_count); for (uint i= 0; i < arg_count; i++) { Item *arg_clone= args[i]->build_clone(thd); if (!arg_clone) return 0; - copy->args[i]= arg_clone; + copy_args[i]= arg_clone; } + Item_row *copy= (Item_row *) get_copy(thd); + if (unlikely(!copy)) + return 0; + copy->args= copy_args; return copy; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9033103cef5..1497296e7cf 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7425,6 +7425,16 @@ static int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff, *(int *)buff= tp_get_idle_thread_count(); return 0; } + + +static int show_threadpool_threads(THD *thd, SHOW_VAR *var, char *buff, + enum enum_var_type scope) +{ + var->type= SHOW_INT; + var->value= buff; + *(reinterpret_cast<int*>(buff))= tp_get_thread_count(); + return 0; +} #endif /* @@ -7644,7 +7654,7 @@ SHOW_VAR status_vars[]= { #endif #ifdef HAVE_POOL_OF_THREADS {"Threadpool_idle_threads", (char *) &show_threadpool_idle_threads, SHOW_SIMPLE_FUNC}, - {"Threadpool_threads", (char *) &tp_stats.num_worker_threads, SHOW_INT}, + {"Threadpool_threads", (char *) &show_threadpool_threads, SHOW_SIMPLE_FUNC}, #endif {"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH}, {"Threads_connected", (char*) &connection_count, SHOW_INT}, diff --git a/sql/opt_split.cc b/sql/opt_split.cc index b27a0d757cb..a6031f75a5b 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -966,7 +966,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(double record_count, The plan for the chosen key has not been found in the cache. Build a new plan and save info on it in the cache */ - table_map all_table_map= (1 << join->table_count) - 1; + table_map all_table_map= (((table_map) 1) << join->table_count) - 1; reset_validity_vars_for_keyuses(best_key_keyuse_ext_start, best_table, best_key, remaining_tables, true); choose_plan(join, all_table_map & ~join->const_table_map); diff --git a/sql/slave.cc b/sql/slave.cc index 6a014e9bfa4..754c8df3638 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation + Copyright (c) 2009, 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 diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 64f8e99c0c4..d323f7e0004 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -636,6 +636,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) m_current_stage_key(0), m_psi(0), in_sub_stmt(0), log_all_errors(0), binlog_unsafe_warning_flags(0), + current_stmt_binlog_format(BINLOG_FORMAT_MIXED), bulk_param(0), table_map_for_update(0), m_examined_row_count(0), diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index d5a90089da4..aa9e561a717 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2007, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2016, MariaDB + Copyright (c) 2008, 2020, MariaDB 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 diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f7660054b74..f78d2ac544c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2964,8 +2964,12 @@ int JOIN::optimize_stage2() having_is_correlated= MY_TEST(having->used_tables() & OUTER_REF_TABLE_BIT); tmp_having= having; - if ((select_lex->options & OPTION_SCHEMA_TABLE)) - optimize_schema_tables_reads(this); + if ((select_lex->options & OPTION_SCHEMA_TABLE) && + optimize_schema_tables_reads(this)) + DBUG_RETURN(TRUE); + + if (unlikely(thd->is_error())) + DBUG_RETURN(TRUE); /* The loose index scan access method guarantees that all grouping or diff --git a/sql/sql_select.h b/sql/sql_select.h index 8b2df74702b..46c84b9df7b 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -2,7 +2,7 @@ #define SQL_SELECT_INCLUDED /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2017, MariaDB Corporation. + Copyright (c) 2008, 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 @@ -1666,6 +1666,9 @@ public: void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr) { DBUG_ASSERT(dst_arr.size() >= src_arr.size()); + if (src_arr.size() == 0) + return; + void *dest= dst_arr.array(); const void *src= src_arr.array(); memcpy(dest, src, src_arr.size() * src_arr.element_size()); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2b1be46b807..78a54f6e5e3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8488,7 +8488,6 @@ end: bool optimize_schema_tables_reads(JOIN *join) { THD *thd= join->thd; - bool result= 0; DBUG_ENTER("optimize_schema_tables_reads"); JOIN_TAB *tab; @@ -8523,11 +8522,11 @@ bool optimize_schema_tables_reads(JOIN *join) */ cond= tab->cache_select->cond; } - - optimize_for_get_all_tables(thd, table_list, cond); + if (optimize_for_get_all_tables(thd, table_list, cond)) + DBUG_RETURN(TRUE); // Handle OOM } } - DBUG_RETURN(result); + DBUG_RETURN(FALSE); } diff --git a/sql/sql_string.h b/sql/sql_string.h index 4eeac0a8a82..37225e17c1e 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -86,6 +86,10 @@ public: Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length) :Well_formed_prefix_status(cs, str, str + length, length), m_str(str) { } + Well_formed_prefix(CHARSET_INFO *cs, LEX_STRING str, size_t nchars) + :Well_formed_prefix_status(cs, str.str, str.str + str.length, nchars), + m_str(str.str) + { } size_t length() const { return m_source_end_pos - m_str; } }; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 05d4b450f30..c6c542fd478 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4454,6 +4454,8 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len, uint err_code, const char *name) { DBUG_ENTER("validate_comment_length"); + if (comment->length == 0) + DBUG_RETURN(false); size_t tmp_len= system_charset_info->charpos(comment->str, comment->str + comment->length, max_len); diff --git a/sql/threadpool.h b/sql/threadpool.h index fe77100a82a..742c357dade 100644 --- a/sql/threadpool.h +++ b/sql/threadpool.h @@ -1,8 +1,4 @@ -#ifndef THREADPOOL_H_INCLUDED -#define THREADPOOL_H_INCLUDED - -#ifdef HAVE_POOL_OF_THREADS -/* Copyright (C) 2012 Monty Program Ab +/* Copyright (C) 2012, 2020, MariaDB 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 @@ -17,6 +13,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#pragma once +#ifdef HAVE_POOL_OF_THREADS #define MAX_THREAD_GROUPS 100000 /* Threadpool parameters */ @@ -50,7 +48,7 @@ extern void tp_timeout_handler(TP_connection *c); struct TP_STATISTICS { /* Current number of worker thread. */ - volatile int32 num_worker_threads; + Atomic_counter<uint32_t> num_worker_threads; }; extern TP_STATISTICS tp_stats; @@ -163,4 +161,3 @@ struct TP_pool_generic :TP_pool }; #endif /* HAVE_POOL_OF_THREADS */ -#endif /* THREADPOOL_H_INCLUDED */ diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 40b230e5392..b0a5d38d5eb 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2012, 2019, MariaDB Corporation. +/* Copyright (C) 2012, 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 @@ -23,7 +23,6 @@ #include <sql_audit.h> #include <debug_sync.h> #include <threadpool.h> -#include <my_counter.h> #ifdef WITH_WSREP #include "wsrep_trans_observer.h" diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 86b039d5319..7aebd217d68 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -92,7 +92,7 @@ static PSI_thread_info thread_list[] = thread_group_t *all_groups; static uint group_count; -static int32 shutdown_group_count; +static Atomic_counter<uint32_t> shutdown_group_count; /** Used for printing "pool blocked" message, see @@ -106,7 +106,7 @@ struct pool_timer_t mysql_mutex_t mutex; mysql_cond_t cond; volatile uint64 current_microtime; - volatile uint64 next_timeout_check; + std::atomic<uint64_t> next_timeout_check; int tick_interval; bool shutdown; pthread_t timer_thread_id; @@ -525,7 +525,8 @@ static void* timer_thread(void *param) my_thread_init(); DBUG_ENTER("timer_thread"); - timer->next_timeout_check= ULONGLONG_MAX; + timer->next_timeout_check.store(std::numeric_limits<uint64_t>::max(), + std::memory_order_relaxed); timer->current_microtime= microsecond_interval_timer(); for(;;) @@ -553,11 +554,12 @@ static void* timer_thread(void *param) } /* Check if any client exceeded wait_timeout */ - if (timer->next_timeout_check <= timer->current_microtime) + if (timer->next_timeout_check.load(std::memory_order_relaxed) <= + timer->current_microtime) { /* Reset next timeout check, it will be recalculated below */ - my_atomic_fas64((volatile int64*) &timer->next_timeout_check, - ULONGLONG_MAX); + timer->next_timeout_check.store(std::numeric_limits<uint64_t>::max(), + std::memory_order_relaxed); server_threads.iterate(timeout_check, timer); } } @@ -809,7 +811,7 @@ static void add_thread_count(thread_group_t *thread_group, int32 count) thread_group->thread_count += count; /* worker starts out and end in "active" state */ thread_group->active_thread_count += count; - my_atomic_add32(&tp_stats.num_worker_threads, count); + tp_stats.num_worker_threads+= count; } @@ -829,7 +831,7 @@ static int create_worker(thread_group_t *thread_group, bool due_to_stall) int err; DBUG_ENTER("create_worker"); - if (tp_stats.num_worker_threads >= (int)threadpool_max_threads + if (tp_stats.num_worker_threads >= threadpool_max_threads && thread_group->thread_count >= 2) { err= 1; @@ -978,7 +980,7 @@ void thread_group_destroy(thread_group_t *thread_group) } #endif - if (my_atomic_add32(&shutdown_group_count, -1) == 1) + if (!--shutdown_group_count) my_free(all_groups); } @@ -1331,12 +1333,15 @@ void TP_connection_generic::wait_end() static void set_next_timeout_check(ulonglong abstime) { + auto old= pool_timer.next_timeout_check.load(std::memory_order_relaxed); DBUG_ENTER("set_next_timeout_check"); - while(abstime < pool_timer.next_timeout_check) + while (abstime < old) { - longlong old= (longlong)pool_timer.next_timeout_check; - my_atomic_cas64((volatile int64*)&pool_timer.next_timeout_check, - &old, abstime); + if (pool_timer.next_timeout_check. + compare_exchange_weak(old, abstime, + std::memory_order_relaxed, + std::memory_order_relaxed)) + break; } DBUG_VOID_RETURN; } diff --git a/sql/threadpool_generic.h b/sql/threadpool_generic.h index 5f923bc0652..64aa67c40d3 100644 --- a/sql/threadpool_generic.h +++ b/sql/threadpool_generic.h @@ -1,4 +1,4 @@ -/* Copyright(C) 2019 MariaDB +/* Copyright(C) 2019, 2020, MariaDB * * This program is free software; you can redistribute itand /or modify * it under the terms of the GNU General Public License as published by @@ -17,8 +17,8 @@ #include <my_global.h> #include <sql_plist.h> #include <my_pthread.h> -#include <threadpool.h> #include <mysqld.h> +#include <threadpool.h> #include <violite.h> #ifdef _WIN32 diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index c9968d48c06..18ffd259fde 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -306,7 +306,7 @@ void tp_win_callback_prolog() /* Running in new worker thread*/ FlsSetValue(fls, (void *)1); statistic_increment(thread_created, &LOCK_status); - InterlockedIncrement((volatile long *)&tp_stats.num_worker_threads); + tp_stats.num_worker_threads++; my_thread_init(); } } @@ -329,7 +329,7 @@ static VOID WINAPI thread_destructor(void *data) { if(data) { - InterlockedDecrement((volatile long *)&tp_stats.num_worker_threads); + tp_stats.num_worker_threads--; my_thread_end(); } } diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index 5dd29085d65..3ef2a460b9d 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -167,8 +167,7 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) #endif // !MARIADB // We used the file name relative to recorded datapath - strcat(strcat(strcat(strcpy(filename, "."), dir_slash), db), dir_slash); - strncat(filename, fn, _MAX_PATH - strlen(filename)); + snprintf(filename, sizeof filename, IF_WIN(".\\%s\\%s","./%s/%s"), db, fn); // Retrieve the file from the web and copy it locally if (http && grf(g->Message, trace(515), http, uri, filename)) { diff --git a/storage/connect/tabrest.h b/storage/connect/tabrest.h index 525b2bdc55f..f08ac7984c9 100644 --- a/storage/connect/tabrest.h +++ b/storage/connect/tabrest.h @@ -5,11 +5,7 @@ /***********************************************************************/ #pragma once -extern PCSZ slash; -#if defined(__WIN__) -#define dir_slash "\\" -#else // !__WIN__ -#define dir_slash "/" +#ifndef __WIN__ #define stricmp strcasecmp #endif // !__WIN__ diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index fdc121eaff7..0721ce2508b 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -69,6 +69,8 @@ Created 11/5/1995 Heikki Tuuri #include <map> #include <sstream> +using st_::span; + #ifdef HAVE_LIBNUMA #include <numa.h> #include <numaif.h> @@ -336,7 +338,7 @@ on the io_type */ @return true if temporary tablespace decrypted, false if not */ static bool buf_tmp_page_decrypt(byte* tmp_frame, byte* src_frame) { - if (buf_page_is_zeroes(src_frame, srv_page_size)) { + if (buf_is_zeroes(span<const byte>(src_frame, srv_page_size))) { return true; } @@ -716,20 +718,14 @@ static void buf_page_check_lsn(bool check_lsn, const byte* read_buf) #endif /* !UNIV_INNOCHECKSUM */ } -/** Check if a page is all zeroes. -@param[in] read_buf database page -@param[in] page_size page frame size -@return whether the page is all zeroes */ -bool buf_page_is_zeroes(const void* read_buf, size_t page_size) + +/** Check if a buffer is all zeroes. +@param[in] buf data to check +@return whether the buffer is all zeroes */ +bool buf_is_zeroes(span<const byte> buf) { - const ulint* b = reinterpret_cast<const ulint*>(read_buf); - const ulint* const e = b + page_size / sizeof *b; - do { - if (*b++) { - return false; - } - } while (b != e); - return true; + ut_ad(buf.size() <= sizeof field_ref_zero); + return memcmp(buf.data(), field_ref_zero, buf.size()) == 0; } /** Check if a page is corrupt. @@ -758,7 +754,7 @@ buf_page_is_corrupted( uint crc32 = mach_read_from_4(end); if (!crc32 && size == srv_page_size - && buf_page_is_zeroes(read_buf, size)) { + && buf_is_zeroes(span<const byte>(read_buf, size))) { return false; } @@ -854,8 +850,9 @@ buf_page_is_corrupted( static_assert(FIL_PAGE_LSN % 8 == 0, "alignment"); /* A page filled with NUL bytes is considered not corrupted. - The FIL_PAGE_FILE_FLUSH_LSN field may be written nonzero for - the first page of each file of the system tablespace. + Before MariaDB Server 10.1.25 (MDEV-12113) or 10.2.2 (or MySQL 5.7), + the FIL_PAGE_FILE_FLUSH_LSN field may have been written nonzero + for the first page of each file of the system tablespace. We want to ignore it for the system tablespace, but because we do not know the expected tablespace here, we ignore the field for all data files, except for @@ -3219,7 +3216,45 @@ buf_wait_for_read( } } -/** This is the general function used to get access to a database page. +/** Lock the page with the given latch type. +@param[in,out] block block to be locked +@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] mtr mini-transaction +@param[in] file file name +@param[in] line line where called +@return pointer to locked block */ +static buf_block_t* buf_page_mtr_lock(buf_block_t *block, + ulint rw_latch, + mtr_t* mtr, + const char *file, + unsigned line) +{ + mtr_memo_type_t fix_type; + switch (rw_latch) + { + case RW_NO_LATCH: + fix_type= MTR_MEMO_BUF_FIX; + break; + case RW_S_LATCH: + rw_lock_s_lock_inline(&block->lock, 0, file, line); + fix_type= MTR_MEMO_PAGE_S_FIX; + break; + case RW_SX_LATCH: + rw_lock_sx_lock_inline(&block->lock, 0, file, line); + fix_type= MTR_MEMO_PAGE_SX_FIX; + break; + default: + ut_ad(rw_latch == RW_X_LATCH); + rw_lock_x_lock_inline(&block->lock, 0, file, line); + fix_type= MTR_MEMO_PAGE_X_FIX; + break; + } + + mtr_memo_push(mtr, block, fix_type); + return block; +} + +/** Low level function used to get access to a database page. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @@ -3236,7 +3271,7 @@ then it makes sure that it does merging of change buffer changes while reading the page from file. @return pointer to the block or NULL */ buf_block_t* -buf_page_get_gen( +buf_page_get_low( const page_id_t page_id, ulint zip_size, ulint rw_latch, @@ -3891,28 +3926,8 @@ evict_from_pool: } } else { get_latch: - mtr_memo_type_t fix_type; - - switch (rw_latch) { - case RW_NO_LATCH: - fix_type = MTR_MEMO_BUF_FIX; - break; - case RW_S_LATCH: - rw_lock_s_lock_inline(&fix_block->lock, 0, file, line); - fix_type = MTR_MEMO_PAGE_S_FIX; - break; - case RW_SX_LATCH: - rw_lock_sx_lock_inline(&fix_block->lock, 0, file, line); - fix_type = MTR_MEMO_PAGE_SX_FIX; - break; - default: - ut_ad(rw_latch == RW_X_LATCH); - rw_lock_x_lock_inline(&fix_block->lock, 0, file, line); - fix_type = MTR_MEMO_PAGE_X_FIX; - break; - } - - mtr->memo_push(block, fix_type); + fix_block = buf_page_mtr_lock(fix_block, rw_latch, mtr, + file, line); } if (mode != BUF_PEEK_IF_IN_POOL && !access_time) { @@ -3928,6 +3943,45 @@ get_latch: return(fix_block); } +/** Get access to a database page. Buffered redo log may be applied. +@param[in] page_id page id +@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 +@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] guess guessed block or NULL +@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, +BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH +@param[in] file file name +@param[in] line line where called +@param[in] mtr mini-transaction +@param[out] err DB_SUCCESS or error code +@param[in] allow_ibuf_merge Allow change buffer merge while +reading the pages from file. +@return pointer to the block or NULL */ +buf_block_t* +buf_page_get_gen( + const page_id_t page_id, + ulint zip_size, + ulint rw_latch, + buf_block_t* guess, + ulint mode, + const char* file, + unsigned line, + mtr_t* mtr, + dberr_t* err, + bool allow_ibuf_merge) +{ + if (buf_block_t *block= recv_sys.recover(page_id)) + { + block->fix(); + ut_ad(rw_lock_s_lock_nowait(block->debug_latch, file, line)); + block= buf_page_mtr_lock(block, rw_latch, mtr, file, line); + return block; + } + + return buf_page_get_low(page_id, zip_size, rw_latch, + guess, mode, file, line, mtr, err, allow_ibuf_merge); +} + /********************************************************************//** This is the general function used to get optimistic access to a database page. @@ -4794,7 +4848,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) /* If traditional checksums match, we assume that page is not anymore encrypted. */ if (space->full_crc32() - && !buf_page_is_zeroes(dst_frame, space->physical_size()) + && !buf_is_zeroes(span<const byte>(dst_frame, + space->physical_size())) && (key_version || space->is_compressed() || space->purpose == FIL_TYPE_TEMPORARY)) { if (buf_page_full_crc32_is_corrupted( diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index a4651f53f8d..c83d21e2e12 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -34,6 +34,8 @@ Created 2011/12/19 #include "fil0crypt.h" #include "fil0pagecompress.h" +using st_::span; + /** The doublewrite buffer */ buf_dblwr_t* buf_dblwr = NULL; @@ -541,7 +543,7 @@ buf_dblwr_process() const ulint physical_size = space->physical_size(); const ulint zip_size = space->zip_size(); - ut_ad(!buf_page_is_zeroes(page, physical_size)); + ut_ad(!buf_is_zeroes(span<const byte>(page, physical_size))); /* We want to ensure that for partial reads the unread portion of the page is NUL. */ @@ -564,8 +566,8 @@ buf_dblwr_process() << "error: " << ut_strerr(err); } - const bool is_all_zero = buf_page_is_zeroes( - read_buf, physical_size); + const bool is_all_zero = buf_is_zeroes( + span<const byte>(read_buf, physical_size)); const bool expect_encrypted = space->crypt_data && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED; bool is_corrupted = false; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9c5db57c661..02722623bf5 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -199,9 +199,6 @@ static ulong innodb_flush_method; stopword table to be used */ static char* innobase_server_stopword_table; -/* Below we have boolean-valued start-up parameters, and their default -values */ - static my_bool innobase_use_atomic_writes; static my_bool innobase_rollback_on_timeout; static my_bool innobase_create_status_file; @@ -217,6 +214,9 @@ extern uint srv_n_fil_crypt_iops; my_bool innodb_evict_tables_on_commit_debug; #endif +/** File format constraint for ALTER TABLE */ +ulong innodb_instant_alter_column_allowed; + /** Note we cannot use rec_format_enum because we do not allow COMPRESSED row format for innodb_default_row_format option. */ enum default_row_format_enum { @@ -395,6 +395,22 @@ static TYPELIB innodb_change_buffering_typelib = { NULL }; +/** Allowed values of innodb_instant_alter_column_allowed */ +const char* innodb_instant_alter_column_allowed_names[] = { + "never", /* compatible with MariaDB 5.5 to 10.2 */ + "add_last",/* allow instant ADD COLUMN ... LAST */ + "add_drop_reorder", /* allow instant ADD anywhere & DROP & reorder */ + NullS +}; + +/** Enumeration of innodb_instant_alter_column_allowed */ +static TYPELIB innodb_instant_alter_column_allowed_typelib = { + array_elements(innodb_instant_alter_column_allowed_names) - 1, + "innodb_instant_alter_column_allowed_typelib", + innodb_instant_alter_column_allowed_names, + NULL +}; + /** Retrieve the FTS Relevance Ranking result for doc with doc_id of m_prebuilt->fts_doc_id @param[in,out] fts_hdl FTS handler @@ -19156,6 +19172,12 @@ static MYSQL_SYSVAR_BOOL(stats_include_delete_marked, "Include delete marked records when calculating persistent statistics", NULL, NULL, FALSE); +static MYSQL_SYSVAR_ENUM(instant_alter_column_allowed, + innodb_instant_alter_column_allowed, + PLUGIN_VAR_RQCMDARG, + "File format constraint for ALTER TABLE", NULL, NULL, 2/*add_drop_reorder*/, + &innodb_instant_alter_column_allowed_typelib); + static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity, PLUGIN_VAR_RQCMDARG, "Number of IOPs the server can do. Tunes the background IO rate", @@ -20336,6 +20358,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(random_read_ahead), MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(read_only), + MYSQL_SYSVAR(instant_alter_column_allowed), MYSQL_SYSVAR(io_capacity), MYSQL_SYSVAR(io_capacity_max), MYSQL_SYSVAR(page_cleaners), diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 477e1b148ec..310d50a78fb 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -58,6 +58,8 @@ Smart ALTER TABLE #include "span.h" using st_::span; +/** File format constraint for ALTER TABLE */ +extern ulong innodb_instant_alter_column_allowed; static const char *MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN= "INPLACE ADD or DROP of virtual columns cannot be " @@ -1960,6 +1962,37 @@ ha_innobase::check_if_supported_inplace_alter( const char* reason_rebuild = NULL; + switch (innodb_instant_alter_column_allowed) { + case 0: /* never */ + if ((ha_alter_info->handler_flags + & (ALTER_ADD_STORED_BASE_COLUMN + | ALTER_STORED_COLUMN_ORDER + | ALTER_DROP_STORED_COLUMN)) + || m_prebuilt->table->is_instant()) { + reason_rebuild = + "innodb_instant_alter_column_allowed=never"; +innodb_instant_alter_column_allowed_reason: + if (ha_alter_info->handler_flags + & ALTER_RECREATE_TABLE) { + reason_rebuild = NULL; + } else { + ha_alter_info->handler_flags + |= ALTER_RECREATE_TABLE; + ha_alter_info->unsupported_reason + = reason_rebuild; + } + } + break; + case 1: /* add_last */ + if ((ha_alter_info->handler_flags + & (ALTER_STORED_COLUMN_ORDER | ALTER_DROP_STORED_COLUMN)) + || m_prebuilt->table->instant) { + reason_rebuild = "innodb_instant_atler_column_allowed=" + "add_last"; + goto innodb_instant_alter_column_allowed_reason; + } + } + switch (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) { case ALTER_OPTIONS: if (alter_options_need_rebuild(ha_alter_info, table)) { @@ -2450,6 +2483,7 @@ cannot_create_many_fulltext_index: } if (need_rebuild || fts_need_rebuild) { + ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE; DBUG_RETURN(online ? HA_ALTER_INPLACE_COPY_NO_LOCK : HA_ALTER_INPLACE_COPY_LOCK); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 4a7dbff9030..9bf10f2031b 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4714,7 +4714,8 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) return DB_CORRUPTION; } - if (buf_page_is_zeroes(bitmap_page->frame, physical_size)) { + if (buf_is_zeroes(span<const byte>(bitmap_page->frame, + physical_size))) { /* This means we got all-zero page instead of ibuf bitmap page. The subsequent page should be all-zero pages. */ @@ -4726,7 +4727,9 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) page_id_t(space->id, curr_page), zip_size, RW_S_LATCH, &mtr); page_t* page = buf_block_get_frame(block); - ut_ad(buf_page_is_zeroes(page, physical_size)); + ut_ad(buf_is_zeroes(span<const byte>( + page, + physical_size))); } #endif /* UNIV_DEBUG */ ibuf_exit(&mtr); diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h index 5c3147f56ea..83c374e2561 100644 --- a/storage/innobase/include/btr0types.h +++ b/storage/innobase/include/btr0types.h @@ -56,10 +56,4 @@ in the index record. */ #define BTR_EXTERN_LOCAL_STORED_MAX_SIZE \ (BTR_EXTERN_FIELD_REF_SIZE * 2) -/** A field reference full of zero, for use in assertions and checks, -and dummy default values of instantly dropped columns. -Initially, BLOB field references are set to zero, in -dtuple_convert_big_rec(). */ -extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX]; - #endif diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 8bf603afbbe..6a21e59d7c3 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -33,6 +33,7 @@ Created 11/5/1995 Heikki Tuuri #include "fil0fil.h" #include "mtr0types.h" #include "buf0types.h" +#include "span.h" #ifndef UNIV_INNOCHECKSUM #include "hash0hash.h" #include "ut0byte.h" @@ -297,7 +298,7 @@ the same set of mutexes or latches. @return pointer to the block */ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size); -/** This is the general function used to get access to a database page. +/** Get access to a database page. Buffered redo log may be applied. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @@ -324,6 +325,35 @@ buf_page_get_gen( dberr_t* err = NULL, bool allow_ibuf_merge = false); +/** This is the low level function used to get access to a database page. +@param[in] page_id page id +@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 +@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] guess guessed block or NULL +@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, +BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH +@param[in] file file name +@param[in] line line where called +@param[in] mtr mini-transaction +@param[out] err DB_SUCCESS or error code +@param[in] allow_ibuf_merge Allow change buffer merge to happen +while reading the page from file +then it makes sure that it does merging of change buffer changes while +reading the page from file. +@return pointer to the block or NULL */ +buf_block_t* +buf_page_get_low( + const page_id_t page_id, + ulint zip_size, + ulint rw_latch, + buf_block_t* guess, + ulint mode, + const char* file, + unsigned line, + mtr_t* mtr, + dberr_t* err, + bool allow_ibuf_merge); + /** Initialize a page in the buffer pool. The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one of the functions which perform to a block a state transition NOT_USED => @@ -460,11 +490,10 @@ buf_block_buf_fix_inc_func( # endif /* UNIV_DEBUG */ #endif /* !UNIV_INNOCHECKSUM */ -/** Check if a page is all zeroes. -@param[in] read_buf database page -@param[in] page_size page frame size -@return whether the page is all zeroes */ -bool buf_page_is_zeroes(const void* read_buf, size_t page_size); +/** Check if a buffer is all zeroes. +@param[in] buf data to check +@return whether the buffer is all zeroes */ +bool buf_is_zeroes(st_::span<const byte> buf); /** Checks if the page is in crc32 checksum format. @param[in] read_buf database page diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h index 34146ccdfa5..611fadae677 100644 --- a/storage/innobase/include/buf0types.h +++ b/storage/innobase/include/buf0types.h @@ -176,6 +176,12 @@ private: uint64_t m_id; }; +/** A field reference full of zero, for use in assertions and checks, +and dummy default values of instantly dropped columns. +Initially, BLOB field references are set to zero, in +dtuple_convert_big_rec(). */ +extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX]; + #ifndef UNIV_INNOCHECKSUM #include "ut0mutex.h" diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index 5e53dce8429..04ddf5b0a42 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.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) 2017, 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 @@ -32,6 +32,7 @@ Created 5/30/1994 Heikki Tuuri #include "mem0mem.h" #include "dict0types.h" #include "btr0types.h" +#include <vector> #include <ostream> @@ -526,9 +527,6 @@ struct dtuple_t { dfield_t* fields; /*!< fields */ ulint n_v_fields; /*!< number of virtual fields */ dfield_t* v_fields; /*!< fields on virtual column */ - UT_LIST_NODE_T(dtuple_t) tuple_list; - /*!< data tuples can be linked into a - list using this field */ #ifdef UNIV_DEBUG ulint magic_n; /*!< magic number, used in debug assertions */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 9773f12d8a6..170f492f0ec 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -964,7 +964,7 @@ public: /** Return the next fil_space_t from key rotation list. Once started, the caller must keep calling this until it returns NULL. - fil_space_acquire() and fil_space_release() are invoked here which + fil_space_acquire() and fil_space_t::release() are invoked here, which blocks a concurrent operation from dropping the tablespace. @param[in] prev_space Previous tablespace or NULL to start from beginning of fil_system->rotation diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index f6e8d808b05..1b4b1c3e6fd 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -301,6 +301,12 @@ private: @return whether the page was successfully initialized */ inline buf_block_t *recover_low(const page_id_t page_id, map::iterator &p, mtr_t &mtr); + /** Attempt to initialize a page based on redo log records. + @param page_id page identifier + @return the recovered block + @retval nullptr if the page cannot be initialized based on log records */ + buf_block_t *recover_low(const page_id_t page_id); + /** All found log files (multiple ones are possible if we are upgrading from before MariaDB Server 10.5.1) */ std::vector<log_file_t> files; @@ -384,6 +390,15 @@ public: This function should only be called when innodb_force_recovery is set. @param page_id corrupted page identifier */ ATTRIBUTE_COLD void free_corrupted_page(page_id_t page_id); + + /** Attempt to initialize a page based on redo log records. + @param page_id page identifier + @return the recovered block + @retval nullptr if the page cannot be initialized based on log records */ + buf_block_t *recover(const page_id_t page_id) + { + return UNIV_UNLIKELY(recovery_on) ? recover_low(page_id) : nullptr; + } }; /** The recovery system */ diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index acee1c49d1a..990c8142704 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -375,7 +375,7 @@ page_zip_calc_checksum( @param data ROW_FORMAT=COMPRESSED page @param size size of the page, in bytes @return whether the stored checksum matches innodb_checksum_algorithm */ -bool page_zip_verify_checksum(const void *data, size_t size); +bool page_zip_verify_checksum(const byte *data, size_t size); #ifndef UNIV_INNOCHECKSUM /**********************************************************************//** diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index 9b6aac9c548..95f4388902d 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 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 @@ -31,6 +31,7 @@ Created 4/20/1996 Heikki Tuuri #include "que0types.h" #include "trx0types.h" #include "row0types.h" +#include <vector> /***************************************************************//** Checks if foreign key constraint fails for an index entry. Sets shared locks @@ -52,15 +53,7 @@ row_ins_check_foreign_constraint( dtuple_t* entry, /*!< in: index entry for index */ que_thr_t* thr) /*!< in: query thread */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*********************************************************************//** -Creates an insert node struct. -@return own: insert node struct */ -ins_node_t* -ins_node_create( -/*============*/ - ulint ins_type, /*!< in: INS_VALUES, ... */ - dict_table_t* table, /*!< in: table where to insert */ - mem_heap_t* heap); /*!< in: mem heap where created */ + /*********************************************************************//** Sets a new row to insert for an INS_DIRECT node. This function is only used if we have constructed the row separately, which is a rare case; this @@ -158,10 +151,31 @@ row_ins_step( /*=========*/ que_thr_t* thr); /*!< in: query thread */ -/* Insert node structure */ +/* Insert node types */ +#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */ +#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */ +#define INS_DIRECT 2 /* this is for internal use in dict0crea: + insert the row directly */ + +/* Node execution states */ +#define INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */ +#define INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */ +#define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and + inserted */ -struct ins_node_t{ - que_common_t common; /*!< node type: QUE_NODE_INSERT */ +/** Insert node structure */ +struct ins_node_t +{ + explicit ins_node_t(ulint ins_type, dict_table_t *table) : + common(QUE_NODE_INSERT, NULL), + ins_type(ins_type), + row(NULL), table(table), select(NULL), values_list(NULL), + state(INS_NODE_SET_IX_LOCK), index(NULL), + entry_list(), entry(entry_list.end()), + trx_id(0), entry_sys_heap(mem_heap_create(128)) + { + } + que_common_t common; /*!< node type: QUE_NODE_INSERT */ ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */ dtuple_t* row; /*!< row to insert */ dict_table_t* table; /*!< table where to insert */ @@ -171,11 +185,12 @@ struct ins_node_t{ ulint state; /*!< node execution state */ dict_index_t* index; /*!< NULL, or the next index where the index entry should be inserted */ - dtuple_t* entry; /*!< NULL, or entry to insert in the index; + std::vector<dtuple_t*> + entry_list;/* list of entries, one for each index */ + std::vector<dtuple_t*>::iterator + entry; /*!< NULL, or entry to insert in the index; after a successful insert of the entry, this should be reset to NULL */ - UT_LIST_BASE_NODE_T(dtuple_t) - entry_list;/* list of entries, one for each index */ /** buffer for the system columns */ byte sys_buf[DATA_ROW_ID_LEN + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN]; @@ -188,20 +203,18 @@ struct ins_node_t{ entry_list and sys fields are stored here; if this is NULL, entry list should be created and buffers for sys fields in row allocated */ - ulint magic_n; }; -#define INS_NODE_MAGIC_N 15849075 +/** Create an insert object. +@param ins_type INS_VALUES, ... +@param table table where to insert +@param heap memory heap +@return the created object */ +inline ins_node_t *ins_node_create(ulint ins_type, dict_table_t *table, + mem_heap_t *heap) +{ + return new (mem_heap_alloc(heap, sizeof(ins_node_t))) + ins_node_t(ins_type, table); +} -/* Insert node types */ -#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */ -#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */ -#define INS_DIRECT 2 /* this is for internal use in dict0crea: - insert the row directly */ - -/* Node execution states */ -#define INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */ -#define INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */ -#define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and - inserted */ #endif diff --git a/storage/innobase/include/row0types.h b/storage/innobase/include/row0types.h index a2edd123b3f..5e737c1c14f 100644 --- a/storage/innobase/include/row0types.h +++ b/storage/innobase/include/row0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 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 @@ -24,8 +24,8 @@ Row operation global types Created 12/27/1996 Heikki Tuuri *******************************************************/ -#ifndef row0types_h -#define row0types_h +#pragma once +#include "buf0types.h" struct plan_t; @@ -52,5 +52,3 @@ struct row_log_t; /* MySQL data types */ struct TABLE; - -#endif diff --git a/storage/innobase/include/span.h b/storage/innobase/include/span.h deleted file mode 100644 index faeb41029b8..00000000000 --- a/storage/innobase/include/span.h +++ /dev/null @@ -1,145 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2019, 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 -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -#pragma once - -#include <cstddef> -#include <iterator> - -namespace st_ { - -template <class ElementType> class span { -public: - typedef ElementType element_type; - typedef ElementType value_type; - typedef size_t index_type; - typedef ptrdiff_t difference_type; - typedef element_type* pointer; - typedef const element_type* const_pointer; - typedef element_type& reference; - typedef const element_type& const_reference; - typedef pointer iterator; - typedef const pointer const_iterator; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - - span() : data_(NULL), size_(0) {} - - span(pointer ptr, index_type count) : data_(ptr), size_(count) {} - - span(pointer first, pointer last) : data_(first), size_(last - first) {} - - template <size_t N> span(element_type (&arr)[N]) : data_(arr), size_(N) - { - } - - template <class Container> - span(Container& cont) : data_(cont.begin()), size_(cont.size()) - { - } - - template <class Container> - span(const Container& cont) : data_(cont.begin()), size_(cont.size()) - { - } - - span(const span& other) : data_(other.data_), size_(other.size_) {} - - ~span(){}; - - span& operator=(const span& other) - { - data_ = other.data_; - size_ = other.size_; - return *this; - } - - template <size_t Count> span<element_type> first() const - { - assert(!empty()); - return span(data_, 1); - } - template <size_t Count> span<element_type> last() const - { - assert(!empty()); - return span(data_ + size() - 1, 1); - } - - span<element_type> first(index_type count) const - { - assert(!empty()); - return span(data_, 1); - } - span<element_type> last(index_type count) const - { - assert(!empty()); - return span(data_ + size() - 1, 1); - } - span<element_type> subspan(index_type offset, index_type count) const - { - assert(!empty()); - assert(size() >= offset + count); - return span(data_ + offset, count); - } - - index_type size() const { return size_; } - index_type size_bytes() const { return size_ * sizeof(ElementType); } - bool empty() const __attribute__((warn_unused_result)) - { - return size_ == 0; - } - - reference operator[](index_type idx) const - { - assert(size() > idx); - return data_[idx]; - } - reference front() const - { - assert(!empty()); - return data_[0]; - } - reference back() const - { - assert(!empty()); - return data_[size() - 1]; - } - pointer data() const - { - assert(!empty()); - return data_; - } - - iterator begin() const { return data_; } - iterator end() const { return data_ + size_; } - reverse_iterator rbegin() const - { - return std::reverse_iterator<iterator>(std::advance(end(), -1)); - } - reverse_iterator rend() const - { - return std::reverse_iterator<iterator>( - std::advance(begin(), -1)); - } - -private: - pointer data_; - index_type size_; -}; - -} // namespace st_ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index a4c2cfd0e42..5dafe916507 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -558,7 +558,7 @@ dberr_t mapped_file_t::map(const char *path, bool read_only, return DB_ERROR; m_area= {static_cast<byte *>(ptr), - static_cast<span<byte>::index_type>(file_size)}; + static_cast<span<byte>::size_type>(file_size)}; return DB_SUCCESS; } diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 3a8ff806e6d..3533cd3058b 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -646,10 +646,10 @@ public: if (!i.second.created) { continue; } - if (buf_block_t* block = buf_page_get_gen( - i.first, 0, RW_X_LATCH, NULL, + if (buf_block_t* block = buf_page_get_low( + i.first, 0, RW_X_LATCH, nullptr, BUF_GET_IF_IN_POOL, __FILE__, __LINE__, - &mtr)) { + &mtr, nullptr, false)) { if (UNIV_LIKELY_NULL(block->page.zip.data)) { switch (fil_page_get_type( block->page.zip.data)) { @@ -2534,6 +2534,26 @@ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id, return block; } +/** Attempt to initialize a page based on redo log records. +@param page_id page identifier +@return whether the page was successfully initialized */ +buf_block_t *recv_sys_t::recover_low(const page_id_t page_id) +{ + buf_block_t *block= nullptr; + + mutex_enter(&mutex); + map::iterator p= pages.find(page_id); + + if (p != pages.end() && p->second.state == page_recv_t::RECV_WILL_NOT_READ) + { + mtr_t mtr; + block= recover_low(page_id, p, mtr); + } + + mutex_exit(&mutex); + return block; +} + /** Apply buffered log to persistent data pages. @param last_batch whether it is possible to write more redo log */ void recv_sys_t::apply(bool last_batch) @@ -2602,9 +2622,10 @@ void recv_sys_t::apply(bool last_batch) case page_recv_t::RECV_NOT_PROCESSED: mtr.start(); mtr.set_log_mode(MTR_LOG_NONE); - if (buf_block_t *block= buf_page_get_gen(page_id, 0, RW_X_LATCH, + if (buf_block_t *block= buf_page_get_low(page_id, 0, RW_X_LATCH, nullptr, BUF_GET_IF_IN_POOL, - __FILE__, __LINE__, &mtr)) + __FILE__, __LINE__, + &mtr, nullptr, false)) { buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); recv_recover_page(block, mtr, p); diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index b7ce0f05c24..3d2c2439372 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -31,8 +31,9 @@ Created June 2005 by Marko Makela #include "buf0checksum.h" #include "ut0crc32.h" #include "zlib.h" +#include "span.h" -#ifndef UNIV_INNOCHECKSUM +using st_::span; /** A BLOB field reference full of zero, for use in assertions and tests. Initially, BLOB field references are set to zero, in @@ -40,6 +41,7 @@ dtuple_convert_big_rec(). */ alignas(UNIV_PAGE_SIZE_MIN) const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, }; +#ifndef UNIV_INNOCHECKSUM #include "mtr0log.h" #include "dict0dict.h" #include "btr0cur.h" @@ -4667,7 +4669,7 @@ page_zip_calc_checksum( @param data ROW_FORMAT=COMPRESSED page @param size size of the page, in bytes @return whether the stored checksum matches innodb_checksum_algorithm */ -bool page_zip_verify_checksum(const void *data, size_t size) +bool page_zip_verify_checksum(const byte *data, size_t size) { const srv_checksum_algorithm_t curr_algo = static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm); @@ -4676,17 +4678,12 @@ bool page_zip_verify_checksum(const void *data, size_t size) return true; } - for (size_t i = 0; i < size; i++) { - if (static_cast<const byte*>(data)[i] != 0) { - goto not_all_zeroes; - } + if (buf_is_zeroes(span<const byte>(data, size))) { + return true; } - return true; - -not_all_zeroes: const uint32_t stored = mach_read_from_4( - static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM); + data + FIL_PAGE_SPACE_OR_CHKSUM); uint32_t calc = page_zip_calc_checksum(data, size, curr_algo); diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 674984719aa..899b4c5aaf8 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 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 @@ -460,6 +460,8 @@ que_graph_free_recursive( que_graph_free_recursive(ins->select); ins->select = NULL; + ins->~ins_node_t(); + if (ins->entry_sys_heap != NULL) { mem_heap_free(ins->entry_sys_heap); ins->entry_sys_heap = NULL; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 3c5e27f5b27..7feac380076 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -50,6 +50,8 @@ Created 2012-02-08 by Sunny Bains. #include <my_aes.h> #endif +using st_::span; + /** The size of the buffer to use for IO. @param n physical page size @return number of pages */ @@ -3474,7 +3476,8 @@ fil_iterate( byte* src = readptr + i * size; const ulint page_no = page_get_page_no(src); if (!page_no && block->page.id.page_no()) { - if (!buf_page_is_zeroes(src, size)) { + if (!buf_is_zeroes(span<const byte>(src, + size))) { goto page_corrupted; } /* Proceed to the next page, diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index cbe82cfcd9c..f446f213e17 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2018, 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 @@ -58,39 +58,6 @@ check. If you make a change in this module make sure that no codepath is introduced where a call to log_free_check() is bypassed. */ -/*********************************************************************//** -Creates an insert node struct. -@return own: insert node struct */ -ins_node_t* -ins_node_create( -/*============*/ - ulint ins_type, /*!< in: INS_VALUES, ... */ - dict_table_t* table, /*!< in: table where to insert */ - mem_heap_t* heap) /*!< in: mem heap where created */ -{ - ins_node_t* node; - - node = static_cast<ins_node_t*>( - mem_heap_zalloc(heap, sizeof(ins_node_t))); - - if (!node) { - return(NULL); - } - - node->common.type = QUE_NODE_INSERT; - - node->ins_type = ins_type; - - node->state = INS_NODE_SET_IX_LOCK; - node->table = table; - - node->entry_sys_heap = mem_heap_create(128); - - node->magic_n = INS_NODE_MAGIC_N; - - return(node); -} - /***********************************************************//** Creates an entry template for each index of a table. */ static @@ -104,12 +71,12 @@ ins_node_create_entry_list( ut_ad(node->entry_sys_heap); - UT_LIST_INIT(node->entry_list, &dtuple_t::tuple_list); - /* We will include all indexes (include those corrupted - secondary indexes) in the entry list. Filteration of + secondary indexes) in the entry list. Filtration of these corrupted index will be done in row_ins() */ + node->entry_list.reserve(UT_LIST_GET_LEN(node->table->indexes)); + for (index = dict_table_get_first_index(node->table); index != 0; index = dict_table_get_next_index(index)) { @@ -118,7 +85,7 @@ ins_node_create_entry_list( node->row, NULL, index, node->entry_sys_heap, ROW_BUILD_FOR_INSERT); - UT_LIST_ADD_LAST(node->entry_list, entry); + node->entry_list.push_back(entry); } } @@ -186,7 +153,8 @@ ins_node_set_new_row( { node->state = INS_NODE_SET_IX_LOCK; node->index = NULL; - node->entry = NULL; + node->entry_list.clear(); + node->entry = node->entry_list.end(); node->row = row; @@ -3517,16 +3485,16 @@ row_ins_index_entry_step( ut_ad(dtuple_check_typed(node->row)); - err = row_ins_index_entry_set_vals(node->index, node->entry, + err = row_ins_index_entry_set_vals(node->index, *node->entry, node->row); if (err != DB_SUCCESS) { DBUG_RETURN(err); } - ut_ad(dtuple_check_typed(node->entry)); + ut_ad(dtuple_check_typed(*node->entry)); - err = row_ins_index_entry(node->index, node->entry, thr); + err = row_ins_index_entry(node->index, *node->entry, thr); DEBUG_SYNC_C_IF_THD(thr_get_trx(thr)->mysql_thd, "after_row_ins_index_entry_step"); @@ -3644,7 +3612,8 @@ row_ins( row_ins_alloc_row_id_step(node); node->index = dict_table_get_first_index(node->table); - node->entry = UT_LIST_GET_FIRST(node->entry_list); + ut_ad(node->entry_list.empty() == false); + node->entry = node->entry_list.begin(); if (node->ins_type == INS_SEARCHED) { @@ -3670,20 +3639,16 @@ row_ins( } node->index = dict_table_get_next_index(node->index); - node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry); - - DBUG_EXECUTE_IF( - "row_ins_skip_sec", - node->index = NULL; node->entry = NULL; break;); + ++node->entry; /* Skip corrupted secondary index and its entry */ while (node->index && node->index->is_corrupted()) { node->index = dict_table_get_next_index(node->index); - node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry); + ++node->entry; } } - ut_ad(node->entry == NULL); + ut_ad(node->entry == node->entry_list.end()); node->state = INS_NODE_ALLOC_ROW_ID; @@ -3739,14 +3704,14 @@ row_ins_step( DBUG_ASSERT(node->table->get_ref_count() > 0); DBUG_ASSERT(node->ins_type == INS_DIRECT); /* No-rollback tables can consist only of a single index. */ - DBUG_ASSERT(UT_LIST_GET_LEN(node->entry_list) == 1); + DBUG_ASSERT(node->entry_list.size() == 1); DBUG_ASSERT(UT_LIST_GET_LEN(node->table->indexes) == 1); /* There should be no possibility for interruption and restarting here. In theory, we could allow resumption from the INS_NODE_INSERT_ENTRIES state here. */ DBUG_ASSERT(node->state == INS_NODE_SET_IX_LOCK); node->index = dict_table_get_first_index(node->table); - node->entry = UT_LIST_GET_FIRST(node->entry_list); + node->entry = node->entry_list.begin(); node->state = INS_NODE_INSERT_ENTRIES; goto do_insert; } diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 48c44d15941..3f567946ce4 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1098,7 +1098,7 @@ row_get_prebuilt_insert_row( may need to rebuild the row insert template. */ if (prebuilt->trx_id == table->def_trx_id - && UT_LIST_GET_LEN(prebuilt->ins_node->entry_list) + && prebuilt->ins_node->entry_list.size() == UT_LIST_GET_LEN(table->indexes)) { return(prebuilt->ins_node->row); diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 88f3380c239..5ade4c7dc7a 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -43,10 +43,8 @@ Created 3/26/1996 Heikki Tuuri const dtuple_t trx_undo_metadata = { /* This also works for REC_INFO_METADATA_ALTER, because the delete-mark (REC_INFO_DELETED_FLAG) is ignored when searching. */ - REC_INFO_METADATA_ADD, - 0, 0, - NULL, 0, NULL, - UT_LIST_NODE_T(dtuple_t)() + REC_INFO_METADATA_ADD, 0, 0, + NULL, 0, NULL #ifdef UNIV_DEBUG , DATA_TUPLE_MAGIC_N #endif /* UNIV_DEBUG */ diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index d7895b095ba..51d775ce06d 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -60,10 +60,10 @@ if(BZIP2_FOUND AND (NOT WITH_ROCKSDB_BZIP2 STREQUAL "OFF")) list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES}) endif() -if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF")) +if(snappy_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF")) add_definitions(-DSNAPPY) - include_directories(${SNAPPY_INCLUDE_DIR}) - list(APPEND THIRDPARTY_LIBS ${SNAPPY_LIBRARIES}) + include_directories(${snappy_INCLUDE_DIR}) + list(APPEND THIRDPARTY_LIBS ${snappy_LIBRARIES}) endif() include(CheckFunctionExists) @@ -189,31 +189,32 @@ set(ROCKSDB_SOURCES cache/clock_cache.cc cache/lru_cache.cc cache/sharded_cache.cc + db/arena_wrapped_db_iter.cc db/builder.cc db/c.cc db/column_family.cc db/compacted_db_impl.cc db/compaction/compaction.cc db/compaction/compaction_iterator.cc - db/compaction/compaction_job.cc db/compaction/compaction_picker.cc + db/compaction/compaction_job.cc db/compaction/compaction_picker_fifo.cc db/compaction/compaction_picker_level.cc db/compaction/compaction_picker_universal.cc db/convenience.cc db/db_filesnapshot.cc - db/dbformat.cc db/db_impl/db_impl.cc + db/db_impl/db_impl_write.cc db/db_impl/db_impl_compaction_flush.cc - db/db_impl/db_impl_debug.cc - db/db_impl/db_impl_experimental.cc db/db_impl/db_impl_files.cc db/db_impl/db_impl_open.cc + db/db_impl/db_impl_debug.cc + db/db_impl/db_impl_experimental.cc db/db_impl/db_impl_readonly.cc db/db_impl/db_impl_secondary.cc - db/db_impl/db_impl_write.cc db/db_info_dumper.cc db/db_iter.cc + db/dbformat.cc db/error_handler.cc db/event_helpers.cc db/experimental.cc @@ -222,9 +223,10 @@ set(ROCKSDB_SOURCES db/flush_job.cc db/flush_scheduler.cc db/forward_iterator.cc + db/import_column_family_job.cc db/internal_stats.cc - db/log_reader.cc db/logs_with_prep_tracker.cc + db/log_reader.cc db/log_writer.cc db/malloc_stats.cc db/memtable.cc @@ -238,22 +240,31 @@ set(ROCKSDB_SOURCES db/table_cache.cc db/table_properties_collector.cc db/transaction_log_impl.cc + db/trim_history_scheduler.cc db/version_builder.cc db/version_edit.cc db/version_set.cc db/wal_manager.cc - db/write_batch_base.cc db/write_batch.cc + db/write_batch_base.cc db/write_controller.cc db/write_thread.cc env/env.cc env/env_chroot.cc + env/env_encryption.cc env/env_hdfs.cc + env/file_system.cc env/mock_env.cc file/delete_scheduler.cc - file/filename.cc + file/file_prefetch_buffer.cc file/file_util.cc + file/filename.cc + file/random_access_file_reader.cc + file/read_write_util.cc + file/readahead_raf.cc + file/sequence_file_reader.cc file/sst_file_manager_impl.cc + file/writable_file_writer.cc logging/auto_roll_logger.cc logging/event_logger.cc logging/log_buffer.cc @@ -268,8 +279,8 @@ set(ROCKSDB_SOURCES memtable/write_buffer_manager.cc monitoring/histogram.cc monitoring/histogram_windowing.cc - monitoring/instrumented_mutex.cc monitoring/in_memory_stats_history.cc + monitoring/instrumented_mutex.cc monitoring/iostats_context.cc monitoring/perf_context.cc monitoring/perf_level.cc @@ -277,7 +288,6 @@ set(ROCKSDB_SOURCES monitoring/statistics.cc monitoring/thread_status_impl.cc monitoring/thread_status_updater.cc - monitoring/thread_status_updater_debug.cc monitoring/thread_status_util.cc monitoring/thread_status_util_debug.cc options/cf_options.cc @@ -288,21 +298,24 @@ set(ROCKSDB_SOURCES options/options_sanity_check.cc port/stack_trace.cc table/adaptive/adaptive_table_factory.cc + table/block_based/block.cc table/block_based/block_based_filter_block.cc table/block_based/block_based_table_builder.cc table/block_based/block_based_table_factory.cc table/block_based/block_based_table_reader.cc table/block_based/block_builder.cc - table/block_based/block.cc table/block_based/block_prefix_index.cc - table/block_based/data_block_footer.cc table/block_based/data_block_hash_index.cc + table/block_based/data_block_footer.cc + table/block_based/filter_block_reader_common.cc + table/block_based/filter_policy.cc table/block_based/flush_block_policy.cc table/block_based/full_filter_block.cc table/block_based/index_builder.cc + table/block_based/parsed_full_filter_block.cc table/block_based/partitioned_filter_block.cc + table/block_based/uncompression_dict_reader.cc table/block_fetcher.cc - table/bloom_block.cc table/cuckoo/cuckoo_table_builder.cc table/cuckoo/cuckoo_table_factory.cc table/cuckoo/cuckoo_table_reader.cc @@ -312,6 +325,7 @@ set(ROCKSDB_SOURCES table/merging_iterator.cc table/meta_blocks.cc table/persistent_cache_helper.cc + table/plain/plain_table_bloom.cc table/plain/plain_table_builder.cc table/plain/plain_table_factory.cc table/plain/plain_table_index.cc @@ -323,23 +337,34 @@ set(ROCKSDB_SOURCES table/two_level_iterator.cc test_util/sync_point.cc test_util/sync_point_impl.cc + test_util/testutil.cc + test_util/transaction_test_util.cc + tools/block_cache_analyzer/block_cache_trace_analyzer.cc + tools/dump/db_dump_tool.cc tools/ldb_cmd.cc tools/ldb_tool.cc tools/sst_dump_tool.cc - trace_replay/block_cache_tracer.cc + tools/trace_analyzer_tool.cc trace_replay/trace_replay.cc - util/bloom.cc + trace_replay/block_cache_tracer.cc util/coding.cc util/compaction_job_stats_impl.cc util/comparator.cc util/compression_context_cache.cc util/concurrent_task_limiter_impl.cc - util/crc32c_arm64.cc util/crc32c.cc util/dynamic_bloom.cc - util/file_reader_writer.cc - util/filter_policy.cc util/hash.cc + util/murmurhash.cc + util/random.cc + util/rate_limiter.cc + util/slice.cc + util/file_checksum_helper.cc + util/status.cc + util/string_util.cc + util/thread_local.cc + util/threadpool_imp.cc + util/xxhash.cc utilities/backupable/backupable_db.cc utilities/blob_db/blob_compaction_filter.cc utilities/blob_db/blob_db.cc @@ -347,12 +372,11 @@ set(ROCKSDB_SOURCES utilities/blob_db/blob_db_impl_filesnapshot.cc utilities/blob_db/blob_dump_tool.cc utilities/blob_db/blob_file.cc - utilities/blob_db/blob_log_format.cc utilities/blob_db/blob_log_reader.cc utilities/blob_db/blob_log_writer.cc + utilities/blob_db/blob_log_format.cc utilities/checkpoint/checkpoint_impl.cc utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc - utilities/convenience/info_log_finder.cc utilities/debug.cc utilities/env_mirror.cc utilities/env_timed.cc @@ -361,9 +385,11 @@ set(ROCKSDB_SOURCES utilities/merge_operators/bytesxor.cc utilities/merge_operators/max.cc utilities/merge_operators/put.cc - utilities/merge_operators/string_append/stringappend2.cc + utilities/merge_operators/sortlist.cc utilities/merge_operators/string_append/stringappend.cc + utilities/merge_operators/string_append/stringappend2.cc utilities/merge_operators/uint64add.cc + utilities/object_registry.cc utilities/option_change_migration/option_change_migration.cc utilities/options/options_util.cc utilities/persistent_cache/block_cache_tier.cc @@ -371,11 +397,12 @@ set(ROCKSDB_SOURCES utilities/persistent_cache/block_cache_tier_metadata.cc utilities/persistent_cache/persistent_cache_tier.cc utilities/persistent_cache/volatile_tier_impl.cc + utilities/simulator_cache/cache_simulator.cc utilities/simulator_cache/sim_cache.cc utilities/table_properties_collectors/compact_on_deletion_collector.cc utilities/trace/file_trace_reader_writer.cc - utilities/transactions/optimistic_transaction.cc utilities/transactions/optimistic_transaction_db_impl.cc + utilities/transactions/optimistic_transaction.cc utilities/transactions/pessimistic_transaction.cc utilities/transactions/pessimistic_transaction_db.cc utilities/transactions/snapshot_checker.cc @@ -390,15 +417,6 @@ set(ROCKSDB_SOURCES utilities/ttl/db_ttl_impl.cc utilities/write_batch_with_index/write_batch_with_index.cc utilities/write_batch_with_index/write_batch_with_index_internal.cc - util/murmurhash.cc - util/random.cc - util/rate_limiter.cc - util/slice.cc - util/status.cc - util/string_util.cc - util/thread_local.cc - util/threadpool_imp.cc - util/xxhash.cc ) @@ -415,7 +433,8 @@ else() list(APPEND ROCKSDB_SOURCES port/port_posix.cc env/env_posix.cc - env/io_posix.cc) + env/io_posix.cc + env/fs_posix.cc) # ppc64 or ppc64le if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64") enable_language(ASM) diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc index 9f470ea2fef..45ae89c1bd4 100644 --- a/storage/rocksdb/rdb_sst_info.cc +++ b/storage/rocksdb/rdb_sst_info.cc @@ -510,7 +510,7 @@ void Rdb_sst_info::set_error_msg(const std::string &sst_file_name, void Rdb_sst_info::report_error_msg(const rocksdb::Status &s, const char *sst_file_name) { if (s.IsInvalidArgument() && - strcmp(s.getState(), "Keys must be added in order") == 0) { + strcmp(s.getState(), "Keys must be added in strict ascending order.") == 0) { my_printf_error(ER_KEYS_OUT_OF_ORDER, "Rows must be inserted in primary key order " "during bulk load operation", diff --git a/storage/rocksdb/rocksdb b/storage/rocksdb/rocksdb -Subproject e731f4402258554812c46334dc0d9483e6cc769 +Subproject bba5e7bc21093d7cfa765e1280a7c4fdcd28428 diff --git a/storage/rocksdb/ut0counter.h b/storage/rocksdb/ut0counter.h index cfa474e7a99..3a7ee85d01c 100644 --- a/storage/rocksdb/ut0counter.h +++ b/storage/rocksdb/ut0counter.h @@ -23,7 +23,7 @@ Created 2012/04/12 by Sunny Bains #include <string.h> /** CPU cache line size */ -#define CACHE_LINE_SIZE 64 +#define UT_CACHE_LINE_SIZE 64 /** Default number of slots to use in ib_counter_t */ #define IB_N_SLOTS 64 @@ -43,7 +43,7 @@ struct generic_indexer_t { /** @return offset within m_counter */ size_t offset(size_t index) const { - return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type))); + return(((index % N) + 1) * (UT_CACHE_LINE_SIZE / sizeof(Type))); } }; @@ -90,7 +90,7 @@ struct single_indexer_t { /** @return offset within m_counter */ size_t offset(size_t index) const { DBUG_ASSERT(N == 1); - return((CACHE_LINE_SIZE / sizeof(Type))); + return((UT_CACHE_LINE_SIZE / sizeof(Type))); } /* @return 1 */ @@ -103,7 +103,7 @@ struct single_indexer_t { /** Class for using fuzzy counters. The counter is not protected by any mutex and the results are not guaranteed to be 100% accurate but close enough. Creates an array of counters and separates each element by the -CACHE_LINE_SIZE bytes */ +UT_CACHE_LINE_SIZE bytes */ template < typename Type, int N = IB_N_SLOTS, @@ -119,7 +119,7 @@ public: bool validate() { #ifdef UNIV_DEBUG - size_t n = (CACHE_LINE_SIZE / sizeof(Type)); + size_t n = (UT_CACHE_LINE_SIZE / sizeof(Type)); /* Check that we aren't writing outside our defined bounds. */ for (size_t i = 0; i < UT_ARRAY_SIZE(m_counter); i += n) { @@ -197,7 +197,7 @@ private: Indexer<Type, N>m_policy; /** Slot 0 is unused. */ - Type m_counter[(N + 1) * (CACHE_LINE_SIZE / sizeof(Type))]; + Type m_counter[(N + 1) * (UT_CACHE_LINE_SIZE / sizeof(Type))]; }; #endif /* UT0COUNTER_H */ diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index fe0ddd1d736..9d530ca1adb 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -1,5 +1,5 @@ /* Copyright (C) 2008-2019 Kentoku Shiba - Copyright (C) 2019 MariaDB corp + 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 |