revision-id: b04c6d9fbdf4fb0da5c2729193a00306dae26853 (mariadb-10.3.7-180-gb04c6d9)
parent(s): 87609324e0eeb8f00810604e570a3b2b0b45d1a4
author: Igor Babaev
committer: Igor Babaev
timestamp: 2018-09-15 14:28:19 -0700
message:
MDEV-16917 Index affects query results
The optimizer erroneously allowed to use join cache when joining a
splittable materialized table together with splitting optimization.
As a consequence in some rare cases the server returned wrong result
sets for queries with materialized derived.
This patch allows to use either join cache without usage of splitting
technique for materialization of a splittable derived table or splitting
without usage of join cache when joining such table. The costs the these
alternatives are compared and the best variant is chosen.
---
mysql-test/main/derived_split_innodb.result | 26 ++++++++++++++++++++++++++
mysql-test/main/derived_split_innodb.test | 26 ++++++++++++++++++++++++++
sql/opt_split.cc | 7 +++++++
sql/sql_select.cc | 7 ++++++-
sql/table.h | 1 +
5 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result
new file mode 100644
index 0000000..6fa20b7
--- /dev/null
+++ b/mysql-test/main/derived_split_innodb.result
@@ -0,0 +1,26 @@
+#
+# MDEV-16917: do not use splitting for derived with join cache
+#
+CREATE TABLE t1 (
+n1 int(10) NOT NULL,
+n2 int(10) NOT NULL,
+c1 char(1) NOT NULL,
+KEY c1 (c1),
+KEY n1_c1_n2 (n1,c1,n2)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0, 2, 'a'), (1, 3, 'a');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t
+WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index c1,n1_c1_n2 n1_c1_n2 9 NULL 2 Using where; Using index
+1 PRIMARY <derived2> ref key0 key0 8 test.t1.n1,test.t1.n2 2
+2 LATERAL DERIVED t1 ref c1,n1_c1_n2 n1_c1_n2 4 test.t1.n1 1 Using where; Using index
+SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t
+WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1;
+n1
+0
+1
+DROP TABLE t1;
diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test
new file mode 100644
index 0000000..2abd6fa
--- /dev/null
+++ b/mysql-test/main/derived_split_innodb.test
@@ -0,0 +1,26 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-16917: do not use splitting for derived with join cache
+--echo #
+
+CREATE TABLE t1 (
+ n1 int(10) NOT NULL,
+ n2 int(10) NOT NULL,
+ c1 char(1) NOT NULL,
+ KEY c1 (c1),
+ KEY n1_c1_n2 (n1,c1,n2)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0, 2, 'a'), (1, 3, 'a');
+
+ANALYZE TABLE t1;
+
+Let $q=
+SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t
+ WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1;
+
+eval EXPLAIN $q;
+eval $q;
+
+DROP TABLE t1;
+
diff --git a/sql/opt_split.cc b/sql/opt_split.cc
index 611e703..c5e31ba 100644
--- a/sql/opt_split.cc
+++ b/sql/opt_split.cc
@@ -267,6 +267,13 @@ void TABLE::deny_splitting()
}
+double TABLE::get_materialization_cost()
+{
+ DBUG_ASSERT(spl_opt_info != NULL);
+ return spl_opt_info->unsplit_cost;
+}
+
+
/* This structure is auxiliary and used only in the function that follows it */
struct SplM_field_ext_info: public SplM_field_info
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 7ff29bb..e97ea68 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7254,7 +7254,11 @@ best_access_path(JOIN *join,
}
}
- tmp += s->startup_cost;
+ /* Splitting technique cannot be used with join cache */
+ if (s->table->is_splittable())
+ tmp+= s->table->get_materialization_cost();
+ else
+ tmp+= s->startup_cost;
/*
We estimate the cost of evaluating WHERE clause for found records
as record_count * rnd_records / TIME_FOR_COMPARE. This cost plus
@@ -7276,6 +7280,7 @@ best_access_path(JOIN *join,
best_ref_depends_map= 0;
best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map &
join->outer_join)));
+ spl_plan= 0;
}
}
diff --git a/sql/table.h b/sql/table.h
index 80f5e12..a14a82e 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1507,6 +1507,7 @@ struct TABLE
bool is_splittable() { return spl_opt_info != NULL; }
void set_spl_opt_info(SplM_opt_info *spl_info);
void deny_splitting();
+ double get_materialization_cost(); // Now used only if is_splittable()==true
void add_splitting_info_for_key_field(struct KEY_FIELD *key_field);
/**
1
0
14 Sep '18
revision-id: d3a8b5aa9cee24a6397662e30df2e915f45460e0 (mariadb-10.1.35-58-gd3a8b5aa9ce)
parent(s): c886368a3ad89cc87eaf66344837d59afa49db7e
author: Jan Lindström
committer: Jan Lindström
timestamp: 2018-09-14 13:10:48 +0300
message:
MDEV-14143: galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0"
Add supression.
---
mysql-test/suite/galera/disabled.def | 1 -
mysql-test/suite/galera/r/galera_kill_largechanges.result | 1 +
mysql-test/suite/galera/r/galera_kill_smallchanges.result | 1 +
mysql-test/suite/galera/t/galera_kill_largechanges.test | 2 ++
mysql-test/suite/galera/t/galera_kill_smallchanges.test | 2 ++
5 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 35e1e59a92c..52bfbb65432 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -38,6 +38,5 @@ galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot
galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node
partition : MDEV-13881 galera.partition failed in buildbot with wrong result
galera_transaction_read_only : MDEV-14142 galera.galera_transaction_read_only fails in buildbot with wrong result
-galera_kill_smallchanges : MDEV-14143 galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0"
galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion
diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result
index a37056ad9b0..4eb5271fadf 100644
--- a/mysql-test/suite/galera/r/galera_kill_largechanges.result
+++ b/mysql-test/suite/galera/r/galera_kill_largechanges.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
diff --git a/mysql-test/suite/galera/r/galera_kill_smallchanges.result b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
index 8409740a035..863b49dd51b 100644
--- a/mysql-test/suite/galera/r/galera_kill_smallchanges.result
+++ b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
Killing server ...
diff --git a/mysql-test/suite/galera/t/galera_kill_largechanges.test b/mysql-test/suite/galera/t/galera_kill_largechanges.test
index e9a32ce813b..2803a43d85a 100644
--- a/mysql-test/suite/galera/t/galera_kill_largechanges.test
+++ b/mysql-test/suite/galera/t/galera_kill_largechanges.test
@@ -6,6 +6,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
+
--connection node_1
# Enable the master to continue running during the split-brain situation that
# occurs when the slave is killed
diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test
index d998032cbc3..148c3dbc132 100644
--- a/mysql-test/suite/galera/t/galera_kill_smallchanges.test
+++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test
@@ -5,6 +5,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
+
--connection node_1
# Enable the master to continue running during the split-brain situation that
1
0
[Commits] c886368a3ad: Test galera_sst_rsync_data_dir has different result on release
by jan 14 Sep '18
by jan 14 Sep '18
14 Sep '18
revision-id: c886368a3ad89cc87eaf66344837d59afa49db7e (mariadb-10.1.35-57-gc886368a3ad)
parent(s): ed7a0e5efc52177fa23213a1e9ef685fc5cb27f8
author: Jan Lindström
committer: Jan Lindström
timestamp: 2018-09-14 11:16:54 +0300
message:
Test galera_sst_rsync_data_dir has different result on release
and debug builds. Modified version for 10.1 from following commit:
commit 8e68876477eaec7944baa0b63ef26e551693c4f8
Author: Oleksandr Byelkin <sanja(a)mariadb.com>
Date: Thu Sep 13 15:06:44 2018 +0200
Fix of the test which has debug version
---
.../galera/r/galera_sst_rsync_data_dir,debug.rdiff | 103 +++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff
new file mode 100644
index 00000000000..5ab88117e89
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff
@@ -0,0 +1,103 @@
+--- r/galera_sst_rsync_data_dir.result 2018-09-11 12:38:42.027479411 +0300
++++ r/galera_sst_rsync_data_dir.reject 2018-09-14 11:11:09.592049414 +0300
+@@ -260,3 +260,100 @@
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++SET wsrep_sync_wait = 0;
++Killing server ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++Performing --wsrep-recover ...
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++ROLLBACK;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++SET AUTOCOMMIT=ON;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET AUTOCOMMIT=ON;
++SET GLOBAL debug_dbug = $debug_orig;
1
0
[Commits] f9e21062008: MDEV-13876: galera.MW-328A failed in buildbot with wrong result or timeout
by jan 14 Sep '18
by jan 14 Sep '18
14 Sep '18
revision-id: f9e21062008f0ec108342c66537779c2bdf9b6d7 (mariadb-10.1.35-55-gf9e21062008)
parent(s): c9d6728c36831ee4e1ba0b105652922faa4a3aee
author: Jan Lindström
committer: Jan Lindström
timestamp: 2018-09-14 10:35:37 +0300
message:
MDEV-13876: galera.MW-328A failed in buildbot with wrong result or timeout
Move MW-328[A,B,C] to big tests as there seem to be big variation
on their execution times and sometimes that could lead timeout.
---
mysql-test/suite/galera/disabled.def | 3 ---
mysql-test/suite/galera/t/MW-328A.test | 1 +
mysql-test/suite/galera/t/MW-328B.test | 1 +
mysql-test/suite/galera/t/MW-328C.test | 1 +
4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index c4aa0ad2a74..35e1e59a92c 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -35,12 +35,9 @@ galera_gc_fc_limit : MDEV-17061 Test failure on galera.galera_gc_fc_limit
galera_applier_ftwrl_table_after : MDEV-13738 galera_applier_ftwrl_table_alter may fail with '2006: MySQL server has gone away'
galra_unicode_identifiers: MDEV-13871 galera.galera_unicode_identifiers failed in buildbot with 'Unknown database'
galera_suspend_slave: MDEV-13873 galera.galera_suspend_slave failed in buildbot with wrong error code
-MW-328A : MDEV-13876 galera.MW-328A failed in buildbot with wrong result or timeout
galera_wan : MDEV-13879 galera.galera_wan fails in buildbot with Stray state UUID msg or with "Transport endpoint is not connected" or with a failure to start a node
partition : MDEV-13881 galera.partition failed in buildbot with wrong result
galera_transaction_read_only : MDEV-14142 galera.galera_transaction_read_only fails in buildbot with wrong result
galera_kill_smallchanges : MDEV-14143 galera.galera_kill_smallchanges, galera.galera_kill_ddl fail in buildbot with "Last Applied Action message in non-primary configuration from member 0"
-MW-328B : MDEV-14145 galera.MW-328B failed in buildbot with a timeout
-MW-328C : MDEV-14149 galera.MW-328A, galera.MW-328C failed with "Found wrong usage of mutex"
galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion
diff --git a/mysql-test/suite/galera/t/MW-328A.test b/mysql-test/suite/galera/t/MW-328A.test
index 4d6e1ea3625..09aad1bcf60 100644
--- a/mysql-test/suite/galera/t/MW-328A.test
+++ b/mysql-test/suite/galera/t/MW-328A.test
@@ -7,6 +7,7 @@
# a success was reported.
#
+--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source suite/galera/t/MW-328-header.inc
diff --git a/mysql-test/suite/galera/t/MW-328B.test b/mysql-test/suite/galera/t/MW-328B.test
index a7b4053ab0c..000b0d8a9ab 100644
--- a/mysql-test/suite/galera/t/MW-328B.test
+++ b/mysql-test/suite/galera/t/MW-328B.test
@@ -7,6 +7,7 @@
# gets the deadlock error
#
+--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source suite/galera/t/MW-328-header.inc
diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test
index b681e743ab3..72a8480923c 100644
--- a/mysql-test/suite/galera/t/MW-328C.test
+++ b/mysql-test/suite/galera/t/MW-328C.test
@@ -7,6 +7,7 @@
# masks all deadlock errors
#
+--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source suite/galera/t/MW-328-header.inc
1
0
revision-id: 28f08d3753eb10a1393a63e6c581d43aad9f93b9 (mariadb-10.2.16-136-g28f08d3753e)
parent(s): 38665893087e20c3ad65d5b0e227a75185a4865e f1bcfbb4373e40dda2c18c137f76fc6ff32e1a45
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-09-14 08:47:22 +0200
message:
Merge branch '10.1' into 10.2
config.h.cmake | 8 +-
extra/mariabackup/fil_cur.cc | 66 +-
include/my_atomic.h | 2 +-
include/my_global.h | 4 +-
include/my_service_manager.h | 2 +
include/mysql/service_wsrep.h | 3 +
include/service_versions.h | 2 +-
include/wsrep.h | 5 +
mysql-test/extra/binlog_tests/binlog.test | 1 -
mysql-test/extra/rpl_tests/rpl_foreign_key.test | 60 -
mysql-test/mysql-test-run.pl | 197 +-
mysql-test/r/flush.result | 24 +
mysql-test/r/gis.result | 16 +
mysql-test/r/group_min_max.result | 28 +
mysql-test/r/join.result | 6 +-
mysql-test/r/query_cache_innodb.result | 2 +-
mysql-test/r/selectivity.result | 48 +-
mysql-test/r/selectivity_innodb.result | 48 +-
mysql-test/r/sp.result | 17 +
mysql-test/r/stat_tables.result | 13 +
mysql-test/r/stat_tables_innodb.result | 13 +
mysql-test/suite/galera/disabled.def | 3 +
mysql-test/suite/galera/r/MW-336.result | 43 +-
mysql-test/suite/galera/r/MW-44.result | 21 +-
mysql-test/suite/galera/r/galera#505.result | 5 +
mysql-test/suite/galera/r/galera_defaults.result | 68 -
.../galera/r/galera_ist_innodb_flush_logs.result | 96 -
.../suite/galera/r/galera_ist_mysqldump.result | 109 +-
mysql-test/suite/galera/r/galera_ist_rsync.result | 108 -
.../suite/galera/r/galera_ist_xtrabackup-v2.result | 96 -
.../suite/galera/r/galera_sst_rsync2,debug.rdiff | 114 +
mysql-test/suite/galera/r/galera_sst_rsync2.result | 288 +
.../r/galera_sst_xtrabackup-v2_data_dir.result | 262 +
.../suite/galera/r/galera_var_slave_threads.result | 67 +-
mysql-test/suite/galera/r/mysql-wsrep#332.result | 111 +
mysql-test/suite/galera/suite.pm | 2 +
mysql-test/suite/galera/t/MW-336.test | 104 +-
mysql-test/suite/galera/t/MW-44.test | 18 +-
mysql-test/suite/galera/t/galera#505.test | 26 +
mysql-test/suite/galera/t/galera_defaults.test | 13 +-
.../suite/galera/t/galera_ist_mysqldump.test | 2 +
.../suite/galera/t/galera_ist_xtrabackup-v2.test | 5 +
mysql-test/suite/galera/t/galera_sst_rsync2.cnf | 15 +
mysql-test/suite/galera/t/galera_sst_rsync2.test | 12 +
.../galera/t/galera_sst_xtrabackup-v2_data_dir.cnf | 16 +
.../t/galera_sst_xtrabackup-v2_data_dir.test | 23 +
.../suite/galera/t/galera_var_slave_threads.test | 10 +
mysql-test/suite/galera/t/mysql-wsrep#332.test | 113 +
.../suite/galera_3nodes/r/galera_pc_weight.result | 31 +-
.../suite/galera_3nodes/t/galera_pc_weight.test | 55 +-
mysql-test/suite/innodb/r/foreign-keys.result | 73 +
mysql-test/suite/innodb/r/foreign_key.result | 19 +
mysql-test/suite/innodb/r/innodb-lock.result | 47 +-
mysql-test/suite/innodb/t/foreign-keys.test | 87 +
mysql-test/suite/innodb/t/foreign_key.test | 24 +
mysql-test/suite/innodb/t/innodb-lock.test | 74 +-
mysql-test/suite/maria/create.result | 33 +
mysql-test/suite/maria/create.test | 42 +
mysql-test/suite/maria/maria.result | 4 +
mysql-test/suite/maria/maria.test | 10 +
.../suite/rpl/r/rpl_foreign_key_innodb.result | 3 +-
mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test | 62 +-
.../sys_vars/r/wsrep_start_position_basic.result | 10 +-
.../sys_vars/t/wsrep_start_position_basic.test | 6 +-
.../suite/wsrep/include/check_galera_version.inc | 20 +-
mysql-test/suite/wsrep/r/variables.result | 56 +-
mysql-test/suite/wsrep/t/variables.test | 18 +-
mysql-test/t/flush.test | 32 +
mysql-test/t/gis.test | 15 +
mysql-test/t/group_min_max.test | 17 +
mysql-test/t/join.test | 3 +-
mysql-test/t/selectivity.test | 36 +
mysql-test/t/sp.test | 21 +
mysql-test/t/stat_tables.test | 12 +
scripts/galera_new_cluster.sh | 3 -
scripts/mysql_install_db.sh | 2 +-
scripts/wsrep_sst_common.sh | 11 +
scripts/wsrep_sst_rsync.sh | 42 +-
scripts/wsrep_sst_xtrabackup-v2.sh | 28 +-
sql/events.cc | 2 +
sql/field.cc | 17 +-
sql/handler.cc | 4 +-
sql/item.cc | 10 +-
sql/log.cc | 8 +-
sql/log_event.cc | 5 -
sql/mysqld.cc | 2 +-
sql/mysqld.h | 1 +
sql/opt_range.cc | 27 +-
sql/sql_alter.cc | 20 +-
sql/sql_base.cc | 160 +-
sql/sql_base.h | 6 +-
sql/sql_parse.cc | 2 +
sql/sql_plugin_services.ic | 3 +-
sql/sql_reload.cc | 13 +-
sql/sql_select.cc | 2 +-
sql/sql_statistics.cc | 3 +
sql/sql_statistics.h | 29 +-
sql/sql_table.cc | 64 +-
sql/sql_trigger.cc | 8 +-
sql/sql_truncate.cc | 2 +-
sql/table.cc | 7 +
sql/table.h | 25 +-
sql/table_cache.cc | 2 -
sql/wsrep_dummy.cc | 3 +
sql/wsrep_hton.cc | 9 +-
sql/wsrep_mysqld.cc | 295 +-
sql/wsrep_mysqld.h | 5 +-
sql/wsrep_sst.cc | 53 +-
sql/wsrep_sst.h | 1 +
sql/wsrep_var.cc | 4 +-
storage/connect/filamdbf.cpp | 4 +-
storage/connect/inihandl.cpp | 2 +-
storage/connect/javaconn.cpp | 2 +-
storage/innobase/btr/btr0scrub.cc | 2 +-
storage/innobase/handler/ha_innodb.cc | 6 +-
storage/innobase/include/univ.i | 4 +-
storage/maria/ma_blockrec.c | 18 +-
storage/maria/ma_norec.c | 4 +-
storage/mroonga/ha_mroonga.cpp | 9 +-
storage/mroonga/ha_mroonga.hpp | 4 -
storage/mroonga/vendor/groonga/lib/expr.c | 2 +-
storage/tokudb/CMakeLists.txt | 8 +-
storage/tokudb/PerconaFT/CMakeLists.txt | 8 +-
.../cmake_modules/TokuSetupCompiler.cmake | 3 +
.../tokudb/PerconaFT/ft/cachetable/cachetable.cc | 21 +-
.../tokudb/PerconaFT/ft/cachetable/cachetable.h | 8 +-
.../tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc | 3 -
storage/tokudb/PerconaFT/ft/ft-test-helpers.cc | 3 -
storage/tokudb/PerconaFT/ft/ft.h | 3 +
storage/tokudb/PerconaFT/ft/node.cc | 2 +
.../PerconaFT/ft/serialize/block_allocator.cc | 2 +-
.../tokudb/PerconaFT/ft/tests/cachetable-4357.cc | 4 -
.../tokudb/PerconaFT/ft/tests/cachetable-4365.cc | 4 -
.../tokudb/PerconaFT/ft/tests/cachetable-5097.cc | 6 +-
.../tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc | 7 +-
.../tokudb/PerconaFT/ft/tests/cachetable-5978.cc | 13 +-
.../PerconaFT/ft/tests/cachetable-all-write.cc | 5 +-
.../ft/tests/cachetable-checkpoint-pending.cc | 8 +-
.../ft/tests/cachetable-checkpoint-pinned-nodes.cc | 6 +-
.../ft/tests/cachetable-cleaner-checkpoint.cc | 5 +-
.../ft/tests/cachetable-cleaner-checkpoint2.cc | 5 +-
.../cachetable-cleaner-thread-attrs-accumulate.cc | 8 +-
.../cachetable-cleaner-thread-everything-pinned.cc | 5 +-
...etable-cleaner-thread-nothing-needs-flushing.cc | 5 +-
.../cachetable-cleaner-thread-same-fullhash.cc | 7 +-
.../ft/tests/cachetable-cleaner-thread-simple.cc | 7 +-
.../ft/tests/cachetable-clock-eviction.cc | 9 +-
.../ft/tests/cachetable-clock-eviction2.cc | 9 +-
.../ft/tests/cachetable-clock-eviction3.cc | 9 +-
.../ft/tests/cachetable-clock-eviction4.cc | 9 +-
.../ft/tests/cachetable-clone-checkpoint.cc | 5 +-
.../cachetable-clone-partial-fetch-pinned-node.cc | 7 +-
.../ft/tests/cachetable-clone-partial-fetch.cc | 7 +-
.../ft/tests/cachetable-clone-pin-nonblocking.cc | 7 +-
.../ft/tests/cachetable-clone-unpin-remove.cc | 5 +-
.../ft/tests/cachetable-eviction-close-test.cc | 4 -
.../ft/tests/cachetable-eviction-close-test2.cc | 4 -
.../ft/tests/cachetable-eviction-getandpin-test.cc | 14 +-
.../tests/cachetable-eviction-getandpin-test2.cc | 12 +-
.../ft/tests/cachetable-fetch-inducing-evictor.cc | 15 +-
.../ft/tests/cachetable-flush-during-cleaner.cc | 3 +-
.../ft/tests/cachetable-getandpin-test.cc | 8 +-
.../cachetable-kibbutz_and_flush_cachefile.cc | 3 +-
.../PerconaFT/ft/tests/cachetable-partial-fetch.cc | 18 +-
.../ft/tests/cachetable-pin-checkpoint.cc | 6 -
.../cachetable-pin-nonblocking-checkpoint-clean.cc | 9 +-
.../ft/tests/cachetable-prefetch-close-test.cc | 2 -
.../ft/tests/cachetable-prefetch-getandpin-test.cc | 12 +-
.../ft/tests/cachetable-put-checkpoint.cc | 9 -
.../PerconaFT/ft/tests/cachetable-simple-clone.cc | 7 +-
.../PerconaFT/ft/tests/cachetable-simple-clone2.cc | 5 +-
.../PerconaFT/ft/tests/cachetable-simple-close.cc | 20 +-
.../ft/tests/cachetable-simple-maybe-get-pin.cc | 3 +-
.../ft/tests/cachetable-simple-pin-cheap.cc | 9 +-
.../ft/tests/cachetable-simple-pin-dep-nodes.cc | 8 +-
.../cachetable-simple-pin-nonblocking-cheap.cc | 19 +-
.../ft/tests/cachetable-simple-pin-nonblocking.cc | 13 +-
.../PerconaFT/ft/tests/cachetable-simple-pin.cc | 11 +-
.../ft/tests/cachetable-simple-put-dep-nodes.cc | 6 +-
.../cachetable-simple-read-pin-nonblocking.cc | 13 +-
.../ft/tests/cachetable-simple-read-pin.cc | 13 +-
.../cachetable-simple-unpin-remove-checkpoint.cc | 7 +-
.../PerconaFT/ft/tests/cachetable-simple-verify.cc | 5 +-
.../tokudb/PerconaFT/ft/tests/cachetable-test.cc | 22 +-
.../ft/tests/cachetable-unpin-and-remove-test.cc | 4 +-
.../cachetable-unpin-remove-and-checkpoint.cc | 6 +-
.../PerconaFT/ft/tests/cachetable-unpin-test.cc | 2 -
storage/tokudb/PerconaFT/ft/tests/test-TDB2-pe.cc | 178 +
storage/tokudb/PerconaFT/ft/tests/test-TDB89.cc | 208 +
storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc | 2 +
storage/tokudb/PerconaFT/ft/txn/rollback.cc | 2 +-
storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp | 2 +-
storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp | 2 +-
storage/tokudb/PerconaFT/portability/memory.cc | 14 +-
storage/tokudb/PerconaFT/portability/toku_assert.h | 2 +-
.../tokudb/PerconaFT/portability/toku_debug_sync.h | 3 +-
.../PerconaFT/portability/toku_instr_mysql.cc | 6 +-
.../PerconaFT/portability/toku_instrumentation.h | 6 +-
.../PerconaFT/portability/toku_portability.h | 2 +-
.../tokudb/PerconaFT/portability/toku_race_tools.h | 2 +-
storage/tokudb/PerconaFT/src/tests/get_last_key.cc | 32 +-
storage/tokudb/PerconaFT/src/ydb.cc | 3 +
storage/tokudb/PerconaFT/src/ydb_lib.cc | 2 +-
storage/tokudb/PerconaFT/util/dmt.cc | 4 +-
storage/tokudb/PerconaFT/util/minicron.cc | 3 +-
storage/tokudb/PerconaFT/util/scoped_malloc.cc | 2 +-
.../util/tests/minicron-change-period-data-race.cc | 66 +
storage/tokudb/ha_tokudb.cc | 325 +-
storage/tokudb/ha_tokudb.h | 92 +-
storage/tokudb/ha_tokudb_admin.cc | 8 +-
storage/tokudb/ha_tokudb_alter_55.cc | 4 +
storage/tokudb/ha_tokudb_alter_56.cc | 265 +-
storage/tokudb/ha_tokudb_alter_common.cc | 6 +-
storage/tokudb/ha_tokudb_update.cc | 96 +-
storage/tokudb/hatoku_cmp.cc | 33 +-
storage/tokudb/hatoku_cmp.h | 14 +-
storage/tokudb/hatoku_defines.h | 51 +-
storage/tokudb/hatoku_hton.cc | 183 +-
storage/tokudb/hatoku_hton.h | 25 +-
storage/tokudb/mysql-test/rpl/disabled.def | 1 +
.../r/rpl_mixed_replace_into.result | 0
.../rpl/r/rpl_parallel_tokudb_delete_pk.result | 5 -
...pl_parallel_tokudb_update_pk_uc0_lookup0.result | 5 -
.../rpl/r/rpl_parallel_tokudb_write_pk.result | 2 -
.../r/rpl_row_replace_into.result | 0
.../r/rpl_stmt_replace_into.result | 0
.../mysql-test/rpl/r/rpl_xa_interleave.result | 78 +
.../t/rpl_mixed_replace_into.test | 0
.../t/rpl_row_replace_into.test | 0
.../t/rpl_stmt_replace_into.test | 0
.../tokudb/mysql-test/rpl/t/rpl_xa_interleave.test | 103 +
.../tokudb/include/fast_update_gen_footer.inc | 2 +
.../include/fast_update_gen_footer_silent.inc | 9 +
.../tokudb/include/fast_update_gen_header.inc | 6 +
.../mysql-test/tokudb/include/fast_update_int.inc | 48 +
.../tokudb/include/fast_upsert_gen_header.inc | 6 +
.../mysql-test/tokudb/include/fast_upsert_int.inc | 19 +
.../tokudb/mysql-test/tokudb/include/have_mrr.inc | 0
.../tokudb/include/setup_fast_update_upsert.inc | 8 +
.../tokudb/mysql-test/tokudb/r/compressions.result | 11 +
.../tokudb/r/fast_update_binlog_mixed.result | 225 +-
.../tokudb/r/fast_update_binlog_row.result | 19 +-
.../tokudb/r/fast_update_binlog_statement.result | 222 +-
.../mysql-test/tokudb/r/fast_update_blobs.result | 18253 +---------
.../r/fast_update_blobs_fixed_varchar.result | 33026 ------------------
.../tokudb/r/fast_update_blobs_with_varchar.result | 32771 +-----------------
.../mysql-test/tokudb/r/fast_update_char.result | 60 +-
.../tokudb/r/fast_update_deadlock.result | 19 +-
.../tokudb/r/fast_update_decr_floor.result | 314 +-
.../r/fast_update_disable_slow_update.result | 7 -
.../mysql-test/tokudb/r/fast_update_error.result | 12 +-
.../mysql-test/tokudb/r/fast_update_int.result | 562 +-
.../tokudb/r/fast_update_int_bounds.result | 52 +-
.../mysql-test/tokudb/r/fast_update_key.result | 54 +-
.../mysql-test/tokudb/r/fast_update_sqlmode.result | 21 +-
.../tokudb/r/fast_update_uint_bounds.result | 36 +-
.../mysql-test/tokudb/r/fast_update_varchar.result | 13575 +-------
.../mysql-test/tokudb/r/fast_upsert_bin_pad.result | Bin 659 -> 738 bytes
.../mysql-test/tokudb/r/fast_upsert_char.result | 24 +-
.../tokudb/r/fast_upsert_deadlock.result | 19 +-
.../mysql-test/tokudb/r/fast_upsert_int.result | 428 +-
.../mysql-test/tokudb/r/fast_upsert_key.result | 43 +-
.../mysql-test/tokudb/r/fast_upsert_sqlmode.result | 23 +-
.../mysql-test/tokudb/r/fast_upsert_values.result | 18 +-
.../tokudb/mysql-test/tokudb/r/tokudb_mrr.result | 334 +
storage/tokudb/mysql-test/tokudb/suite.pm | 6 +
.../tokudb/mysql-test/tokudb/t/compressions.test | 68 +
storage/tokudb/mysql-test/tokudb/t/disabled.def | 24 -
.../tokudb/t/fast_update_binlog_mixed-master.opt | 2 +
.../tokudb/t/fast_update_binlog_mixed.test | 15 +-
.../tokudb/t/fast_update_binlog_row-master.opt | 2 +
.../tokudb/t/fast_update_binlog_row.test | 19 +-
.../t/fast_update_binlog_statement-master.opt | 2 +
.../tokudb/t/fast_update_binlog_statement.test | 15 +-
.../mysql-test/tokudb/t/fast_update_blobs.py | 57 -
.../mysql-test/tokudb/t/fast_update_blobs.test | 18575 +----------
.../tokudb/t/fast_update_blobs_fixed_varchar.py | 63 -
.../tokudb/t/fast_update_blobs_fixed_varchar.test | 33287 -------------------
.../tokudb/t/fast_update_blobs_with_varchar.py | 62 -
.../tokudb/t/fast_update_blobs_with_varchar.test | 33115 +-----------------
.../mysql-test/tokudb/t/fast_update_char.test | 66 +-
.../mysql-test/tokudb/t/fast_update_deadlock.test | 21 +-
.../mysql-test/tokudb/t/fast_update_decr_floor.py | 58 -
.../tokudb/t/fast_update_decr_floor.test | 409 +-
.../tokudb/t/fast_update_disable_slow_update.test | 17 -
.../mysql-test/tokudb/t/fast_update_error.test | 16 +-
.../tokudb/mysql-test/tokudb/t/fast_update_int.py | 77 -
.../mysql-test/tokudb/t/fast_update_int.test | 682 +-
.../tokudb/t/fast_update_int_bounds.test | 55 +-
.../mysql-test/tokudb/t/fast_update_key.test | 63 +-
.../mysql-test/tokudb/t/fast_update_sqlmode.test | 25 +-
.../tokudb/t/fast_update_uint_bounds.test | 42 +-
.../mysql-test/tokudb/t/fast_update_varchar.py | 63 -
.../mysql-test/tokudb/t/fast_update_varchar.test | 7390 +---
.../mysql-test/tokudb/t/fast_upsert_bin_pad.test | 19 +-
.../mysql-test/tokudb/t/fast_upsert_char.test | 27 +-
.../mysql-test/tokudb/t/fast_upsert_deadlock.test | 22 +-
.../tokudb/mysql-test/tokudb/t/fast_upsert_int.py | 50 -
.../mysql-test/tokudb/t/fast_upsert_int.test | 486 +-
.../mysql-test/tokudb/t/fast_upsert_key.test | 46 +-
.../mysql-test/tokudb/t/fast_upsert_sqlmode.test | 27 +-
.../mysql-test/tokudb/t/fast_upsert_values.test | 21 +-
storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test | 73 +
.../tokudb/mysql-test/tokudb_bugs/r/PS-3773.result | 8 +
.../r/alter_table_comment_rebuild_data.result | 177 +
.../tokudb/mysql-test/tokudb_bugs/t/PS-3773.test | 26 +
.../t/alter_table_comment_rebuild_data.test | 188 +
storage/tokudb/tokudb_debug.h | 5 -
storage/tokudb/tokudb_dir_cmd.h | 6 +-
storage/tokudb/tokudb_information_schema.cc | 74 +-
storage/tokudb/tokudb_sysvars.cc | 122 +-
storage/tokudb/tokudb_sysvars.h | 16 +-
storage/tokudb/tokudb_thread.h | 26 +-
storage/tokudb/tokudb_update_fun.cc | 230 +-
storage/xtradb/btr/btr0scrub.cc | 2 +-
storage/xtradb/buf/buf0buf.cc | 2 +-
storage/xtradb/fil/fil0crypt.cc | 2 +-
storage/xtradb/handler/ha_innodb.cc | 41 +-
storage/xtradb/handler/handler0alter.cc | 20 +-
storage/xtradb/include/univ.i | 3 +-
storage/xtradb/row/row0mysql.cc | 4 +-
321 files changed, 6845 insertions(+), 195812 deletions(-)
diff --cc config.h.cmake
index 3e5a9a95397,52d837fad2a..bbeb457fd13
--- a/config.h.cmake
+++ b/config.h.cmake
@@@ -569,12 -666,6 +569,8 @@@
#cmakedefine WSREP_PROC_INFO 1
#endif
- #ifdef _AIX
- /*
- AIX includes inttypes.h from sys/types.h
- Explicitly request format macros before the first inclusion of inttypes.h
- */
++#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
- #endif
++#endif // !defined(__STDC_FORMAT_MACROS)
#endif
diff --cc extra/mariabackup/fil_cur.cc
index be2e0593129,be4a625342b..f5b3db1e184
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@@ -341,42 -343,45 +341,42 @@@ read_retry
/* check pages for corruption and re-read if necessary. i.e. in case of
partially written pages */
for (page = cursor->buf, i = 0; i < npages;
- page += cursor->page_size, i++) {
- ib_int64_t page_no = cursor->buf_page_no + i;
-
- bool checksum_ok = fil_space_verify_crypt_checksum(page, cursor->zip_size,space, (ulint)page_no);
-
- if (!checksum_ok &&
- buf_page_is_corrupted(true, page, cursor->zip_size,space)) {
-
- if (cursor->is_system &&
- page_no >= (ib_int64_t)FSP_EXTENT_SIZE &&
- page_no < (ib_int64_t) FSP_EXTENT_SIZE * 3) {
- /* skip doublewrite buffer pages */
- xb_a(cursor->page_size == UNIV_PAGE_SIZE);
- msg("[%02u] mariabackup: "
- "Page " UINT64PF " is a doublewrite buffer page, "
- "skipping.\n", cursor->thread_n, page_no);
- } else {
- retry_count--;
- if (retry_count == 0) {
- msg("[%02u] mariabackup: "
- "Error: failed to read page after "
- "10 retries. File %s seems to be "
- "corrupted.\n", cursor->thread_n,
- cursor->abs_path);
- ret = XB_FIL_CUR_ERROR;
- break;
- }
- msg("[%02u] mariabackup: "
- "Database page corruption detected at page "
- UINT64PF ", retrying...\n", cursor->thread_n,
- page_no);
-
- os_thread_sleep(100000);
-
- goto read_retry;
- }
- }
- cursor->buf_read += cursor->page_size;
- cursor->buf_npages++;
+ page += page_size, i++) {
+ ulint page_no = cursor->buf_page_no + i;
+
- if (cursor->space_id == TRX_SYS_SPACE &&
- page_no >= FSP_EXTENT_SIZE &&
- page_no < FSP_EXTENT_SIZE * 3) {
- /* We ignore the doublewrite buffer pages */
- } else if (!fil_space_verify_crypt_checksum(
- page, cursor->page_size, space->id, page_no)
- && buf_page_is_corrupted(true, page,
- cursor->page_size,
- space)) {
- retry_count--;
- if (retry_count == 0) {
- msg("[%02u] mariabackup: "
- "Error: failed to read page after "
- "10 retries. File %s seems to be "
- "corrupted.\n", cursor->thread_n,
- cursor->abs_path);
- ret = XB_FIL_CUR_ERROR;
- break;
- }
-
- if (retry_count == 9) {
- msg("[%02u] mariabackup: "
- "Database page corruption detected at page "
- ULINTPF ", retrying...\n",
- cursor->thread_n, page_no);
- }
-
- os_thread_sleep(100000);
-
- goto read_retry;
- }
- cursor->buf_read += page_size;
- cursor->buf_npages++;
++ if (cursor->space_id == TRX_SYS_SPACE &&
++ page_no >= FSP_EXTENT_SIZE &&
++ page_no < FSP_EXTENT_SIZE * 3) {
++ /* We ignore the doublewrite buffer pages */
++ } else if (!fil_space_verify_crypt_checksum(
++ page, cursor->page_size, space->id, page_no)
++ && buf_page_is_corrupted(true, page,
++ cursor->page_size,
++ space)) {
++ retry_count--;
++ if (retry_count == 0) {
++ msg("[%02u] mariabackup: "
++ "Error: failed to read page after "
++ "10 retries. File %s seems to be "
++ "corrupted.\n", cursor->thread_n,
++ cursor->abs_path);
++ ret = XB_FIL_CUR_ERROR;
++ break;
++ }
++
++ if (retry_count == 9) {
++ msg("[%02u] mariabackup: "
++ "Database page corruption detected at page "
++ ULINTPF ", retrying...\n",
++ cursor->thread_n, page_no);
++ }
++
++ os_thread_sleep(100000);
++
++ goto read_retry;
++ }
++ cursor->buf_read += page_size;
++ cursor->buf_npages++;
}
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
diff --cc include/my_global.h
index 65546a37700,dcfd607b455..8651956892c
--- a/include/my_global.h
+++ b/include/my_global.h
@@@ -255,7 -257,7 +255,9 @@@
AIX includes inttypes.h from sys/types.h
Explicitly request format macros before the first inclusion of inttypes.h
*/
--#define __STDC_FORMAT_MACROS
++#if !defined(__STDC_FORMAT_MACROS)
++#define __STDC_FORMAT_MACROS
++#endif // !defined(__STDC_FORMAT_MACROS)
#endif
diff --cc include/my_service_manager.h
index 4d88e992b5e,4d88e992b5e..d9f41ace4d5
--- a/include/my_service_manager.h
+++ b/include/my_service_manager.h
@@@ -24,7 -24,7 +24,9 @@@
sd-daemon.h may include inttypes.h. Explicitly request format macros before
the first inclusion of inttypes.h.
*/
++#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
++#endif // !defined(__STDC_FORMAT_MACROS)
#include <systemd/sd-daemon.h>
/** INTERVAL in seconds followed by printf style status */
#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \
diff --cc mysql-test/r/group_min_max.result
index b3b660c4170,777780f8400..f200f70dd8b
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@@ -3733,6 -3733,34 +3733,34 @@@ id MIN(a) MAX(a
4 2001-01-04 2001-01-04
DROP TABLE t1;
#
+ # MDEV-17039: Query plan changes when we use GROUP BY optimization with optimizer_use_condition_selectivity=4
+ # and use_stat_tables= PREFERABLY
+ #
+ CREATE TABLE t1 (a INT, b INT,c INT DEFAULT 0, INDEX (a,b));
+ INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
+ (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
+ set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+ set @save_use_stat_tables= @@use_stat_tables;
+ set @@optimizer_use_condition_selectivity=4;
+ set @@use_stat_tables=PREFERABLY;
+ explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
+ id select_type table type possible_keys key key_len ref rows filtered Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00
+ 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index
+ 2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by
+ Warnings:
-Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where (`test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`)
++Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`
+ set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+ set @@use_stat_tables=@save_use_stat_tables;
+ explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
+ id select_type table type possible_keys key key_len ref rows filtered Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00
+ 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index
+ 2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by
+ Warnings:
-Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where (`test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`)
++Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`
+ drop table t1;
+ #
# End of 10.0 tests
#
#
diff --cc mysql-test/r/query_cache_innodb.result
index 643a065612f,00000000000..146a6fbc289
mode 100644,000000..100644
--- a/mysql-test/r/query_cache_innodb.result
+++ b/mysql-test/r/query_cache_innodb.result
@@@ -1,90 -1,0 +1,90 @@@
+#
+# MDEV-12485: foreign key on delete cascade stale entries with
+# query cache enabled
+#
+SET NAMES utf8;
+set global query_cache_type=1;
+set global query_cache_size=1024*1024;
+set query_cache_type=1;
+create table t1 ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
+create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references t1(`id`) on delete cascade ) engine=innodb;
+insert into t1 values (1);
+insert into t2 values (1,1);
+select * from t2;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t2;
+t2id id
+optimize table t2;
+Table Op Msg_type Msg_text
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+select * from t2;
+t2id id
+drop table t2;
+drop table t1;
+create database `testdatabase$ї`;
+use `testdatabase$ї`;
+create table `t1$ї` ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
+create table `t2$ї` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `t1$ї`(`id`) on delete cascade ) engine=innodb;
+insert into `t1$ї` values (1);
+insert into `t2$ї`values (1,1);
+select * from `t2$ї`;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from `t1$ї`;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from `t2$ї`;
+t2id id
+optimize table `t2$ї`;
+Table Op Msg_type Msg_text
+testdatabase$ї.t2$ї optimize note Table does not support optimize, doing recreate + analyze instead
+testdatabase$ї.t2$ї optimize status OK
+select * from `t2$ї`;
+t2id id
+use test;
+drop database `testdatabase$ї`;
+SET NAMES default;
+create database `#mysql50#-`;
+use `#mysql50#-`;
+create table `#mysql50#t-1` ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
+create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `#mysql50#t-1`(`id`) on delete cascade ) engine=innodb;
+insert into `#mysql50#t-1` values (1);
+insert into `#mysql50#t-2`values (1,1);
+select * from `#mysql50#t-2`;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from `#mysql50#t-1`;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from `#mysql50#t-2`;
+t2id id
+optimize table `#mysql50#t-2`;
+Table Op Msg_type Msg_text
+#mysql50#-.#mysql50#t-2 optimize note Table does not support optimize, doing recreate + analyze instead
+#mysql50#-.#mysql50#t-2 optimize status OK
+select * from `#mysql50#t-2`;
+t2id id
+use test;
+drop database `#mysql50#-`;
+SET NAMES default;
- FOUND 12 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err
++FOUND 8 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err
+set global query_cache_type=DEFAULT;
+set global query_cache_size=DEFAULT;
+End of 10.2 tests
diff --cc mysql-test/r/selectivity.result
index 5f3f2bb5064,2e69f674ea3..db82c3fb4de
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@@ -782,9 -782,9 +782,9 @@@ set optimizer_use_condition_selectivity
explain extended
select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
++Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
select * from t1 where a < 1 and a > 7;
a
drop table t1;
@@@ -1506,9 -1506,9 +1506,9 @@@ col
explain extended
select * from t2 where col1 < 'b' and col1 > 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where ((`test`.`t2`.`col1` < 'b') and (`test`.`t2`.`col1` > 'd'))
++Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd'
drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
diff --cc mysql-test/r/selectivity_innodb.result
index 849217116ea,d3e71088f87..249ac264fd6
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@@ -789,9 -789,9 +789,9 @@@ set optimizer_use_condition_selectivity
explain extended
select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
++Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
select * from t1 where a < 1 and a > 7;
a
drop table t1;
@@@ -1516,9 -1516,9 +1516,9 @@@ col
explain extended
select * from t2 where col1 < 'b' and col1 > 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where ((`test`.`t2`.`col1` < 'b') and (`test`.`t2`.`col1` > 'd'))
++Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd'
drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
diff --cc mysql-test/suite/galera/disabled.def
index 9be8e73f06b,40b4065c3db..ec3ae5f3907
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@@ -30,10 -30,7 +30,13 @@@ query_cache : MDEV-15805 Test failure o
MW-416 : MDEV-13549 Galera test failures
galera_wan : MDEV-13549 Galera test failures
MW-388 : MDEV-13549 Galera test failures
+galera.MW-44 : MDEV-15809 Test failure on galera.MW-44
+galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
+galera_kill_applier : race condition at the start of the test
+galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
+pxc-421: Lock timeout exceeded
galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure
+galera.galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl
+ galera.galera_binlog_stmt_autoinc : MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc
+ galera.galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl
+ galera.galera_var_node_address : MDEV-17151 Galera test failure on galera.galera_var_node_address
diff --cc mysql-test/suite/galera/r/MW-336.result
index 0bf8d9d3909,81e8eae0eb3..4d7d6440066
--- a/mysql-test/suite/galera/r/MW-336.result
+++ b/mysql-test/suite/galera/r/MW-336.result
@@@ -1,40 -1,31 +1,39 @@@
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+ INSERT INTO t1 values(0);
+connection node_1;
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1;
+ # Wait 10 slave threads to start 1
+connection node_2;
- INSERT INTO t1 VALUES (1);
+ # Generate 12 replication events
+connection node_1;
+ SELECT COUNT(*) FROM t1;
+ COUNT(*)
+ 13
+ # Wait 9 slave threads to exit 1
SET GLOBAL wsrep_slave_threads = 10;
+ # Wait 10 slave threads to start 2
SET GLOBAL wsrep_slave_threads = 20;
+ # Wait 20 slave threads to start 3
SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
- INSERT INTO t1 VALUES (1);
- INSERT INTO t1 VALUES (2);
- INSERT INTO t1 VALUES (3);
- INSERT INTO t1 VALUES (4);
- INSERT INTO t1 VALUES (5);
- INSERT INTO t1 VALUES (6);
- INSERT INTO t1 VALUES (7);
- INSERT INTO t1 VALUES (8);
- INSERT INTO t1 VALUES (9);
+ # Generate 40 replication events
+connection node_1;
+ SELECT COUNT(*) FROM t1;
+ COUNT(*)
+ 53
+ # Wait 10 slave threads to exit 3
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0;
Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+ # Wait 10 slave threads to start 3
+connection node_2;
- INSERT INTO t1 VALUES (10);
- INSERT INTO t1 VALUES (11);
- INSERT INTO t1 VALUES (12);
- INSERT INTO t1 VALUES (13);
- INSERT INTO t1 VALUES (14);
- INSERT INTO t1 VALUES (15);
- INSERT INTO t1 VALUES (16);
- INSERT INTO t1 VALUES (17);
- INSERT INTO t1 VALUES (18);
- INSERT INTO t1 VALUES (19);
- INSERT INTO t1 VALUES (20);
+ # Generate 12 replication events
++connection node_1;
+ SELECT COUNT(*) FROM t1;
+ COUNT(*)
+ 65
+ # Wait 10 slave threads to exit 4
+connection node_1;
- SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;
diff --cc mysql-test/suite/galera/r/galera_ist_mysqldump.result
index 58a3ca297f8,e254a1b195b..296ecc2adc7
--- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
@@@ -5,12 -4,9 +5,13 @@@ connection node_1
CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
SET GLOBAL wsrep_sst_method = 'mysqldump';
+ call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*");
+connection node_1;
+connection node_2;
Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@@ -199,120 -180,12 +200,12 @@@ COUNT(*) =
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
- Performing State Transfer on a server that has been killed and restarted
- while a DDL was in progress on it
- connection node_1;
- CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
- INSERT INTO t1 VALUES ('node1_committed_before');
- INSERT INTO t1 VALUES ('node1_committed_before');
- INSERT INTO t1 VALUES ('node1_committed_before');
- INSERT INTO t1 VALUES ('node1_committed_before');
- INSERT INTO t1 VALUES ('node1_committed_before');
- connection node_2;
- START TRANSACTION;
- INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- COMMIT;
- SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
- connection node_1;
- ALTER TABLE t1 ADD COLUMN f2 INTEGER;
- connection node_2;
- SET wsrep_sync_wait = 0;
- Killing server ...
- connection node_1;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
- INSERT INTO t1 (f1) VALUES ('node1_committed_during');
- INSERT INTO t1 (f1) VALUES ('node1_committed_during');
- INSERT INTO t1 (f1) VALUES ('node1_committed_during');
- INSERT INTO t1 (f1) VALUES ('node1_committed_during');
- INSERT INTO t1 (f1) VALUES ('node1_committed_during');
- COMMIT;
- START TRANSACTION;
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- connection node_2;
- Performing --wsrep-recover ...
- connection node_2;
- Starting server ...
- Using --wsrep-start-position when starting mysqld ...
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
- INSERT INTO t1 (f1) VALUES ('node2_committed_after');
- INSERT INTO t1 (f1) VALUES ('node2_committed_after');
- INSERT INTO t1 (f1) VALUES ('node2_committed_after');
- INSERT INTO t1 (f1) VALUES ('node2_committed_after');
- INSERT INTO t1 (f1) VALUES ('node2_committed_after');
- COMMIT;
- connection node_1;
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
- COMMIT;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
- INSERT INTO t1 (f1) VALUES ('node1_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_committed_after');
- INSERT INTO t1 (f1) VALUES ('node1_committed_after');
- COMMIT;
- connection node_1a_galera_st_kill_slave_ddl;
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
- ROLLBACK;
- SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
- COUNT(*) = 2
- 1
- SELECT COUNT(*) = 35 FROM t1;
- COUNT(*) = 35
- 1
- SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
- COUNT(*) = 0
- 1
- COMMIT;
- SET AUTOCOMMIT=ON;
- connection node_1;
- SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
- COUNT(*) = 2
- 1
- SELECT COUNT(*) = 35 FROM t1;
- COUNT(*) = 35
- 1
- SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
- COUNT(*) = 0
- 1
- DROP TABLE t1;
- COMMIT;
- SET AUTOCOMMIT=ON;
- SET GLOBAL debug_dbug = $debug_orig;
+connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
+connection node_2;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
-CALL mtr.add_suppression("InnoDB: New log files created");
-CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
diff --cc mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
index 00000000000,2803211c418..525156d88da
mode 000000,100644..100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
@@@ -1,0 -1,103 +1,114 @@@
---- mysql-test/suite/galera/r/galera_sst_rsync2.result 2018-09-07 01:29:47.133578834 +0200
-+++ galera_sst_rsync2.result 2018-09-07 01:29:37.619557422 +0200
-@@ -260,3 +260,100 @@
++--- suite/galera/r/galera_sst_rsync2.result 2018-09-12 13:09:35.352229478 +0200
+++++ suite/galera/r/galera_sst_rsync2,debug.reject 2018-09-12 17:00:51.601974979 +0200
++@@ -286,3 +286,111 @@
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+ +Performing State Transfer on a server that has been killed and restarted
+ +while a DDL was in progress on it
+++connection node_1;
+ +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+++connection node_2;
+ +START TRANSACTION;
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +COMMIT;
+ +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+++connection node_1;
+ +ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+++connection node_2;
+ +SET wsrep_sync_wait = 0;
+ +Killing server ...
+++connection node_1;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +COMMIT;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+++connection node_2;
+ +Performing --wsrep-recover ...
+++connection node_2;
+ +Starting server ...
+ +Using --wsrep-start-position when starting mysqld ...
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +COMMIT;
+++connection node_1;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +COMMIT;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +COMMIT;
+++connection node_1a_galera_st_kill_slave_ddl;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +ROLLBACK;
+ +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+ +COUNT(*) = 2
+ +1
+ +SELECT COUNT(*) = 35 FROM t1;
+ +COUNT(*) = 35
+ +1
+ +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ +COUNT(*) = 0
+ +1
+ +COMMIT;
+ +SET AUTOCOMMIT=ON;
+++connection node_1;
+ +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+ +COUNT(*) = 2
+ +1
+ +SELECT COUNT(*) = 35 FROM t1;
+ +COUNT(*) = 35
+ +1
+ +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ +COUNT(*) = 0
+ +1
+ +DROP TABLE t1;
+ +COMMIT;
+ +SET AUTOCOMMIT=ON;
+ +SET GLOBAL debug_dbug = $debug_orig;
diff --cc mysql-test/suite/galera/r/galera_sst_rsync2.result
index 00000000000,cec0f21ee22..ff85a7d6c0f
mode 000000,100644..100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync2.result
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2.result
@@@ -1,0 -1,262 +1,288 @@@
++connection node_1;
++connection node_2;
+ Performing State Transfer on a server that has been shut down cleanly and restarted
++connection node_1;
+ CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ COMMIT;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ COMMIT;
+ Shutting down server ...
++connection node_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+ Starting server ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ COMMIT;
++connection node_1;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ COMMIT;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ COMMIT;
++connection node_1a_galera_st_shutdown_slave;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ ROLLBACK;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++connection node_1;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+ Performing State Transfer on a server that starts from a clean var directory
+ This is accomplished by shutting down node #2 and removing its var directory before restarting it
++connection node_1;
+ CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ COMMIT;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ COMMIT;
+ Shutting down server ...
++connection node_1;
+ Cleaning var directory ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+ Starting server ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ COMMIT;
++connection node_1;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ COMMIT;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ COMMIT;
++connection node_1a_galera_st_clean_slave;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ ROLLBACK;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++connection node_1;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+ Performing State Transfer on a server that has been killed and restarted
++connection node_1;
+ CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ COMMIT;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ COMMIT;
+ Killing server ...
++connection node_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+ Performing --wsrep-recover ...
+ Starting server ...
+ Using --wsrep-start-position when starting mysqld ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ COMMIT;
++connection node_1;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ COMMIT;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ COMMIT;
++connection node_1a_galera_st_kill_slave;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ ROLLBACK;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++connection node_1;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
diff --cc mysql-test/suite/galera/r/galera_var_slave_threads.result
index 3f0a63ab9d7,c7c6af2098f..c28cc091ae9
--- a/mysql-test/suite/galera/r/galera_var_slave_threads.result
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@@ -13,85 -11,26 +13,24 @@@ SELECT @@wsrep_slave_threads = 1
@@wsrep_slave_threads = 1
1
SET GLOBAL wsrep_slave_threads = 1;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 64;
+connection node_1;
INSERT INTO t1 VALUES (1);
+connection node_2;
+ SELECT COUNT(*) = 1 FROM t1;
+ COUNT(*) = 1
+ 1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
-1
SET GLOBAL wsrep_slave_threads = 1;
-SELECT COUNT(*) = 64 FROM t2;
-COUNT(*) = 64
-1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
+connection node_1;
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
+connection node_2;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+64
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;
diff --cc mysql-test/suite/galera/t/MW-336.test
index 8cd363aa019,749ffe671be..40d093a1a86
--- a/mysql-test/suite/galera/t/MW-336.test
+++ b/mysql-test/suite/galera/t/MW-336.test
@@@ -14,15 -19,43 +19,43 @@@ SET GLOBAL wsrep_slave_threads = 1
--source include/wait_condition.inc
--connection node_2
- INSERT INTO t1 VALUES (1);
+ # Wait until inserts are replicated
+ --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+ --source include/wait_condition.inc
+ --echo # Generate 12 replication events
+ --disable_query_log
+ --disable_result_log
+ --let $count = 12
+ while ($count)
+ {
+ INSERT INTO t1 VALUES (1);
+ --dec $count
+ }
+ --enable_result_log
+ --enable_query_log
--connection node_1
+ # Wait until inserts are replicated
+ --let $wait_condition = SELECT COUNT(*) = 13 FROM t1;
+ --source include/wait_condition.inc
+
+ SELECT COUNT(*) FROM t1;
+
+ --echo # Wait 9 slave threads to exit 1
+ # Wait until appliers exit
+ --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+ --source include/wait_condition.inc
+
SET GLOBAL wsrep_slave_threads = 10;
+
+ --echo # Wait 10 slave threads to start 2
---let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 20;
+
+ --echo # Wait 20 slave threads to start 3
---let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1;
diff --cc mysql-test/suite/galera/t/MW-44.test
index e8caa28c80e,5bc5fa9dab8..eb50be1a53b
--- a/mysql-test/suite/galera/t/MW-44.test
+++ b/mysql-test/suite/galera/t/MW-44.test
@@@ -6,23 -6,20 +6,22 @@@
--source include/have_innodb.inc
--connection node_1
- SET GLOBAL general_log='OFF';
TRUNCATE TABLE mysql.general_log;
- --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
- --source include/wait_condition.inc
+--sleep 1
--connection node_2
- SET GLOBAL general_log='OFF';
TRUNCATE TABLE mysql.general_log;
- --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
+ --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%';
--source include/wait_condition.inc
+ SELECT Argument FROM mysql.general_log;
+--sleep 1
--connection node_1
- SET GLOBAL general_log='ON';
- SELECT argument from mysql.general_log WHERE argument NOT LIKE 'SELECT%';
+ --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%';
+ --source include/wait_condition.inc
+ SELECT Argument FROM mysql.general_log;
+ SET GLOBAL general_log='ON';
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
diff --cc mysql-test/suite/galera/t/galera#505.test
index 00000000000,78cdf53db74..785b1411596
mode 000000,100644..100644
--- a/mysql-test/suite/galera/t/galera#505.test
+++ b/mysql-test/suite/galera/t/galera#505.test
@@@ -1,0 -1,32 +1,26 @@@
+ # galera#505 - Change of pc.weight wsrep param will be correctly stored in wsrep_provider_options variable
+
+ --source include/galera_cluster.inc
+
---disable_query_log
-select CAST(REGEXP_REPLACE(variable_value,'^(\\d+)\\.(\\d+)\\.(\\d+)(r\\d+)','\\3') AS UNSIGNED) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version' INTO @GALERA_VERSION;
-
-# Make sure that the test is operating on the right version of galera library.
---let $galera_version=24
-eval SET @REQUIRED_GALERA_VERSION='$galera_version';
-
-SELECT @GALERA_VERSION, @REQUIRED_GALERA_VERSION;
++--connection node_1
+
-if (!`SELECT (@GALERA_VERSION < @REQUIRED_GALERA_VERSION)`)
-{
- skip Test requires Galera library version 25.3.$galera_version;
-}
++SET SESSION wsrep_sync_wait=0;
++--disable_result_log
++--disable_query_log
++--let $galera_version=25.3.24
++source ../../wsrep/include/check_galera_version.inc;
++--enable_result_log
+ --enable_query_log
-
---connection node_1
++SET SESSION wsrep_sync_wait=DEFAULT;
+
+ # Convert "... pc.weight = N; ..." to "N; ..."
+ --let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))`
+ # Convert "N; ..." to "N"
+ --let $pc_weight_value = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)`
+
+ SET GLOBAL wsrep_provider_options = 'pc.weight=3';
+
+ -- replace_regex /.*(pc\.weight = [0-9]+);.*/\1/
+ SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options';
+
+ --eval SET GLOBAL wsrep_provider_options = 'pc.weight=$pc_weight_value'
diff --cc mysql-test/suite/galera/t/galera_var_slave_threads.test
index e5986f7ee12,1cee845b6ab..80edcb2aff9
--- a/mysql-test/suite/galera/t/galera_var_slave_threads.test
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@@ -33,8 -34,15 +33,14 @@@ SET GLOBAL wsrep_slave_threads = 64
INSERT INTO t1 VALUES (1);
--connection node_2
+ --let $wait_timeout=600
+ --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+ --source include/wait_condition.inc
+
+ SELECT COUNT(*) = 1 FROM t1;
+
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
# Reduce the number of slave threads. The change is not immediate -- a thread will only exit after a replication event
@@@ -51,13 -61,18 +59,15 @@@ while ($count
INSERT INTO t2 VALUES (DEFAULT);
--dec $count
}
+ --enable_query_log
+ --enable_result_log
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 64 FROM t2;
---source include/wait_condition.inc
+SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) = 64 FROM t2;
-
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig
diff --cc mysql-test/suite/innodb/r/foreign-keys.result
index 0cb53f52a6c,66fc00e34d0..4402c5ca2fe
--- a/mysql-test/suite/innodb/r/foreign-keys.result
+++ b/mysql-test/suite/innodb/r/foreign-keys.result
@@@ -17,37 -17,73 +17,110 @@@ drop table title, department, people
create table t1 (a int primary key, b int) engine=innodb;
create table t2 (c int primary key, d int,
foreign key (d) references t1 (a) on update cascade) engine=innodb;
+ insert t1 values (1,1),(2,2),(3,3);
+ insert t2 values (4,1),(5,2),(6,3);
+ flush table t2 with read lock;
+ connect con1,localhost,root;
+ delete from t1 where a=2;
+ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+ update t1 set a=10 where a=1;
+ connection default;
+ unlock tables;
+ connection con1;
+ connection default;
+ lock table t2 write;
+ connection con1;
+ delete from t1 where a=2;
+ connection default;
+ unlock tables;
+ connection con1;
+ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+ connection default;
+ unlock tables;
+ disconnect con1;
+ create user foo;
+ grant select,update on test.t1 to foo;
+ connect foo,localhost,foo;
+ update t1 set a=30 where a=3;
+ disconnect foo;
+ connection default;
+ select * from t2;
+ c d
+ 5 2
+ 4 10
+ 6 30
+ drop table t2, t1;
+ drop user foo;
+ create table t1 (f1 int primary key) engine=innodb;
+ create table t2 (f2 int primary key) engine=innodb;
+ create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+ insert into t1 values (1),(2),(3),(4),(5);
+ insert into t2 values (1),(2),(3),(4),(5);
+ insert into t3 values (1),(2),(3),(4),(5);
+ connect con1,localhost,root;
+ set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+ alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+ connection default;
+ set debug_sync='before_execute_sql_command wait_for g1';
+ update t1 set f1 = f1 + 100000 limit 2;
+ connect con2,localhost,root;
+ kill query UPDATE;
+ disconnect con2;
+ connection default;
+ ERROR 70100: Query execution was interrupted
+ set debug_sync='now signal g2';
+ connection con1;
+ show create table t2;
+ Table Create Table
+ t2 CREATE TABLE `t2` (
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f2`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ disconnect con1;
+ connection default;
+ select * from t2 where f2 not in (select f1 from t1);
+ f2
+ select * from t3 where f3 not in (select f2 from t2);
+ f3
+ drop table t3;
+ drop table t2;
+ drop table t1;
+ set debug_sync='reset';
++create table t1 (a int primary key, b int) engine=innodb;
++create table t2 (c int primary key, d int,
++foreign key (d) references t1 (a) on update cascade) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+insert t2 values (4,1),(5,2),(6,3);
+flush table t2 with read lock;
+connect con1,localhost,root;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+update t1 set a=10 where a=1;
+connection default;
+unlock tables;
+connection con1;
+connection default;
+lock table t2 write;
+connection con1;
+delete from t1 where a=2;
+connection default;
+unlock tables;
+connection con1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+connection default;
+unlock tables;
+disconnect con1;
+create user foo;
+grant select,update on test.t1 to foo;
+connect foo,localhost,foo;
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+c d
+5 2
+4 10
+6 30
+drop table t2, t1;
+drop user foo;
diff --cc mysql-test/suite/innodb/r/foreign_key.result
index 5838c3a1fd5,0d04f27f51f..a151651b594
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@@ -1,319 -1,19 +1,338 @@@
+#
+# Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
+# DICT_CREATE_FOREIGN_CONSTR
+#
+create table t1 (f1 int primary key) engine=InnoDB;
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1),
+constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+set foreign_key_checks = 0;
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/c1'
+drop table t2, t1;
+#
+# Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
+# NULL/NOT NULL MISMATCH
+#
+set foreign_key_checks = 1;
+show variables like 'foreign_key_checks';
+Variable_name Value
+foreign_key_checks ON
+CREATE TABLE t1
+(a INT NOT NULL,
+b INT NOT NULL,
+INDEX idx(a)) ENGINE=InnoDB;
+CREATE TABLE t2
+(a INT KEY,
+b INT,
+INDEX ind(b),
+FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
+ENGINE=InnoDB;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ KEY `idx` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `ind` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1, 80);
+INSERT INTO t1 VALUES (2, 81);
+INSERT INTO t1 VALUES (3, 82);
+INSERT INTO t1 VALUES (4, 83);
+INSERT INTO t1 VALUES (5, 84);
+INSERT INTO t2 VALUES (51, 1);
+INSERT INTO t2 VALUES (52, 2);
+INSERT INTO t2 VALUES (53, 3);
+INSERT INTO t2 VALUES (54, 4);
+INSERT INTO t2 VALUES (55, 5);
+SELECT a, b FROM t1 ORDER BY a;
+a b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+53 3
+54 4
+55 5
+INSERT INTO t2 VALUES (56, 6);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
+ALTER TABLE t1 CHANGE a id INT;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+53 3
+54 4
+55 5
+# Operations on child table
+INSERT INTO t2 VALUES (56, 6);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
+UPDATE t2 SET b = 99 WHERE a = 51;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
+DELETE FROM t2 WHERE a = 53;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+54 4
+55 5
+# Operations on parent table
+DELETE FROM t1 WHERE id = 1;
+UPDATE t1 SET id = 50 WHERE id = 5;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+2 81
+3 82
+4 83
+50 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+52 2
+54 4
+55 50
+DROP TABLE t2, t1;
+#
+# bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART
+# base bug#24818604 [GR]
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+SELECT * FROM t1;
+c1
+1
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+DROP TABLE t2;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE staff (
+staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+store_id TINYINT UNSIGNED NOT NULL,
+PRIMARY KEY (staff_id),
+KEY idx_fk_store_id (store_id),
+CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE store (
+store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+manager_staff_id TINYINT UNSIGNED NOT NULL,
+PRIMARY KEY (store_id),
+UNIQUE KEY idx_unique_manager (manager_staff_id),
+CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=DEFAULT;
+LOCK TABLE staff WRITE;
+UNLOCK TABLES;
+DROP TABLES staff, store;
+SET FOREIGN_KEY_CHECKS=1;
+#
+# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
+#
+CREATE TABLE users (
+id int unsigned AUTO_INCREMENT PRIMARY KEY,
+name varchar(32) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_groups (
+id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
+host_user_id int unsigned NOT NULL UNIQUE,
+CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_group_users (
+matchmaking_group_id bigint unsigned NOT NULL,
+user_id int unsigned NOT NULL,
+PRIMARY KEY (matchmaking_group_id,user_id),
+UNIQUE KEY user_id (user_id),
+CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT FOREIGN KEY (user_id)
+REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_group_maps (
+matchmaking_group_id bigint unsigned NOT NULL,
+map_id tinyint unsigned NOT NULL,
+PRIMARY KEY (matchmaking_group_id,map_id),
+CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar');
+INSERT INTO matchmaking_groups VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_users VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
+BEGIN;
+UPDATE users SET name = 'qux' WHERE id = 1;
+connect con1,localhost,root,,;
+SET innodb_lock_wait_timeout= 1;
+DELETE FROM matchmaking_groups WHERE id = 10;
+connection default;
+COMMIT;
+SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+matchmaking_group_id user_id
+SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+matchmaking_group_id map_id
+SELECT * FROM users;
+id name
+1 qux
+2 bar
+DROP TABLE
+matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users;
+#
+# MDEV-13331 FK DELETE CASCADE does not honor innodb_lock_wait_timeout
+#
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id INT NOT NULL PRIMARY KEY,
+ref_id INT NOT NULL DEFAULT 0,
+f INT NULL,
+FOREIGN KEY (ref_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1,1,10),(2,2,20);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `ref_id` int(11) NOT NULL DEFAULT 0,
+ `f` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `ref_id` (`ref_id`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`ref_id`) REFERENCES `t1` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+connection con1;
+BEGIN;
+UPDATE t2 SET f = 11 WHERE id = 1;
+connection default;
+SET innodb_lock_wait_timeout= 1;
+DELETE FROM t1 WHERE id = 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con1;
+COMMIT;
+disconnect con1;
+connection default;
+SELECT * FROM t2;
+id ref_id f
+1 1 11
+2 2 20
+DELETE FROM t1 WHERE id = 1;
+SELECT * FROM t2;
+id ref_id f
+2 2 20
+DROP TABLE t2, t1;
+#
+# MDEV-15199 Referential integrity broken in ON DELETE CASCADE
+#
+CREATE TABLE member (id int AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO member VALUES (1);
+CREATE TABLE address (
+id int AUTO_INCREMENT PRIMARY KEY,
+member_id int NOT NULL,
+KEY address_FI_1 (member_id),
+CONSTRAINT address_FK_1 FOREIGN KEY (member_id) REFERENCES member (id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO address VALUES (2,1);
+CREATE TABLE payment_method (
+id int AUTO_INCREMENT PRIMARY KEY,
+member_id int NOT NULL,
+cardholder_address_id int DEFAULT NULL,
+KEY payment_method_FI_1 (member_id),
+KEY payment_method_FI_2 (cardholder_address_id),
+CONSTRAINT payment_method_FK_1 FOREIGN KEY (member_id) REFERENCES member (id) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT payment_method_FK_2 FOREIGN KEY (cardholder_address_id) REFERENCES address (id) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO payment_method VALUES (3,1,2);
+BEGIN;
+UPDATE member SET id=42;
+SELECT * FROM member;
+id
+42
+SELECT * FROM address;
+id member_id
+2 42
+SELECT * FROM payment_method;
+id member_id cardholder_address_id
+3 42 2
+DELETE FROM member;
+COMMIT;
+SELECT * FROM member;
+id
+SELECT * FROM address;
+id member_id
+SELECT * FROM payment_method;
+id member_id cardholder_address_id
+DROP TABLE payment_method,address,member;
+#
+# Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY
+# PRODUCE BROKEN TABLE (no bug in MariaDB)
+#
+create table t1(f1 int,f2 int, primary key(f1), key(f2, f1))engine=innodb;
+create table t2(f1 int, f2 int as (2) stored, f3 int as (f2) stored,
+foreign key(f1) references t1(f2) on update set NULL)
+engine=innodb;
+insert into t1 values(1, 1);
+insert into t2(f1) values(1);
+drop table t2, t1;
+ SET FOREIGN_KEY_CHECKS=0;
+ CREATE TABLE staff (
+ staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ store_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (staff_id),
+ KEY idx_fk_store_id (store_id),
+ CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ CREATE TABLE store (
+ store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ manager_staff_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (store_id),
+ UNIQUE KEY idx_unique_manager (manager_staff_id),
+ CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ SET FOREIGN_KEY_CHECKS=DEFAULT;
+ LOCK TABLE staff WRITE;
+ UNLOCK TABLES;
+ DROP TABLES staff, store;
diff --cc mysql-test/suite/innodb/r/innodb-lock.result
index e63a7cd1505,5806535d6f0..1fe0d263fef
--- a/mysql-test/suite/innodb/r/innodb-lock.result
+++ b/mysql-test/suite/innodb/r/innodb-lock.result
@@@ -2,21 -2,15 +2,18 @@@ set global innodb_table_locks=1
select @@innodb_table_locks;
@@innodb_table_locks
1
- connect con1,localhost,root,,;
- connect con2,localhost,root,,;
- drop table if exists t1;
set @@innodb_table_locks=1;
- connection con1;
++connect con1,localhost,root,,;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
- connection con2;
++connect con2,localhost,root,,;
set autocommit=0;
lock table t1 write;
+connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
@@@ -115,14 -104,36 +112,50 @@@ INSERT IGNORE INTO t1 VALUES(3,23)
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 FOR UPDATE;
+connection con2;
++disconnect con2;
+connection default;
COMMIT;
+connection con1;
a b
3 1
COMMIT;
- disconnect con1;
- disconnect con2;
+connection default;
DROP TABLE t1;
+ #
+ # MDEV-11080 InnoDB: Failing assertion:
+ # table->n_waiting_or_granted_auto_inc_locks > 0
+ #
+ CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+ INSERT INTO t1 VALUES (NULL),(NULL);
+ CREATE TABLE t2 LIKE t1;
+ BEGIN;
++connection con1;
+ BEGIN;
+ DELETE FROM t2;
++connection default;
+ LOCK TABLE t2 READ;;
++connection con1;
+ SET innodb_lock_wait_timeout= 1, lock_wait_timeout= 2;
+ INSERT INTO t2 SELECT * FROM t1;
+ COMMIT;
++connection default;
+ UNLOCK TABLES;
+ DROP TABLE t1, t2;
+ #
+ # MDEV-16709 InnoDB: Error: trx already had an AUTO-INC lock
+ #
+ CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
+ PARTITION BY key (pk) PARTITIONS 2;
+ CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+ INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6);
+ CREATE TABLE t3 (b INT) ENGINE=InnoDB;
+ INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
++connection con1;
+ INSERT t1 SELECT NULL FROM t2;
++connection default;
+ INSERT t1 SELECT NULL FROM t3;
++connection con1;
++disconnect con1;
++connection default;
+ DROP TABLE t1, t2, t3;
diff --cc mysql-test/suite/innodb/t/foreign-keys.test
index e77e1e761c7,7ef440b260b..35da5a5d075
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@@ -35,38 -38,76 +38,122 @@@ create table t2 (c int primary key, d i
insert t1 values (1,1),(2,2),(3,3);
insert t2 values (4,1),(5,2),(6,3);
flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
+ connect (con1,localhost,root);
+ --error ER_ROW_IS_REFERENCED_2
+ delete from t1 where a=2;
+ send update t1 set a=10 where a=1;
+ connection default;
+ let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+ source include/wait_condition.inc;
+ unlock tables;
+ connection con1;
+ reap;
+ connection default;
+ lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
+ connection con1;
+ send delete from t1 where a=2;
+ connection default;
+ let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+ source include/wait_condition.inc;
+ unlock tables;
+ connection con1;
+ --error ER_ROW_IS_REFERENCED_2
+ reap;
+ connection default;
+ unlock tables;
+ disconnect con1;
+
+ # but privileges should not be checked
+ create user foo;
+ grant select,update on test.t1 to foo;
+ connect(foo,localhost,foo);
+ update t1 set a=30 where a=3;
+ disconnect foo;
+ connection default;
+ select * from t2;
+ drop table t2, t1;
+ drop user foo;
+
+ #
+ # MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
+ #
+ create table t1 (f1 int primary key) engine=innodb;
+ create table t2 (f2 int primary key) engine=innodb;
+ create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+ insert into t1 values (1),(2),(3),(4),(5);
+ insert into t2 values (1),(2),(3),(4),(5);
+ insert into t3 values (1),(2),(3),(4),(5);
+ connect con1,localhost,root;
+ set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+ send alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+ connection default;
+ let $conn=`select connection_id()`;
+ set debug_sync='before_execute_sql_command wait_for g1';
+ send update t1 set f1 = f1 + 100000 limit 2;
+ connect con2,localhost,root;
+ let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock' and info like 'update t1 %';
+ source include/wait_condition.inc;
+ --replace_result $conn UPDATE
+ eval kill query $conn;
+ disconnect con2;
+ connection default;
+ error ER_QUERY_INTERRUPTED;
+ reap;
+ set debug_sync='now signal g2';
+ connection con1;
+ reap;
+ show create table t2;
+ disconnect con1;
+ connection default;
+ select * from t2 where f2 not in (select f1 from t1);
+ select * from t3 where f3 not in (select f2 from t2);
+ drop table t3;
+ drop table t2;
+ drop table t1;
+ set debug_sync='reset';
++
++#
++# FK and prelocking:
++# child table accesses (reads and writes) wait for locks.
++#
++create table t1 (a int primary key, b int) engine=innodb;
++create table t2 (c int primary key, d int,
++ foreign key (d) references t1 (a) on update cascade) engine=innodb;
++insert t1 values (1,1),(2,2),(3,3);
++insert t2 values (4,1),(5,2),(6,3);
++flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
+connect (con1,localhost,root);
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where a=2;
+send update t1 set a=10 where a=1;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+reap;
+connection default;
+lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
+connection con1;
+send delete from t1 where a=2;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+--error ER_ROW_IS_REFERENCED_2
+reap;
+connection default;
+unlock tables;
+disconnect con1;
+
+# but privileges should not be checked
+create user foo;
+grant select,update on test.t1 to foo;
+connect(foo,localhost,foo);
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+drop table t2, t1;
+drop user foo;
diff --cc mysql-test/suite/innodb/t/foreign_key.test
index b586f3e9406,223a1596883..7a8a9295ee7
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@@ -1,291 -1,25 +1,315 @@@
--source include/have_innodb.inc
+--source include/count_sessions.inc
+
+--echo #
+--echo # Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
+--echo # DICT_CREATE_FOREIGN_CONSTR
+--echo #
+
+create table t1 (f1 int primary key) engine=InnoDB;
+--error ER_CANT_CREATE_TABLE
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1),
+constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
+create table t2 (f1 int primary key,
+ constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+
+set foreign_key_checks = 0;
+--error ER_DUP_CONSTRAINT_NAME
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+
+drop table t2, t1;
+
+--echo #
+--echo # Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
+--echo # NULL/NOT NULL MISMATCH
+--echo #
+
+set foreign_key_checks = 1;
+show variables like 'foreign_key_checks';
+
+CREATE TABLE t1
+(a INT NOT NULL,
+ b INT NOT NULL,
+ INDEX idx(a)) ENGINE=InnoDB;
+
+CREATE TABLE t2
+(a INT KEY,
+ b INT,
+ INDEX ind(b),
+ FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
+ ENGINE=InnoDB;
+
+show create table t1;
+show create table t2;
+
+INSERT INTO t1 VALUES (1, 80);
+INSERT INTO t1 VALUES (2, 81);
+INSERT INTO t1 VALUES (3, 82);
+INSERT INTO t1 VALUES (4, 83);
+INSERT INTO t1 VALUES (5, 84);
+
+INSERT INTO t2 VALUES (51, 1);
+INSERT INTO t2 VALUES (52, 2);
+INSERT INTO t2 VALUES (53, 3);
+INSERT INTO t2 VALUES (54, 4);
+INSERT INTO t2 VALUES (55, 5);
+
+SELECT a, b FROM t1 ORDER BY a;
+SELECT a, b FROM t2 ORDER BY a;
+
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (56, 6);
+
+ALTER TABLE t1 CHANGE a id INT;
+
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+--echo # Operations on child table
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (56, 6);
+--error ER_NO_REFERENCED_ROW_2
+UPDATE t2 SET b = 99 WHERE a = 51;
+DELETE FROM t2 WHERE a = 53;
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+--echo # Operations on parent table
+DELETE FROM t1 WHERE id = 1;
+UPDATE t1 SET id = 50 WHERE id = 5;
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+DROP TABLE t2, t1;
+
+--echo #
+--echo # bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART
+--echo # base bug#24818604 [GR]
+--echo #
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1))
+ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+--source include/restart_mysqld.inc
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+SELECT * FROM t1;
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
+#
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE staff (
+ staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ store_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (staff_id),
+ KEY idx_fk_store_id (store_id),
+ CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE store (
+ store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ manager_staff_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (store_id),
+ UNIQUE KEY idx_unique_manager (manager_staff_id),
+ CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=DEFAULT;
+
+LOCK TABLE staff WRITE;
+UNLOCK TABLES;
+DROP TABLES staff, store;
+SET FOREIGN_KEY_CHECKS=1;
+
+--echo #
+--echo # MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
+--echo #
+
+CREATE TABLE users (
+ id int unsigned AUTO_INCREMENT PRIMARY KEY,
+ name varchar(32) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_groups (
+ id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
+ host_user_id int unsigned NOT NULL UNIQUE,
+ CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_group_users (
+ matchmaking_group_id bigint unsigned NOT NULL,
+ user_id int unsigned NOT NULL,
+ PRIMARY KEY (matchmaking_group_id,user_id),
+ UNIQUE KEY user_id (user_id),
+ CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+ REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT FOREIGN KEY (user_id)
+ REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_group_maps (
+ matchmaking_group_id bigint unsigned NOT NULL,
+ map_id tinyint unsigned NOT NULL,
+ PRIMARY KEY (matchmaking_group_id,map_id),
+ CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+ REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar');
+INSERT INTO matchmaking_groups VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_users VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
+
+BEGIN;
+UPDATE users SET name = 'qux' WHERE id = 1;
+
+--connect (con1,localhost,root,,)
+SET innodb_lock_wait_timeout= 1;
+DELETE FROM matchmaking_groups WHERE id = 10;
+
+--connection default
+COMMIT;
+--sorted_result
+SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+--sorted_result
+SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+--sorted_result
+SELECT * FROM users;
+
+DROP TABLE
+matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users;
+
+--echo #
+--echo # MDEV-13331 FK DELETE CASCADE does not honor innodb_lock_wait_timeout
+--echo #
+
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ id INT NOT NULL PRIMARY KEY,
+ ref_id INT NOT NULL DEFAULT 0,
+ f INT NULL,
+ FOREIGN KEY (ref_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1,1,10),(2,2,20);
+
+SHOW CREATE TABLE t2;
+
+--connection con1
+BEGIN;
+UPDATE t2 SET f = 11 WHERE id = 1;
+
+--connection default
+SET innodb_lock_wait_timeout= 1;
+--error ER_LOCK_WAIT_TIMEOUT
+DELETE FROM t1 WHERE id = 1;
+
+--connection con1
+COMMIT;
+--disconnect con1
+
+--connection default
+SELECT * FROM t2;
+DELETE FROM t1 WHERE id = 1;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-15199 Referential integrity broken in ON DELETE CASCADE
+--echo #
+
+CREATE TABLE member (id int AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO member VALUES (1);
+CREATE TABLE address (
+ id int AUTO_INCREMENT PRIMARY KEY,
+ member_id int NOT NULL,
+ KEY address_FI_1 (member_id),
+ CONSTRAINT address_FK_1 FOREIGN KEY (member_id) REFERENCES member (id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO address VALUES (2,1);
+CREATE TABLE payment_method (
+ id int AUTO_INCREMENT PRIMARY KEY,
+ member_id int NOT NULL,
+ cardholder_address_id int DEFAULT NULL,
+ KEY payment_method_FI_1 (member_id),
+ KEY payment_method_FI_2 (cardholder_address_id),
+ CONSTRAINT payment_method_FK_1 FOREIGN KEY (member_id) REFERENCES member (id) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT payment_method_FK_2 FOREIGN KEY (cardholder_address_id) REFERENCES address (id) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO payment_method VALUES (3,1,2);
+
+BEGIN;
+UPDATE member SET id=42;
+SELECT * FROM member;
+SELECT * FROM address;
+SELECT * FROM payment_method;
+DELETE FROM member;
+COMMIT;
+SELECT * FROM member;
+SELECT * FROM address;
+SELECT * FROM payment_method;
+
+DROP TABLE payment_method,address,member;
+
+--echo #
+--echo # Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY
+--echo # PRODUCE BROKEN TABLE (no bug in MariaDB)
+--echo #
+create table t1(f1 int,f2 int, primary key(f1), key(f2, f1))engine=innodb;
+create table t2(f1 int, f2 int as (2) stored, f3 int as (f2) stored,
+ foreign key(f1) references t1(f2) on update set NULL)
+engine=innodb;
+insert into t1 values(1, 1);
+insert into t2(f1) values(1);
+drop table t2, t1;
+
+--source include/wait_until_count_sessions.inc
+
+ #
+ # MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
+ #
+ SET FOREIGN_KEY_CHECKS=0;
+ CREATE TABLE staff (
+ staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ store_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (staff_id),
+ KEY idx_fk_store_id (store_id),
+ CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ CREATE TABLE store (
+ store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ manager_staff_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (store_id),
+ UNIQUE KEY idx_unique_manager (manager_staff_id),
+ CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ SET FOREIGN_KEY_CHECKS=DEFAULT;
+
+ LOCK TABLE staff WRITE;
+ UNLOCK TABLES;
+ DROP TABLES staff, store;
diff --cc mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
index 120ae018d2f,efe8155ec08..7f2a82f1efb
--- a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
@@@ -40,11 -36,8 +40,10 @@@ connection master
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS t1,t2,t3;
SET FOREIGN_KEY_CHECKS=1;
+connection slave;
+connection master;
create table t1 (b int primary key) engine = INNODB;
- create table t2 (a int primary key, b int, foreign key (b) references t1(b))
- engine = INNODB;
+ create table t2 (a int primary key, b int, foreign key (b) references t1(b)) engine = INNODB;
insert into t1 set b=1;
insert into t2 set a=1, b=1;
set foreign_key_checks=0;
diff --cc mysql-test/suite/wsrep/include/check_galera_version.inc
index e495da8f1ee,fd691161a54..32d01197f94
--- a/mysql-test/suite/wsrep/include/check_galera_version.inc
+++ b/mysql-test/suite/wsrep/include/check_galera_version.inc
@@@ -20,20 -21,23 +21,23 @@@ SELECT CAST(REGEXP_REPLACE(@GALERA_VERS
# Actual
SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version';
-
- SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MAJOR_VERSION;
- SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
-SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
-SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
++SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*(\\d+)\\.\\d+.*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
++SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
# For testing
- #SELECT @GALERA_MAJOR_VERSION, @GALERA_MINOR_VERSION;
+ #SELECT @GALERA_MAJOR_VERSION;
+ #SELECT @GALERA_MINOR_VERSION;
+ #SELECT @GALERA_RELEASE_VERSION;
#SELECT @ACTUAL_GALERA_VERSION;
- #SELECT @ACTUAL_GALERA_MAJOR_VERSION, @ACTUAL_GALERA_MINOR_VERSION;
+ #SELECT @ACTUAL_GALERA_MINOR_VERSION;
+ #SELECT @ACTUAL_GALERA_RELEASE_VERSION;
- if (!`SELECT (@ACTUAL_GALERA_MAJOR_VERSION > @GALERA_MAJOR_VERSION) OR
- (@ACTUAL_GALERA_MAJOR_VERSION = @GALERA_MAJOR_VERSION AND @ACTUAL_GALERA_MINOR_VERSION >= @GALERA_MINOR_VERSION)
+ if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR
+ (@ACTUAL_GALERA_MINOR_VERSION = @GALERA_MINOR_VERSION AND
+ @ACTUAL_GALERA_RELEASE_VERSION >= @GALERA_RELEASE_VERSION)
`)
{
- skip Test requires Galera library version $galera_version;
+ skip Test requires Galera library version >= $galera_version;
}
--enable_query_log
diff --cc scripts/wsrep_sst_rsync.sh
index 17f000324c8,1b42903e094..73b1f4f649d
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@@ -175,8 -157,15 +190,15 @@@ f
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')
# New filter - exclude everything except dirs (schemas) and innodb files
- FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes'
- -f '+ /wsrep_sst_binlog.tar' -f '- $INNODB_DATA_HOME_DIR/ib_lru_dump' -f '- $INNODB_DATA_HOME_DIR/ibdata*' -f '+ /*/' -f '- /*'"
-FILTER=(-f '- /lost+found'
++FILTER="-f '- /lost+found'
+ -f '- /.fseventsd'
+ -f '- /.Trashes'
+ -f '+ /wsrep_sst_binlog.tar'
+ -f '- $INNODB_DATA_HOME_DIR/ib_lru_dump'
+ -f '- $INNODB_DATA_HOME_DIR/ibdata*'
+ -f '+ /undo*'
+ -f '+ /*/'
- -f '- /*')
++ -f '- /*'"
SSTKEY=$(parse_cnf sst tkey "")
SSTCERT=$(parse_cnf sst tcert "")
diff --cc sql/field.cc
index 9ca9663f066,ecb383a9575..a1a8ca41698
--- a/sql/field.cc
+++ b/sql/field.cc
@@@ -9815,15 -9782,20 +9815,20 @@@ void Column_definition::create_length_t
}
break;
case MYSQL_TYPE_NEWDECIMAL:
- key_length= pack_length=
- my_decimal_get_binary_size(my_decimal_length_to_precision((uint)length,
- decimals,
- flags &
- UNSIGNED_FLAG),
- decimals);
+ {
+ /*
+ This code must be identical to code in
+ Field_new_decimal::Field_new_decimal as otherwise the record layout
+ gets out of sync.
+ */
- uint precision= my_decimal_length_to_precision(length, decimals,
++ uint precision= my_decimal_length_to_precision((uint)length, decimals,
+ flags & UNSIGNED_FLAG);
+ set_if_smaller(precision, DECIMAL_MAX_PRECISION);
+ key_length= pack_length= my_decimal_get_binary_size(precision, decimals);
break;
+ }
default:
- key_length= pack_length= calc_pack_length(sql_type, length);
+ key_length= pack_length= calc_pack_length(sql_type, (uint)length);
break;
}
}
diff --cc sql/log.cc
index fa1fe3d808c,767070799a9..053c0f16c6c
--- a/sql/log.cc
+++ b/sql/log.cc
@@@ -1668,14 -1677,14 +1668,14 @@@ static int binlog_close_connection(hand
uchar *buf;
size_t len=0;
wsrep_write_cache_buf(cache, &buf, &len);
- WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lld",
- (ulong) len, (longlong) thd->thread_id);
- WSREP_WARN("binlog trx cache not empty (%zu bytes) @ connection close %lu",
- len, thd->thread_id);
++ WSREP_WARN("binlog trx cache not empty (%zu bytes) @ connection close %lld",
++ len, (longlong) thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
cache = cache_mngr->get_binlog_cache_log(false);
wsrep_write_cache_buf(cache, &buf, &len);
- WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lld",
- (ulong) len, (longlong) thd->thread_id);
- WSREP_WARN("binlog stmt cache not empty (%zu bytes) @ connection close %lu",
- len, thd->thread_id);
++ WSREP_WARN("binlog stmt cache not empty (%zu bytes) @ connection close %lld",
++ len, (longlong) thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
}
#endif /* WITH_WSREP */
diff --cc sql/log_event.cc
index ff3efcc62a3,e1912ad4620..04a616d0006
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@@ -8726,12 -7911,7 +8726,7 @@@ User_var_log_event(const char* buf, uin
Old events will not have this extra byte, thence,
we keep the flags set to UNDEF_F.
*/
- uint bytes_read= ((val + val_len) - buf_start);
+ size_t bytes_read= (val + val_len) - buf_start;
- if (bytes_read > size_t(event_len))
- {
- error= true;
- goto err;
- }
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
diff --cc sql/sql_alter.cc
index dbb138ed9ab,0accc04c10d..c8bc3952b61
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@@ -306,12 -305,19 +306,17 @@@ bool Sql_cmd_alter_table::execute(THD *
thd->enable_slow_log= opt_log_slow_admin_statements;
#ifdef WITH_WSREP
- if ((!thd->is_current_stmt_binlog_format_row() ||
- TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
-
+ if (WSREP(thd) &&
+ (!thd->is_current_stmt_binlog_format_row() ||
- !find_temporary_table(thd, first_table)))
+ !thd->find_temporary_table(first_table)))
{
- WSREP_TO_ISOLATION_BEGIN(((lex->name.str) ? select_lex->db : NULL),
- ((lex->name.str) ? lex->name.str : NULL),
- first_table);
+ WSREP_TO_ISOLATION_BEGIN_ALTER(((lex->name.str) ? select_lex->db : NULL),
+ ((lex->name.str) ? lex->name.str : NULL),
+ first_table,
+ &alter_info);
+
+ thd->variables.auto_increment_offset = 1;
+ thd->variables.auto_increment_increment = 1;
}
#endif /* WITH_WSREP */
diff --cc sql/sql_base.cc
index cae5b4a3f7d,dc1122ffad8..52474116fa6
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@@ -1460,6 -2122,66 +1461,66 @@@ open_table_get_mdl_lock(THD *thd, Open_
}
+ /**
+ Check if the given table is actually a VIEW that was LOCK-ed
+
+ @param thd Thread context.
+ @param t Table to check.
+
+ @retval TRUE The 't'-table is a locked view
+ needed to remedy problem before retrying again.
+ @retval FALSE 't' was not locked, not a VIEW or an error happened.
+ */
+ bool is_locked_view(THD *thd, TABLE_LIST *t)
+ {
+ DBUG_ENTER("check_locked_view");
+ /*
+ Is this table a view and not a base table?
+ (it is work around to allow to open view with locked tables,
+ real fix will be made after definition cache will be made)
+
+ Since opening of view which was not explicitly locked by LOCK
+ TABLES breaks metadata locking protocol (potentially can lead
+ to deadlocks) it should be disallowed.
+ */
+ if (thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+ t->db, t->table_name,
+ MDL_SHARED))
+ {
+ char path[FN_REFLEN + 1];
+ build_table_filename(path, sizeof(path) - 1,
+ t->db, t->table_name, reg_ext, 0);
+ /*
+ Note that we can't be 100% sure that it is a view since it's
+ possible that we either simply have not found unused TABLE
+ instance in THD::open_tables list or were unable to open table
+ during prelocking process (in this case in theory we still
+ should hold shared metadata lock on it).
+ */
+ if (dd_frm_is_view(thd, path))
+ {
+ /*
+ If parent_l of the table_list is non null then a merge table
+ has this view as child table, which is not supported.
+ */
+ if (t->parent_l)
+ {
+ my_error(ER_WRONG_MRG_TABLE, MYF(0));
+ DBUG_RETURN(FALSE);
+ }
+
- if (!tdc_open_view(thd, t, t->alias, CHECK_METADATA_VERSION))
++ if (!tdc_open_view(thd, t, CHECK_METADATA_VERSION))
+ {
+ DBUG_ASSERT(t->view != 0);
+ DBUG_RETURN(TRUE); // VIEW
+ }
+ }
+ }
+
+ DBUG_RETURN(FALSE);
+ }
+
+
/**
Open a base table.
@@@ -4213,8 -4874,8 +4246,9 @@@ handle_routine(THD *thd, Query_tables_l
@note this can be changed to use a hash, instead of scanning the linked
list, if the performance of this function will ever become an issue
*/
- static bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
- LEX_STRING *table, thr_lock_type lock_type)
++
+ bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
+ LEX_STRING *table, thr_lock_type lock_type)
{
for (; tl; tl= tl->next_global )
{
diff --cc sql/sql_base.h
index 4f99111cbd9,94294e3aa43..37cc9e8e8f1
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@@ -138,8 -145,11 +139,10 @@@ thr_lock_type read_lock_type_for_table(
bool routine_modifies_data);
my_bool mysql_rm_tmp_tables(void);
-bool rm_temporary_table(handlerton *base, const char *path);
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
const MDL_savepoint &start_of_statement_svp);
+ bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
+ LEX_STRING *table, thr_lock_type lock_type);
TABLE_LIST *find_table_in_list(TABLE_LIST *table,
TABLE_LIST *TABLE_LIST::*link,
const char *db_name,
@@@ -295,8 -332,11 +298,9 @@@ bool tdc_open_view(THD *thd, TABLE_LIS
TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
const char *table_name,
- bool no_error);
+ int *p_error);
+ void mark_tmp_table_for_reuse(TABLE *table);
-int update_virtual_fields(THD *thd, TABLE *table,
- enum enum_vcol_update_mode vcol_update_mode= VCOL_UPDATE_FOR_READ);
int dynamic_column_error_message(enum_dyncol_func_result rc);
/* open_and_lock_tables with optional derived handling */
diff --cc sql/sql_parse.cc
index dd16200539d,add059340c9..3231c4b730f
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@@ -7797,9 -7262,10 +7797,11 @@@ static void wsrep_mysql_parse(THD *thd
"WAIT_FOR wsrep_retry_autocommit_continue";
DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
});
+ WSREP_DEBUG("Retry autocommit query: %s", thd->query());
}
+
- mysql_parse(thd, rawbuf, length, parser_state);
+ mysql_parse(thd, rawbuf, length, parser_state, is_com_multi,
+ is_next_command);
if (WSREP(thd)) {
/* wsrep BF abort in query exec phase */
diff --cc sql/sql_table.cc
index dbcab9bb870,da65f168d84..4aed06e3590
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@@ -3371,75 -3464,6 +3371,79 @@@ mysql_prepare_create_table(THD *thd, HA
if (prepare_blob_field(thd, sql_field))
DBUG_RETURN(TRUE);
+ /*
+ Convert the default value from client character
+ set into the column character set if necessary.
+ We can only do this for constants as we have not yet run fix_fields.
+ */
+ if (sql_field->default_value &&
+ sql_field->default_value->expr->basic_const_item() &&
+ (!sql_field->field ||
+ sql_field->field->default_value != sql_field->default_value) &&
+ save_cs != sql_field->default_value->expr->collation.collation &&
+ (sql_field->sql_type == MYSQL_TYPE_VAR_STRING ||
+ sql_field->sql_type == MYSQL_TYPE_STRING ||
+ sql_field->sql_type == MYSQL_TYPE_SET ||
+ sql_field->sql_type == MYSQL_TYPE_TINY_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_MEDIUM_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_LONG_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_ENUM))
+ {
+ Item *item;
+ if (!(item= sql_field->default_value->expr->
+ safe_charset_converter(thd, save_cs)))
+ {
+ /* Could not convert */
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(TRUE);
+ }
+ /* Fix for prepare statement */
+ thd->change_item_tree(&sql_field->default_value->expr, item);
+ }
+
++ /* Virtual fields are always NULL */
++ if (sql_field->vcol_info)
++ sql_field->flags&= ~NOT_NULL_FLAG;
++
+ if (sql_field->default_value &&
+ sql_field->default_value->expr->basic_const_item() &&
+ (sql_field->sql_type == MYSQL_TYPE_SET ||
+ sql_field->sql_type == MYSQL_TYPE_ENUM))
+ {
+ StringBuffer<MAX_FIELD_WIDTH> str;
+ String *def= sql_field->default_value->expr->val_str(&str);
+ bool not_found;
+ if (def == NULL) /* SQL "NULL" maps to NULL */
+ {
+ not_found= sql_field->flags & NOT_NULL_FLAG;
+ }
+ else
+ {
+ not_found= false;
+ if (sql_field->sql_type == MYSQL_TYPE_SET)
+ {
+ char *not_used;
+ uint not_used2;
+ find_set(sql_field->interval, def->ptr(), def->length(),
+ sql_field->charset, ¬_used, ¬_used2, ¬_found);
+ }
+ else /* MYSQL_TYPE_ENUM */
+ {
+ def->length(sql_field->charset->cset->lengthsp(sql_field->charset,
+ def->ptr(), def->length()));
+ not_found= !find_type2(sql_field->interval, def->ptr(),
+ def->length(), sql_field->charset);
+ }
+ }
+
+ if (not_found)
+ {
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(TRUE);
+ }
+ }
+
if (!(sql_field->flags & NOT_NULL_FLAG))
null_fields++;
@@@ -9477,27 -9132,73 +9481,79 @@@ bool mysql_alter_table(THD *thd,char *n
tbl.init_one_table(alter_ctx.new_db, strlen(alter_ctx.new_db),
alter_ctx.tmp_name, strlen(alter_ctx.tmp_name),
alter_ctx.tmp_name, TL_READ_NO_INSERT);
- /* Table is in thd->temporary_tables */
- if (open_temporary_table(thd, &tbl))
+ /*
+ Table can be found in the list of open tables in THD::all_temp_tables
+ list.
+ */
- tbl.table= thd->find_temporary_table(&tbl);
++ if ((tbl.table= thd->find_temporary_table(&tbl)) == NULL)
+ goto err_new_table_cleanup;
new_table= tbl.table;
+ DBUG_ASSERT(new_table);
}
else
{
- /* table is a normal table: Create temporary table in same directory */
- /* Open our intermediate table. */
- new_table= open_table_uncached(thd, new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db, alter_ctx.tmp_name,
- true, true);
+ /*
+ table is a normal table: Create temporary table in same directory.
+ Open our intermediate table.
+ */
+ new_table=
+ thd->create_and_open_tmp_table(new_db_type, &frm,
+ alter_ctx.get_tmp_path(),
+ alter_ctx.new_db, alter_ctx.tmp_name,
+ true);
+ if (!new_table)
+ goto err_new_table_cleanup;
+
+ /*
+ Normally, an attempt to modify an FK parent table will cause
+ FK children to be prelocked, so the table-being-altered cannot
+ be modified by a cascade FK action, because ALTER holds a lock
+ and prelocking will wait.
+
+ But if a new FK is being added by this very ALTER, then the target
+ table is not locked yet (it's a temporary table). So, we have to
+ lock FK parents explicitly.
+ */
+ if (alter_info->flags & Alter_info::ADD_FOREIGN_KEY)
+ {
+ List <FOREIGN_KEY_INFO> fk_list;
+ List_iterator<FOREIGN_KEY_INFO> fk_list_it(fk_list);
+ FOREIGN_KEY_INFO *fk;
+
+ /* tables_opened can be > 1 only for MERGE tables */
+ DBUG_ASSERT(tables_opened == 1);
+ DBUG_ASSERT(&table_list->next_global == thd->lex->query_tables_last);
+
+ new_table->file->get_foreign_key_list(thd, &fk_list);
+ while ((fk= fk_list_it++))
+ {
+ if (lower_case_table_names)
+ {
+ char buf[NAME_LEN];
+ uint len;
+ strmake_buf(buf, fk->referenced_db->str);
+ len = my_casedn_str(files_charset_info, buf);
+ thd->make_lex_string(fk->referenced_db, buf, len);
+ strmake_buf(buf, fk->referenced_table->str);
+ len = my_casedn_str(files_charset_info, buf);
+ thd->make_lex_string(fk->referenced_table, buf, len);
+ }
+ if (table_already_fk_prelocked(table_list, fk->referenced_db,
+ fk->referenced_table, TL_READ_NO_INSERT))
+ continue;
+
+ TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
+ tl->init_one_table_for_prelocking(fk->referenced_db->str, fk->referenced_db->length,
+ fk->referenced_table->str, fk->referenced_table->length,
+ NULL, TL_READ_NO_INSERT, false, NULL, 0,
+ &thd->lex->query_tables_last);
+ }
+
+ if (open_tables(thd, &table_list->next_global, &tables_opened, 0,
+ &alter_prelocking_strategy))
+ goto err_new_table_cleanup;
+ }
}
- if (!new_table)
- goto err_new_table_cleanup;
/*
Note: In case of MERGE table, we do not attach children. We do not
copy data for MERGE tables. Only the children have data.
diff --cc sql/table.h
index c0cca1026ea,ca32234579f..fc3102fc9a5
--- a/sql/table.h
+++ b/sql/table.h
@@@ -1507,14 -1517,15 +1507,15 @@@ typedef struct st_foreign_key_inf
} FOREIGN_KEY_INFO;
LEX_CSTRING *fk_option_name(enum_fk_option opt);
+ bool fk_modifies_child(enum_fk_option opt);
-#define MY_I_S_MAYBE_NULL 1
-#define MY_I_S_UNSIGNED 2
+#define MY_I_S_MAYBE_NULL 1U
+#define MY_I_S_UNSIGNED 2U
-#define SKIP_OPEN_TABLE 0 // do not open table
-#define OPEN_FRM_ONLY 1 // open FRM file only
-#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files
+#define SKIP_OPEN_TABLE 0U // do not open table
+#define OPEN_FRM_ONLY 1U // open FRM file only
+#define OPEN_FULL_TABLE 2U // open FRM,MYD, MYI files
typedef struct st_field_info
{
@@@ -1792,6 -1808,6 +1798,7 @@@ struct TABLE_LIS
*last_ptr= &next_global;
}
++
/*
List of tables local to a subquery (used by SQL_I_List). Considers
views as leaves (unlike 'next_leaf' below). Created at parse time
@@@ -2399,9 -2400,17 +2406,19 @@@
return false;
}
void set_lock_type(THD* thd, enum thr_lock_type lock);
+ void check_pushable_cond_for_table(Item *cond);
+ Item *build_pushable_cond_for_table(THD *thd, Item *cond);
+ void remove_join_columns()
+ {
+ if (join_columns)
+ {
+ join_columns->empty();
+ join_columns= NULL;
+ is_join_columns_complete= FALSE;
+ }
+ }
+
private:
bool prep_check_option(THD *thd, uint8 check_opt_type);
bool prep_where(THD *thd, Item **conds, bool no_where_clause);
diff --cc sql/wsrep_mysqld.cc
index 326b5928366,1b2d7fe04e6..0ddc4520cee
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@@ -62,57 -62,44 +62,53 @@@ extern my_bool plugins_are_initialized
extern uint kill_cached_threads;
extern mysql_cond_t COND_thread_cache;
-const char* wsrep_data_home_dir = NULL;
-const char* wsrep_dbug_option = "";
-
-long wsrep_slave_threads = 1; // # of slave action appliers wanted
-int wsrep_slave_count_change = 0; // # of appliers to stop or start
-my_bool wsrep_debug = 0; // enable debug level logging
-my_bool wsrep_convert_LOCK_to_trx = 1; // convert locking sessions to trx
-ulong wsrep_retry_autocommit = 5; // retry aborted autocommit trx
-my_bool wsrep_auto_increment_control = 1; // control auto increment variables
-my_bool wsrep_drupal_282555_workaround = 1; // retry autoinc insert after dupkey
-my_bool wsrep_incremental_data_collection = 0; // incremental data collection
-ulong wsrep_max_ws_size = 1073741824UL;//max ws (RBR buffer) size
-ulong wsrep_max_ws_rows = 65536; // max number of rows in ws
-int wsrep_to_isolation = 0; // # of active TO isolation threads
-my_bool wsrep_certify_nonPK = 1; // certify, even when no primary key
-long wsrep_max_protocol_version = 3; // maximum protocol version to use
-ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC;
-my_bool wsrep_recovery = 0; // recovery
-my_bool wsrep_replicate_myisam = 0; // enable myisam replication
-my_bool wsrep_log_conflicts = 0;
-ulong wsrep_mysql_replication_bundle = 0;
-my_bool wsrep_desync = 0; // desynchronize the node from the
- // cluster
-my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals
-my_bool wsrep_restart_slave = 0; // should mysql slave thread be
- // restarted, if node joins back
-my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
- // restart will be needed
-my_bool wsrep_slave_UK_checks = 0; // slave thread does UK checks
-my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks
-bool wsrep_new_cluster = false; // Bootstrap the cluster ?
-
-// Use wsrep_gtid_domain_id for galera transactions?
-bool wsrep_gtid_mode = 0;
-// gtid_domain_id for galera transactions.
-uint32 wsrep_gtid_domain_id = 0;
-// Allow reads even if the node is not in the primary component.
-bool wsrep_dirty_reads = false;
+/* System variables. */
+const char *wsrep_provider;
+const char *wsrep_provider_options;
+const char *wsrep_cluster_address;
+const char *wsrep_cluster_name;
+const char *wsrep_node_name;
+const char *wsrep_node_address;
+const char *wsrep_node_incoming_address;
+const char *wsrep_start_position;
+const char *wsrep_data_home_dir;
+const char *wsrep_dbug_option;
+const char *wsrep_notify_cmd;
- const char *wsrep_sst_method;
- const char *wsrep_sst_receive_address;
- const char *wsrep_sst_donor;
- const char *wsrep_sst_auth;
++
+my_bool wsrep_debug; // Enable debug level logging
+my_bool wsrep_convert_LOCK_to_trx; // Convert locking sessions to trx
+my_bool wsrep_auto_increment_control; // Control auto increment variables
+my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after dupkey
+my_bool wsrep_certify_nonPK; // Certify, even when no primary key
+my_bool wsrep_recovery; // Recovery
+my_bool wsrep_replicate_myisam; // Enable MyISAM replication
+my_bool wsrep_log_conflicts;
+my_bool wsrep_load_data_splitting; // Commit load data every 10K intervals
+my_bool wsrep_slave_UK_checks; // Slave thread does UK checks
+my_bool wsrep_slave_FK_checks; // Slave thread does FK checks
- my_bool wsrep_sst_donor_rejects_queries;
+my_bool wsrep_restart_slave; // Should mysql slave thread be
+ // restarted, when node joins back?
+my_bool wsrep_desync; // De(re)synchronize the node from the
+ // cluster
+long wsrep_slave_threads; // No. of slave appliers threads
+ulong wsrep_retry_autocommit; // Retry aborted autocommit trx
+ulong wsrep_max_ws_size; // Max allowed ws (RBR buffer) size
+ulong wsrep_max_ws_rows; // Max number of rows in ws
+ulong wsrep_forced_binlog_format;
+ulong wsrep_mysql_replication_bundle;
+bool wsrep_gtid_mode; // Use wsrep_gtid_domain_id
+ // for galera transactions?
+uint32 wsrep_gtid_domain_id; // gtid_domain_id for galera
+ // transactions
+
+/* Other configuration variables and their default values. */
+my_bool wsrep_incremental_data_collection= 0; // Incremental data collection
+my_bool wsrep_restart_slave_activated= 0; // Node has dropped, and slave
+ // restart will be needed
+bool wsrep_new_cluster= false; // Bootstrap the cluster?
+int wsrep_slave_count_change= 0; // No. of appliers to stop/start
+int wsrep_to_isolation= 0; // No. of active TO isolation threads
+long wsrep_max_protocol_version= 3; // Maximum protocol version to use
/*
* End configuration options
@@@ -1395,6 -1408,67 +1431,67 @@@ create_view_query(THD *thd, uchar** buf
return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len);
}
+ /*
+ Rewrite DROP TABLE for TOI. Temporary tables are eliminated from
+ the query as they are visible only to client connection.
+
+ TODO: See comments for sql_base.cc:drop_temporary_table() and refine
+ the function to deal with transactional locked tables.
+ */
+ static int wsrep_drop_table_query(THD* thd, uchar** buf, size_t* buf_len)
+ {
+
+ LEX* lex= thd->lex;
+ SELECT_LEX* select_lex= &lex->select_lex;
+ TABLE_LIST* first_table= select_lex->table_list.first;
+ String buff;
+
+ DBUG_ASSERT(!lex->create_info.tmp_table());
+
+ bool found_temp_table= false;
+ for (TABLE_LIST* table= first_table; table; table= table->next_global)
+ {
- if (find_temporary_table(thd, table->db, table->table_name))
++ if (thd->find_temporary_table(table->db, table->table_name))
+ {
+ found_temp_table= true;
+ break;
+ }
+ }
+
+ if (found_temp_table)
+ {
+ buff.append("DROP TABLE ");
+ if (lex->check_exists)
+ buff.append("IF EXISTS ");
+
+ for (TABLE_LIST* table= first_table; table; table= table->next_global)
+ {
- if (!find_temporary_table(thd, table->db, table->table_name))
++ if (!thd->find_temporary_table(table->db, table->table_name))
+ {
+ append_identifier(thd, &buff, table->db, strlen(table->db));
+ buff.append(".");
+ append_identifier(thd, &buff, table->table_name,
+ strlen(table->table_name));
+ buff.append(",");
+ }
+ }
+
+ /* Chop the last comma */
+ buff.chop();
+ buff.append(" /* generated by wsrep */");
+
+ WSREP_DEBUG("Rewrote '%s' as '%s'", thd->query(), buff.ptr());
+
+ return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len);
+ }
+ else
+ {
+ return wsrep_to_buf_helper(thd, thd->query(), thd->query_length(),
+ buf, buf_len);
+ }
+ }
+
+
/* Forward declarations. */
static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len);
static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
diff --cc sql/wsrep_sst.cc
index 908c0c56685,e2c55583594..3790c81d398
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@@ -37,8 -40,14 +38,14 @@@ static char wsrep_defaults_file[FN_REFL
sizeof(WSREP_SST_OPT_CONF_SUFFIX) +
sizeof(WSREP_SST_OPT_CONF_EXTRA)] = {0};
+ const char* wsrep_sst_method = WSREP_SST_DEFAULT;
+ const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO;
+ const char* wsrep_sst_donor = "";
- char* wsrep_sst_auth = NULL;
++const char* wsrep_sst_auth = NULL;
+
// container for real auth string
static const char* sst_auth_real = NULL;
+ my_bool wsrep_sst_donor_rejects_queries = FALSE;
bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var)
{
@@@ -157,12 -165,13 +163,12 @@@ void wsrep_sst_auth_free(
bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type)
{
-- return sst_auth_real_set (wsrep_sst_auth);
++ return sst_auth_real_set (wsrep_sst_auth);
}
-void wsrep_sst_auth_init (const char* value)
+void wsrep_sst_auth_init ()
{
- DBUG_ASSERT(wsrep_sst_auth == value);
- sst_auth_real_set (wsrep_sst_auth);
+ sst_auth_real_set(wsrep_sst_auth);
}
bool wsrep_sst_donor_check (sys_var *self, THD* thd, set_var* var)
@@@ -172,9 -181,11 +178,11 @@@
bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type)
{
-- return 0;
++ return 0;
}
+ static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
+
bool wsrep_before_SE()
{
return (wsrep_provider != NULL
@@@ -266,99 -277,42 +274,99 @@@ void wsrep_sst_complete (const wsrep_uu
mysql_mutex_unlock (&LOCK_wsrep_sst);
}
-void wsrep_sst_received (wsrep_t* const wsrep,
+/*
+ If wsrep provider is loaded, inform that the new state snapshot
+ has been received. Also update the local checkpoint.
+
+ @param wsrep [IN] wsrep handle
+ @param uuid [IN] Initial state UUID
+ @param seqno [IN] Initial state sequence number
+ @param state [IN] Always NULL, also ignored by wsrep provider (?)
+ @param state_len [IN] Always 0, also ignored by wsrep provider (?)
+ @param implicit [IN] Whether invoked implicitly due to SST
+ (true) or explicitly because if change
+ in wsrep_start_position by user (false).
+ @return false Success
+ true Error
+
+*/
+bool wsrep_sst_received (wsrep_t* const wsrep,
const wsrep_uuid_t& uuid,
- wsrep_seqno_t const seqno,
+ const wsrep_seqno_t seqno,
const void* const state,
- size_t const state_len)
+ const size_t state_len,
+ const bool implicit)
{
- wsrep_get_SE_checkpoint(local_uuid, local_seqno);
+ /*
+ To keep track of whether the local uuid:seqno should be updated. Also, note
+ that local state (uuid:seqno) is updated/checkpointed only after we get an
+ OK from wsrep provider. By doing so, the values remain consistent across
+ the server & wsrep provider.
+ */
+ bool do_update= false;
- if (memcmp(&local_uuid, &uuid, sizeof(wsrep_uuid_t)) ||
- local_seqno < seqno || seqno < 0)
+ // Get the locally stored uuid:seqno.
+ if (wsrep_get_SE_checkpoint(local_uuid, local_seqno))
+ {
+ return true;
+ }
+
+ if (memcmp(&local_uuid, &uuid, sizeof(wsrep_uuid_t)) ||
- local_seqno < seqno)
++ local_seqno < seqno || seqno < 0)
+ {
+ do_update= true;
+ }
+ else if (local_seqno > seqno)
+ {
+ WSREP_WARN("SST position can't be set in past. Requested: %lld, Current: "
+ " %lld.", (long long)seqno, (long long)local_seqno);
+ /*
+ If we are here because of SET command, simply return true (error) instead of
+ aborting.
+ */
+ if (implicit)
{
- wsrep_set_SE_checkpoint(uuid, seqno);
- local_uuid = uuid;
- local_seqno = seqno;
+ WSREP_WARN("Can't continue.");
+ unireg_abort(1);
}
- else if (local_seqno > seqno)
+ else
{
- WSREP_WARN("SST postion is in the past: %lld, current: %lld. "
- "Can't continue.",
- (long long)seqno, (long long)local_seqno);
- unireg_abort(1);
+ return true;
}
+ }
#ifdef GTID_SUPPORT
- wsrep_init_sidno(uuid);
+ wsrep_init_sidno(uuid);
#endif /* GTID_SUPPORT */
- if (wsrep)
+ if (wsrep)
+ {
+ int const rcode(seqno < 0 ? seqno : 0);
+ wsrep_gtid_t const state_id= {uuid,
+ (rcode ? WSREP_SEQNO_UNDEFINED : seqno)};
+
+ wsrep_status_t ret= wsrep->sst_received(wsrep, &state_id, state,
+ state_len, rcode);
+
+ if (ret != WSREP_OK)
{
- int const rcode(seqno < 0 ? seqno : 0);
- wsrep_gtid_t const state_id = {
- uuid, (rcode ? WSREP_SEQNO_UNDEFINED : seqno)
- };
+ return true;
+ }
+ }
- wsrep->sst_received(wsrep, &state_id, state, state_len, rcode);
+ // Now is the good time to update the local state and checkpoint.
+ if (do_update)
+ {
+ if (wsrep_set_SE_checkpoint(uuid, seqno))
+ {
+ return true;
}
+
+ local_uuid= uuid;
+ local_seqno= seqno;
+ }
+
+ return false;
}
// Let applier threads to continue
diff --cc storage/innobase/btr/btr0scrub.cc
index 376a106bf8a,2e667e64d0b..578f9438eb8
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@@ -144,13 -143,12 +144,13 @@@ btr_scrub_lock_dict_func(ulint space_id
os_thread_sleep(250000);
time_t now = time(0);
+
if (now >= last + 30) {
fprintf(stderr,
- "WARNING: %s:%u waited %ld seconds for"
+ "WARNING: %s:%u waited " TIMETPF " seconds for"
- " dict_sys lock, space: %lu"
+ " dict_sys lock, space: " ULINTPF
" lock_to_close_table: %d\n",
- file, line, now - start, space_id,
+ file, line, long(now - start), space_id,
lock_to_close_table);
last = now;
diff --cc storage/innobase/handler/ha_innodb.cc
index b363b4ff52e,084272124b7..4bed93b3a9e
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@@ -14963,9 -14427,9 +14963,9 @@@ get_foreign_key_info
/* Referenced (parent) table name */
ptr = dict_remove_db_name(foreign->referenced_table_name);
- len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff), 1);
f_key_info.referenced_table = thd_make_lex_string(
- thd, 0, name_buff, static_cast<unsigned int>(len), 1);
+ thd, 0, name_buff, len, 1);
/* Dependent (child) database name */
len = dict_get_db_name_len(foreign->foreign_table_name);
@@@ -14979,9 -14443,9 +14979,9 @@@
/* Dependent (child) table name */
ptr = dict_remove_db_name(foreign->foreign_table_name);
- len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff), 1);
f_key_info.foreign_table = thd_make_lex_string(
- thd, 0, name_buff, static_cast<unsigned int>(len), 1);
+ thd, 0, name_buff, len, 1);
do {
ptr = foreign->foreign_col_names[i];
diff --cc storage/innobase/include/univ.i
index 10eb83289da,e4503672375..1d2e0f37dbe
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@@ -75,51 -79,65 +75,50 @@@ the virtual method table (vtable) in GC
# define ha_innobase ha_innodb
#endif /* MYSQL_DYNAMIC_PLUGIN */
-#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
-# undef __WIN__
-# define __WIN__
-
+#if defined(_WIN32)
# include <windows.h>
+#endif /* _WIN32 */
-# ifdef _NT_
-# define __NT__
-# endif
+/* Include a minimum number of SQL header files so that few changes
+made in SQL code cause a complete InnoDB rebuild. These headers are
+used throughout InnoDB but do not include too much themselves. They
+support cross-platform development and expose comonly used SQL names. */
-#else
-/* The defines used with MySQL */
+#include <my_global.h>
-/* Include two header files from MySQL to make the Unix flavor used
-in compiling more Posix-compatible. These headers also define __WIN__
-if we are compiling on Windows. */
+/* JAN: TODO: missing 5.7 header */
+#ifdef HAVE_MY_THREAD_H
+//# include <my_thread.h>
+#endif
-#ifndef UNIV_HOTBACKUP
-# include <my_global.h>
-# include <my_pthread.h>
-#endif /* UNIV_HOTBACKUP */
+#ifndef UNIV_INNOCHECKSUM
+# include <m_string.h>
+# include <mysqld_error.h>
+#endif /* !UNIV_INNOCHECKSUM */
/* Include <sys/stat.h> to get S_I... macros defined for os0file.cc */
-# include <sys/stat.h>
-# if !defined(__WIN__)
-# include <sys/mman.h> /* mmap() for os0proc.cc */
-# endif
-
-/* Include the header file generated by GNU autoconf */
-# ifndef __WIN__
-# ifndef UNIV_HOTBACKUP
-# include "my_config.h"
-# endif /* UNIV_HOTBACKUP */
-# endif
+#include <sys/stat.h>
-# ifdef HAVE_SCHED_H
-# include <sched.h>
-# endif
-
-/* We only try to do explicit inlining of functions with gcc and
-Sun Studio */
-
-# ifdef HAVE_PREAD
-# define HAVE_PWRITE
-# endif
-
-#endif /* #if (defined(WIN32) || ... */
+#ifndef _WIN32
+# include <sys/mman.h> /* mmap() for os0proc.cc */
+# include <sched.h>
+# include "my_config.h"
+#endif
-#ifndef __WIN__
+#include <stdint.h>
- #define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */
#include <inttypes.h>
-#endif /* !__WIN__ */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "my_pthread.h"
/* Following defines are to enable performance schema
-instrumentation in each of four InnoDB modules if
+instrumentation in each of five InnoDB modules if
HAVE_PSI_INTERFACE is defined. */
-#if defined HAVE_PSI_INTERFACE && !defined UNIV_HOTBACKUP
+#ifdef HAVE_PSI_INTERFACE
# define UNIV_PFS_MUTEX
# define UNIV_PFS_RWLOCK
-
# define UNIV_PFS_IO
# define UNIV_PFS_THREAD
@@@ -452,23 -452,43 +451,26 @@@ typedef ssize_t lint
/* Use the integer types and formatting strings defined in Visual Studio. */
# define UINT32PF "%u"
# define INT64PF "%lld"
-# define UINT64PF "%llu"
+# define UINT64scan "llu"
# define UINT64PFx "%016llx"
+ # define TIMETPF "%ld"
-typedef __int64 ib_int64_t;
-typedef unsigned __int64 ib_uint64_t;
-typedef unsigned __int32 ib_uint32_t;
+#elif defined __APPLE__
+/* Apple prefers to call the 64-bit types 'long long'
+in both 32-bit and 64-bit environments. */
+# define UINT32PF "%" PRIu32
+# define INT64PF "%lld"
+# define UINT64scan "llu"
+# define UINT64PFx "%016llx"
++# define TIMETPF "%" PRIdFAST32
#else
/* Use the integer types and formatting strings defined in the C99 standard. */
# define UINT32PF "%" PRIu32
# define INT64PF "%" PRId64
-# define UINT64PF "%" PRIu64
+# define UINT64scan PRIu64
# define UINT64PFx "%016" PRIx64
+ # define TIMETPF "%" PRIdFAST32
-typedef int64_t ib_int64_t;
-typedef uint64_t ib_uint64_t;
-typedef uint32_t ib_uint32_t;
#endif
-#define IB_ID_FMT UINT64PF
-
-/* Type used for all log sequence number storage and arithmetics */
-typedef ib_uint64_t lsn_t;
-
-#ifdef _WIN64
-typedef unsigned __int64 ulint;
-typedef __int64 lint;
-# define ULINTPF UINT64PF
-#else
-typedef unsigned long int ulint;
-typedef long int lint;
-# define ULINTPF "%lu"
-#endif /* _WIN64 */
-
-#ifndef UNIV_HOTBACKUP
-typedef unsigned long long int ullint;
-#endif /* UNIV_HOTBACKUP */
-
#ifdef UNIV_INNOCHECKSUM
extern bool strict_verify;
extern FILE* log_file;
diff --cc storage/tokudb/ha_tokudb.cc
index 91041ec6df4,61c7011252b..d5b4adcd745
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@@ -5893,10 -5942,12 +5929,11 @@@ int ha_tokudb::rnd_pos(uchar * buf, uch
DBT* key = get_pos(&db_pos, pos);
unpack_entire_row = true;
- ha_statistic_increment(&SSV::ha_read_rnd_count);
tokudb_active_index = MAX_KEY;
- // test rpl slave by inducing a delay before the point query
THD *thd = ha_thd();
+ #if defined(TOKU_INCLUDE_RFR) && TOKU_INCLUDE_RFR
+ // test rpl slave by inducing a delay before the point query
if (thd->slave_thread && (in_rpl_delete_rows || in_rpl_update_rows)) {
DBUG_EXECUTE_IF("tokudb_crash_if_rpl_looks_up_row", DBUG_ASSERT(0););
uint64_t delay_ms = tokudb::sysvars::rpl_lookup_rows_delay(thd);
diff --cc storage/tokudb/ha_tokudb_alter_56.cc
index ba1afbf091a,b579d00f67b..46da873d750
--- a/storage/tokudb/ha_tokudb_alter_56.cc
+++ b/storage/tokudb/ha_tokudb_alter_56.cc
@@@ -446,16 -476,13 +476,13 @@@ enum_alter_inplace_result ha_tokudb::ch
setup_kc_info(altered_table, ctx->altered_table_kc_info) == 0) {
// change column length
- if (change_length_is_supported(
- table,
- altered_table,
- ha_alter_info, ctx)) {
+ if (change_length_is_supported(table, altered_table, ctx)) {
result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
}
- } else if ((ctx->handler_flags & Alter_inplace_info::ALTER_COLUMN_TYPE) &&
+ } else if ((ctx->handler_flags & Alter_inplace_info::ALTER_STORED_COLUMN_TYPE) &&
only_flags(
ctx->handler_flags,
- Alter_inplace_info::ALTER_COLUMN_TYPE +
+ Alter_inplace_info::ALTER_STORED_COLUMN_TYPE +
Alter_inplace_info::ALTER_COLUMN_DEFAULT) &&
table->s->fields == altered_table->s->fields &&
find_changed_fields(
@@@ -911,9 -929,10 +929,10 @@@ bool ha_tokudb::commit_inplace_alter_ta
ha_alter_info->group_commit_ctx = NULL;
}
#endif
+ #if defined(TOKU_INCLUDE_WRITE_FRM_DATA) && TOKU_INCLUDE_WRITE_FRM_DATA
#if (50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599) || \
- (100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100199)
+ (100000 <= MYSQL_VERSION_ID)
- #if WITH_PARTITION_STORAGE_ENGINE
+ #if defined(WITH_PARTITION_STORAGE_ENGINE) && WITH_PARTITION_STORAGE_ENGINE
if (TOKU_PARTITION_WRITE_FRM_DATA || altered_table->part_info == NULL) {
#else
if (true) {
@@@ -1578,22 -1548,11 +1548,11 @@@ static bool change_field_type_is_suppor
return false;
} else if (old_type == MYSQL_TYPE_VARCHAR) {
// varchar(X) -> varchar(Y) and varbinary(X) -> varbinary(Y) expansion
- // where X < 256 <= Y the ALTER_COLUMN_TYPE handler flag is set for
+ // where X < 256 <= Y the ALTER_STORED_COLUMN_TYPE handler flag is set for
// these cases
- return change_varchar_length_is_supported(
- old_field,
- new_field,
- table,
- altered_table,
- ha_alter_info,
- ctx);
+ return change_varchar_length_is_supported(old_field, new_field, ctx);
} else if (old_type == MYSQL_TYPE_BLOB && new_type == MYSQL_TYPE_BLOB) {
- return change_blob_length_is_supported(
- table,
- altered_table,
- old_field,
- new_field,
- ctx);
+ return change_blob_length_is_supported(old_field, new_field, ctx);
} else
return false;
}
diff --cc storage/tokudb/hatoku_defines.h
index 2f058797993,ab9e0f79ef8..ced3254199f
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@@ -69,8 -74,20 +74,20 @@@ Copyright (c) 2006, 2015, Percona and/o
#pragma interface /* gcc class implementation */
#endif
- #if 100000 <= MYSQL_VERSION_ID
+ // TOKU_INCLUDE_WRITE_FRM_DATA, TOKU_PARTITION_WRITE_FRM_DATA, and
+ // TOKU_INCLUDE_DISCOVER_FRM all work together as two opposing sides
+ // of the same functionality. The 'WRITE' includes functionality to
+ // write a copy of every tables .frm data into the tables status dictionary on
+ // CREATE or ALTER. When WRITE is in, the .frm data is also verified whenever a
+ // table is opened.
+ //
+ // The 'DISCOVER' then implements the MySQL table discovery API which reads
+ // this same data and returns it back to MySQL.
+ // In most cases, they should all be in or out without mixing. There may be
+ // extreme cases though where one side (WRITE) is supported but perhaps
+ // 'DISCOVERY' may not be, thus the need for individual indicators.
-#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100199
++#if 100000 <= MYSQL_VERSION_ID
// mariadb 10.0
#define TOKU_USE_DB_TYPE_TOKUDB 1
#define TOKU_INCLUDE_ALTER_56 1
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_delete_pk.result
index a85d2155725,48ea60013ad..9ad7708a11d
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_delete_pk.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_delete_pk.result
@@@ -1,16 -1,8 +1,11 @@@
include/master-slave.inc
[connection master]
+connection master;
drop table if exists t;
+connection slave;
show variables like 'tokudb_rpl_%';
Variable_name Value
- tokudb_rpl_check_readonly ON
- tokudb_rpl_lookup_rows OFF
- tokudb_rpl_lookup_rows_delay 10000
- tokudb_rpl_unique_checks OFF
- tokudb_rpl_unique_checks_delay 10000
+connection master;
create table t (a bigint not null, primary key(a)) engine=tokudb;
insert into t values (1);
insert into t values (2),(3);
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
index 991ad8d1c48,10375677c8d..10ab579de27
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
@@@ -1,16 -1,8 +1,11 @@@
include/master-slave.inc
[connection master]
+connection master;
drop table if exists t;
+connection slave;
show variables like 'tokudb_rpl_%';
Variable_name Value
- tokudb_rpl_check_readonly ON
- tokudb_rpl_lookup_rows OFF
- tokudb_rpl_lookup_rows_delay 10000
- tokudb_rpl_unique_checks OFF
- tokudb_rpl_unique_checks_delay 10000
+connection master;
create table t (a bigint not null, b bigint not null, primary key(a)) engine=tokudb;
insert into t values (1,0);
insert into t values (2,0),(3,0);
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
index 1de619eb4ec,1cb047bbf62..0ae63f0d02f
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
@@@ -1,13 -1,8 +1,11 @@@
include/master-slave.inc
[connection master]
+connection master;
drop table if exists t;
+connection slave;
show variables like 'tokudb_rpl_unique_checks%';
Variable_name Value
- tokudb_rpl_unique_checks OFF
- tokudb_rpl_unique_checks_delay 5000
+connection master;
create table t (a bigint not null, primary key(a)) engine=tokudb;
insert into t values (1);
insert into t values (2),(3);
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_xa_interleave.result
index 00000000000,53564ab0fe4..98ded9d2097
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/rpl/r/rpl_xa_interleave.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_xa_interleave.result
@@@ -1,0 -1,59 +1,78 @@@
+ include/master-slave.inc
+ [connection master]
+ CREATE TABLE t1(`a` INT) ENGINE=TokuDB;
++connection master;
+ XA START 'x1';
+ INSERT INTO t1 VALUES (1);
+ XA END 'x1';
+ XA PREPARE 'x1';
++connection master1;
+ BEGIN;
+ INSERT INTO t1 VALUES (10);
+ COMMIT;
+ XA START 'y1';
+ INSERT INTO t1 VALUES (2);
+ XA END 'y1';
+ XA PREPARE 'y1';
++connection master;
+ XA COMMIT 'x1';
++connection master1;
+ XA COMMIT 'y1';
++connection master;
+ BEGIN;
+ INSERT INTO t1 VALUES (11);
+ COMMIT;
+ XA START 'x2';
+ INSERT INTO t1 VALUES (3);
+ XA END 'x2';
+ XA PREPARE 'x2';
++connection master1;
+ XA START 'y2';
+ INSERT INTO t1 VALUES (4);
+ XA END 'y2';
+ XA PREPARE 'y2';
++connection master;
+ XA COMMIT 'x2';
++connection master1;
+ XA COMMIT 'y2';
++connection master;
+ XA START 'x1';
+ INSERT INTO t1 VALUES (1);
+ XA END 'x1';
+ XA PREPARE 'x1';
++connection master1;
+ BEGIN;
+ INSERT INTO t1 VALUES (10);
+ COMMIT;
+ XA START 'y1';
+ INSERT INTO t1 VALUES (2);
+ XA END 'y1';
+ XA PREPARE 'y1';
++connection master;
+ XA ROLLBACK 'x1';
++connection master1;
+ XA ROLLBACK 'y1';
++connection master;
+ BEGIN;
+ INSERT INTO t1 VALUES (11);
+ COMMIT;
+ XA START 'x2';
+ INSERT INTO t1 VALUES (3);
+ XA END 'x2';
+ XA PREPARE 'x2';
++connection master1;
+ XA START 'y2';
+ INSERT INTO t1 VALUES (4);
+ XA END 'y2';
+ XA PREPARE 'y2';
++connection master;
+ XA ROLLBACK 'x2';
++connection master1;
+ XA ROLLBACK 'y2';
++connection master;
++connection slave;
+ TABLES t1 and t2 must be equal otherwise an error will be thrown.
+ include/diff_tables.inc [master:test.t1, slave:test.t1]
++connection master;
+ DROP TABLE t1;
+ include/rpl_end.inc
diff --cc storage/tokudb/mysql-test/tokudb/r/compressions.result
index 00000000000,03e0d18e9eb..435b34b6af3
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/tokudb/r/compressions.result
+++ b/storage/tokudb/mysql-test/tokudb/r/compressions.result
@@@ -1,0 -1,11 +1,11 @@@
+ CREATE TABLE t1 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_UNCOMPRESSED;
+ CREATE TABLE t2 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_SNAPPY;
+ CREATE TABLE t3 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_QUICKLZ;
+ CREATE TABLE t4 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_LZMA;
+ CREATE TABLE t5 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_ZLIB;
-FOUND /compression_method=0/ in dump
-FOUND /compression_method=7/ in dump
-FOUND /compression_method=9/ in dump
-FOUND /compression_method=10/ in dump
-FOUND /compression_method=11/ in dump
++FOUND 1 /compression_method=0/ in dump
++FOUND 1 /compression_method=7/ in dump
++FOUND 1 /compression_method=9/ in dump
++FOUND 1 /compression_method=10/ in dump
++FOUND 1 /compression_method=11/ in dump
+ DROP TABLE t1, t2, t3, t4, t5;
diff --cc storage/tokudb/mysql-test/tokudb/r/tokudb_mrr.result
index 00000000000,d79f19202a3..024580d4258
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/tokudb/r/tokudb_mrr.result
+++ b/storage/tokudb/mysql-test/tokudb/r/tokudb_mrr.result
@@@ -1,0 -1,326 +1,334 @@@
+ set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
+ set default_storage_engine=TokuDB;
+ create table t1(a int);
+ show create table t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+ ) ENGINE=TokuDB DEFAULT CHARSET=latin1
+ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+ create table t2(a int);
+ insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C;
+ create table t3 (
+ a char(8) not null, b char(8) not null, filler char(200),
+ key(a)
+ );
+ insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A;
+ insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'),
+ 'filler-1' from t2 A;
+ insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'),
+ 'filler-2' from t2 A;
+ select a,filler from t3 where a >= 'c-9011=w';
+ a filler
+ select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w';
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or
+ (a>='c-1014=w' and a <= 'c-1015=w');
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ insert into t3 values ('c-1013=z', 'c-1013=z', 'err');
+ insert into t3 values ('a-1014=w', 'a-1014=w', 'err');
+ select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or
+ (a>='c-1014=w' and a <= 'c-1015=w');
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ delete from t3 where b in ('c-1013=z', 'a-1014=w');
+ select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or
+ a='c-1014=w' or a='c-1015=w';
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ insert into t3 values ('c-1013=w', 'del-me', 'inserted');
+ select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or
+ a='c-1014=w' or a='c-1015=w';
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ c-1013=w inserted
+ delete from t3 where b='del-me';
+ alter table t3 add primary key(b);
+ select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or
+ b IN ('c-1019=w', 'c-1020=w', 'c-1021=w',
+ 'c-1022=w', 'c-1023=w', 'c-1024=w');
+ b filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1016=w filler
+ c-1017=w filler
+ c-1018=w filler
+ c-1019=w filler
+ c-1020=w filler
+ c-1021=w filler
+ c-1022=w filler
+ c-1023=w filler
+ c-1024=w filler
+ select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or
+ b IN ('c-1021=w', 'c-1022=w', 'c-1023=w');
+ b filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1016=w filler
+ c-1017=w filler
+ c-1018=w filler
+ c-1019=w filler
+ c-1020=w filler
+ c-1021=w filler
+ c-1022=w filler
+ c-1023=w filler
+ select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or
+ b IN ('c-1019=w', 'c-1020=w') or
+ (b>='c-1021=w' and b<= 'c-1023=w');
+ b filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1016=w filler
+ c-1017=w filler
+ c-1018=w filler
+ c-1019=w filler
+ c-1020=w filler
+ c-1021=w filler
+ c-1022=w filler
+ c-1023=w filler
+ drop table if exists t4;
+ create table t4 (a varchar(10), b int, c char(10), filler char(200),
+ key idx1 (a, b, c));
+ insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500;
+ explain
+ select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
+ or c='no-such-row2');
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t4 range idx1 idx1 29 NULL 16 Using where; Rowid-ordered scan
+ select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
+ or c='no-such-row2');
+ a b c filler
+ NULL NULL NULL NULL-15
+ NULL NULL NULL NULL-14
+ NULL NULL NULL NULL-13
+ NULL NULL NULL NULL-12
+ NULL NULL NULL NULL-11
+ NULL NULL NULL NULL-10
+ NULL NULL NULL NULL-9
+ NULL NULL NULL NULL-8
+ NULL NULL NULL NULL-7
+ NULL NULL NULL NULL-6
+ NULL NULL NULL NULL-5
+ NULL NULL NULL NULL-4
+ NULL NULL NULL NULL-3
+ NULL NULL NULL NULL-2
+ NULL NULL NULL NULL-1
+ explain
+ select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t4 range idx1 idx1 29 NULL 32 Using where; Rowid-ordered scan
+ select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
+ a b c filler
+ b-1 NULL c-1 NULL-15
+ b-1 NULL c-1 NULL-14
+ b-1 NULL c-1 NULL-13
+ b-1 NULL c-1 NULL-12
+ b-1 NULL c-1 NULL-11
+ b-1 NULL c-1 NULL-10
+ b-1 NULL c-1 NULL-9
+ b-1 NULL c-1 NULL-8
+ b-1 NULL c-1 NULL-7
+ b-1 NULL c-1 NULL-6
+ b-1 NULL c-1 NULL-5
+ b-1 NULL c-1 NULL-4
+ b-1 NULL c-1 NULL-3
+ b-1 NULL c-1 NULL-2
+ b-1 NULL c-1 NULL-1
+ bb-1 NULL cc-2 NULL-15
+ bb-1 NULL cc-2 NULL-14
+ bb-1 NULL cc-2 NULL-13
+ bb-1 NULL cc-2 NULL-12
+ bb-1 NULL cc-2 NULL-11
+ bb-1 NULL cc-2 NULL-10
+ bb-1 NULL cc-2 NULL-9
+ bb-1 NULL cc-2 NULL-8
+ bb-1 NULL cc-2 NULL-7
+ bb-1 NULL cc-2 NULL-6
+ bb-1 NULL cc-2 NULL-5
+ bb-1 NULL cc-2 NULL-4
+ bb-1 NULL cc-2 NULL-3
+ bb-1 NULL cc-2 NULL-2
+ bb-1 NULL cc-2 NULL-1
+ select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
+ a b c filler
+ b-1 NULL c-1 NULL-15
+ b-1 NULL c-1 NULL-14
+ b-1 NULL c-1 NULL-13
+ b-1 NULL c-1 NULL-12
+ b-1 NULL c-1 NULL-11
+ b-1 NULL c-1 NULL-10
+ b-1 NULL c-1 NULL-9
+ b-1 NULL c-1 NULL-8
+ b-1 NULL c-1 NULL-7
+ b-1 NULL c-1 NULL-6
+ b-1 NULL c-1 NULL-5
+ b-1 NULL c-1 NULL-4
+ b-1 NULL c-1 NULL-3
+ b-1 NULL c-1 NULL-2
+ b-1 NULL c-1 NULL-1
+ bb-1 NULL cc-2 NULL-15
+ bb-1 NULL cc-2 NULL-14
+ bb-1 NULL cc-2 NULL-13
+ bb-1 NULL cc-2 NULL-12
+ bb-1 NULL cc-2 NULL-11
+ bb-1 NULL cc-2 NULL-10
+ bb-1 NULL cc-2 NULL-9
+ bb-1 NULL cc-2 NULL-8
+ bb-1 NULL cc-2 NULL-7
+ bb-1 NULL cc-2 NULL-6
+ bb-1 NULL cc-2 NULL-5
+ bb-1 NULL cc-2 NULL-4
+ bb-1 NULL cc-2 NULL-3
+ bb-1 NULL cc-2 NULL-2
+ bb-1 NULL cc-2 NULL-1
+ drop table t1, t2, t3, t4;
+ create table t1 (a int, b int not null,unique key (a,b),index(b));
+ insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
+ Warnings:
+ Warning 1062 Duplicate entry '6-6' for key 'a'
+ create table t2 like t1;
+ insert into t2 select * from t1;
+ alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
+ select * from t1 where a is null;
+ a b c
+ NULL 7 0
+ NULL 9 0
+ NULL 9 0
+ select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
+ a b c
+ NULL 9 0
+ NULL 9 0
+ select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+ a b c
+ NULL 7 0
+ NULL 9 0
+ NULL 9 0
+ drop table t1, t2;
+ #
+ # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
+ #
++connect con1,localhost,root,,;
++connect con2,localhost,root,,;
++connection con1;
+ SET AUTOCOMMIT=0;
+ CREATE TABLE t1 (
+ dummy INT PRIMARY KEY,
+ a INT UNIQUE,
+ b INT
+ ) ENGINE=TokuDB;
+ INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5);
+ COMMIT;
+ SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+ SELECT @@tx_isolation;
+ @@tx_isolation
+ REPEATABLE-READ
+ START TRANSACTION;
+ EXPLAIN SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t1 range a a 5 NULL 2 Using where
+ SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
+ dummy a b
+ 3 3 3
+ 5 5 5
++connection con2;
+ SET AUTOCOMMIT=0;
+ SET TOKUDB_LOCK_TIMEOUT=2;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES (2,2,2);
+ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ ROLLBACK;
++connection con1;
+ ROLLBACK;
+ DROP TABLE t1;
++connection default;
++disconnect con1;
++disconnect con2;
diff --cc storage/tokudb/mysql-test/tokudb_bugs/r/PS-3773.result
index 00000000000,49c61790837..c870ac1c784
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/PS-3773.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-3773.result
@@@ -1,0 -1,8 +1,8 @@@
+ CREATE TABLE t1(a INT, b INT, c INT, PRIMARY KEY(a), KEY(b)) ENGINE=TokuDB;
+ SET tokudb_auto_analyze=0;
+ INSERT INTO t1 VALUES(0,0,0), (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
+ SET GLOBAL debug_dbug = "+d,tokudb_fake_db_notfound_error_in_read_full_row";
+ SELECT * FROM t1 WHERE b = 2;
-ERROR HY000: Incorrect key file for table 't1'; try to repair it
++ERROR HY000: Index for table 't1' is corrupt; try to repair it
+ DROP TABLE t1;
-FOUND /ha_tokudb::read_full_row on table/ in tokudb.bugs.PS-3773.log
++FOUND 1 /ha_tokudb::read_full_row on table/ in tokudb.bugs.PS-3773.log
1
0
[Commits] 8ba01caefee: MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
by varunraiko1803@gmail.com 13 Sep '18
by varunraiko1803@gmail.com 13 Sep '18
13 Sep '18
revision-id: 8ba01caefee392f51b5ed7f5635c10dff07825bd (mariadb-10.0.36-27-g8ba01caefee)
parent(s): 3a4242fd57b3a2235d2478ed080941b67a82ad1b
author: Varun Gupta
committer: Varun Gupta
timestamp: 2018-09-13 22:56:23 +0530
message:
MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
This assert is hit when we do filesort using the priority queue and try to insert elements in
the queue. The compare function used for the priority queue should handle the case for zerolength
sortkey.
---
mysql-test/r/order_by_zerolength-4285.result | 20 ++++++++++++++++++++
mysql-test/t/order_by_zerolength-4285.test | 13 +++++++++++++
mysys/ptr_cmp.c | 3 +++
3 files changed, 36 insertions(+)
diff --git a/mysql-test/r/order_by_zerolength-4285.result b/mysql-test/r/order_by_zerolength-4285.result
index f60ce7d90c7..e4c117b26af 100644
--- a/mysql-test/r/order_by_zerolength-4285.result
+++ b/mysql-test/r/order_by_zerolength-4285.result
@@ -24,3 +24,23 @@ Warning 1292 Truncated incorrect CHAR(0) value: '8'
Warning 1292 Truncated incorrect CHAR(0) value: '9'
Warning 1292 Truncated incorrect CHAR(0) value: '10'
drop table t1;
+#
+# MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
+#
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode= '';
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2);
+explain
+SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index; Using filesort
+SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2;
+pk
+1
+2
+Warnings:
+Warning 1292 Truncated incorrect CHAR(0) value: '1'
+Warning 1292 Truncated incorrect CHAR(0) value: '2'
+set @@sql_mode= @save_sql_mode;
+drop table t1;
diff --git a/mysql-test/t/order_by_zerolength-4285.test b/mysql-test/t/order_by_zerolength-4285.test
index 2fb58edd36d..f03d528320c 100644
--- a/mysql-test/t/order_by_zerolength-4285.test
+++ b/mysql-test/t/order_by_zerolength-4285.test
@@ -6,3 +6,16 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t1 order by now(), cast(pk as char(0));
drop table t1;
+--echo #
+--echo # MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion
+--echo #
+
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode= '';
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2);
+explain
+SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2;
+SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2;
+set @@sql_mode= @save_sql_mode;
+drop table t1;
diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c
index 6e373e98972..9007265816b 100644
--- a/mysys/ptr_cmp.c
+++ b/mysys/ptr_cmp.c
@@ -91,6 +91,9 @@ static int ptr_compare(size_t *compare_length, uchar **a, uchar **b)
reg3 int length= *compare_length;
reg1 uchar *first,*last;
+ if (length == 0)
+ return 0;
+
DBUG_ASSERT(length > 0);
first= *a; last= *b;
while (--length)
1
0
revision-id: 2b6939ed8ebe4428aa01ba0af3b4888a5ded9e9e (mariadb-10.2.16-135-g2b6939ed8eb)
parent(s): 8e68876477eaec7944baa0b63ef26e551693c4f8 f1bcfbb4373e40dda2c18c137f76fc6ff32e1a45
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-09-13 17:06:17 +0200
message:
Merge branch '10.1' into 10.2
config.h.cmake | 8 +-
extra/mariabackup/fil_cur.cc | 66 +-
include/my_atomic.h | 2 +-
include/my_global.h | 4 +-
include/my_service_manager.h | 2 +
include/mysql/service_wsrep.h | 3 +
include/service_versions.h | 2 +-
include/wsrep.h | 5 +
mysql-test/extra/binlog_tests/binlog.test | 1 -
mysql-test/extra/rpl_tests/rpl_foreign_key.test | 60 -
mysql-test/mysql-test-run.pl | 197 +-
mysql-test/r/flush.result | 24 +
mysql-test/r/gis.result | 16 +
mysql-test/r/group_min_max.result | 28 +
mysql-test/r/join.result | 6 +-
mysql-test/r/query_cache_innodb.result | 2 +-
mysql-test/r/selectivity.result | 48 +-
mysql-test/r/selectivity_innodb.result | 48 +-
mysql-test/r/sp.result | 17 +
mysql-test/r/stat_tables.result | 13 +
mysql-test/r/stat_tables_innodb.result | 13 +
mysql-test/suite/galera/disabled.def | 3 +
mysql-test/suite/galera/r/MW-336.result | 43 +-
mysql-test/suite/galera/r/MW-44.result | 21 +-
mysql-test/suite/galera/r/galera#505.result | 5 +
mysql-test/suite/galera/r/galera_defaults.result | 68 -
.../galera/r/galera_ist_innodb_flush_logs.result | 96 -
.../suite/galera/r/galera_ist_mysqldump.result | 106 +
mysql-test/suite/galera/r/galera_ist_rsync.result | 101 +
.../suite/galera/r/galera_ist_xtrabackup-v2.result | 96 -
.../suite/galera/r/galera_sst_rsync2,debug.rdiff | 114 +
mysql-test/suite/galera/r/galera_sst_rsync2.result | 288 +
.../r/galera_sst_xtrabackup-v2_data_dir.result | 262 +
.../suite/galera/r/galera_var_slave_threads.result | 67 +-
mysql-test/suite/galera/r/mysql-wsrep#332.result | 111 +
mysql-test/suite/galera/suite.pm | 2 +
mysql-test/suite/galera/t/MW-336.test | 104 +-
mysql-test/suite/galera/t/MW-44.test | 18 +-
mysql-test/suite/galera/t/galera#505.test | 26 +
mysql-test/suite/galera/t/galera_defaults.test | 13 +-
.../suite/galera/t/galera_ist_mysqldump.test | 2 +
.../suite/galera/t/galera_ist_xtrabackup-v2.test | 5 +
mysql-test/suite/galera/t/galera_sst_rsync2.cnf | 15 +
mysql-test/suite/galera/t/galera_sst_rsync2.test | 12 +
.../galera/t/galera_sst_xtrabackup-v2_data_dir.cnf | 16 +
.../t/galera_sst_xtrabackup-v2_data_dir.test | 23 +
.../suite/galera/t/galera_var_slave_threads.test | 10 +
mysql-test/suite/galera/t/mysql-wsrep#332.test | 113 +
.../suite/galera_3nodes/r/galera_pc_weight.result | 31 +-
.../suite/galera_3nodes/t/galera_pc_weight.test | 55 +-
mysql-test/suite/innodb/r/foreign-keys.result | 73 +
mysql-test/suite/innodb/r/foreign_key.result | 19 +
mysql-test/suite/innodb/r/innodb-lock.result | 47 +-
mysql-test/suite/innodb/t/foreign-keys.test | 87 +
mysql-test/suite/innodb/t/foreign_key.test | 24 +
mysql-test/suite/innodb/t/innodb-lock.test | 74 +-
mysql-test/suite/maria/create.result | 33 +
mysql-test/suite/maria/create.test | 42 +
mysql-test/suite/maria/maria.result | 4 +
mysql-test/suite/maria/maria.test | 10 +
.../suite/rpl/r/rpl_foreign_key_innodb.result | 3 +-
mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test | 62 +-
.../sys_vars/r/wsrep_start_position_basic.result | 10 +-
.../sys_vars/t/wsrep_start_position_basic.test | 6 +-
.../suite/wsrep/include/check_galera_version.inc | 20 +-
mysql-test/suite/wsrep/r/variables.result | 56 +-
mysql-test/suite/wsrep/t/variables.test | 18 +-
mysql-test/t/flush.test | 32 +
mysql-test/t/gis.test | 15 +
mysql-test/t/group_min_max.test | 17 +
mysql-test/t/join.test | 3 +-
mysql-test/t/selectivity.test | 36 +
mysql-test/t/sp.test | 21 +
mysql-test/t/stat_tables.test | 12 +
scripts/galera_new_cluster.sh | 3 -
scripts/mysql_install_db.sh | 2 +-
scripts/wsrep_sst_common.sh | 11 +
scripts/wsrep_sst_rsync.sh | 42 +-
scripts/wsrep_sst_xtrabackup-v2.sh | 28 +-
sql/events.cc | 2 +
sql/field.cc | 17 +-
sql/handler.cc | 4 +-
sql/item.cc | 10 +-
sql/log.cc | 8 +-
sql/log_event.cc | 5 -
sql/mysqld.cc | 2 +-
sql/mysqld.h | 1 +
sql/opt_range.cc | 27 +-
sql/sql_alter.cc | 20 +-
sql/sql_base.cc | 160 +-
sql/sql_base.h | 6 +-
sql/sql_parse.cc | 2 +
sql/sql_plugin_services.ic | 3 +-
sql/sql_reload.cc | 13 +-
sql/sql_select.cc | 2 +-
sql/sql_statistics.cc | 3 +
sql/sql_statistics.h | 29 +-
sql/sql_table.cc | 64 +-
sql/sql_trigger.cc | 8 +-
sql/sql_truncate.cc | 2 +-
sql/table.cc | 7 +
sql/table.h | 25 +-
sql/table_cache.cc | 2 -
sql/wsrep_dummy.cc | 3 +
sql/wsrep_hton.cc | 9 +-
sql/wsrep_mysqld.cc | 295 +-
sql/wsrep_mysqld.h | 5 +-
sql/wsrep_sst.cc | 53 +-
sql/wsrep_sst.h | 1 +
sql/wsrep_var.cc | 4 +-
storage/connect/filamdbf.cpp | 4 +-
storage/connect/inihandl.cpp | 2 +-
storage/connect/javaconn.cpp | 2 +-
storage/innobase/btr/btr0scrub.cc | 2 +-
storage/innobase/handler/ha_innodb.cc | 6 +-
storage/innobase/include/univ.i | 4 +-
storage/maria/ma_blockrec.c | 18 +-
storage/maria/ma_norec.c | 4 +-
storage/mroonga/ha_mroonga.cpp | 9 +-
storage/mroonga/ha_mroonga.hpp | 4 -
storage/mroonga/vendor/groonga/lib/expr.c | 2 +-
storage/tokudb/CMakeLists.txt | 8 +-
storage/tokudb/PerconaFT/CMakeLists.txt | 8 +-
.../cmake_modules/TokuSetupCompiler.cmake | 3 +
.../tokudb/PerconaFT/ft/cachetable/cachetable.cc | 21 +-
.../tokudb/PerconaFT/ft/cachetable/cachetable.h | 8 +-
.../tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc | 3 -
storage/tokudb/PerconaFT/ft/ft-test-helpers.cc | 3 -
storage/tokudb/PerconaFT/ft/ft.h | 3 +
storage/tokudb/PerconaFT/ft/node.cc | 2 +
.../PerconaFT/ft/serialize/block_allocator.cc | 2 +-
.../tokudb/PerconaFT/ft/tests/cachetable-4357.cc | 4 -
.../tokudb/PerconaFT/ft/tests/cachetable-4365.cc | 4 -
.../tokudb/PerconaFT/ft/tests/cachetable-5097.cc | 6 +-
.../tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc | 7 +-
.../tokudb/PerconaFT/ft/tests/cachetable-5978.cc | 13 +-
.../PerconaFT/ft/tests/cachetable-all-write.cc | 5 +-
.../ft/tests/cachetable-checkpoint-pending.cc | 8 +-
.../ft/tests/cachetable-checkpoint-pinned-nodes.cc | 6 +-
.../ft/tests/cachetable-cleaner-checkpoint.cc | 5 +-
.../ft/tests/cachetable-cleaner-checkpoint2.cc | 5 +-
.../cachetable-cleaner-thread-attrs-accumulate.cc | 8 +-
.../cachetable-cleaner-thread-everything-pinned.cc | 5 +-
...etable-cleaner-thread-nothing-needs-flushing.cc | 5 +-
.../cachetable-cleaner-thread-same-fullhash.cc | 7 +-
.../ft/tests/cachetable-cleaner-thread-simple.cc | 7 +-
.../ft/tests/cachetable-clock-eviction.cc | 9 +-
.../ft/tests/cachetable-clock-eviction2.cc | 9 +-
.../ft/tests/cachetable-clock-eviction3.cc | 9 +-
.../ft/tests/cachetable-clock-eviction4.cc | 9 +-
.../ft/tests/cachetable-clone-checkpoint.cc | 5 +-
.../cachetable-clone-partial-fetch-pinned-node.cc | 7 +-
.../ft/tests/cachetable-clone-partial-fetch.cc | 7 +-
.../ft/tests/cachetable-clone-pin-nonblocking.cc | 7 +-
.../ft/tests/cachetable-clone-unpin-remove.cc | 5 +-
.../ft/tests/cachetable-eviction-close-test.cc | 4 -
.../ft/tests/cachetable-eviction-close-test2.cc | 4 -
.../ft/tests/cachetable-eviction-getandpin-test.cc | 14 +-
.../tests/cachetable-eviction-getandpin-test2.cc | 12 +-
.../ft/tests/cachetable-fetch-inducing-evictor.cc | 15 +-
.../ft/tests/cachetable-flush-during-cleaner.cc | 3 +-
.../ft/tests/cachetable-getandpin-test.cc | 8 +-
.../cachetable-kibbutz_and_flush_cachefile.cc | 3 +-
.../PerconaFT/ft/tests/cachetable-partial-fetch.cc | 18 +-
.../ft/tests/cachetable-pin-checkpoint.cc | 6 -
.../cachetable-pin-nonblocking-checkpoint-clean.cc | 9 +-
.../ft/tests/cachetable-prefetch-close-test.cc | 2 -
.../ft/tests/cachetable-prefetch-getandpin-test.cc | 12 +-
.../ft/tests/cachetable-put-checkpoint.cc | 9 -
.../PerconaFT/ft/tests/cachetable-simple-clone.cc | 7 +-
.../PerconaFT/ft/tests/cachetable-simple-clone2.cc | 5 +-
.../PerconaFT/ft/tests/cachetable-simple-close.cc | 20 +-
.../ft/tests/cachetable-simple-maybe-get-pin.cc | 3 +-
.../ft/tests/cachetable-simple-pin-cheap.cc | 9 +-
.../ft/tests/cachetable-simple-pin-dep-nodes.cc | 8 +-
.../cachetable-simple-pin-nonblocking-cheap.cc | 19 +-
.../ft/tests/cachetable-simple-pin-nonblocking.cc | 13 +-
.../PerconaFT/ft/tests/cachetable-simple-pin.cc | 11 +-
.../ft/tests/cachetable-simple-put-dep-nodes.cc | 6 +-
.../cachetable-simple-read-pin-nonblocking.cc | 13 +-
.../ft/tests/cachetable-simple-read-pin.cc | 13 +-
.../cachetable-simple-unpin-remove-checkpoint.cc | 7 +-
.../PerconaFT/ft/tests/cachetable-simple-verify.cc | 5 +-
.../tokudb/PerconaFT/ft/tests/cachetable-test.cc | 22 +-
.../ft/tests/cachetable-unpin-and-remove-test.cc | 4 +-
.../cachetable-unpin-remove-and-checkpoint.cc | 6 +-
.../PerconaFT/ft/tests/cachetable-unpin-test.cc | 2 -
storage/tokudb/PerconaFT/ft/tests/test-TDB2-pe.cc | 178 +
storage/tokudb/PerconaFT/ft/tests/test-TDB89.cc | 208 +
storage/tokudb/PerconaFT/ft/txn/rollback-apply.cc | 2 +
storage/tokudb/PerconaFT/ft/txn/rollback.cc | 2 +-
storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp | 2 +-
storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp | 2 +-
storage/tokudb/PerconaFT/portability/memory.cc | 14 +-
storage/tokudb/PerconaFT/portability/toku_assert.h | 2 +-
.../tokudb/PerconaFT/portability/toku_debug_sync.h | 3 +-
.../PerconaFT/portability/toku_instr_mysql.cc | 6 +-
.../PerconaFT/portability/toku_instrumentation.h | 6 +-
.../PerconaFT/portability/toku_portability.h | 2 +-
.../tokudb/PerconaFT/portability/toku_race_tools.h | 2 +-
storage/tokudb/PerconaFT/src/tests/get_last_key.cc | 32 +-
storage/tokudb/PerconaFT/src/ydb.cc | 3 +
storage/tokudb/PerconaFT/src/ydb_lib.cc | 2 +-
storage/tokudb/PerconaFT/util/dmt.cc | 4 +-
storage/tokudb/PerconaFT/util/minicron.cc | 3 +-
storage/tokudb/PerconaFT/util/scoped_malloc.cc | 2 +-
.../util/tests/minicron-change-period-data-race.cc | 66 +
storage/tokudb/ha_tokudb.cc | 325 +-
storage/tokudb/ha_tokudb.h | 92 +-
storage/tokudb/ha_tokudb_admin.cc | 8 +-
storage/tokudb/ha_tokudb_alter_55.cc | 4 +
storage/tokudb/ha_tokudb_alter_56.cc | 265 +-
storage/tokudb/ha_tokudb_alter_common.cc | 6 +-
storage/tokudb/ha_tokudb_update.cc | 96 +-
storage/tokudb/hatoku_cmp.cc | 33 +-
storage/tokudb/hatoku_cmp.h | 14 +-
storage/tokudb/hatoku_defines.h | 51 +-
storage/tokudb/hatoku_hton.cc | 183 +-
storage/tokudb/hatoku_hton.h | 25 +-
storage/tokudb/mysql-test/rpl/disabled.def | 1 +
.../r/rpl_mixed_replace_into.result | 0
.../rpl/r/rpl_parallel_tokudb_delete_pk.result | 5 -
...pl_parallel_tokudb_update_pk_uc0_lookup0.result | 5 -
.../rpl/r/rpl_parallel_tokudb_write_pk.result | 2 -
.../r/rpl_row_replace_into.result | 0
.../r/rpl_stmt_replace_into.result | 0
.../mysql-test/rpl/r/rpl_xa_interleave.result | 78 +
.../t/rpl_mixed_replace_into.test | 0
.../t/rpl_row_replace_into.test | 0
.../t/rpl_stmt_replace_into.test | 0
.../tokudb/mysql-test/rpl/t/rpl_xa_interleave.test | 103 +
.../tokudb/include/fast_update_gen_footer.inc | 2 +
.../include/fast_update_gen_footer_silent.inc | 9 +
.../tokudb/include/fast_update_gen_header.inc | 6 +
.../mysql-test/tokudb/include/fast_update_int.inc | 48 +
.../tokudb/include/fast_upsert_gen_header.inc | 6 +
.../mysql-test/tokudb/include/fast_upsert_int.inc | 19 +
.../tokudb/mysql-test/tokudb/include/have_mrr.inc | 0
.../tokudb/include/setup_fast_update_upsert.inc | 8 +
.../tokudb/mysql-test/tokudb/r/compressions.result | 11 +
.../tokudb/r/fast_update_binlog_mixed.result | 225 +-
.../tokudb/r/fast_update_binlog_row.result | 19 +-
.../tokudb/r/fast_update_binlog_statement.result | 222 +-
.../mysql-test/tokudb/r/fast_update_blobs.result | 18253 +---------
.../r/fast_update_blobs_fixed_varchar.result | 33026 ------------------
.../tokudb/r/fast_update_blobs_with_varchar.result | 32771 +-----------------
.../mysql-test/tokudb/r/fast_update_char.result | 60 +-
.../tokudb/r/fast_update_deadlock.result | 19 +-
.../tokudb/r/fast_update_decr_floor.result | 314 +-
.../r/fast_update_disable_slow_update.result | 7 -
.../mysql-test/tokudb/r/fast_update_error.result | 12 +-
.../mysql-test/tokudb/r/fast_update_int.result | 562 +-
.../tokudb/r/fast_update_int_bounds.result | 52 +-
.../mysql-test/tokudb/r/fast_update_key.result | 54 +-
.../mysql-test/tokudb/r/fast_update_sqlmode.result | 21 +-
.../tokudb/r/fast_update_uint_bounds.result | 36 +-
.../mysql-test/tokudb/r/fast_update_varchar.result | 13575 +-------
.../mysql-test/tokudb/r/fast_upsert_bin_pad.result | Bin 659 -> 738 bytes
.../mysql-test/tokudb/r/fast_upsert_char.result | 24 +-
.../tokudb/r/fast_upsert_deadlock.result | 19 +-
.../mysql-test/tokudb/r/fast_upsert_int.result | 428 +-
.../mysql-test/tokudb/r/fast_upsert_key.result | 43 +-
.../mysql-test/tokudb/r/fast_upsert_sqlmode.result | 23 +-
.../mysql-test/tokudb/r/fast_upsert_values.result | 18 +-
.../tokudb/mysql-test/tokudb/r/tokudb_mrr.result | 334 +
storage/tokudb/mysql-test/tokudb/suite.pm | 6 +
.../tokudb/mysql-test/tokudb/t/compressions.test | 68 +
storage/tokudb/mysql-test/tokudb/t/disabled.def | 24 -
.../tokudb/t/fast_update_binlog_mixed-master.opt | 2 +
.../tokudb/t/fast_update_binlog_mixed.test | 15 +-
.../tokudb/t/fast_update_binlog_row-master.opt | 2 +
.../tokudb/t/fast_update_binlog_row.test | 19 +-
.../t/fast_update_binlog_statement-master.opt | 2 +
.../tokudb/t/fast_update_binlog_statement.test | 15 +-
.../mysql-test/tokudb/t/fast_update_blobs.py | 57 -
.../mysql-test/tokudb/t/fast_update_blobs.test | 18575 +----------
.../tokudb/t/fast_update_blobs_fixed_varchar.py | 63 -
.../tokudb/t/fast_update_blobs_fixed_varchar.test | 33287 -------------------
.../tokudb/t/fast_update_blobs_with_varchar.py | 62 -
.../tokudb/t/fast_update_blobs_with_varchar.test | 33115 +-----------------
.../mysql-test/tokudb/t/fast_update_char.test | 66 +-
.../mysql-test/tokudb/t/fast_update_deadlock.test | 21 +-
.../mysql-test/tokudb/t/fast_update_decr_floor.py | 58 -
.../tokudb/t/fast_update_decr_floor.test | 409 +-
.../tokudb/t/fast_update_disable_slow_update.test | 17 -
.../mysql-test/tokudb/t/fast_update_error.test | 16 +-
.../tokudb/mysql-test/tokudb/t/fast_update_int.py | 77 -
.../mysql-test/tokudb/t/fast_update_int.test | 682 +-
.../tokudb/t/fast_update_int_bounds.test | 55 +-
.../mysql-test/tokudb/t/fast_update_key.test | 63 +-
.../mysql-test/tokudb/t/fast_update_sqlmode.test | 25 +-
.../tokudb/t/fast_update_uint_bounds.test | 42 +-
.../mysql-test/tokudb/t/fast_update_varchar.py | 63 -
.../mysql-test/tokudb/t/fast_update_varchar.test | 7390 +---
.../mysql-test/tokudb/t/fast_upsert_bin_pad.test | 19 +-
.../mysql-test/tokudb/t/fast_upsert_char.test | 27 +-
.../mysql-test/tokudb/t/fast_upsert_deadlock.test | 22 +-
.../tokudb/mysql-test/tokudb/t/fast_upsert_int.py | 50 -
.../mysql-test/tokudb/t/fast_upsert_int.test | 486 +-
.../mysql-test/tokudb/t/fast_upsert_key.test | 46 +-
.../mysql-test/tokudb/t/fast_upsert_sqlmode.test | 27 +-
.../mysql-test/tokudb/t/fast_upsert_values.test | 21 +-
storage/tokudb/mysql-test/tokudb/t/tokudb_mrr.test | 73 +
.../tokudb/mysql-test/tokudb_bugs/r/PS-3773.result | 8 +
.../r/alter_table_comment_rebuild_data.result | 177 +
.../tokudb/mysql-test/tokudb_bugs/t/PS-3773.test | 26 +
.../t/alter_table_comment_rebuild_data.test | 188 +
storage/tokudb/tokudb_debug.h | 5 -
storage/tokudb/tokudb_dir_cmd.h | 6 +-
storage/tokudb/tokudb_information_schema.cc | 74 +-
storage/tokudb/tokudb_sysvars.cc | 122 +-
storage/tokudb/tokudb_sysvars.h | 16 +-
storage/tokudb/tokudb_thread.h | 26 +-
storage/tokudb/tokudb_update_fun.cc | 230 +-
storage/xtradb/btr/btr0scrub.cc | 2 +-
storage/xtradb/buf/buf0buf.cc | 2 +-
storage/xtradb/fil/fil0crypt.cc | 2 +-
storage/xtradb/handler/ha_innodb.cc | 41 +-
storage/xtradb/handler/handler0alter.cc | 20 +-
storage/xtradb/include/univ.i | 3 +-
storage/xtradb/row/row0mysql.cc | 4 +-
321 files changed, 7051 insertions(+), 195596 deletions(-)
diff --cc config.h.cmake
index 3e5a9a95397,52d837fad2a..bbeb457fd13
--- a/config.h.cmake
+++ b/config.h.cmake
@@@ -569,12 -666,6 +569,8 @@@
#cmakedefine WSREP_PROC_INFO 1
#endif
- #ifdef _AIX
- /*
- AIX includes inttypes.h from sys/types.h
- Explicitly request format macros before the first inclusion of inttypes.h
- */
++#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
- #endif
++#endif // !defined(__STDC_FORMAT_MACROS)
#endif
diff --cc extra/mariabackup/fil_cur.cc
index be2e0593129,be4a625342b..f5b3db1e184
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@@ -341,42 -343,45 +341,42 @@@ read_retry
/* check pages for corruption and re-read if necessary. i.e. in case of
partially written pages */
for (page = cursor->buf, i = 0; i < npages;
- page += cursor->page_size, i++) {
- ib_int64_t page_no = cursor->buf_page_no + i;
-
- bool checksum_ok = fil_space_verify_crypt_checksum(page, cursor->zip_size,space, (ulint)page_no);
-
- if (!checksum_ok &&
- buf_page_is_corrupted(true, page, cursor->zip_size,space)) {
-
- if (cursor->is_system &&
- page_no >= (ib_int64_t)FSP_EXTENT_SIZE &&
- page_no < (ib_int64_t) FSP_EXTENT_SIZE * 3) {
- /* skip doublewrite buffer pages */
- xb_a(cursor->page_size == UNIV_PAGE_SIZE);
- msg("[%02u] mariabackup: "
- "Page " UINT64PF " is a doublewrite buffer page, "
- "skipping.\n", cursor->thread_n, page_no);
- } else {
- retry_count--;
- if (retry_count == 0) {
- msg("[%02u] mariabackup: "
- "Error: failed to read page after "
- "10 retries. File %s seems to be "
- "corrupted.\n", cursor->thread_n,
- cursor->abs_path);
- ret = XB_FIL_CUR_ERROR;
- break;
- }
- msg("[%02u] mariabackup: "
- "Database page corruption detected at page "
- UINT64PF ", retrying...\n", cursor->thread_n,
- page_no);
-
- os_thread_sleep(100000);
-
- goto read_retry;
- }
- }
- cursor->buf_read += cursor->page_size;
- cursor->buf_npages++;
+ page += page_size, i++) {
+ ulint page_no = cursor->buf_page_no + i;
+
- if (cursor->space_id == TRX_SYS_SPACE &&
- page_no >= FSP_EXTENT_SIZE &&
- page_no < FSP_EXTENT_SIZE * 3) {
- /* We ignore the doublewrite buffer pages */
- } else if (!fil_space_verify_crypt_checksum(
- page, cursor->page_size, space->id, page_no)
- && buf_page_is_corrupted(true, page,
- cursor->page_size,
- space)) {
- retry_count--;
- if (retry_count == 0) {
- msg("[%02u] mariabackup: "
- "Error: failed to read page after "
- "10 retries. File %s seems to be "
- "corrupted.\n", cursor->thread_n,
- cursor->abs_path);
- ret = XB_FIL_CUR_ERROR;
- break;
- }
-
- if (retry_count == 9) {
- msg("[%02u] mariabackup: "
- "Database page corruption detected at page "
- ULINTPF ", retrying...\n",
- cursor->thread_n, page_no);
- }
-
- os_thread_sleep(100000);
-
- goto read_retry;
- }
- cursor->buf_read += page_size;
- cursor->buf_npages++;
++ if (cursor->space_id == TRX_SYS_SPACE &&
++ page_no >= FSP_EXTENT_SIZE &&
++ page_no < FSP_EXTENT_SIZE * 3) {
++ /* We ignore the doublewrite buffer pages */
++ } else if (!fil_space_verify_crypt_checksum(
++ page, cursor->page_size, space->id, page_no)
++ && buf_page_is_corrupted(true, page,
++ cursor->page_size,
++ space)) {
++ retry_count--;
++ if (retry_count == 0) {
++ msg("[%02u] mariabackup: "
++ "Error: failed to read page after "
++ "10 retries. File %s seems to be "
++ "corrupted.\n", cursor->thread_n,
++ cursor->abs_path);
++ ret = XB_FIL_CUR_ERROR;
++ break;
++ }
++
++ if (retry_count == 9) {
++ msg("[%02u] mariabackup: "
++ "Database page corruption detected at page "
++ ULINTPF ", retrying...\n",
++ cursor->thread_n, page_no);
++ }
++
++ os_thread_sleep(100000);
++
++ goto read_retry;
++ }
++ cursor->buf_read += page_size;
++ cursor->buf_npages++;
}
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
diff --cc include/my_global.h
index 65546a37700,dcfd607b455..8651956892c
--- a/include/my_global.h
+++ b/include/my_global.h
@@@ -255,7 -257,7 +255,9 @@@
AIX includes inttypes.h from sys/types.h
Explicitly request format macros before the first inclusion of inttypes.h
*/
--#define __STDC_FORMAT_MACROS
++#if !defined(__STDC_FORMAT_MACROS)
++#define __STDC_FORMAT_MACROS
++#endif // !defined(__STDC_FORMAT_MACROS)
#endif
diff --cc include/my_service_manager.h
index 4d88e992b5e,4d88e992b5e..d9f41ace4d5
--- a/include/my_service_manager.h
+++ b/include/my_service_manager.h
@@@ -24,7 -24,7 +24,9 @@@
sd-daemon.h may include inttypes.h. Explicitly request format macros before
the first inclusion of inttypes.h.
*/
++#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
++#endif // !defined(__STDC_FORMAT_MACROS)
#include <systemd/sd-daemon.h>
/** INTERVAL in seconds followed by printf style status */
#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \
diff --cc mysql-test/r/group_min_max.result
index b3b660c4170,777780f8400..f200f70dd8b
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@@ -3733,6 -3733,34 +3733,34 @@@ id MIN(a) MAX(a
4 2001-01-04 2001-01-04
DROP TABLE t1;
#
+ # MDEV-17039: Query plan changes when we use GROUP BY optimization with optimizer_use_condition_selectivity=4
+ # and use_stat_tables= PREFERABLY
+ #
+ CREATE TABLE t1 (a INT, b INT,c INT DEFAULT 0, INDEX (a,b));
+ INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
+ (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
+ set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+ set @save_use_stat_tables= @@use_stat_tables;
+ set @@optimizer_use_condition_selectivity=4;
+ set @@use_stat_tables=PREFERABLY;
+ explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
+ id select_type table type possible_keys key key_len ref rows filtered Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00
+ 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index
+ 2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by
+ Warnings:
-Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where (`test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`)
++Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`
+ set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+ set @@use_stat_tables=@save_use_stat_tables;
+ explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
+ id select_type table type possible_keys key key_len ref rows filtered Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00
+ 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index
+ 2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by
+ Warnings:
-Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where (`test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`)
++Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`
+ drop table t1;
+ #
# End of 10.0 tests
#
#
diff --cc mysql-test/r/query_cache_innodb.result
index 643a065612f,00000000000..146a6fbc289
mode 100644,000000..100644
--- a/mysql-test/r/query_cache_innodb.result
+++ b/mysql-test/r/query_cache_innodb.result
@@@ -1,90 -1,0 +1,90 @@@
+#
+# MDEV-12485: foreign key on delete cascade stale entries with
+# query cache enabled
+#
+SET NAMES utf8;
+set global query_cache_type=1;
+set global query_cache_size=1024*1024;
+set query_cache_type=1;
+create table t1 ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
+create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references t1(`id`) on delete cascade ) engine=innodb;
+insert into t1 values (1);
+insert into t2 values (1,1);
+select * from t2;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t2;
+t2id id
+optimize table t2;
+Table Op Msg_type Msg_text
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+select * from t2;
+t2id id
+drop table t2;
+drop table t1;
+create database `testdatabase$ї`;
+use `testdatabase$ї`;
+create table `t1$ї` ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
+create table `t2$ї` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `t1$ї`(`id`) on delete cascade ) engine=innodb;
+insert into `t1$ї` values (1);
+insert into `t2$ї`values (1,1);
+select * from `t2$ї`;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from `t1$ї`;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from `t2$ї`;
+t2id id
+optimize table `t2$ї`;
+Table Op Msg_type Msg_text
+testdatabase$ї.t2$ї optimize note Table does not support optimize, doing recreate + analyze instead
+testdatabase$ї.t2$ї optimize status OK
+select * from `t2$ї`;
+t2id id
+use test;
+drop database `testdatabase$ї`;
+SET NAMES default;
+create database `#mysql50#-`;
+use `#mysql50#-`;
+create table `#mysql50#t-1` ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
+create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `#mysql50#t-1`(`id`) on delete cascade ) engine=innodb;
+insert into `#mysql50#t-1` values (1);
+insert into `#mysql50#t-2`values (1,1);
+select * from `#mysql50#t-2`;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from `#mysql50#t-1`;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from `#mysql50#t-2`;
+t2id id
+optimize table `#mysql50#t-2`;
+Table Op Msg_type Msg_text
+#mysql50#-.#mysql50#t-2 optimize note Table does not support optimize, doing recreate + analyze instead
+#mysql50#-.#mysql50#t-2 optimize status OK
+select * from `#mysql50#t-2`;
+t2id id
+use test;
+drop database `#mysql50#-`;
+SET NAMES default;
- FOUND 12 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err
++FOUND 8 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err
+set global query_cache_type=DEFAULT;
+set global query_cache_size=DEFAULT;
+End of 10.2 tests
diff --cc mysql-test/r/selectivity.result
index 5f3f2bb5064,2e69f674ea3..db82c3fb4de
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@@ -782,9 -782,9 +782,9 @@@ set optimizer_use_condition_selectivity
explain extended
select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
++Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
select * from t1 where a < 1 and a > 7;
a
drop table t1;
@@@ -1506,9 -1506,9 +1506,9 @@@ col
explain extended
select * from t2 where col1 < 'b' and col1 > 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where ((`test`.`t2`.`col1` < 'b') and (`test`.`t2`.`col1` > 'd'))
++Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd'
drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
diff --cc mysql-test/r/selectivity_innodb.result
index 849217116ea,d3e71088f87..249ac264fd6
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@@ -789,9 -789,9 +789,9 @@@ set optimizer_use_condition_selectivity
explain extended
select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
++Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
select * from t1 where a < 1 and a > 7;
a
drop table t1;
@@@ -1516,9 -1516,9 +1516,9 @@@ col
explain extended
select * from t2 where col1 < 'b' and col1 > 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
- 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+ 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
- Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where 0
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where ((`test`.`t2`.`col1` < 'b') and (`test`.`t2`.`col1` > 'd'))
++Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd'
drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
diff --cc mysql-test/suite/galera/disabled.def
index 9be8e73f06b,40b4065c3db..ec3ae5f3907
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@@ -30,10 -30,7 +30,13 @@@ query_cache : MDEV-15805 Test failure o
MW-416 : MDEV-13549 Galera test failures
galera_wan : MDEV-13549 Galera test failures
MW-388 : MDEV-13549 Galera test failures
+galera.MW-44 : MDEV-15809 Test failure on galera.MW-44
+galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
+galera_kill_applier : race condition at the start of the test
+galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
+pxc-421: Lock timeout exceeded
galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure
+galera.galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl
+ galera.galera_binlog_stmt_autoinc : MDEV-17106 Test failure on galera.galera_binlog_stmt_autoinc
+ galera.galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl
+ galera.galera_var_node_address : MDEV-17151 Galera test failure on galera.galera_var_node_address
diff --cc mysql-test/suite/galera/r/MW-336.result
index 0bf8d9d3909,81e8eae0eb3..4d7d6440066
--- a/mysql-test/suite/galera/r/MW-336.result
+++ b/mysql-test/suite/galera/r/MW-336.result
@@@ -1,40 -1,31 +1,39 @@@
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+ INSERT INTO t1 values(0);
+connection node_1;
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1;
+ # Wait 10 slave threads to start 1
+connection node_2;
- INSERT INTO t1 VALUES (1);
+ # Generate 12 replication events
+connection node_1;
+ SELECT COUNT(*) FROM t1;
+ COUNT(*)
+ 13
+ # Wait 9 slave threads to exit 1
SET GLOBAL wsrep_slave_threads = 10;
+ # Wait 10 slave threads to start 2
SET GLOBAL wsrep_slave_threads = 20;
+ # Wait 20 slave threads to start 3
SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
- INSERT INTO t1 VALUES (1);
- INSERT INTO t1 VALUES (2);
- INSERT INTO t1 VALUES (3);
- INSERT INTO t1 VALUES (4);
- INSERT INTO t1 VALUES (5);
- INSERT INTO t1 VALUES (6);
- INSERT INTO t1 VALUES (7);
- INSERT INTO t1 VALUES (8);
- INSERT INTO t1 VALUES (9);
+ # Generate 40 replication events
+connection node_1;
+ SELECT COUNT(*) FROM t1;
+ COUNT(*)
+ 53
+ # Wait 10 slave threads to exit 3
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0;
Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+ # Wait 10 slave threads to start 3
+connection node_2;
- INSERT INTO t1 VALUES (10);
- INSERT INTO t1 VALUES (11);
- INSERT INTO t1 VALUES (12);
- INSERT INTO t1 VALUES (13);
- INSERT INTO t1 VALUES (14);
- INSERT INTO t1 VALUES (15);
- INSERT INTO t1 VALUES (16);
- INSERT INTO t1 VALUES (17);
- INSERT INTO t1 VALUES (18);
- INSERT INTO t1 VALUES (19);
- INSERT INTO t1 VALUES (20);
+ # Generate 12 replication events
++connection node_1;
+ SELECT COUNT(*) FROM t1;
+ COUNT(*)
+ 65
+ # Wait 10 slave threads to exit 4
+connection node_1;
- SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;
diff --cc mysql-test/suite/galera/r/galera_ist_mysqldump.result
index 58a3ca297f8,e254a1b195b..a33ad2d55cb
--- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
@@@ -5,12 -4,9 +5,17 @@@ connection node_1
CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
SET GLOBAL wsrep_sst_method = 'mysqldump';
++<<<<<<< HEAD
+connection node_1;
+connection node_2;
++||||||| merged common ancestors
++=======
+ call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*");
++>>>>>>> 10.1
Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@@ -199,120 -180,12 +204,221 @@@ COUNT(*) =
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
++<<<<<<< HEAD
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
+connection node_1;
++||||||| merged common ancestors
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++SET wsrep_sync_wait = 0;
++Killing server ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++Performing --wsrep-recover ...
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++ROLLBACK;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++SET AUTOCOMMIT=ON;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET AUTOCOMMIT=ON;
++SET GLOBAL debug_dbug = $debug_orig;
++=======
++>>>>>>> 10.1
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
+connection node_2;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
-CALL mtr.add_suppression("InnoDB: New log files created");
-CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
diff --cc mysql-test/suite/galera/r/galera_ist_rsync.result
index 9c0d78d96e9,099d944d491..84eeac4093d
--- a/mysql-test/suite/galera/r/galera_ist_rsync.result
+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
@@@ -285,111 -259,3 +285,212 @@@ COUNT(*) =
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
++<<<<<<< HEAD
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
++||||||| merged common ancestors
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++SET wsrep_sync_wait = 0;
++Killing server ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++Performing --wsrep-recover ...
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++COMMIT;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++ROLLBACK;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++SET AUTOCOMMIT=ON;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET AUTOCOMMIT=ON;
++SET GLOBAL debug_dbug = $debug_orig;
++=======
++>>>>>>> 10.1
diff --cc mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
index 00000000000,2803211c418..525156d88da
mode 000000,100644..100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
@@@ -1,0 -1,103 +1,114 @@@
---- mysql-test/suite/galera/r/galera_sst_rsync2.result 2018-09-07 01:29:47.133578834 +0200
-+++ galera_sst_rsync2.result 2018-09-07 01:29:37.619557422 +0200
-@@ -260,3 +260,100 @@
++--- suite/galera/r/galera_sst_rsync2.result 2018-09-12 13:09:35.352229478 +0200
+++++ suite/galera/r/galera_sst_rsync2,debug.reject 2018-09-12 17:00:51.601974979 +0200
++@@ -286,3 +286,111 @@
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+ +Performing State Transfer on a server that has been killed and restarted
+ +while a DDL was in progress on it
+++connection node_1;
+ +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+ +INSERT INTO t1 VALUES ('node1_committed_before');
+++connection node_2;
+ +START TRANSACTION;
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +INSERT INTO t1 VALUES ('node2_committed_before');
+ +COMMIT;
+ +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+++connection node_1;
+ +ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+++connection node_2;
+ +SET wsrep_sync_wait = 0;
+ +Killing server ...
+++connection node_1;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_during');
+ +COMMIT;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+++connection node_2;
+ +Performing --wsrep-recover ...
+++connection node_2;
+ +Starting server ...
+ +Using --wsrep-start-position when starting mysqld ...
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node2_committed_after');
+ +COMMIT;
+++connection node_1;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
+ +COMMIT;
+ +SET AUTOCOMMIT=OFF;
+ +START TRANSACTION;
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_committed_after');
+ +COMMIT;
+++connection node_1a_galera_st_kill_slave_ddl;
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
+ +ROLLBACK;
+ +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+ +COUNT(*) = 2
+ +1
+ +SELECT COUNT(*) = 35 FROM t1;
+ +COUNT(*) = 35
+ +1
+ +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ +COUNT(*) = 0
+ +1
+ +COMMIT;
+ +SET AUTOCOMMIT=ON;
+++connection node_1;
+ +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+ +COUNT(*) = 2
+ +1
+ +SELECT COUNT(*) = 35 FROM t1;
+ +COUNT(*) = 35
+ +1
+ +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ +COUNT(*) = 0
+ +1
+ +DROP TABLE t1;
+ +COMMIT;
+ +SET AUTOCOMMIT=ON;
+ +SET GLOBAL debug_dbug = $debug_orig;
diff --cc mysql-test/suite/galera/r/galera_sst_rsync2.result
index 00000000000,cec0f21ee22..ff85a7d6c0f
mode 000000,100644..100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync2.result
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2.result
@@@ -1,0 -1,262 +1,288 @@@
++connection node_1;
++connection node_2;
+ Performing State Transfer on a server that has been shut down cleanly and restarted
++connection node_1;
+ CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ COMMIT;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ COMMIT;
+ Shutting down server ...
++connection node_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+ Starting server ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ COMMIT;
++connection node_1;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ COMMIT;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ COMMIT;
++connection node_1a_galera_st_shutdown_slave;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ ROLLBACK;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++connection node_1;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+ Performing State Transfer on a server that starts from a clean var directory
+ This is accomplished by shutting down node #2 and removing its var directory before restarting it
++connection node_1;
+ CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ COMMIT;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ COMMIT;
+ Shutting down server ...
++connection node_1;
+ Cleaning var directory ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+ Starting server ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ COMMIT;
++connection node_1;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ COMMIT;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ COMMIT;
++connection node_1a_galera_st_clean_slave;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ ROLLBACK;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++connection node_1;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
+ Performing State Transfer on a server that has been killed and restarted
++connection node_1;
+ CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ INSERT INTO t1 VALUES ('node1_committed_before');
+ COMMIT;
++connection node_2;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ INSERT INTO t1 VALUES ('node2_committed_before');
+ COMMIT;
+ Killing server ...
++connection node_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ INSERT INTO t1 VALUES ('node1_committed_during');
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
+ Performing --wsrep-recover ...
+ Starting server ...
+ Using --wsrep-start-position when starting mysqld ...
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ INSERT INTO t1 VALUES ('node2_committed_after');
+ COMMIT;
++connection node_1;
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+ COMMIT;
+ SET AUTOCOMMIT=OFF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ INSERT INTO t1 VALUES ('node1_committed_after');
+ COMMIT;
++connection node_1a_galera_st_kill_slave;
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ ROLLBACK;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++connection node_1;
+ SELECT COUNT(*) = 35 FROM t1;
+ COUNT(*) = 35
+ 1
+ SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+ COUNT(*) = 0
+ 1
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
diff --cc mysql-test/suite/galera/r/galera_var_slave_threads.result
index 3f0a63ab9d7,c7c6af2098f..c28cc091ae9
--- a/mysql-test/suite/galera/r/galera_var_slave_threads.result
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@@ -13,85 -11,26 +13,24 @@@ SELECT @@wsrep_slave_threads = 1
@@wsrep_slave_threads = 1
1
SET GLOBAL wsrep_slave_threads = 1;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 64;
+connection node_1;
INSERT INTO t1 VALUES (1);
+connection node_2;
+ SELECT COUNT(*) = 1 FROM t1;
+ COUNT(*) = 1
+ 1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
-1
SET GLOBAL wsrep_slave_threads = 1;
-SELECT COUNT(*) = 64 FROM t2;
-COUNT(*) = 64
-1
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
-COUNT(*) = 1
+connection node_1;
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
- INSERT INTO t2 VALUES (DEFAULT);
+connection node_2;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+64
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;
diff --cc mysql-test/suite/galera/t/MW-336.test
index 8cd363aa019,749ffe671be..40d093a1a86
--- a/mysql-test/suite/galera/t/MW-336.test
+++ b/mysql-test/suite/galera/t/MW-336.test
@@@ -14,15 -19,43 +19,43 @@@ SET GLOBAL wsrep_slave_threads = 1
--source include/wait_condition.inc
--connection node_2
- INSERT INTO t1 VALUES (1);
+ # Wait until inserts are replicated
+ --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+ --source include/wait_condition.inc
+ --echo # Generate 12 replication events
+ --disable_query_log
+ --disable_result_log
+ --let $count = 12
+ while ($count)
+ {
+ INSERT INTO t1 VALUES (1);
+ --dec $count
+ }
+ --enable_result_log
+ --enable_query_log
--connection node_1
+ # Wait until inserts are replicated
+ --let $wait_condition = SELECT COUNT(*) = 13 FROM t1;
+ --source include/wait_condition.inc
+
+ SELECT COUNT(*) FROM t1;
+
+ --echo # Wait 9 slave threads to exit 1
+ # Wait until appliers exit
+ --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
+ --source include/wait_condition.inc
+
SET GLOBAL wsrep_slave_threads = 10;
+
+ --echo # Wait 10 slave threads to start 2
---let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 20;
+
+ --echo # Wait 20 slave threads to start 3
---let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1;
diff --cc mysql-test/suite/galera/t/MW-44.test
index e8caa28c80e,5bc5fa9dab8..eb50be1a53b
--- a/mysql-test/suite/galera/t/MW-44.test
+++ b/mysql-test/suite/galera/t/MW-44.test
@@@ -6,23 -6,20 +6,22 @@@
--source include/have_innodb.inc
--connection node_1
- SET GLOBAL general_log='OFF';
TRUNCATE TABLE mysql.general_log;
- --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
- --source include/wait_condition.inc
+--sleep 1
--connection node_2
- SET GLOBAL general_log='OFF';
TRUNCATE TABLE mysql.general_log;
- --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
+ --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%';
--source include/wait_condition.inc
+ SELECT Argument FROM mysql.general_log;
+--sleep 1
--connection node_1
- SET GLOBAL general_log='ON';
- SELECT argument from mysql.general_log WHERE argument NOT LIKE 'SELECT%';
+ --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE 'TRUNCATE%';
+ --source include/wait_condition.inc
+ SELECT Argument FROM mysql.general_log;
+ SET GLOBAL general_log='ON';
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
diff --cc mysql-test/suite/galera/t/galera#505.test
index 00000000000,78cdf53db74..785b1411596
mode 000000,100644..100644
--- a/mysql-test/suite/galera/t/galera#505.test
+++ b/mysql-test/suite/galera/t/galera#505.test
@@@ -1,0 -1,32 +1,26 @@@
+ # galera#505 - Change of pc.weight wsrep param will be correctly stored in wsrep_provider_options variable
+
+ --source include/galera_cluster.inc
+
---disable_query_log
-select CAST(REGEXP_REPLACE(variable_value,'^(\\d+)\\.(\\d+)\\.(\\d+)(r\\d+)','\\3') AS UNSIGNED) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version' INTO @GALERA_VERSION;
-
-# Make sure that the test is operating on the right version of galera library.
---let $galera_version=24
-eval SET @REQUIRED_GALERA_VERSION='$galera_version';
-
-SELECT @GALERA_VERSION, @REQUIRED_GALERA_VERSION;
++--connection node_1
+
-if (!`SELECT (@GALERA_VERSION < @REQUIRED_GALERA_VERSION)`)
-{
- skip Test requires Galera library version 25.3.$galera_version;
-}
++SET SESSION wsrep_sync_wait=0;
++--disable_result_log
++--disable_query_log
++--let $galera_version=25.3.24
++source ../../wsrep/include/check_galera_version.inc;
++--enable_result_log
+ --enable_query_log
-
---connection node_1
++SET SESSION wsrep_sync_wait=DEFAULT;
+
+ # Convert "... pc.weight = N; ..." to "N; ..."
+ --let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))`
+ # Convert "N; ..." to "N"
+ --let $pc_weight_value = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)`
+
+ SET GLOBAL wsrep_provider_options = 'pc.weight=3';
+
+ -- replace_regex /.*(pc\.weight = [0-9]+);.*/\1/
+ SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options';
+
+ --eval SET GLOBAL wsrep_provider_options = 'pc.weight=$pc_weight_value'
diff --cc mysql-test/suite/galera/t/galera_var_slave_threads.test
index e5986f7ee12,1cee845b6ab..80edcb2aff9
--- a/mysql-test/suite/galera/t/galera_var_slave_threads.test
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@@ -33,8 -34,15 +33,14 @@@ SET GLOBAL wsrep_slave_threads = 64
INSERT INTO t1 VALUES (1);
--connection node_2
+ --let $wait_timeout=600
+ --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+ --source include/wait_condition.inc
+
+ SELECT COUNT(*) = 1 FROM t1;
+
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
#
# Reduce the number of slave threads. The change is not immediate -- a thread will only exit after a replication event
@@@ -51,13 -61,18 +59,15 @@@ while ($count
INSERT INTO t2 VALUES (DEFAULT);
--dec $count
}
+ --enable_query_log
+ --enable_result_log
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 64 FROM t2;
---source include/wait_condition.inc
+SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) = 64 FROM t2;
-
---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
+--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig
diff --cc mysql-test/suite/innodb/r/foreign-keys.result
index 0cb53f52a6c,66fc00e34d0..4402c5ca2fe
--- a/mysql-test/suite/innodb/r/foreign-keys.result
+++ b/mysql-test/suite/innodb/r/foreign-keys.result
@@@ -17,37 -17,73 +17,110 @@@ drop table title, department, people
create table t1 (a int primary key, b int) engine=innodb;
create table t2 (c int primary key, d int,
foreign key (d) references t1 (a) on update cascade) engine=innodb;
+ insert t1 values (1,1),(2,2),(3,3);
+ insert t2 values (4,1),(5,2),(6,3);
+ flush table t2 with read lock;
+ connect con1,localhost,root;
+ delete from t1 where a=2;
+ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+ update t1 set a=10 where a=1;
+ connection default;
+ unlock tables;
+ connection con1;
+ connection default;
+ lock table t2 write;
+ connection con1;
+ delete from t1 where a=2;
+ connection default;
+ unlock tables;
+ connection con1;
+ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+ connection default;
+ unlock tables;
+ disconnect con1;
+ create user foo;
+ grant select,update on test.t1 to foo;
+ connect foo,localhost,foo;
+ update t1 set a=30 where a=3;
+ disconnect foo;
+ connection default;
+ select * from t2;
+ c d
+ 5 2
+ 4 10
+ 6 30
+ drop table t2, t1;
+ drop user foo;
+ create table t1 (f1 int primary key) engine=innodb;
+ create table t2 (f2 int primary key) engine=innodb;
+ create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+ insert into t1 values (1),(2),(3),(4),(5);
+ insert into t2 values (1),(2),(3),(4),(5);
+ insert into t3 values (1),(2),(3),(4),(5);
+ connect con1,localhost,root;
+ set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+ alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+ connection default;
+ set debug_sync='before_execute_sql_command wait_for g1';
+ update t1 set f1 = f1 + 100000 limit 2;
+ connect con2,localhost,root;
+ kill query UPDATE;
+ disconnect con2;
+ connection default;
+ ERROR 70100: Query execution was interrupted
+ set debug_sync='now signal g2';
+ connection con1;
+ show create table t2;
+ Table Create Table
+ t2 CREATE TABLE `t2` (
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f2`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ disconnect con1;
+ connection default;
+ select * from t2 where f2 not in (select f1 from t1);
+ f2
+ select * from t3 where f3 not in (select f2 from t2);
+ f3
+ drop table t3;
+ drop table t2;
+ drop table t1;
+ set debug_sync='reset';
++create table t1 (a int primary key, b int) engine=innodb;
++create table t2 (c int primary key, d int,
++foreign key (d) references t1 (a) on update cascade) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+insert t2 values (4,1),(5,2),(6,3);
+flush table t2 with read lock;
+connect con1,localhost,root;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+update t1 set a=10 where a=1;
+connection default;
+unlock tables;
+connection con1;
+connection default;
+lock table t2 write;
+connection con1;
+delete from t1 where a=2;
+connection default;
+unlock tables;
+connection con1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+connection default;
+unlock tables;
+disconnect con1;
+create user foo;
+grant select,update on test.t1 to foo;
+connect foo,localhost,foo;
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+c d
+5 2
+4 10
+6 30
+drop table t2, t1;
+drop user foo;
diff --cc mysql-test/suite/innodb/r/foreign_key.result
index 5838c3a1fd5,0d04f27f51f..a151651b594
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@@ -1,319 -1,19 +1,338 @@@
+#
+# Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
+# DICT_CREATE_FOREIGN_CONSTR
+#
+create table t1 (f1 int primary key) engine=InnoDB;
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1),
+constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+set foreign_key_checks = 0;
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/c1'
+drop table t2, t1;
+#
+# Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
+# NULL/NOT NULL MISMATCH
+#
+set foreign_key_checks = 1;
+show variables like 'foreign_key_checks';
+Variable_name Value
+foreign_key_checks ON
+CREATE TABLE t1
+(a INT NOT NULL,
+b INT NOT NULL,
+INDEX idx(a)) ENGINE=InnoDB;
+CREATE TABLE t2
+(a INT KEY,
+b INT,
+INDEX ind(b),
+FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
+ENGINE=InnoDB;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ KEY `idx` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `ind` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1, 80);
+INSERT INTO t1 VALUES (2, 81);
+INSERT INTO t1 VALUES (3, 82);
+INSERT INTO t1 VALUES (4, 83);
+INSERT INTO t1 VALUES (5, 84);
+INSERT INTO t2 VALUES (51, 1);
+INSERT INTO t2 VALUES (52, 2);
+INSERT INTO t2 VALUES (53, 3);
+INSERT INTO t2 VALUES (54, 4);
+INSERT INTO t2 VALUES (55, 5);
+SELECT a, b FROM t1 ORDER BY a;
+a b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+53 3
+54 4
+55 5
+INSERT INTO t2 VALUES (56, 6);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
+ALTER TABLE t1 CHANGE a id INT;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+53 3
+54 4
+55 5
+# Operations on child table
+INSERT INTO t2 VALUES (56, 6);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
+UPDATE t2 SET b = 99 WHERE a = 51;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
+DELETE FROM t2 WHERE a = 53;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+54 4
+55 5
+# Operations on parent table
+DELETE FROM t1 WHERE id = 1;
+UPDATE t1 SET id = 50 WHERE id = 5;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+2 81
+3 82
+4 83
+50 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+52 2
+54 4
+55 50
+DROP TABLE t2, t1;
+#
+# bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART
+# base bug#24818604 [GR]
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+SELECT * FROM t1;
+c1
+1
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+DROP TABLE t2;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE staff (
+staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+store_id TINYINT UNSIGNED NOT NULL,
+PRIMARY KEY (staff_id),
+KEY idx_fk_store_id (store_id),
+CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE store (
+store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+manager_staff_id TINYINT UNSIGNED NOT NULL,
+PRIMARY KEY (store_id),
+UNIQUE KEY idx_unique_manager (manager_staff_id),
+CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=DEFAULT;
+LOCK TABLE staff WRITE;
+UNLOCK TABLES;
+DROP TABLES staff, store;
+SET FOREIGN_KEY_CHECKS=1;
+#
+# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
+#
+CREATE TABLE users (
+id int unsigned AUTO_INCREMENT PRIMARY KEY,
+name varchar(32) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_groups (
+id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
+host_user_id int unsigned NOT NULL UNIQUE,
+CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_group_users (
+matchmaking_group_id bigint unsigned NOT NULL,
+user_id int unsigned NOT NULL,
+PRIMARY KEY (matchmaking_group_id,user_id),
+UNIQUE KEY user_id (user_id),
+CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT FOREIGN KEY (user_id)
+REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_group_maps (
+matchmaking_group_id bigint unsigned NOT NULL,
+map_id tinyint unsigned NOT NULL,
+PRIMARY KEY (matchmaking_group_id,map_id),
+CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar');
+INSERT INTO matchmaking_groups VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_users VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
+BEGIN;
+UPDATE users SET name = 'qux' WHERE id = 1;
+connect con1,localhost,root,,;
+SET innodb_lock_wait_timeout= 1;
+DELETE FROM matchmaking_groups WHERE id = 10;
+connection default;
+COMMIT;
+SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+matchmaking_group_id user_id
+SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+matchmaking_group_id map_id
+SELECT * FROM users;
+id name
+1 qux
+2 bar
+DROP TABLE
+matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users;
+#
+# MDEV-13331 FK DELETE CASCADE does not honor innodb_lock_wait_timeout
+#
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id INT NOT NULL PRIMARY KEY,
+ref_id INT NOT NULL DEFAULT 0,
+f INT NULL,
+FOREIGN KEY (ref_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1,1,10),(2,2,20);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `ref_id` int(11) NOT NULL DEFAULT 0,
+ `f` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `ref_id` (`ref_id`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`ref_id`) REFERENCES `t1` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+connection con1;
+BEGIN;
+UPDATE t2 SET f = 11 WHERE id = 1;
+connection default;
+SET innodb_lock_wait_timeout= 1;
+DELETE FROM t1 WHERE id = 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con1;
+COMMIT;
+disconnect con1;
+connection default;
+SELECT * FROM t2;
+id ref_id f
+1 1 11
+2 2 20
+DELETE FROM t1 WHERE id = 1;
+SELECT * FROM t2;
+id ref_id f
+2 2 20
+DROP TABLE t2, t1;
+#
+# MDEV-15199 Referential integrity broken in ON DELETE CASCADE
+#
+CREATE TABLE member (id int AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO member VALUES (1);
+CREATE TABLE address (
+id int AUTO_INCREMENT PRIMARY KEY,
+member_id int NOT NULL,
+KEY address_FI_1 (member_id),
+CONSTRAINT address_FK_1 FOREIGN KEY (member_id) REFERENCES member (id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO address VALUES (2,1);
+CREATE TABLE payment_method (
+id int AUTO_INCREMENT PRIMARY KEY,
+member_id int NOT NULL,
+cardholder_address_id int DEFAULT NULL,
+KEY payment_method_FI_1 (member_id),
+KEY payment_method_FI_2 (cardholder_address_id),
+CONSTRAINT payment_method_FK_1 FOREIGN KEY (member_id) REFERENCES member (id) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT payment_method_FK_2 FOREIGN KEY (cardholder_address_id) REFERENCES address (id) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO payment_method VALUES (3,1,2);
+BEGIN;
+UPDATE member SET id=42;
+SELECT * FROM member;
+id
+42
+SELECT * FROM address;
+id member_id
+2 42
+SELECT * FROM payment_method;
+id member_id cardholder_address_id
+3 42 2
+DELETE FROM member;
+COMMIT;
+SELECT * FROM member;
+id
+SELECT * FROM address;
+id member_id
+SELECT * FROM payment_method;
+id member_id cardholder_address_id
+DROP TABLE payment_method,address,member;
+#
+# Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY
+# PRODUCE BROKEN TABLE (no bug in MariaDB)
+#
+create table t1(f1 int,f2 int, primary key(f1), key(f2, f1))engine=innodb;
+create table t2(f1 int, f2 int as (2) stored, f3 int as (f2) stored,
+foreign key(f1) references t1(f2) on update set NULL)
+engine=innodb;
+insert into t1 values(1, 1);
+insert into t2(f1) values(1);
+drop table t2, t1;
+ SET FOREIGN_KEY_CHECKS=0;
+ CREATE TABLE staff (
+ staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ store_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (staff_id),
+ KEY idx_fk_store_id (store_id),
+ CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ CREATE TABLE store (
+ store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ manager_staff_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (store_id),
+ UNIQUE KEY idx_unique_manager (manager_staff_id),
+ CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ SET FOREIGN_KEY_CHECKS=DEFAULT;
+ LOCK TABLE staff WRITE;
+ UNLOCK TABLES;
+ DROP TABLES staff, store;
diff --cc mysql-test/suite/innodb/r/innodb-lock.result
index e63a7cd1505,5806535d6f0..1fe0d263fef
--- a/mysql-test/suite/innodb/r/innodb-lock.result
+++ b/mysql-test/suite/innodb/r/innodb-lock.result
@@@ -2,21 -2,15 +2,18 @@@ set global innodb_table_locks=1
select @@innodb_table_locks;
@@innodb_table_locks
1
- connect con1,localhost,root,,;
- connect con2,localhost,root,,;
- drop table if exists t1;
set @@innodb_table_locks=1;
- connection con1;
++connect con1,localhost,root,,;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
- connection con2;
++connect con2,localhost,root,,;
set autocommit=0;
lock table t1 write;
+connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
@@@ -115,14 -104,36 +112,50 @@@ INSERT IGNORE INTO t1 VALUES(3,23)
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 FOR UPDATE;
+connection con2;
++disconnect con2;
+connection default;
COMMIT;
+connection con1;
a b
3 1
COMMIT;
- disconnect con1;
- disconnect con2;
+connection default;
DROP TABLE t1;
+ #
+ # MDEV-11080 InnoDB: Failing assertion:
+ # table->n_waiting_or_granted_auto_inc_locks > 0
+ #
+ CREATE TABLE t1 (pk INTEGER AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+ INSERT INTO t1 VALUES (NULL),(NULL);
+ CREATE TABLE t2 LIKE t1;
+ BEGIN;
++connection con1;
+ BEGIN;
+ DELETE FROM t2;
++connection default;
+ LOCK TABLE t2 READ;;
++connection con1;
+ SET innodb_lock_wait_timeout= 1, lock_wait_timeout= 2;
+ INSERT INTO t2 SELECT * FROM t1;
+ COMMIT;
++connection default;
+ UNLOCK TABLES;
+ DROP TABLE t1, t2;
+ #
+ # MDEV-16709 InnoDB: Error: trx already had an AUTO-INC lock
+ #
+ CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
+ PARTITION BY key (pk) PARTITIONS 2;
+ CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+ INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6);
+ CREATE TABLE t3 (b INT) ENGINE=InnoDB;
+ INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
++connection con1;
+ INSERT t1 SELECT NULL FROM t2;
++connection default;
+ INSERT t1 SELECT NULL FROM t3;
++connection con1;
++disconnect con1;
++connection default;
+ DROP TABLE t1, t2, t3;
diff --cc mysql-test/suite/innodb/t/foreign-keys.test
index e77e1e761c7,7ef440b260b..35da5a5d075
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@@ -35,38 -38,76 +38,122 @@@ create table t2 (c int primary key, d i
insert t1 values (1,1),(2,2),(3,3);
insert t2 values (4,1),(5,2),(6,3);
flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
+ connect (con1,localhost,root);
+ --error ER_ROW_IS_REFERENCED_2
+ delete from t1 where a=2;
+ send update t1 set a=10 where a=1;
+ connection default;
+ let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+ source include/wait_condition.inc;
+ unlock tables;
+ connection con1;
+ reap;
+ connection default;
+ lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
+ connection con1;
+ send delete from t1 where a=2;
+ connection default;
+ let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+ source include/wait_condition.inc;
+ unlock tables;
+ connection con1;
+ --error ER_ROW_IS_REFERENCED_2
+ reap;
+ connection default;
+ unlock tables;
+ disconnect con1;
+
+ # but privileges should not be checked
+ create user foo;
+ grant select,update on test.t1 to foo;
+ connect(foo,localhost,foo);
+ update t1 set a=30 where a=3;
+ disconnect foo;
+ connection default;
+ select * from t2;
+ drop table t2, t1;
+ drop user foo;
+
+ #
+ # MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
+ #
+ create table t1 (f1 int primary key) engine=innodb;
+ create table t2 (f2 int primary key) engine=innodb;
+ create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+ insert into t1 values (1),(2),(3),(4),(5);
+ insert into t2 values (1),(2),(3),(4),(5);
+ insert into t3 values (1),(2),(3),(4),(5);
+ connect con1,localhost,root;
+ set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+ send alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+ connection default;
+ let $conn=`select connection_id()`;
+ set debug_sync='before_execute_sql_command wait_for g1';
+ send update t1 set f1 = f1 + 100000 limit 2;
+ connect con2,localhost,root;
+ let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock' and info like 'update t1 %';
+ source include/wait_condition.inc;
+ --replace_result $conn UPDATE
+ eval kill query $conn;
+ disconnect con2;
+ connection default;
+ error ER_QUERY_INTERRUPTED;
+ reap;
+ set debug_sync='now signal g2';
+ connection con1;
+ reap;
+ show create table t2;
+ disconnect con1;
+ connection default;
+ select * from t2 where f2 not in (select f1 from t1);
+ select * from t3 where f3 not in (select f2 from t2);
+ drop table t3;
+ drop table t2;
+ drop table t1;
+ set debug_sync='reset';
++
++#
++# FK and prelocking:
++# child table accesses (reads and writes) wait for locks.
++#
++create table t1 (a int primary key, b int) engine=innodb;
++create table t2 (c int primary key, d int,
++ foreign key (d) references t1 (a) on update cascade) engine=innodb;
++insert t1 values (1,1),(2,2),(3,3);
++insert t2 values (4,1),(5,2),(6,3);
++flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
+connect (con1,localhost,root);
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where a=2;
+send update t1 set a=10 where a=1;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+reap;
+connection default;
+lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
+connection con1;
+send delete from t1 where a=2;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+--error ER_ROW_IS_REFERENCED_2
+reap;
+connection default;
+unlock tables;
+disconnect con1;
+
+# but privileges should not be checked
+create user foo;
+grant select,update on test.t1 to foo;
+connect(foo,localhost,foo);
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+drop table t2, t1;
+drop user foo;
diff --cc mysql-test/suite/innodb/t/foreign_key.test
index b586f3e9406,223a1596883..7a8a9295ee7
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@@ -1,291 -1,25 +1,315 @@@
--source include/have_innodb.inc
+--source include/count_sessions.inc
+
+--echo #
+--echo # Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
+--echo # DICT_CREATE_FOREIGN_CONSTR
+--echo #
+
+create table t1 (f1 int primary key) engine=InnoDB;
+--error ER_CANT_CREATE_TABLE
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1),
+constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
+create table t2 (f1 int primary key,
+ constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+
+set foreign_key_checks = 0;
+--error ER_DUP_CONSTRAINT_NAME
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+
+drop table t2, t1;
+
+--echo #
+--echo # Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
+--echo # NULL/NOT NULL MISMATCH
+--echo #
+
+set foreign_key_checks = 1;
+show variables like 'foreign_key_checks';
+
+CREATE TABLE t1
+(a INT NOT NULL,
+ b INT NOT NULL,
+ INDEX idx(a)) ENGINE=InnoDB;
+
+CREATE TABLE t2
+(a INT KEY,
+ b INT,
+ INDEX ind(b),
+ FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
+ ENGINE=InnoDB;
+
+show create table t1;
+show create table t2;
+
+INSERT INTO t1 VALUES (1, 80);
+INSERT INTO t1 VALUES (2, 81);
+INSERT INTO t1 VALUES (3, 82);
+INSERT INTO t1 VALUES (4, 83);
+INSERT INTO t1 VALUES (5, 84);
+
+INSERT INTO t2 VALUES (51, 1);
+INSERT INTO t2 VALUES (52, 2);
+INSERT INTO t2 VALUES (53, 3);
+INSERT INTO t2 VALUES (54, 4);
+INSERT INTO t2 VALUES (55, 5);
+
+SELECT a, b FROM t1 ORDER BY a;
+SELECT a, b FROM t2 ORDER BY a;
+
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (56, 6);
+
+ALTER TABLE t1 CHANGE a id INT;
+
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+--echo # Operations on child table
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (56, 6);
+--error ER_NO_REFERENCED_ROW_2
+UPDATE t2 SET b = 99 WHERE a = 51;
+DELETE FROM t2 WHERE a = 53;
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+--echo # Operations on parent table
+DELETE FROM t1 WHERE id = 1;
+UPDATE t1 SET id = 50 WHERE id = 5;
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+DROP TABLE t2, t1;
+
+--echo #
+--echo # bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART
+--echo # base bug#24818604 [GR]
+--echo #
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1))
+ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+--source include/restart_mysqld.inc
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+SELECT * FROM t1;
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
+#
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE staff (
+ staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ store_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (staff_id),
+ KEY idx_fk_store_id (store_id),
+ CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE store (
+ store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ manager_staff_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (store_id),
+ UNIQUE KEY idx_unique_manager (manager_staff_id),
+ CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=DEFAULT;
+
+LOCK TABLE staff WRITE;
+UNLOCK TABLES;
+DROP TABLES staff, store;
+SET FOREIGN_KEY_CHECKS=1;
+
+--echo #
+--echo # MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
+--echo #
+
+CREATE TABLE users (
+ id int unsigned AUTO_INCREMENT PRIMARY KEY,
+ name varchar(32) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_groups (
+ id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
+ host_user_id int unsigned NOT NULL UNIQUE,
+ CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_group_users (
+ matchmaking_group_id bigint unsigned NOT NULL,
+ user_id int unsigned NOT NULL,
+ PRIMARY KEY (matchmaking_group_id,user_id),
+ UNIQUE KEY user_id (user_id),
+ CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+ REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT FOREIGN KEY (user_id)
+ REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_group_maps (
+ matchmaking_group_id bigint unsigned NOT NULL,
+ map_id tinyint unsigned NOT NULL,
+ PRIMARY KEY (matchmaking_group_id,map_id),
+ CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+ REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar');
+INSERT INTO matchmaking_groups VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_users VALUES (10,1),(11,2);
+INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
+
+BEGIN;
+UPDATE users SET name = 'qux' WHERE id = 1;
+
+--connect (con1,localhost,root,,)
+SET innodb_lock_wait_timeout= 1;
+DELETE FROM matchmaking_groups WHERE id = 10;
+
+--connection default
+COMMIT;
+--sorted_result
+SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+--sorted_result
+SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+--sorted_result
+SELECT * FROM users;
+
+DROP TABLE
+matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users;
+
+--echo #
+--echo # MDEV-13331 FK DELETE CASCADE does not honor innodb_lock_wait_timeout
+--echo #
+
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ id INT NOT NULL PRIMARY KEY,
+ ref_id INT NOT NULL DEFAULT 0,
+ f INT NULL,
+ FOREIGN KEY (ref_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1,1,10),(2,2,20);
+
+SHOW CREATE TABLE t2;
+
+--connection con1
+BEGIN;
+UPDATE t2 SET f = 11 WHERE id = 1;
+
+--connection default
+SET innodb_lock_wait_timeout= 1;
+--error ER_LOCK_WAIT_TIMEOUT
+DELETE FROM t1 WHERE id = 1;
+
+--connection con1
+COMMIT;
+--disconnect con1
+
+--connection default
+SELECT * FROM t2;
+DELETE FROM t1 WHERE id = 1;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-15199 Referential integrity broken in ON DELETE CASCADE
+--echo #
+
+CREATE TABLE member (id int AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO member VALUES (1);
+CREATE TABLE address (
+ id int AUTO_INCREMENT PRIMARY KEY,
+ member_id int NOT NULL,
+ KEY address_FI_1 (member_id),
+ CONSTRAINT address_FK_1 FOREIGN KEY (member_id) REFERENCES member (id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO address VALUES (2,1);
+CREATE TABLE payment_method (
+ id int AUTO_INCREMENT PRIMARY KEY,
+ member_id int NOT NULL,
+ cardholder_address_id int DEFAULT NULL,
+ KEY payment_method_FI_1 (member_id),
+ KEY payment_method_FI_2 (cardholder_address_id),
+ CONSTRAINT payment_method_FK_1 FOREIGN KEY (member_id) REFERENCES member (id) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT payment_method_FK_2 FOREIGN KEY (cardholder_address_id) REFERENCES address (id) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO payment_method VALUES (3,1,2);
+
+BEGIN;
+UPDATE member SET id=42;
+SELECT * FROM member;
+SELECT * FROM address;
+SELECT * FROM payment_method;
+DELETE FROM member;
+COMMIT;
+SELECT * FROM member;
+SELECT * FROM address;
+SELECT * FROM payment_method;
+
+DROP TABLE payment_method,address,member;
+
+--echo #
+--echo # Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY
+--echo # PRODUCE BROKEN TABLE (no bug in MariaDB)
+--echo #
+create table t1(f1 int,f2 int, primary key(f1), key(f2, f1))engine=innodb;
+create table t2(f1 int, f2 int as (2) stored, f3 int as (f2) stored,
+ foreign key(f1) references t1(f2) on update set NULL)
+engine=innodb;
+insert into t1 values(1, 1);
+insert into t2(f1) values(1);
+drop table t2, t1;
+
+--source include/wait_until_count_sessions.inc
+
+ #
+ # MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
+ #
+ SET FOREIGN_KEY_CHECKS=0;
+ CREATE TABLE staff (
+ staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ store_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (staff_id),
+ KEY idx_fk_store_id (store_id),
+ CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ CREATE TABLE store (
+ store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ manager_staff_id TINYINT UNSIGNED NOT NULL,
+ PRIMARY KEY (store_id),
+ UNIQUE KEY idx_unique_manager (manager_staff_id),
+ CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
+ ) ENGINE=InnoDB;
+ SET FOREIGN_KEY_CHECKS=DEFAULT;
+
+ LOCK TABLE staff WRITE;
+ UNLOCK TABLES;
+ DROP TABLES staff, store;
diff --cc mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
index 120ae018d2f,efe8155ec08..7f2a82f1efb
--- a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
@@@ -40,11 -36,8 +40,10 @@@ connection master
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS t1,t2,t3;
SET FOREIGN_KEY_CHECKS=1;
+connection slave;
+connection master;
create table t1 (b int primary key) engine = INNODB;
- create table t2 (a int primary key, b int, foreign key (b) references t1(b))
- engine = INNODB;
+ create table t2 (a int primary key, b int, foreign key (b) references t1(b)) engine = INNODB;
insert into t1 set b=1;
insert into t2 set a=1, b=1;
set foreign_key_checks=0;
diff --cc mysql-test/suite/wsrep/include/check_galera_version.inc
index e495da8f1ee,fd691161a54..32d01197f94
--- a/mysql-test/suite/wsrep/include/check_galera_version.inc
+++ b/mysql-test/suite/wsrep/include/check_galera_version.inc
@@@ -20,20 -21,23 +21,23 @@@ SELECT CAST(REGEXP_REPLACE(@GALERA_VERS
# Actual
SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version';
-
- SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MAJOR_VERSION;
- SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
-SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
-SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
++SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*(\\d+)\\.\\d+.*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
++SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
# For testing
- #SELECT @GALERA_MAJOR_VERSION, @GALERA_MINOR_VERSION;
+ #SELECT @GALERA_MAJOR_VERSION;
+ #SELECT @GALERA_MINOR_VERSION;
+ #SELECT @GALERA_RELEASE_VERSION;
#SELECT @ACTUAL_GALERA_VERSION;
- #SELECT @ACTUAL_GALERA_MAJOR_VERSION, @ACTUAL_GALERA_MINOR_VERSION;
+ #SELECT @ACTUAL_GALERA_MINOR_VERSION;
+ #SELECT @ACTUAL_GALERA_RELEASE_VERSION;
- if (!`SELECT (@ACTUAL_GALERA_MAJOR_VERSION > @GALERA_MAJOR_VERSION) OR
- (@ACTUAL_GALERA_MAJOR_VERSION = @GALERA_MAJOR_VERSION AND @ACTUAL_GALERA_MINOR_VERSION >= @GALERA_MINOR_VERSION)
+ if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR
+ (@ACTUAL_GALERA_MINOR_VERSION = @GALERA_MINOR_VERSION AND
+ @ACTUAL_GALERA_RELEASE_VERSION >= @GALERA_RELEASE_VERSION)
`)
{
- skip Test requires Galera library version $galera_version;
+ skip Test requires Galera library version >= $galera_version;
}
--enable_query_log
diff --cc scripts/wsrep_sst_rsync.sh
index 17f000324c8,1b42903e094..73b1f4f649d
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@@ -175,8 -157,15 +190,15 @@@ f
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index')
# New filter - exclude everything except dirs (schemas) and innodb files
- FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes'
- -f '+ /wsrep_sst_binlog.tar' -f '- $INNODB_DATA_HOME_DIR/ib_lru_dump' -f '- $INNODB_DATA_HOME_DIR/ibdata*' -f '+ /*/' -f '- /*'"
-FILTER=(-f '- /lost+found'
++FILTER="-f '- /lost+found'
+ -f '- /.fseventsd'
+ -f '- /.Trashes'
+ -f '+ /wsrep_sst_binlog.tar'
+ -f '- $INNODB_DATA_HOME_DIR/ib_lru_dump'
+ -f '- $INNODB_DATA_HOME_DIR/ibdata*'
+ -f '+ /undo*'
+ -f '+ /*/'
- -f '- /*')
++ -f '- /*'"
SSTKEY=$(parse_cnf sst tkey "")
SSTCERT=$(parse_cnf sst tcert "")
diff --cc sql/field.cc
index 9ca9663f066,ecb383a9575..a1a8ca41698
--- a/sql/field.cc
+++ b/sql/field.cc
@@@ -9815,15 -9782,20 +9815,20 @@@ void Column_definition::create_length_t
}
break;
case MYSQL_TYPE_NEWDECIMAL:
- key_length= pack_length=
- my_decimal_get_binary_size(my_decimal_length_to_precision((uint)length,
- decimals,
- flags &
- UNSIGNED_FLAG),
- decimals);
+ {
+ /*
+ This code must be identical to code in
+ Field_new_decimal::Field_new_decimal as otherwise the record layout
+ gets out of sync.
+ */
- uint precision= my_decimal_length_to_precision(length, decimals,
++ uint precision= my_decimal_length_to_precision((uint)length, decimals,
+ flags & UNSIGNED_FLAG);
+ set_if_smaller(precision, DECIMAL_MAX_PRECISION);
+ key_length= pack_length= my_decimal_get_binary_size(precision, decimals);
break;
+ }
default:
- key_length= pack_length= calc_pack_length(sql_type, length);
+ key_length= pack_length= calc_pack_length(sql_type, (uint)length);
break;
}
}
diff --cc sql/log.cc
index fa1fe3d808c,767070799a9..053c0f16c6c
--- a/sql/log.cc
+++ b/sql/log.cc
@@@ -1668,14 -1677,14 +1668,14 @@@ static int binlog_close_connection(hand
uchar *buf;
size_t len=0;
wsrep_write_cache_buf(cache, &buf, &len);
- WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lld",
- (ulong) len, (longlong) thd->thread_id);
- WSREP_WARN("binlog trx cache not empty (%zu bytes) @ connection close %lu",
- len, thd->thread_id);
++ WSREP_WARN("binlog trx cache not empty (%zu bytes) @ connection close %lld",
++ len, (longlong) thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
cache = cache_mngr->get_binlog_cache_log(false);
wsrep_write_cache_buf(cache, &buf, &len);
- WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lld",
- (ulong) len, (longlong) thd->thread_id);
- WSREP_WARN("binlog stmt cache not empty (%zu bytes) @ connection close %lu",
- len, thd->thread_id);
++ WSREP_WARN("binlog stmt cache not empty (%zu bytes) @ connection close %lld",
++ len, (longlong) thd->thread_id);
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
}
#endif /* WITH_WSREP */
diff --cc sql/log_event.cc
index ff3efcc62a3,e1912ad4620..04a616d0006
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@@ -8726,12 -7911,7 +8726,7 @@@ User_var_log_event(const char* buf, uin
Old events will not have this extra byte, thence,
we keep the flags set to UNDEF_F.
*/
- uint bytes_read= ((val + val_len) - buf_start);
+ size_t bytes_read= (val + val_len) - buf_start;
- if (bytes_read > size_t(event_len))
- {
- error= true;
- goto err;
- }
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
diff --cc sql/sql_alter.cc
index dbb138ed9ab,0accc04c10d..c8bc3952b61
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@@ -306,12 -305,19 +306,17 @@@ bool Sql_cmd_alter_table::execute(THD *
thd->enable_slow_log= opt_log_slow_admin_statements;
#ifdef WITH_WSREP
- if ((!thd->is_current_stmt_binlog_format_row() ||
- TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
-
+ if (WSREP(thd) &&
+ (!thd->is_current_stmt_binlog_format_row() ||
- !find_temporary_table(thd, first_table)))
+ !thd->find_temporary_table(first_table)))
{
- WSREP_TO_ISOLATION_BEGIN(((lex->name.str) ? select_lex->db : NULL),
- ((lex->name.str) ? lex->name.str : NULL),
- first_table);
+ WSREP_TO_ISOLATION_BEGIN_ALTER(((lex->name.str) ? select_lex->db : NULL),
+ ((lex->name.str) ? lex->name.str : NULL),
+ first_table,
+ &alter_info);
+
+ thd->variables.auto_increment_offset = 1;
+ thd->variables.auto_increment_increment = 1;
}
#endif /* WITH_WSREP */
diff --cc sql/sql_base.cc
index cae5b4a3f7d,dc1122ffad8..52474116fa6
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@@ -1460,6 -2122,66 +1461,66 @@@ open_table_get_mdl_lock(THD *thd, Open_
}
+ /**
+ Check if the given table is actually a VIEW that was LOCK-ed
+
+ @param thd Thread context.
+ @param t Table to check.
+
+ @retval TRUE The 't'-table is a locked view
+ needed to remedy problem before retrying again.
+ @retval FALSE 't' was not locked, not a VIEW or an error happened.
+ */
+ bool is_locked_view(THD *thd, TABLE_LIST *t)
+ {
+ DBUG_ENTER("check_locked_view");
+ /*
+ Is this table a view and not a base table?
+ (it is work around to allow to open view with locked tables,
+ real fix will be made after definition cache will be made)
+
+ Since opening of view which was not explicitly locked by LOCK
+ TABLES breaks metadata locking protocol (potentially can lead
+ to deadlocks) it should be disallowed.
+ */
+ if (thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+ t->db, t->table_name,
+ MDL_SHARED))
+ {
+ char path[FN_REFLEN + 1];
+ build_table_filename(path, sizeof(path) - 1,
+ t->db, t->table_name, reg_ext, 0);
+ /*
+ Note that we can't be 100% sure that it is a view since it's
+ possible that we either simply have not found unused TABLE
+ instance in THD::open_tables list or were unable to open table
+ during prelocking process (in this case in theory we still
+ should hold shared metadata lock on it).
+ */
+ if (dd_frm_is_view(thd, path))
+ {
+ /*
+ If parent_l of the table_list is non null then a merge table
+ has this view as child table, which is not supported.
+ */
+ if (t->parent_l)
+ {
+ my_error(ER_WRONG_MRG_TABLE, MYF(0));
+ DBUG_RETURN(FALSE);
+ }
+
- if (!tdc_open_view(thd, t, t->alias, CHECK_METADATA_VERSION))
++ if (!tdc_open_view(thd, t, CHECK_METADATA_VERSION))
+ {
+ DBUG_ASSERT(t->view != 0);
+ DBUG_RETURN(TRUE); // VIEW
+ }
+ }
+ }
+
+ DBUG_RETURN(FALSE);
+ }
+
+
/**
Open a base table.
@@@ -4213,8 -4874,8 +4246,9 @@@ handle_routine(THD *thd, Query_tables_l
@note this can be changed to use a hash, instead of scanning the linked
list, if the performance of this function will ever become an issue
*/
- static bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
- LEX_STRING *table, thr_lock_type lock_type)
++
+ bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
+ LEX_STRING *table, thr_lock_type lock_type)
{
for (; tl; tl= tl->next_global )
{
diff --cc sql/sql_base.h
index 4f99111cbd9,94294e3aa43..37cc9e8e8f1
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@@ -138,8 -145,11 +139,10 @@@ thr_lock_type read_lock_type_for_table(
bool routine_modifies_data);
my_bool mysql_rm_tmp_tables(void);
-bool rm_temporary_table(handlerton *base, const char *path);
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
const MDL_savepoint &start_of_statement_svp);
+ bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
+ LEX_STRING *table, thr_lock_type lock_type);
TABLE_LIST *find_table_in_list(TABLE_LIST *table,
TABLE_LIST *TABLE_LIST::*link,
const char *db_name,
@@@ -295,8 -332,11 +298,9 @@@ bool tdc_open_view(THD *thd, TABLE_LIS
TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
const char *table_name,
- bool no_error);
+ int *p_error);
+ void mark_tmp_table_for_reuse(TABLE *table);
-int update_virtual_fields(THD *thd, TABLE *table,
- enum enum_vcol_update_mode vcol_update_mode= VCOL_UPDATE_FOR_READ);
int dynamic_column_error_message(enum_dyncol_func_result rc);
/* open_and_lock_tables with optional derived handling */
diff --cc sql/sql_parse.cc
index dd16200539d,add059340c9..3231c4b730f
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@@ -7797,9 -7262,10 +7797,11 @@@ static void wsrep_mysql_parse(THD *thd
"WAIT_FOR wsrep_retry_autocommit_continue";
DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
});
+ WSREP_DEBUG("Retry autocommit query: %s", thd->query());
}
+
- mysql_parse(thd, rawbuf, length, parser_state);
+ mysql_parse(thd, rawbuf, length, parser_state, is_com_multi,
+ is_next_command);
if (WSREP(thd)) {
/* wsrep BF abort in query exec phase */
diff --cc sql/sql_table.cc
index dbcab9bb870,da65f168d84..4aed06e3590
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@@ -3371,75 -3464,6 +3371,79 @@@ mysql_prepare_create_table(THD *thd, HA
if (prepare_blob_field(thd, sql_field))
DBUG_RETURN(TRUE);
+ /*
+ Convert the default value from client character
+ set into the column character set if necessary.
+ We can only do this for constants as we have not yet run fix_fields.
+ */
+ if (sql_field->default_value &&
+ sql_field->default_value->expr->basic_const_item() &&
+ (!sql_field->field ||
+ sql_field->field->default_value != sql_field->default_value) &&
+ save_cs != sql_field->default_value->expr->collation.collation &&
+ (sql_field->sql_type == MYSQL_TYPE_VAR_STRING ||
+ sql_field->sql_type == MYSQL_TYPE_STRING ||
+ sql_field->sql_type == MYSQL_TYPE_SET ||
+ sql_field->sql_type == MYSQL_TYPE_TINY_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_MEDIUM_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_LONG_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_BLOB ||
+ sql_field->sql_type == MYSQL_TYPE_ENUM))
+ {
+ Item *item;
+ if (!(item= sql_field->default_value->expr->
+ safe_charset_converter(thd, save_cs)))
+ {
+ /* Could not convert */
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(TRUE);
+ }
+ /* Fix for prepare statement */
+ thd->change_item_tree(&sql_field->default_value->expr, item);
+ }
+
++ /* Virtual fields are always NULL */
++ if (sql_field->vcol_info)
++ sql_field->flags&= ~NOT_NULL_FLAG;
++
+ if (sql_field->default_value &&
+ sql_field->default_value->expr->basic_const_item() &&
+ (sql_field->sql_type == MYSQL_TYPE_SET ||
+ sql_field->sql_type == MYSQL_TYPE_ENUM))
+ {
+ StringBuffer<MAX_FIELD_WIDTH> str;
+ String *def= sql_field->default_value->expr->val_str(&str);
+ bool not_found;
+ if (def == NULL) /* SQL "NULL" maps to NULL */
+ {
+ not_found= sql_field->flags & NOT_NULL_FLAG;
+ }
+ else
+ {
+ not_found= false;
+ if (sql_field->sql_type == MYSQL_TYPE_SET)
+ {
+ char *not_used;
+ uint not_used2;
+ find_set(sql_field->interval, def->ptr(), def->length(),
+ sql_field->charset, ¬_used, ¬_used2, ¬_found);
+ }
+ else /* MYSQL_TYPE_ENUM */
+ {
+ def->length(sql_field->charset->cset->lengthsp(sql_field->charset,
+ def->ptr(), def->length()));
+ not_found= !find_type2(sql_field->interval, def->ptr(),
+ def->length(), sql_field->charset);
+ }
+ }
+
+ if (not_found)
+ {
+ my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
+ DBUG_RETURN(TRUE);
+ }
+ }
+
if (!(sql_field->flags & NOT_NULL_FLAG))
null_fields++;
@@@ -9477,27 -9132,73 +9481,79 @@@ bool mysql_alter_table(THD *thd,char *n
tbl.init_one_table(alter_ctx.new_db, strlen(alter_ctx.new_db),
alter_ctx.tmp_name, strlen(alter_ctx.tmp_name),
alter_ctx.tmp_name, TL_READ_NO_INSERT);
- /* Table is in thd->temporary_tables */
- if (open_temporary_table(thd, &tbl))
+ /*
+ Table can be found in the list of open tables in THD::all_temp_tables
+ list.
+ */
- tbl.table= thd->find_temporary_table(&tbl);
++ if ((tbl.table= thd->find_temporary_table(&tbl)) == NULL)
+ goto err_new_table_cleanup;
new_table= tbl.table;
+ DBUG_ASSERT(new_table);
}
else
{
- /* table is a normal table: Create temporary table in same directory */
- /* Open our intermediate table. */
- new_table= open_table_uncached(thd, new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db, alter_ctx.tmp_name,
- true, true);
+ /*
+ table is a normal table: Create temporary table in same directory.
+ Open our intermediate table.
+ */
+ new_table=
+ thd->create_and_open_tmp_table(new_db_type, &frm,
+ alter_ctx.get_tmp_path(),
+ alter_ctx.new_db, alter_ctx.tmp_name,
+ true);
+ if (!new_table)
+ goto err_new_table_cleanup;
+
+ /*
+ Normally, an attempt to modify an FK parent table will cause
+ FK children to be prelocked, so the table-being-altered cannot
+ be modified by a cascade FK action, because ALTER holds a lock
+ and prelocking will wait.
+
+ But if a new FK is being added by this very ALTER, then the target
+ table is not locked yet (it's a temporary table). So, we have to
+ lock FK parents explicitly.
+ */
+ if (alter_info->flags & Alter_info::ADD_FOREIGN_KEY)
+ {
+ List <FOREIGN_KEY_INFO> fk_list;
+ List_iterator<FOREIGN_KEY_INFO> fk_list_it(fk_list);
+ FOREIGN_KEY_INFO *fk;
+
+ /* tables_opened can be > 1 only for MERGE tables */
+ DBUG_ASSERT(tables_opened == 1);
+ DBUG_ASSERT(&table_list->next_global == thd->lex->query_tables_last);
+
+ new_table->file->get_foreign_key_list(thd, &fk_list);
+ while ((fk= fk_list_it++))
+ {
+ if (lower_case_table_names)
+ {
+ char buf[NAME_LEN];
+ uint len;
+ strmake_buf(buf, fk->referenced_db->str);
+ len = my_casedn_str(files_charset_info, buf);
+ thd->make_lex_string(fk->referenced_db, buf, len);
+ strmake_buf(buf, fk->referenced_table->str);
+ len = my_casedn_str(files_charset_info, buf);
+ thd->make_lex_string(fk->referenced_table, buf, len);
+ }
+ if (table_already_fk_prelocked(table_list, fk->referenced_db,
+ fk->referenced_table, TL_READ_NO_INSERT))
+ continue;
+
+ TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
+ tl->init_one_table_for_prelocking(fk->referenced_db->str, fk->referenced_db->length,
+ fk->referenced_table->str, fk->referenced_table->length,
+ NULL, TL_READ_NO_INSERT, false, NULL, 0,
+ &thd->lex->query_tables_last);
+ }
+
+ if (open_tables(thd, &table_list->next_global, &tables_opened, 0,
+ &alter_prelocking_strategy))
+ goto err_new_table_cleanup;
+ }
}
- if (!new_table)
- goto err_new_table_cleanup;
/*
Note: In case of MERGE table, we do not attach children. We do not
copy data for MERGE tables. Only the children have data.
diff --cc sql/table.h
index c0cca1026ea,ca32234579f..fc3102fc9a5
--- a/sql/table.h
+++ b/sql/table.h
@@@ -1507,14 -1517,15 +1507,15 @@@ typedef struct st_foreign_key_inf
} FOREIGN_KEY_INFO;
LEX_CSTRING *fk_option_name(enum_fk_option opt);
+ bool fk_modifies_child(enum_fk_option opt);
-#define MY_I_S_MAYBE_NULL 1
-#define MY_I_S_UNSIGNED 2
+#define MY_I_S_MAYBE_NULL 1U
+#define MY_I_S_UNSIGNED 2U
-#define SKIP_OPEN_TABLE 0 // do not open table
-#define OPEN_FRM_ONLY 1 // open FRM file only
-#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files
+#define SKIP_OPEN_TABLE 0U // do not open table
+#define OPEN_FRM_ONLY 1U // open FRM file only
+#define OPEN_FULL_TABLE 2U // open FRM,MYD, MYI files
typedef struct st_field_info
{
@@@ -1792,6 -1808,6 +1798,7 @@@ struct TABLE_LIS
*last_ptr= &next_global;
}
++
/*
List of tables local to a subquery (used by SQL_I_List). Considers
views as leaves (unlike 'next_leaf' below). Created at parse time
@@@ -2399,9 -2400,17 +2406,19 @@@
return false;
}
void set_lock_type(THD* thd, enum thr_lock_type lock);
+ void check_pushable_cond_for_table(Item *cond);
+ Item *build_pushable_cond_for_table(THD *thd, Item *cond);
+ void remove_join_columns()
+ {
+ if (join_columns)
+ {
+ join_columns->empty();
+ join_columns= NULL;
+ is_join_columns_complete= FALSE;
+ }
+ }
+
private:
bool prep_check_option(THD *thd, uint8 check_opt_type);
bool prep_where(THD *thd, Item **conds, bool no_where_clause);
diff --cc sql/wsrep_mysqld.cc
index 326b5928366,1b2d7fe04e6..0ddc4520cee
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@@ -62,57 -62,44 +62,53 @@@ extern my_bool plugins_are_initialized
extern uint kill_cached_threads;
extern mysql_cond_t COND_thread_cache;
-const char* wsrep_data_home_dir = NULL;
-const char* wsrep_dbug_option = "";
-
-long wsrep_slave_threads = 1; // # of slave action appliers wanted
-int wsrep_slave_count_change = 0; // # of appliers to stop or start
-my_bool wsrep_debug = 0; // enable debug level logging
-my_bool wsrep_convert_LOCK_to_trx = 1; // convert locking sessions to trx
-ulong wsrep_retry_autocommit = 5; // retry aborted autocommit trx
-my_bool wsrep_auto_increment_control = 1; // control auto increment variables
-my_bool wsrep_drupal_282555_workaround = 1; // retry autoinc insert after dupkey
-my_bool wsrep_incremental_data_collection = 0; // incremental data collection
-ulong wsrep_max_ws_size = 1073741824UL;//max ws (RBR buffer) size
-ulong wsrep_max_ws_rows = 65536; // max number of rows in ws
-int wsrep_to_isolation = 0; // # of active TO isolation threads
-my_bool wsrep_certify_nonPK = 1; // certify, even when no primary key
-long wsrep_max_protocol_version = 3; // maximum protocol version to use
-ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC;
-my_bool wsrep_recovery = 0; // recovery
-my_bool wsrep_replicate_myisam = 0; // enable myisam replication
-my_bool wsrep_log_conflicts = 0;
-ulong wsrep_mysql_replication_bundle = 0;
-my_bool wsrep_desync = 0; // desynchronize the node from the
- // cluster
-my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals
-my_bool wsrep_restart_slave = 0; // should mysql slave thread be
- // restarted, if node joins back
-my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
- // restart will be needed
-my_bool wsrep_slave_UK_checks = 0; // slave thread does UK checks
-my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks
-bool wsrep_new_cluster = false; // Bootstrap the cluster ?
-
-// Use wsrep_gtid_domain_id for galera transactions?
-bool wsrep_gtid_mode = 0;
-// gtid_domain_id for galera transactions.
-uint32 wsrep_gtid_domain_id = 0;
-// Allow reads even if the node is not in the primary component.
-bool wsrep_dirty_reads = false;
+/* System variables. */
+const char *wsrep_provider;
+const char *wsrep_provider_options;
+const char *wsrep_cluster_address;
+const char *wsrep_cluster_name;
+const char *wsrep_node_name;
+const char *wsrep_node_address;
+const char *wsrep_node_incoming_address;
+const char *wsrep_start_position;
+const char *wsrep_data_home_dir;
+const char *wsrep_dbug_option;
+const char *wsrep_notify_cmd;
- const char *wsrep_sst_method;
- const char *wsrep_sst_receive_address;
- const char *wsrep_sst_donor;
- const char *wsrep_sst_auth;
++
+my_bool wsrep_debug; // Enable debug level logging
+my_bool wsrep_convert_LOCK_to_trx; // Convert locking sessions to trx
+my_bool wsrep_auto_increment_control; // Control auto increment variables
+my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after dupkey
+my_bool wsrep_certify_nonPK; // Certify, even when no primary key
+my_bool wsrep_recovery; // Recovery
+my_bool wsrep_replicate_myisam; // Enable MyISAM replication
+my_bool wsrep_log_conflicts;
+my_bool wsrep_load_data_splitting; // Commit load data every 10K intervals
+my_bool wsrep_slave_UK_checks; // Slave thread does UK checks
+my_bool wsrep_slave_FK_checks; // Slave thread does FK checks
- my_bool wsrep_sst_donor_rejects_queries;
+my_bool wsrep_restart_slave; // Should mysql slave thread be
+ // restarted, when node joins back?
+my_bool wsrep_desync; // De(re)synchronize the node from the
+ // cluster
+long wsrep_slave_threads; // No. of slave appliers threads
+ulong wsrep_retry_autocommit; // Retry aborted autocommit trx
+ulong wsrep_max_ws_size; // Max allowed ws (RBR buffer) size
+ulong wsrep_max_ws_rows; // Max number of rows in ws
+ulong wsrep_forced_binlog_format;
+ulong wsrep_mysql_replication_bundle;
+bool wsrep_gtid_mode; // Use wsrep_gtid_domain_id
+ // for galera transactions?
+uint32 wsrep_gtid_domain_id; // gtid_domain_id for galera
+ // transactions
+
+/* Other configuration variables and their default values. */
+my_bool wsrep_incremental_data_collection= 0; // Incremental data collection
+my_bool wsrep_restart_slave_activated= 0; // Node has dropped, and slave
+ // restart will be needed
+bool wsrep_new_cluster= false; // Bootstrap the cluster?
+int wsrep_slave_count_change= 0; // No. of appliers to stop/start
+int wsrep_to_isolation= 0; // No. of active TO isolation threads
+long wsrep_max_protocol_version= 3; // Maximum protocol version to use
/*
* End configuration options
@@@ -1395,6 -1408,67 +1431,67 @@@ create_view_query(THD *thd, uchar** buf
return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len);
}
+ /*
+ Rewrite DROP TABLE for TOI. Temporary tables are eliminated from
+ the query as they are visible only to client connection.
+
+ TODO: See comments for sql_base.cc:drop_temporary_table() and refine
+ the function to deal with transactional locked tables.
+ */
+ static int wsrep_drop_table_query(THD* thd, uchar** buf, size_t* buf_len)
+ {
+
+ LEX* lex= thd->lex;
+ SELECT_LEX* select_lex= &lex->select_lex;
+ TABLE_LIST* first_table= select_lex->table_list.first;
+ String buff;
+
+ DBUG_ASSERT(!lex->create_info.tmp_table());
+
+ bool found_temp_table= false;
+ for (TABLE_LIST* table= first_table; table; table= table->next_global)
+ {
- if (find_temporary_table(thd, table->db, table->table_name))
++ if (thd->find_temporary_table(table->db, table->table_name))
+ {
+ found_temp_table= true;
+ break;
+ }
+ }
+
+ if (found_temp_table)
+ {
+ buff.append("DROP TABLE ");
+ if (lex->check_exists)
+ buff.append("IF EXISTS ");
+
+ for (TABLE_LIST* table= first_table; table; table= table->next_global)
+ {
- if (!find_temporary_table(thd, table->db, table->table_name))
++ if (!thd->find_temporary_table(table->db, table->table_name))
+ {
+ append_identifier(thd, &buff, table->db, strlen(table->db));
+ buff.append(".");
+ append_identifier(thd, &buff, table->table_name,
+ strlen(table->table_name));
+ buff.append(",");
+ }
+ }
+
+ /* Chop the last comma */
+ buff.chop();
+ buff.append(" /* generated by wsrep */");
+
+ WSREP_DEBUG("Rewrote '%s' as '%s'", thd->query(), buff.ptr());
+
+ return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len);
+ }
+ else
+ {
+ return wsrep_to_buf_helper(thd, thd->query(), thd->query_length(),
+ buf, buf_len);
+ }
+ }
+
+
/* Forward declarations. */
static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len);
static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
diff --cc sql/wsrep_sst.cc
index 908c0c56685,e2c55583594..3790c81d398
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@@ -37,8 -40,14 +38,14 @@@ static char wsrep_defaults_file[FN_REFL
sizeof(WSREP_SST_OPT_CONF_SUFFIX) +
sizeof(WSREP_SST_OPT_CONF_EXTRA)] = {0};
+ const char* wsrep_sst_method = WSREP_SST_DEFAULT;
+ const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO;
+ const char* wsrep_sst_donor = "";
- char* wsrep_sst_auth = NULL;
++const char* wsrep_sst_auth = NULL;
+
// container for real auth string
static const char* sst_auth_real = NULL;
+ my_bool wsrep_sst_donor_rejects_queries = FALSE;
bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var)
{
@@@ -157,12 -165,13 +163,12 @@@ void wsrep_sst_auth_free(
bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type)
{
-- return sst_auth_real_set (wsrep_sst_auth);
++ return sst_auth_real_set (wsrep_sst_auth);
}
-void wsrep_sst_auth_init (const char* value)
+void wsrep_sst_auth_init ()
{
- DBUG_ASSERT(wsrep_sst_auth == value);
- sst_auth_real_set (wsrep_sst_auth);
+ sst_auth_real_set(wsrep_sst_auth);
}
bool wsrep_sst_donor_check (sys_var *self, THD* thd, set_var* var)
@@@ -172,9 -181,11 +178,11 @@@
bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type)
{
-- return 0;
++ return 0;
}
+ static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
+
bool wsrep_before_SE()
{
return (wsrep_provider != NULL
@@@ -266,99 -277,42 +274,99 @@@ void wsrep_sst_complete (const wsrep_uu
mysql_mutex_unlock (&LOCK_wsrep_sst);
}
-void wsrep_sst_received (wsrep_t* const wsrep,
+/*
+ If wsrep provider is loaded, inform that the new state snapshot
+ has been received. Also update the local checkpoint.
+
+ @param wsrep [IN] wsrep handle
+ @param uuid [IN] Initial state UUID
+ @param seqno [IN] Initial state sequence number
+ @param state [IN] Always NULL, also ignored by wsrep provider (?)
+ @param state_len [IN] Always 0, also ignored by wsrep provider (?)
+ @param implicit [IN] Whether invoked implicitly due to SST
+ (true) or explicitly because if change
+ in wsrep_start_position by user (false).
+ @return false Success
+ true Error
+
+*/
+bool wsrep_sst_received (wsrep_t* const wsrep,
const wsrep_uuid_t& uuid,
- wsrep_seqno_t const seqno,
+ const wsrep_seqno_t seqno,
const void* const state,
- size_t const state_len)
+ const size_t state_len,
+ const bool implicit)
{
- wsrep_get_SE_checkpoint(local_uuid, local_seqno);
+ /*
+ To keep track of whether the local uuid:seqno should be updated. Also, note
+ that local state (uuid:seqno) is updated/checkpointed only after we get an
+ OK from wsrep provider. By doing so, the values remain consistent across
+ the server & wsrep provider.
+ */
+ bool do_update= false;
- if (memcmp(&local_uuid, &uuid, sizeof(wsrep_uuid_t)) ||
- local_seqno < seqno || seqno < 0)
+ // Get the locally stored uuid:seqno.
+ if (wsrep_get_SE_checkpoint(local_uuid, local_seqno))
+ {
+ return true;
+ }
+
+ if (memcmp(&local_uuid, &uuid, sizeof(wsrep_uuid_t)) ||
- local_seqno < seqno)
++ local_seqno < seqno || seqno < 0)
+ {
+ do_update= true;
+ }
+ else if (local_seqno > seqno)
+ {
+ WSREP_WARN("SST position can't be set in past. Requested: %lld, Current: "
+ " %lld.", (long long)seqno, (long long)local_seqno);
+ /*
+ If we are here because of SET command, simply return true (error) instead of
+ aborting.
+ */
+ if (implicit)
{
- wsrep_set_SE_checkpoint(uuid, seqno);
- local_uuid = uuid;
- local_seqno = seqno;
+ WSREP_WARN("Can't continue.");
+ unireg_abort(1);
}
- else if (local_seqno > seqno)
+ else
{
- WSREP_WARN("SST postion is in the past: %lld, current: %lld. "
- "Can't continue.",
- (long long)seqno, (long long)local_seqno);
- unireg_abort(1);
+ return true;
}
+ }
#ifdef GTID_SUPPORT
- wsrep_init_sidno(uuid);
+ wsrep_init_sidno(uuid);
#endif /* GTID_SUPPORT */
- if (wsrep)
+ if (wsrep)
+ {
+ int const rcode(seqno < 0 ? seqno : 0);
+ wsrep_gtid_t const state_id= {uuid,
+ (rcode ? WSREP_SEQNO_UNDEFINED : seqno)};
+
+ wsrep_status_t ret= wsrep->sst_received(wsrep, &state_id, state,
+ state_len, rcode);
+
+ if (ret != WSREP_OK)
{
- int const rcode(seqno < 0 ? seqno : 0);
- wsrep_gtid_t const state_id = {
- uuid, (rcode ? WSREP_SEQNO_UNDEFINED : seqno)
- };
+ return true;
+ }
+ }
- wsrep->sst_received(wsrep, &state_id, state, state_len, rcode);
+ // Now is the good time to update the local state and checkpoint.
+ if (do_update)
+ {
+ if (wsrep_set_SE_checkpoint(uuid, seqno))
+ {
+ return true;
}
+
+ local_uuid= uuid;
+ local_seqno= seqno;
+ }
+
+ return false;
}
// Let applier threads to continue
diff --cc storage/innobase/btr/btr0scrub.cc
index 376a106bf8a,2e667e64d0b..578f9438eb8
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@@ -144,13 -143,12 +144,13 @@@ btr_scrub_lock_dict_func(ulint space_id
os_thread_sleep(250000);
time_t now = time(0);
+
if (now >= last + 30) {
fprintf(stderr,
- "WARNING: %s:%u waited %ld seconds for"
+ "WARNING: %s:%u waited " TIMETPF " seconds for"
- " dict_sys lock, space: %lu"
+ " dict_sys lock, space: " ULINTPF
" lock_to_close_table: %d\n",
- file, line, now - start, space_id,
+ file, line, long(now - start), space_id,
lock_to_close_table);
last = now;
diff --cc storage/innobase/handler/ha_innodb.cc
index b363b4ff52e,084272124b7..4bed93b3a9e
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@@ -14963,9 -14427,9 +14963,9 @@@ get_foreign_key_info
/* Referenced (parent) table name */
ptr = dict_remove_db_name(foreign->referenced_table_name);
- len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff), 1);
f_key_info.referenced_table = thd_make_lex_string(
- thd, 0, name_buff, static_cast<unsigned int>(len), 1);
+ thd, 0, name_buff, len, 1);
/* Dependent (child) database name */
len = dict_get_db_name_len(foreign->foreign_table_name);
@@@ -14979,9 -14443,9 +14979,9 @@@
/* Dependent (child) table name */
ptr = dict_remove_db_name(foreign->foreign_table_name);
- len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
+ len = filename_to_tablename(ptr, name_buff, sizeof(name_buff), 1);
f_key_info.foreign_table = thd_make_lex_string(
- thd, 0, name_buff, static_cast<unsigned int>(len), 1);
+ thd, 0, name_buff, len, 1);
do {
ptr = foreign->foreign_col_names[i];
diff --cc storage/innobase/include/univ.i
index 10eb83289da,e4503672375..1d2e0f37dbe
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@@ -75,51 -79,65 +75,50 @@@ the virtual method table (vtable) in GC
# define ha_innobase ha_innodb
#endif /* MYSQL_DYNAMIC_PLUGIN */
-#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
-# undef __WIN__
-# define __WIN__
-
+#if defined(_WIN32)
# include <windows.h>
+#endif /* _WIN32 */
-# ifdef _NT_
-# define __NT__
-# endif
+/* Include a minimum number of SQL header files so that few changes
+made in SQL code cause a complete InnoDB rebuild. These headers are
+used throughout InnoDB but do not include too much themselves. They
+support cross-platform development and expose comonly used SQL names. */
-#else
-/* The defines used with MySQL */
+#include <my_global.h>
-/* Include two header files from MySQL to make the Unix flavor used
-in compiling more Posix-compatible. These headers also define __WIN__
-if we are compiling on Windows. */
+/* JAN: TODO: missing 5.7 header */
+#ifdef HAVE_MY_THREAD_H
+//# include <my_thread.h>
+#endif
-#ifndef UNIV_HOTBACKUP
-# include <my_global.h>
-# include <my_pthread.h>
-#endif /* UNIV_HOTBACKUP */
+#ifndef UNIV_INNOCHECKSUM
+# include <m_string.h>
+# include <mysqld_error.h>
+#endif /* !UNIV_INNOCHECKSUM */
/* Include <sys/stat.h> to get S_I... macros defined for os0file.cc */
-# include <sys/stat.h>
-# if !defined(__WIN__)
-# include <sys/mman.h> /* mmap() for os0proc.cc */
-# endif
-
-/* Include the header file generated by GNU autoconf */
-# ifndef __WIN__
-# ifndef UNIV_HOTBACKUP
-# include "my_config.h"
-# endif /* UNIV_HOTBACKUP */
-# endif
+#include <sys/stat.h>
-# ifdef HAVE_SCHED_H
-# include <sched.h>
-# endif
-
-/* We only try to do explicit inlining of functions with gcc and
-Sun Studio */
-
-# ifdef HAVE_PREAD
-# define HAVE_PWRITE
-# endif
-
-#endif /* #if (defined(WIN32) || ... */
+#ifndef _WIN32
+# include <sys/mman.h> /* mmap() for os0proc.cc */
+# include <sched.h>
+# include "my_config.h"
+#endif
-#ifndef __WIN__
+#include <stdint.h>
- #define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */
#include <inttypes.h>
-#endif /* !__WIN__ */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "my_pthread.h"
/* Following defines are to enable performance schema
-instrumentation in each of four InnoDB modules if
+instrumentation in each of five InnoDB modules if
HAVE_PSI_INTERFACE is defined. */
-#if defined HAVE_PSI_INTERFACE && !defined UNIV_HOTBACKUP
+#ifdef HAVE_PSI_INTERFACE
# define UNIV_PFS_MUTEX
# define UNIV_PFS_RWLOCK
-
# define UNIV_PFS_IO
# define UNIV_PFS_THREAD
@@@ -452,23 -452,43 +451,26 @@@ typedef ssize_t lint
/* Use the integer types and formatting strings defined in Visual Studio. */
# define UINT32PF "%u"
# define INT64PF "%lld"
-# define UINT64PF "%llu"
+# define UINT64scan "llu"
# define UINT64PFx "%016llx"
+ # define TIMETPF "%ld"
-typedef __int64 ib_int64_t;
-typedef unsigned __int64 ib_uint64_t;
-typedef unsigned __int32 ib_uint32_t;
+#elif defined __APPLE__
+/* Apple prefers to call the 64-bit types 'long long'
+in both 32-bit and 64-bit environments. */
+# define UINT32PF "%" PRIu32
+# define INT64PF "%lld"
+# define UINT64scan "llu"
+# define UINT64PFx "%016llx"
++# define TIMETPF "%" PRIdFAST32
#else
/* Use the integer types and formatting strings defined in the C99 standard. */
# define UINT32PF "%" PRIu32
# define INT64PF "%" PRId64
-# define UINT64PF "%" PRIu64
+# define UINT64scan PRIu64
# define UINT64PFx "%016" PRIx64
+ # define TIMETPF "%" PRIdFAST32
-typedef int64_t ib_int64_t;
-typedef uint64_t ib_uint64_t;
-typedef uint32_t ib_uint32_t;
#endif
-#define IB_ID_FMT UINT64PF
-
-/* Type used for all log sequence number storage and arithmetics */
-typedef ib_uint64_t lsn_t;
-
-#ifdef _WIN64
-typedef unsigned __int64 ulint;
-typedef __int64 lint;
-# define ULINTPF UINT64PF
-#else
-typedef unsigned long int ulint;
-typedef long int lint;
-# define ULINTPF "%lu"
-#endif /* _WIN64 */
-
-#ifndef UNIV_HOTBACKUP
-typedef unsigned long long int ullint;
-#endif /* UNIV_HOTBACKUP */
-
#ifdef UNIV_INNOCHECKSUM
extern bool strict_verify;
extern FILE* log_file;
diff --cc storage/tokudb/ha_tokudb.cc
index 91041ec6df4,61c7011252b..d5b4adcd745
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@@ -5893,10 -5942,12 +5929,11 @@@ int ha_tokudb::rnd_pos(uchar * buf, uch
DBT* key = get_pos(&db_pos, pos);
unpack_entire_row = true;
- ha_statistic_increment(&SSV::ha_read_rnd_count);
tokudb_active_index = MAX_KEY;
- // test rpl slave by inducing a delay before the point query
THD *thd = ha_thd();
+ #if defined(TOKU_INCLUDE_RFR) && TOKU_INCLUDE_RFR
+ // test rpl slave by inducing a delay before the point query
if (thd->slave_thread && (in_rpl_delete_rows || in_rpl_update_rows)) {
DBUG_EXECUTE_IF("tokudb_crash_if_rpl_looks_up_row", DBUG_ASSERT(0););
uint64_t delay_ms = tokudb::sysvars::rpl_lookup_rows_delay(thd);
diff --cc storage/tokudb/ha_tokudb_alter_56.cc
index ba1afbf091a,b579d00f67b..46da873d750
--- a/storage/tokudb/ha_tokudb_alter_56.cc
+++ b/storage/tokudb/ha_tokudb_alter_56.cc
@@@ -446,16 -476,13 +476,13 @@@ enum_alter_inplace_result ha_tokudb::ch
setup_kc_info(altered_table, ctx->altered_table_kc_info) == 0) {
// change column length
- if (change_length_is_supported(
- table,
- altered_table,
- ha_alter_info, ctx)) {
+ if (change_length_is_supported(table, altered_table, ctx)) {
result = HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
}
- } else if ((ctx->handler_flags & Alter_inplace_info::ALTER_COLUMN_TYPE) &&
+ } else if ((ctx->handler_flags & Alter_inplace_info::ALTER_STORED_COLUMN_TYPE) &&
only_flags(
ctx->handler_flags,
- Alter_inplace_info::ALTER_COLUMN_TYPE +
+ Alter_inplace_info::ALTER_STORED_COLUMN_TYPE +
Alter_inplace_info::ALTER_COLUMN_DEFAULT) &&
table->s->fields == altered_table->s->fields &&
find_changed_fields(
@@@ -911,9 -929,10 +929,10 @@@ bool ha_tokudb::commit_inplace_alter_ta
ha_alter_info->group_commit_ctx = NULL;
}
#endif
+ #if defined(TOKU_INCLUDE_WRITE_FRM_DATA) && TOKU_INCLUDE_WRITE_FRM_DATA
#if (50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599) || \
- (100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100199)
+ (100000 <= MYSQL_VERSION_ID)
- #if WITH_PARTITION_STORAGE_ENGINE
+ #if defined(WITH_PARTITION_STORAGE_ENGINE) && WITH_PARTITION_STORAGE_ENGINE
if (TOKU_PARTITION_WRITE_FRM_DATA || altered_table->part_info == NULL) {
#else
if (true) {
@@@ -1578,22 -1548,11 +1548,11 @@@ static bool change_field_type_is_suppor
return false;
} else if (old_type == MYSQL_TYPE_VARCHAR) {
// varchar(X) -> varchar(Y) and varbinary(X) -> varbinary(Y) expansion
- // where X < 256 <= Y the ALTER_COLUMN_TYPE handler flag is set for
+ // where X < 256 <= Y the ALTER_STORED_COLUMN_TYPE handler flag is set for
// these cases
- return change_varchar_length_is_supported(
- old_field,
- new_field,
- table,
- altered_table,
- ha_alter_info,
- ctx);
+ return change_varchar_length_is_supported(old_field, new_field, ctx);
} else if (old_type == MYSQL_TYPE_BLOB && new_type == MYSQL_TYPE_BLOB) {
- return change_blob_length_is_supported(
- table,
- altered_table,
- old_field,
- new_field,
- ctx);
+ return change_blob_length_is_supported(old_field, new_field, ctx);
} else
return false;
}
diff --cc storage/tokudb/hatoku_defines.h
index 2f058797993,ab9e0f79ef8..ced3254199f
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@@ -69,8 -74,20 +74,20 @@@ Copyright (c) 2006, 2015, Percona and/o
#pragma interface /* gcc class implementation */
#endif
- #if 100000 <= MYSQL_VERSION_ID
+ // TOKU_INCLUDE_WRITE_FRM_DATA, TOKU_PARTITION_WRITE_FRM_DATA, and
+ // TOKU_INCLUDE_DISCOVER_FRM all work together as two opposing sides
+ // of the same functionality. The 'WRITE' includes functionality to
+ // write a copy of every tables .frm data into the tables status dictionary on
+ // CREATE or ALTER. When WRITE is in, the .frm data is also verified whenever a
+ // table is opened.
+ //
+ // The 'DISCOVER' then implements the MySQL table discovery API which reads
+ // this same data and returns it back to MySQL.
+ // In most cases, they should all be in or out without mixing. There may be
+ // extreme cases though where one side (WRITE) is supported but perhaps
+ // 'DISCOVERY' may not be, thus the need for individual indicators.
-#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100199
++#if 100000 <= MYSQL_VERSION_ID
// mariadb 10.0
#define TOKU_USE_DB_TYPE_TOKUDB 1
#define TOKU_INCLUDE_ALTER_56 1
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_delete_pk.result
index a85d2155725,48ea60013ad..9ad7708a11d
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_delete_pk.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_delete_pk.result
@@@ -1,16 -1,8 +1,11 @@@
include/master-slave.inc
[connection master]
+connection master;
drop table if exists t;
+connection slave;
show variables like 'tokudb_rpl_%';
Variable_name Value
- tokudb_rpl_check_readonly ON
- tokudb_rpl_lookup_rows OFF
- tokudb_rpl_lookup_rows_delay 10000
- tokudb_rpl_unique_checks OFF
- tokudb_rpl_unique_checks_delay 10000
+connection master;
create table t (a bigint not null, primary key(a)) engine=tokudb;
insert into t values (1);
insert into t values (2),(3);
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
index 991ad8d1c48,10375677c8d..10ab579de27
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
@@@ -1,16 -1,8 +1,11 @@@
include/master-slave.inc
[connection master]
+connection master;
drop table if exists t;
+connection slave;
show variables like 'tokudb_rpl_%';
Variable_name Value
- tokudb_rpl_check_readonly ON
- tokudb_rpl_lookup_rows OFF
- tokudb_rpl_lookup_rows_delay 10000
- tokudb_rpl_unique_checks OFF
- tokudb_rpl_unique_checks_delay 10000
+connection master;
create table t (a bigint not null, b bigint not null, primary key(a)) engine=tokudb;
insert into t values (1,0);
insert into t values (2,0),(3,0);
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
index 1de619eb4ec,1cb047bbf62..0ae63f0d02f
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
@@@ -1,13 -1,8 +1,11 @@@
include/master-slave.inc
[connection master]
+connection master;
drop table if exists t;
+connection slave;
show variables like 'tokudb_rpl_unique_checks%';
Variable_name Value
- tokudb_rpl_unique_checks OFF
- tokudb_rpl_unique_checks_delay 5000
+connection master;
create table t (a bigint not null, primary key(a)) engine=tokudb;
insert into t values (1);
insert into t values (2),(3);
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_xa_interleave.result
index 00000000000,53564ab0fe4..98ded9d2097
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/rpl/r/rpl_xa_interleave.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_xa_interleave.result
@@@ -1,0 -1,59 +1,78 @@@
+ include/master-slave.inc
+ [connection master]
+ CREATE TABLE t1(`a` INT) ENGINE=TokuDB;
++connection master;
+ XA START 'x1';
+ INSERT INTO t1 VALUES (1);
+ XA END 'x1';
+ XA PREPARE 'x1';
++connection master1;
+ BEGIN;
+ INSERT INTO t1 VALUES (10);
+ COMMIT;
+ XA START 'y1';
+ INSERT INTO t1 VALUES (2);
+ XA END 'y1';
+ XA PREPARE 'y1';
++connection master;
+ XA COMMIT 'x1';
++connection master1;
+ XA COMMIT 'y1';
++connection master;
+ BEGIN;
+ INSERT INTO t1 VALUES (11);
+ COMMIT;
+ XA START 'x2';
+ INSERT INTO t1 VALUES (3);
+ XA END 'x2';
+ XA PREPARE 'x2';
++connection master1;
+ XA START 'y2';
+ INSERT INTO t1 VALUES (4);
+ XA END 'y2';
+ XA PREPARE 'y2';
++connection master;
+ XA COMMIT 'x2';
++connection master1;
+ XA COMMIT 'y2';
++connection master;
+ XA START 'x1';
+ INSERT INTO t1 VALUES (1);
+ XA END 'x1';
+ XA PREPARE 'x1';
++connection master1;
+ BEGIN;
+ INSERT INTO t1 VALUES (10);
+ COMMIT;
+ XA START 'y1';
+ INSERT INTO t1 VALUES (2);
+ XA END 'y1';
+ XA PREPARE 'y1';
++connection master;
+ XA ROLLBACK 'x1';
++connection master1;
+ XA ROLLBACK 'y1';
++connection master;
+ BEGIN;
+ INSERT INTO t1 VALUES (11);
+ COMMIT;
+ XA START 'x2';
+ INSERT INTO t1 VALUES (3);
+ XA END 'x2';
+ XA PREPARE 'x2';
++connection master1;
+ XA START 'y2';
+ INSERT INTO t1 VALUES (4);
+ XA END 'y2';
+ XA PREPARE 'y2';
++connection master;
+ XA ROLLBACK 'x2';
++connection master1;
+ XA ROLLBACK 'y2';
++connection master;
++connection slave;
+ TABLES t1 and t2 must be equal otherwise an error will be thrown.
+ include/diff_tables.inc [master:test.t1, slave:test.t1]
++connection master;
+ DROP TABLE t1;
+ include/rpl_end.inc
diff --cc storage/tokudb/mysql-test/tokudb/r/compressions.result
index 00000000000,03e0d18e9eb..435b34b6af3
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/tokudb/r/compressions.result
+++ b/storage/tokudb/mysql-test/tokudb/r/compressions.result
@@@ -1,0 -1,11 +1,11 @@@
+ CREATE TABLE t1 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_UNCOMPRESSED;
+ CREATE TABLE t2 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_SNAPPY;
+ CREATE TABLE t3 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_QUICKLZ;
+ CREATE TABLE t4 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_LZMA;
+ CREATE TABLE t5 (a INT) ENGINE=TokuDB COMPRESSION=TOKUDB_ZLIB;
-FOUND /compression_method=0/ in dump
-FOUND /compression_method=7/ in dump
-FOUND /compression_method=9/ in dump
-FOUND /compression_method=10/ in dump
-FOUND /compression_method=11/ in dump
++FOUND 1 /compression_method=0/ in dump
++FOUND 1 /compression_method=7/ in dump
++FOUND 1 /compression_method=9/ in dump
++FOUND 1 /compression_method=10/ in dump
++FOUND 1 /compression_method=11/ in dump
+ DROP TABLE t1, t2, t3, t4, t5;
diff --cc storage/tokudb/mysql-test/tokudb/r/tokudb_mrr.result
index 00000000000,d79f19202a3..024580d4258
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/tokudb/r/tokudb_mrr.result
+++ b/storage/tokudb/mysql-test/tokudb/r/tokudb_mrr.result
@@@ -1,0 -1,326 +1,334 @@@
+ set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
+ set default_storage_engine=TokuDB;
+ create table t1(a int);
+ show create table t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+ ) ENGINE=TokuDB DEFAULT CHARSET=latin1
+ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+ create table t2(a int);
+ insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C;
+ create table t3 (
+ a char(8) not null, b char(8) not null, filler char(200),
+ key(a)
+ );
+ insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A;
+ insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'),
+ 'filler-1' from t2 A;
+ insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'),
+ 'filler-2' from t2 A;
+ select a,filler from t3 where a >= 'c-9011=w';
+ a filler
+ select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w';
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or
+ (a>='c-1014=w' and a <= 'c-1015=w');
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ insert into t3 values ('c-1013=z', 'c-1013=z', 'err');
+ insert into t3 values ('a-1014=w', 'a-1014=w', 'err');
+ select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or
+ (a>='c-1014=w' and a <= 'c-1015=w');
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ delete from t3 where b in ('c-1013=z', 'a-1014=w');
+ select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or
+ a='c-1014=w' or a='c-1015=w';
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ insert into t3 values ('c-1013=w', 'del-me', 'inserted');
+ select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or
+ a='c-1014=w' or a='c-1015=w';
+ a filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1011=w filler-1
+ c-1012=w filler-1
+ c-1013=w filler-1
+ c-1014=w filler-1
+ c-1015=w filler-1
+ c-1011=w filler-2
+ c-1012=w filler-2
+ c-1013=w filler-2
+ c-1014=w filler-2
+ c-1015=w filler-2
+ c-1013=w inserted
+ delete from t3 where b='del-me';
+ alter table t3 add primary key(b);
+ select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or
+ b IN ('c-1019=w', 'c-1020=w', 'c-1021=w',
+ 'c-1022=w', 'c-1023=w', 'c-1024=w');
+ b filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1016=w filler
+ c-1017=w filler
+ c-1018=w filler
+ c-1019=w filler
+ c-1020=w filler
+ c-1021=w filler
+ c-1022=w filler
+ c-1023=w filler
+ c-1024=w filler
+ select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or
+ b IN ('c-1021=w', 'c-1022=w', 'c-1023=w');
+ b filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1016=w filler
+ c-1017=w filler
+ c-1018=w filler
+ c-1019=w filler
+ c-1020=w filler
+ c-1021=w filler
+ c-1022=w filler
+ c-1023=w filler
+ select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or
+ b IN ('c-1019=w', 'c-1020=w') or
+ (b>='c-1021=w' and b<= 'c-1023=w');
+ b filler
+ c-1011=w filler
+ c-1012=w filler
+ c-1013=w filler
+ c-1014=w filler
+ c-1015=w filler
+ c-1016=w filler
+ c-1017=w filler
+ c-1018=w filler
+ c-1019=w filler
+ c-1020=w filler
+ c-1021=w filler
+ c-1022=w filler
+ c-1023=w filler
+ drop table if exists t4;
+ create table t4 (a varchar(10), b int, c char(10), filler char(200),
+ key idx1 (a, b, c));
+ insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15;
+ insert into t4 (a,b,c,filler)
+ select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500;
+ explain
+ select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
+ or c='no-such-row2');
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t4 range idx1 idx1 29 NULL 16 Using where; Rowid-ordered scan
+ select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
+ or c='no-such-row2');
+ a b c filler
+ NULL NULL NULL NULL-15
+ NULL NULL NULL NULL-14
+ NULL NULL NULL NULL-13
+ NULL NULL NULL NULL-12
+ NULL NULL NULL NULL-11
+ NULL NULL NULL NULL-10
+ NULL NULL NULL NULL-9
+ NULL NULL NULL NULL-8
+ NULL NULL NULL NULL-7
+ NULL NULL NULL NULL-6
+ NULL NULL NULL NULL-5
+ NULL NULL NULL NULL-4
+ NULL NULL NULL NULL-3
+ NULL NULL NULL NULL-2
+ NULL NULL NULL NULL-1
+ explain
+ select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t4 range idx1 idx1 29 NULL 32 Using where; Rowid-ordered scan
+ select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
+ a b c filler
+ b-1 NULL c-1 NULL-15
+ b-1 NULL c-1 NULL-14
+ b-1 NULL c-1 NULL-13
+ b-1 NULL c-1 NULL-12
+ b-1 NULL c-1 NULL-11
+ b-1 NULL c-1 NULL-10
+ b-1 NULL c-1 NULL-9
+ b-1 NULL c-1 NULL-8
+ b-1 NULL c-1 NULL-7
+ b-1 NULL c-1 NULL-6
+ b-1 NULL c-1 NULL-5
+ b-1 NULL c-1 NULL-4
+ b-1 NULL c-1 NULL-3
+ b-1 NULL c-1 NULL-2
+ b-1 NULL c-1 NULL-1
+ bb-1 NULL cc-2 NULL-15
+ bb-1 NULL cc-2 NULL-14
+ bb-1 NULL cc-2 NULL-13
+ bb-1 NULL cc-2 NULL-12
+ bb-1 NULL cc-2 NULL-11
+ bb-1 NULL cc-2 NULL-10
+ bb-1 NULL cc-2 NULL-9
+ bb-1 NULL cc-2 NULL-8
+ bb-1 NULL cc-2 NULL-7
+ bb-1 NULL cc-2 NULL-6
+ bb-1 NULL cc-2 NULL-5
+ bb-1 NULL cc-2 NULL-4
+ bb-1 NULL cc-2 NULL-3
+ bb-1 NULL cc-2 NULL-2
+ bb-1 NULL cc-2 NULL-1
+ select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
+ a b c filler
+ b-1 NULL c-1 NULL-15
+ b-1 NULL c-1 NULL-14
+ b-1 NULL c-1 NULL-13
+ b-1 NULL c-1 NULL-12
+ b-1 NULL c-1 NULL-11
+ b-1 NULL c-1 NULL-10
+ b-1 NULL c-1 NULL-9
+ b-1 NULL c-1 NULL-8
+ b-1 NULL c-1 NULL-7
+ b-1 NULL c-1 NULL-6
+ b-1 NULL c-1 NULL-5
+ b-1 NULL c-1 NULL-4
+ b-1 NULL c-1 NULL-3
+ b-1 NULL c-1 NULL-2
+ b-1 NULL c-1 NULL-1
+ bb-1 NULL cc-2 NULL-15
+ bb-1 NULL cc-2 NULL-14
+ bb-1 NULL cc-2 NULL-13
+ bb-1 NULL cc-2 NULL-12
+ bb-1 NULL cc-2 NULL-11
+ bb-1 NULL cc-2 NULL-10
+ bb-1 NULL cc-2 NULL-9
+ bb-1 NULL cc-2 NULL-8
+ bb-1 NULL cc-2 NULL-7
+ bb-1 NULL cc-2 NULL-6
+ bb-1 NULL cc-2 NULL-5
+ bb-1 NULL cc-2 NULL-4
+ bb-1 NULL cc-2 NULL-3
+ bb-1 NULL cc-2 NULL-2
+ bb-1 NULL cc-2 NULL-1
+ drop table t1, t2, t3, t4;
+ create table t1 (a int, b int not null,unique key (a,b),index(b));
+ insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
+ Warnings:
+ Warning 1062 Duplicate entry '6-6' for key 'a'
+ create table t2 like t1;
+ insert into t2 select * from t1;
+ alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
+ select * from t1 where a is null;
+ a b c
+ NULL 7 0
+ NULL 9 0
+ NULL 9 0
+ select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
+ a b c
+ NULL 9 0
+ NULL 9 0
+ select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
+ a b c
+ NULL 7 0
+ NULL 9 0
+ NULL 9 0
+ drop table t1, t2;
+ #
+ # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
+ #
++connect con1,localhost,root,,;
++connect con2,localhost,root,,;
++connection con1;
+ SET AUTOCOMMIT=0;
+ CREATE TABLE t1 (
+ dummy INT PRIMARY KEY,
+ a INT UNIQUE,
+ b INT
+ ) ENGINE=TokuDB;
+ INSERT INTO t1 VALUES (1,1,1),(3,3,3),(5,5,5);
+ COMMIT;
+ SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+ SELECT @@tx_isolation;
+ @@tx_isolation
+ REPEATABLE-READ
+ START TRANSACTION;
+ EXPLAIN SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t1 range a a 5 NULL 2 Using where
+ SELECT * FROM t1 WHERE a >= 2 FOR UPDATE;
+ dummy a b
+ 3 3 3
+ 5 5 5
++connection con2;
+ SET AUTOCOMMIT=0;
+ SET TOKUDB_LOCK_TIMEOUT=2;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES (2,2,2);
+ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ ROLLBACK;
++connection con1;
+ ROLLBACK;
+ DROP TABLE t1;
++connection default;
++disconnect con1;
++disconnect con2;
diff --cc storage/tokudb/mysql-test/tokudb_bugs/r/PS-3773.result
index 00000000000,49c61790837..c870ac1c784
mode 000000,100644..100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/PS-3773.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-3773.result
@@@ -1,0 -1,8 +1,8 @@@
+ CREATE TABLE t1(a INT, b INT, c INT, PRIMARY KEY(a), KEY(b)) ENGINE=TokuDB;
+ SET tokudb_auto_analyze=0;
+ INSERT INTO t1 VALUES(0,0,0), (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
+ SET GLOBAL debug_dbug = "+d,tokudb_fake_db_notfound_error_in_read_full_row";
+ SELECT * FROM t1 WHERE b = 2;
-ERROR HY000: Incorrect key file for table 't1'; try to repair it
++ERROR HY000: Index for table 't1' is corrupt; try to repair it
+ DROP TABLE t1;
-FOUND /ha_tokudb::read_full_row on table/ in tokudb.bugs.PS-3773.log
++FOUND 1 /ha_tokudb::read_full_row on table/ in tokudb.bugs.PS-3773.log
1
0
13 Sep '18
revision-id: 8e68876477eaec7944baa0b63ef26e551693c4f8 (mariadb-10.2.16-134-g8e68876477e)
parent(s): d85a7220dc7c605d7cbdb2fa64428c9a4283467c
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-09-13 15:06:44 +0200
message:
Fix of the test which has debug version
---
.../galera/r/galera_sst_rsync_data_dir,debug.rdiff | 114 +++++++++++++++++++++
.../galera/r/galera_sst_rsync_data_dir.result | 108 -------------------
2 files changed, 114 insertions(+), 108 deletions(-)
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff
new file mode 100644
index 00000000000..e307a2ff0f9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff
@@ -0,0 +1,114 @@
+--- suite/galera/r/galera_sst_rsync_data_dir.result 2018-09-13 14:52:50.848220719 +0200
++++ suite/galera/r/galera_sst_rsync_data_dir.reject 2018-09-13 15:03:32.339135247 +0200
+@@ -286,3 +286,111 @@
+ DROP TABLE t1;
+ COMMIT;
+ SET AUTOCOMMIT=ON;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++INSERT INTO t1 VALUES ('node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++INSERT INTO t1 VALUES ('node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++INSERT INTO t1 (f1) VALUES ('node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++INSERT INTO t1 (f1) VALUES ('node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++INSERT INTO t1 (f1) VALUES ('node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
++ROLLBACK;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++SET AUTOCOMMIT=ON;
++connection node_1;
++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++COUNT(*) = 2
++1
++SELECT COUNT(*) = 35 FROM t1;
++COUNT(*) = 35
++1
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET AUTOCOMMIT=ON;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
index d5c6a11f61f..ff85a7d6c0f 100644
--- a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
@@ -286,111 +286,3 @@ COUNT(*) = 0
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
-Performing State Transfer on a server that has been killed and restarted
-while a DDL was in progress on it
-connection node_1;
-CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-INSERT INTO t1 VALUES ('node1_committed_before');
-connection node_2;
-START TRANSACTION;
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-INSERT INTO t1 VALUES ('node2_committed_before');
-COMMIT;
-SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
-connection node_1;
-ALTER TABLE t1 ADD COLUMN f2 INTEGER;
-connection node_2;
-SET wsrep_sync_wait = 0;
-Killing server ...
-connection node_1;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-INSERT INTO t1 (f1) VALUES ('node1_committed_during');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-connection node_2;
-Performing --wsrep-recover ...
-connection node_2;
-Starting server ...
-Using --wsrep-start-position when starting mysqld ...
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-INSERT INTO t1 (f1) VALUES ('node2_committed_after');
-COMMIT;
-connection node_1;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after');
-COMMIT;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-INSERT INTO t1 (f1) VALUES ('node1_committed_after');
-COMMIT;
-connection node_1a_galera_st_kill_slave_ddl;
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
-ROLLBACK;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-COMMIT;
-SET AUTOCOMMIT=ON;
-connection node_1;
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 35 FROM t1;
-COUNT(*) = 35
-1
-SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
-COUNT(*) = 0
-1
-DROP TABLE t1;
-COMMIT;
-SET AUTOCOMMIT=ON;
-SET GLOBAL debug_dbug = $debug_orig;
1
0
[Commits] 44284f4: MDEV-17188: rocksdb.2pc_group_commit fails intermittently in BB
by psergey@askmonty.org 13 Sep '18
by psergey@askmonty.org 13 Sep '18
13 Sep '18
revision-id: 44284f437d5e1f80b8aa4fa9934491259551835f
parent(s): 2b46dca5d7fdade3f64b993dc30686693210022a
committer: Sergei Petrunia
branch nick: 10.2-r4-fix-merged
timestamp: 2018-09-13 14:59:12 +0300
message:
MDEV-17188: rocksdb.2pc_group_commit fails intermittently in BB
When counter increment is not within the expected range, print the number
instead of just FAIL.
This doesnt solve the bug but will help with the diagnostics.
---
.../mysql-test/rocksdb/r/2pc_group_commit.result | 30 +++++++++++-----------
.../mysql-test/rocksdb/t/2pc_group_commit.test | 24 ++++++++---------
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
index a9e80f1..722edad 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
@@ -14,16 +14,16 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
# Prepare operations sync, commits don't. We expect slightly more than 1K syncs:
-select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced
+select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
Rocksdb_wal_synced
OK
@@ -33,17 +33,17 @@ OK
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
-select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3)
OK
##
# 2PC enabled, MyRocks durability disabled, single thread
@@ -53,17 +53,17 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=0;
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
OK
##
# 2PC enabled, MyRocks durability disabled, concurrent workload
@@ -71,17 +71,17 @@ OK
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
OK
SET GLOBAL rocksdb_enable_2pc= @save_rocksdb_enable_2pc;
SET GLOBAL rocksdb_flush_log_at_trx_commit= @save_rocksdb_flush_log_at_trx_commit;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
index 1a77424..af9d266 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
@@ -31,12 +31,12 @@ select variable_value into @b1 from information_schema.global_status where varia
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
--echo # Prepare operations sync, commits don't. We expect slightly more than 1K syncs:
-select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced
+select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--echo ##
@@ -48,11 +48,11 @@ select variable_value into @b3 from information_schema.global_status where varia
--exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
-select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--echo ##
@@ -66,11 +66,11 @@ select variable_value into @b2 from information_schema.global_status where varia
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--echo ##
@@ -83,11 +83,11 @@ select variable_value into @b3 from information_schema.global_status where varia
--exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
##
1
0
[Commits] 90e5e2e: MDEV-17188: rocksdb.2pc_group_commit fails intermittently in BB
by psergey@askmonty.org 13 Sep '18
by psergey@askmonty.org 13 Sep '18
13 Sep '18
revision-id: 90e5e2e456c0650a52cdab65599897233a01591a
parent(s): 08481e6357f7a07804aeac07d1ab12f94fbcf283
committer: Sergei Petrunia
branch nick: 10.2-r4-fix-merged
timestamp: 2018-09-13 14:58:12 +0300
message:
MDEV-17188: rocksdb.2pc_group_commit fails intermittently in BB
When counter increment is not within the expected range, print the number
instead of just FAIL.
This doesnt solve the bug but will help with the diagnostics.
---
.../mysql-test/rocksdb/r/2pc_group_commit.result | 30 +++++++++++-----------
.../mysql-test/rocksdb/t/2pc_group_commit.test | 24 ++++++++---------
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
index a9e80f1..722edad 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
@@ -14,16 +14,16 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
# Prepare operations sync, commits don't. We expect slightly more than 1K syncs:
-select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced
+select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
Rocksdb_wal_synced
OK
@@ -33,17 +33,17 @@ OK
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
-select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3)
OK
##
# 2PC enabled, MyRocks durability disabled, single thread
@@ -53,17 +53,17 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=0;
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
OK
##
# 2PC enabled, MyRocks durability disabled, concurrent workload
@@ -71,17 +71,17 @@ OK
select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits';
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
Binlog_commits
OK
-select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
Binlog_group_commits
OK
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
-IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
OK
SET GLOBAL rocksdb_enable_2pc= @save_rocksdb_enable_2pc;
SET GLOBAL rocksdb_flush_log_at_trx_commit= @save_rocksdb_flush_log_at_trx_commit;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
index 1a77424..af9d266 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
@@ -31,12 +31,12 @@ select variable_value into @b1 from information_schema.global_status where varia
select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits';
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
--echo # Prepare operations sync, commits don't. We expect slightly more than 1K syncs:
-select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced
+select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--echo ##
@@ -48,11 +48,11 @@ select variable_value into @b3 from information_schema.global_status where varia
--exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
-select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--echo ##
@@ -66,11 +66,11 @@ select variable_value into @b2 from information_schema.global_status where varia
select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
--echo ##
@@ -83,11 +83,11 @@ select variable_value into @b3 from information_schema.global_status where varia
--exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits
from information_schema.global_status where variable_name='Binlog_commits';
-select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits
+select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits
from information_schema.global_status where variable_name='Binlog_group_commits';
-select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3)
from information_schema.global_status where variable_name='Rocksdb_wal_synced';
##
1
0