summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-03-30 14:50:23 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-03-30 14:50:23 +0300
commite2f1f88fa60680cb87833a7cceb172f5d436a804 (patch)
tree5e48f8ed5c7a169af6692c72de9f1007af48737e
parent9eae063e79376fd71586e1106e750a366467a984 (diff)
parentb092d35f13ceae37cda26478635b127f9b401e2c (diff)
downloadmariadb-git-e2f1f88fa60680cb87833a7cceb172f5d436a804.tar.gz
Merge 10.3 into 10.4
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/my_pthread.h4
-rw-r--r--include/span.h141
-rw-r--r--mysql-test/include/io_thd_fault_injection.inc9
-rw-r--r--mysql-test/main/derived_cond_pushdown.result97
-rw-r--r--mysql-test/main/derived_cond_pushdown.test67
-rw-r--r--mysql-test/main/group_by.result15
-rw-r--r--mysql-test/main/group_by.test19
-rw-r--r--mysql-test/main/innodb_mysql_lock.result1
-rw-r--r--mysql-test/main/innodb_mysql_lock.test9
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_binlog_errors.result70
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_corruption.result24
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result18
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test18
-rw-r--r--mysql-test/suite/innodb/r/corrupted_during_recovery.result16
-rw-r--r--mysql-test/suite/innodb/r/instant_alter,4k.rdiff66
-rw-r--r--mysql-test/suite/innodb/r/instant_alter.result119
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.test28
-rw-r--r--mysql-test/suite/innodb/t/instant_alter.test44
-rw-r--r--mysql-test/suite/parts/r/partition_alter_instant.result34
-rw-r--r--mysql-test/suite/parts/t/partition_alter_instant.test43
-rw-r--r--mysql-test/suite/rpl/disabled.def2
-rw-r--r--mysql-test/suite/rpl/include/rpl_binlog_errors.inc42
-rw-r--r--mysql-test/suite/rpl/include/rpl_corruption.inc24
-rw-r--r--mysql-test/suite/rpl/include/rpl_get_master_version_and_clock.test6
-rw-r--r--mysql-test/suite/rpl/include/rpl_stop_middle_group.test12
-rw-r--r--mysql-test/suite/rpl/r/circular_serverid0.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_errors.result70
-rw-r--r--mysql-test/suite/rpl/r/rpl_corruption.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_strict.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_corruption.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result12
-rw-r--r--mysql-test/suite/rpl/t/circular_serverid0.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug41902-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_strict.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_corruption.test14
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_instant_alter_column_allowed_basic.result49
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result12
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test34
-rw-r--r--sql/ha_partition.cc53
-rw-r--r--sql/item.cc50
-rw-r--r--sql/item_row.cc13
-rw-r--r--sql/opt_split.cc2
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_class.cc3
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/sql_select.h5
-rw-r--r--sql/sql_show.cc7
-rw-r--r--sql/sql_string.h6
-rw-r--r--sql/sql_table.cc12
-rw-r--r--storage/connect/jdbconn.cpp1
-rw-r--r--storage/connect/tabrest.cpp3
-rw-r--r--storage/connect/tabrest.h5
-rw-r--r--storage/innobase/buf/buf0buf.cc143
-rw-r--r--storage/innobase/buf/buf0dblwr.cc8
-rw-r--r--storage/innobase/handler/ha_innodb.cc30
-rw-r--r--storage/innobase/handler/handler0alter.cc34
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc11
-rw-r--r--storage/innobase/include/btr0types.h6
-rw-r--r--storage/innobase/include/buf0buf.h35
-rw-r--r--storage/innobase/include/buf0types.h8
-rw-r--r--storage/innobase/include/data0data.h6
-rw-r--r--storage/innobase/include/fil0fil.h2
-rw-r--r--storage/innobase/include/log0recv.h18
-rw-r--r--storage/innobase/include/page0zip.h2
-rw-r--r--storage/innobase/include/row0ins.h71
-rw-r--r--storage/innobase/include/row0types.h8
-rw-r--r--storage/innobase/include/span.h145
-rw-r--r--storage/innobase/log/log0recv.cc170
-rw-r--r--storage/innobase/page/page0zip.cc18
-rw-r--r--storage/innobase/que/que0que.cc4
-rw-r--r--storage/innobase/row/row0import.cc5
-rw-r--r--storage/innobase/row/row0ins.cc69
-rw-r--r--storage/innobase/row/row0mysql.cc2
-rw-r--r--storage/innobase/trx/trx0rec.cc6
-rw-r--r--storage/rocksdb/build_rocksdb.cmake89
-rw-r--r--storage/rocksdb/rdb_sst_info.cc2
m---------storage/rocksdb/rocksdb0
-rw-r--r--storage/rocksdb/ut0counter.h12
-rw-r--r--storage/spider/spd_conn.cc2
85 files changed, 1553 insertions, 796 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59444ffd1c8..566d6d58d43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,7 +222,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 1b35d0fdd0d..eeee0c387cb 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
@@ -705,7 +705,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 7dea6a81e04..8bd25a43f3c 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -10578,6 +10578,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
@@ -16912,6 +16924,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 d5d987b9d6d..ecd115c2dd0 100644
--- a/mysql-test/main/group_by.result
+++ b/mysql-test/main/group_by.result
@@ -2870,6 +2870,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
#
@@ -2880,3 +2894,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 fdebe058043..3dc0ee9f00b 100644
--- a/mysql-test/main/group_by.test
+++ b/mysql-test/main/group_by.test
@@ -1983,6 +1983,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 #
@@ -1991,3 +2008,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 ffc821b6ecc..e3e5ee6857c 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;
@@ -209,8 +209,8 @@ DROP TABLE t1, t2;
# on table with virtual columns and indexes
#
InnoDB 0 transactions not purged
-set @saved_dbug= @@global.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
+SET @saved_dbug= @@GLOBAL.debug_dbug;
+set global debug_dbug= "d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
@@ -219,7 +219,7 @@ insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released";
-set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
+set global debug_dbug= @saved_dbug;
drop table t1;
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
create table t1 (
@@ -255,7 +255,7 @@ SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open "
"SIGNAL purge_open "
"WAIT_FOR select_open";
SET @saved_dbug= @@GLOBAL.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_index_callback";
+set global debug_dbug= "d,ib_purge_virtual_index_callback";
connect purge_waiter,localhost,root;
SET debug_sync= "now WAIT_FOR before_row_allocated";
connection default;
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 a384e0667de..69b784d497a 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);
@@ -266,8 +266,8 @@ DROP TABLE t1, t2;
--source suite/innodb/include/wait_all_purged.inc
--let $datadir= `select @@datadir`
-set @saved_dbug= @@global.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
+SET @saved_dbug= @@GLOBAL.debug_dbug;
+set global debug_dbug= "d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
@@ -280,7 +280,7 @@ select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released";
-set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
+set global debug_dbug= @saved_dbug;
drop table t1;
--remove_file $datadir/test/load.data
@@ -338,7 +338,7 @@ SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open "
# In 10.2 trx_undo_roll_ptr_is_insert(t_roll_ptr) condition never pass in purge,
# so this condition is forced to pass in row_vers_old_has_index_entry
SET @saved_dbug= @@GLOBAL.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_index_callback";
+set global debug_dbug= "d,ib_purge_virtual_index_callback";
# The purge starts from REPLACE command. To avoid possible race, separate
# connection is used.
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 ca93b1d6519..7a6774a0e10 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
--199
-+201
+-205
++207
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 5780849d279..3ce1a2d8ccf 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;
@@ -1406,6 +1446,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;
@@ -2286,6 +2364,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;
@@ -2700,8 +2816,9 @@ SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-199
+205
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 8473984afba..8bbeb7fe94d 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;
@@ -838,6 +881,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 f91c01c285a..41db90a4464 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -1137,6 +1137,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 d65a4963905..af60ca68c82 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -10071,7 +10071,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();
@@ -10098,33 +10099,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 9b721266e9d..0d5c39086a6 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, 2019, 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
@@ -2559,42 +2559,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 150d57263b6..a363f9b5576 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
@@ -165,16 +166,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/opt_split.cc b/sql/opt_split.cc
index 6f8248c315c..c70fac49930 100644
--- a/sql/opt_split.cc
+++ b/sql/opt_split.cc
@@ -968,7 +968,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 fcb4777b189..7fb68d2dfb5 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, 2017, 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 22690c7e432..2a805605faa 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, 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
@@ -608,6 +608,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
m_current_stage_key(0),
in_sub_stmt(0), log_all_errors(0),
binlog_unsafe_warning_flags(0),
+ current_stmt_binlog_format(BINLOG_FORMAT_MIXED),
binlog_table_maps(0),
bulk_param(0),
table_map_for_update(0),
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 6bf43d3df5e..643b7ee898a 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_parse.cc b/sql/sql_parse.cc
index ffba46b4573..e5b9f74c5f3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, 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 99feb1006fb..539d8362050 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2958,8 +2958,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 b9043a851e7..d41fc3317a3 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
@@ -1665,6 +1665,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 409574d4686..46d4685e0db 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -8765,7 +8765,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;
@@ -8800,11 +8799,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 aad5314a973..7d7d9f08748 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -3,7 +3,7 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, 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
@@ -79,6 +79,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 619c3fe2654..f46a7da09f5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2010, 2019, MariaDB
+ Copyright (c) 2010, 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
@@ -4392,8 +4392,14 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len,
uint err_code, const char *name)
{
DBUG_ENTER("validate_comment_length");
- size_t tmp_len= my_charpos(system_charset_info, comment->str,
- comment->str + comment->length, max_len);
+ if (comment->length == 0)
+ DBUG_RETURN(false);
+
+ if (max_len > comment->length)
+ max_len= comment->length;
+
+ size_t tmp_len=
+ Well_formed_prefix(system_charset_info, comment->str, max_len).length();
if (tmp_len < comment->length)
{
if (thd->is_strict_mode())
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index 2cb75e0adc1..2dab385a36f 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -766,7 +766,6 @@ void JDBConn::AddJars(PSTRG jpop, char sep)
/***********************************************************************/
bool JDBConn::Connect(PJPARM sop)
{
- int irc = RC_FX;
bool err = false;
jint rc;
jboolean jt = (trace(1));
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index 9c6b724973f..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, "."), slash), db), 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 9cf2d10a6b8..f08ac7984c9 100644
--- a/storage/connect/tabrest.h
+++ b/storage/connect/tabrest.h
@@ -5,10 +5,7 @@
/***********************************************************************/
#pragma once
-#if defined(__WIN__)
-static PCSZ slash = "\\";
-#else // !__WIN__
-static PCSZ slash = "/";
+#ifndef __WIN__
#define stricmp strcasecmp
#endif // !__WIN__
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 94fef62099d..d261465066e 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -75,6 +75,8 @@ Created 11/5/1995 Heikki Tuuri
#include "lzo/lzo1x.h"
#endif
+using st_::span;
+
#ifdef HAVE_LIBNUMA
#include <numa.h>
#include <numaif.h>
@@ -457,7 +459,7 @@ buf_pool_register_chunk(
@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;
}
@@ -964,20 +966,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.
@@ -1006,7 +1002,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;
}
@@ -1095,8 +1091,9 @@ buf_page_is_corrupted(
compile_time_assert(!(FIL_PAGE_LSN % 8));
/* 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
@@ -4209,7 +4206,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;
+}
+
+/** 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
@@ -4222,7 +4257,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@param[out] err DB_SUCCESS or error code
@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,
@@ -4868,35 +4903,7 @@ evict_from_pool:
return NULL;
}
- 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(mtr, fix_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) {
/* In the case of a first access, try to apply linear
@@ -4911,6 +4918,43 @@ evict_from_pool:
return(fix_block);
}
+/** This is the general function used to get access to a database page.
+It does page initialization and applies the buffered redo logs.
+@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
+@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)
+{
+ if (buf_block_t *block= recv_recovery_create_page(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);
+}
+
/********************************************************************//**
This is the general function used to get optimistic access to a database
page.
@@ -5927,7 +5971,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 00d6c1f9ded..f9b5b30c364 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;
@@ -577,7 +579,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. */
@@ -600,8 +602,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 7c06171d413..c8c9b92f727 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -198,9 +198,6 @@ static char* innodb_large_prefix;
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_use_checksums;
static my_bool innobase_locks_unsafe_for_binlog;
@@ -224,6 +221,9 @@ my_bool innodb_evict_tables_on_commit_debug;
extern my_bool srv_scrub_force_testing;
#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 {
@@ -457,6 +457,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
@@ -18899,6 +18915,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",
@@ -19015,6 +19037,7 @@ static MYSQL_SYSVAR_ENUM(flush_method, innodb_flush_method,
static MYSQL_SYSVAR_STR(file_format, innodb_file_format,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Deprecated parameter with no effect.", NULL, NULL, NULL);
+
static MYSQL_SYSVAR_STR(large_prefix, innodb_large_prefix,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Deprecated parameter with no effect.", NULL, NULL, NULL);
@@ -20181,6 +20204,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 4200e87fa7f..9b5b4d6e566 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -59,6 +59,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 "
@@ -1998,6 +2000,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)) {
@@ -2488,6 +2521,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 642ba94d9dc..a0fe5306e65 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, 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
@@ -28,6 +28,8 @@ Created 7/19/1997 Heikki Tuuri
#include "sync0sync.h"
#include "btr0sea.h"
+using st_::span;
+
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
my_bool srv_ibuf_disable_background_merge;
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
@@ -4896,7 +4898,8 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
bitmap_page = ibuf_bitmap_get_map_page(
page_id_t(space->id, page_no), zip_size, &mtr);
- if (buf_page_is_zeroes(bitmap_page, physical_size)) {
+ if (buf_is_zeroes(span<const byte>(bitmap_page,
+ physical_size))) {
/* This means we got all-zero page instead of
ibuf bitmap page. The subsequent page should be
all-zero pages. */
@@ -4908,7 +4911,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 a6119e38dfd..93cf3742c88 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"
@@ -431,6 +432,7 @@ the same set of mutexes or latches.
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.
+It does page initialization and applies the buffered redo logs.
@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
@@ -454,6 +456,30 @@ buf_page_get_gen(
mtr_t* mtr,
dberr_t* err);
+/** 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
+@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);
+
/** 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 =>
@@ -616,11 +642,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 969edfe2374..5532a524782 100644
--- a/storage/innobase/include/buf0types.h
+++ b/storage/innobase/include/buf0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -211,6 +211,12 @@ private:
const page_id_t page_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 76f87dd6e4c..a24b2a43fda 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -971,7 +971,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 19f213db58b..21ddd2b0388 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -336,4 +336,22 @@ times! */
roll-forward */
#define RECV_SCAN_SIZE (4U << srv_page_size_shift)
+/** This is a low level function for the recovery system
+to create a page which has buffered intialized redo log records.
+@param[in] page_id page to be created using redo logs
+@return whether the page creation successfully */
+buf_block_t* recv_recovery_create_page_low(const page_id_t page_id);
+
+/** Recovery system creates a page which has buffered intialized
+redo log records.
+@param[in] page_id page to be created using redo logs
+@return block which contains page was initialized */
+inline buf_block_t* recv_recovery_create_page(const page_id_t page_id)
+{
+ if (UNIV_LIKELY(!recv_recovery_on))
+ return NULL;
+
+ return recv_recovery_create_page_low(page_id);
+}
+
#endif
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index 1637ea00330..2f11a1c77f3 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -497,7 +497,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 5f1e46c6a4d..048b161b884 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;
@@ -146,5 +146,3 @@ public:
return first_use;
}
};
-
-#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/log0recv.cc b/storage/innobase/log/log0recv.cc
index 106d7e0d49d..1c96a43715b 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -308,7 +308,7 @@ public:
if (!i.second.created) {
continue;
}
- if (buf_block_t* block = buf_page_get_gen(
+ if (buf_block_t* block = buf_page_get_low(
i.first, 0, RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr, NULL)) {
@@ -2177,6 +2177,96 @@ static void recv_read_in_area(const page_id_t page_id)
mutex_enter(&recv_sys.mutex);
}
+/** This is another low level function for the recovery system
+to create a page which has buffered page intialization redo log records.
+@param[in] page_id page to be created using redo logs
+@param[in,out] recv_addr Hashed redo logs for the given page id
+@return whether the page creation successfully */
+static buf_block_t* recv_recovery_create_page_low(const page_id_t page_id,
+ recv_addr_t* recv_addr)
+{
+ mtr_t mtr;
+ mlog_init_t::init &i= mlog_init.last(page_id);
+ const lsn_t end_lsn= UT_LIST_GET_LAST(recv_addr->rec_list)->end_lsn;
+
+ if (end_lsn < i.lsn)
+ {
+ DBUG_LOG("ib_log", "skip log for page "
+ << page_id
+ << " LSN " << end_lsn
+ << " < " << i.lsn);
+ recv_addr->state= RECV_PROCESSED;
+ignore:
+ ut_a(recv_sys.n_addrs);
+ recv_sys.n_addrs--;
+ return NULL;
+ }
+
+ fil_space_t *space= fil_space_acquire_for_io(recv_addr->space);
+ if (!space)
+ {
+ recv_addr->state= RECV_PROCESSED;
+ goto ignore;
+ }
+
+ if (space->enable_lsn)
+ {
+init_fail:
+ space->release_for_io();
+ recv_addr->state= RECV_NOT_PROCESSED;
+ return NULL;
+ }
+
+ /* Determine if a tablespace could be for an internal table
+ for FULLTEXT INDEX. For those tables, no MLOG_INDEX_LOAD record
+ used to be written when redo logging was disabled. Hence, we
+ cannot optimize away page reads, because all the redo
+ log records for initializing and modifying the page in the
+ past could be older than the page in the data file.
+
+ The check is too broad, causing all
+ tables whose names start with FTS_ to skip the optimization. */
+
+ if (strstr(space->name, "/FTS_"))
+ goto init_fail;
+
+ mtr.start();
+ mtr.set_log_mode(MTR_LOG_NONE);
+ buf_block_t *block= buf_page_create(page_id, space->zip_size(), &mtr);
+ if (recv_addr->state == RECV_PROCESSED)
+ /* The page happened to exist in the buffer pool, or it was
+ just being read in. Before buf_page_get_with_no_latch() returned,
+ all changes must have been applied to the page already. */
+ mtr.commit();
+ else
+ {
+ i.created= true;
+ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
+ mtr.x_latch_at_savepoint(0, block);
+ recv_recover_page(block, mtr, recv_addr, &i);
+ ut_ad(mtr.has_committed());
+ }
+
+ space->release_for_io();
+ return block;
+}
+
+/** This is a low level function for the recovery system
+to create a page which has buffered intialized redo log records.
+@param[in] page_id page to be created using redo logs
+@return whether the page creation successfully */
+buf_block_t* recv_recovery_create_page_low(const page_id_t page_id)
+{
+ buf_block_t* block= nullptr;
+ mutex_enter(&recv_sys.mutex);
+ recv_addr_t* recv_addr= recv_get_fil_addr_struct(page_id.space(),
+ page_id.page_no());
+ if (recv_addr && recv_addr->state == RECV_WILL_NOT_READ)
+ block= recv_recovery_create_page_low(page_id, recv_addr);
+ mutex_exit(&recv_sys.mutex);
+ return block;
+}
+
/** Apply the hash table of stored log records to persistent data pages.
@param[in] last_batch whether the change buffer merge will be
performed as part of the operation */
@@ -2272,7 +2362,7 @@ ignore:
apply:
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
- if (buf_block_t* block = buf_page_get_gen(
+ if (buf_block_t* block = buf_page_get_low(
page_id, 0, RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &mtr, NULL)) {
@@ -2285,79 +2375,9 @@ apply:
mtr.commit();
recv_read_in_area(page_id);
}
- } else {
- mlog_init_t::init& i = mlog_init.last(page_id);
- const lsn_t end_lsn = UT_LIST_GET_LAST(
- recv_addr->rec_list)->end_lsn;
-
- if (end_lsn < i.lsn) {
- DBUG_LOG("ib_log", "skip log for page "
- << page_id
- << " LSN " << end_lsn
- << " < " << i.lsn);
-skip:
- recv_addr->state = RECV_PROCESSED;
- goto ignore;
- }
-
- fil_space_t* space = fil_space_acquire_for_io(
- recv_addr->space);
- if (!space) {
- goto skip;
- }
-
- if (space->enable_lsn) {
-do_read:
- space->release_for_io();
- recv_addr->state = RECV_NOT_PROCESSED;
- goto apply;
- }
-
- /* Determine if a tablespace could be
- for an internal table for FULLTEXT INDEX.
- For those tables, no MLOG_INDEX_LOAD record
- used to be written when redo logging was
- disabled. Hence, we cannot optimize
- away page reads when crash-upgrading
- from MariaDB versions before 10.4,
- because all the redo log records for
- initializing and modifying the page in
- the past could be older than the page
- in the data file.
-
- The check is too broad, causing all
- tables whose names start with FTS_ to
- skip the optimization. */
- if ((log_sys.log.format
- & ~log_t::FORMAT_ENCRYPTED)
- != log_t::FORMAT_10_4
- && strstr(space->name, "/FTS_")) {
- goto do_read;
- }
-
- mtr.start();
- mtr.set_log_mode(MTR_LOG_NONE);
- buf_block_t* block = buf_page_create(
- page_id, space->zip_size(), &mtr);
- if (recv_addr->state == RECV_PROCESSED) {
- /* The page happened to exist
- in the buffer pool, or it was
- just being read in. Before
- buf_page_get_with_no_latch()
- returned, all changes must have
- been applied to the page already. */
- mtr.commit();
- } else {
- i.created = true;
- buf_block_dbg_add_level(
- block, SYNC_NO_ORDER_CHECK);
- mtr.x_latch_at_savepoint(0, block);
- recv_recover_page(block, mtr,
- recv_addr, &i);
- ut_ad(mtr.has_committed());
- }
-
- space->release_for_io();
+ } else if (!recv_recovery_create_page_low(
+ page_id, recv_addr)) {
+ goto apply;
}
}
}
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index ade9350dfa0..727e6c21653 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -31,14 +31,17 @@ 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
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"
@@ -4992,7 +4995,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);
@@ -5001,17 +5004,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 6e4bce86df8..3f4810dcc0e 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 ba48103137a..5bc69c282e1 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 */
@@ -3454,7 +3456,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 735bd4517a1..1bde1199906 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;
@@ -3516,16 +3484,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");
@@ -3643,7 +3611,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) {
@@ -3669,20 +3638,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;
@@ -3738,14 +3703,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 6e6c1abb3a8..65e34b317c3 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 1ff18a2a7eb..e612a9f577b 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 5e5fa0eda52..03afdfd68f8 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