diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-09-23 12:59:39 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-09-23 12:59:39 +0300 |
commit | 913efaa328026455cef0e608c25eaed042344b15 (patch) | |
tree | 7fde69044368384a188e3e01aef6e2ec19c808de | |
parent | c8c21a4c8f5daf09ff0c49eb1541bb665e05fb1d (diff) | |
download | mariadb-git-913efaa328026455cef0e608c25eaed042344b15.tar.gz |
MDEV-26566 : galera.galera_var_cluster_address MTR failed: InnoDB: Assertion failure in file row0ins.cc line 3206
Actual problem was that we tried to calculate persistent statistics
to wsrep_schema tables in this case wsrep_streaming_log. These tables
should not have persistent statistics. Therefore, in table creation
tables should be created with STATS_PERSISTENT=0 table option. During
rolling-upgrade tables naturally already exists, thus we need to
alter them to contain STATS_PERSISTENT=0 table option.
-rw-r--r-- | mysql-test/suite/galera/r/galera_schema.result | 114 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_schema.test | 61 | ||||
-rw-r--r-- | mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result | 4 | ||||
-rw-r--r-- | sql/wsrep_schema.cc | 48 |
5 files changed, 220 insertions, 11 deletions
diff --git a/mysql-test/suite/galera/r/galera_schema.result b/mysql-test/suite/galera/r/galera_schema.result new file mode 100644 index 00000000000..24a4099c94d --- /dev/null +++ b/mysql-test/suite/galera/r/galera_schema.result @@ -0,0 +1,114 @@ +connection node_2; +connection node_1; +CREATE TABLE IF NOT EXISTS wsrep_cluster +( +cluster_uuid CHAR(36) PRIMARY KEY, +view_id BIGINT NOT NULL, +view_seqno BIGINT NOT NULL, +protocol_version INT NOT NULL, +capabilities INT NOT NULL +) ENGINE=InnoDB; +CREATE TABLE IF NOT EXISTS wsrep_cluster_members +( +node_uuid CHAR(36) PRIMARY KEY, +cluster_uuid CHAR(36) NOT NULL, +node_name CHAR(32) NOT NULL, +node_incoming_address VARCHAR(256) NOT NULL +) ENGINE=InnoDB; +CREATE TABLE IF NOT EXISTS wsrep_cluster_members_history +( +node_uuid CHAR(36) PRIMARY KEY, +cluster_uuid CHAR(36) NOT NULL, +last_view_id BIGINT NOT NULL, +last_view_seqno BIGINT NOT NULL, +node_name CHAR(32) NOT NULL, +node_incoming_address VARCHAR(256) NOT NULL +) ENGINE=InnoDB; +CREATE TABLE IF NOT EXISTS wsrep_streaming_log +( +node_uuid CHAR(36), +trx_id BIGINT, +seqno BIGINT, +flags INT NOT NULL, +frag LONGBLOB NOT NULL, +PRIMARY KEY (node_uuid, trx_id, seqno) +) ENGINE=InnoDB; +DELETE FROM wsrep_cluster; +DELETE FROM wsrep_cluster_members; +ALTER TABLE wsrep_cluster STATS_PERSISTENT=0; +ALTER TABLE wsrep_cluster_members STATS_PERSISTENT=0; +ALTER TABLE wsrep_cluster_members_history STATS_PERSISTENT=0; +ALTER TABLE wsrep_streaming_log STATS_PERSISTENT=0; +SHOW CREATE TABLE wsrep_cluster; +Table Create Table +wsrep_cluster CREATE TABLE `wsrep_cluster` ( + `cluster_uuid` char(36) NOT NULL, + `view_id` bigint(20) NOT NULL, + `view_seqno` bigint(20) NOT NULL, + `protocol_version` int(11) NOT NULL, + `capabilities` int(11) NOT NULL, + PRIMARY KEY (`cluster_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +SHOW CREATE TABLE wsrep_cluster_members; +Table Create Table +wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( + `node_uuid` char(36) NOT NULL, + `cluster_uuid` char(36) NOT NULL, + `node_name` char(32) NOT NULL, + `node_incoming_address` varchar(256) NOT NULL, + PRIMARY KEY (`node_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +SHOW CREATE TABLE wsrep_cluster_members_history; +Table Create Table +wsrep_cluster_members_history CREATE TABLE `wsrep_cluster_members_history` ( + `node_uuid` char(36) NOT NULL, + `cluster_uuid` char(36) NOT NULL, + `last_view_id` bigint(20) NOT NULL, + `last_view_seqno` bigint(20) NOT NULL, + `node_name` char(32) NOT NULL, + `node_incoming_address` varchar(256) NOT NULL, + PRIMARY KEY (`node_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +SHOW CREATE TABLE wsrep_streaming_log; +Table Create Table +wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` ( + `node_uuid` char(36) NOT NULL, + `trx_id` bigint(20) NOT NULL, + `seqno` bigint(20) NOT NULL, + `flags` int(11) NOT NULL, + `frag` longblob NOT NULL, + PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +SHOW CREATE TABLE mysql.wsrep_cluster; +Table Create Table +wsrep_cluster CREATE TABLE `wsrep_cluster` ( + `cluster_uuid` char(36) NOT NULL, + `view_id` bigint(20) NOT NULL, + `view_seqno` bigint(20) NOT NULL, + `protocol_version` int(11) NOT NULL, + `capabilities` int(11) NOT NULL, + PRIMARY KEY (`cluster_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +SHOW CREATE TABLE mysql.wsrep_cluster_members; +Table Create Table +wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( + `node_uuid` char(36) NOT NULL, + `cluster_uuid` char(36) NOT NULL, + `node_name` char(32) NOT NULL, + `node_incoming_address` varchar(256) NOT NULL, + PRIMARY KEY (`node_uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +SHOW CREATE TABLE mysql.wsrep_streaming_log; +Table Create Table +wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` ( + `node_uuid` char(36) NOT NULL, + `trx_id` bigint(20) NOT NULL, + `seqno` bigint(20) NOT NULL, + `flags` int(11) NOT NULL, + `frag` longblob NOT NULL, + PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 +DROP TABLE wsrep_cluster; +DROP TABLE wsrep_cluster_members; +DROP TABLE wsrep_cluster_members_history; +DROP TABLE wsrep_streaming_log; diff --git a/mysql-test/suite/galera/t/galera_schema.test b/mysql-test/suite/galera/t/galera_schema.test new file mode 100644 index 00000000000..a3ee814c393 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_schema.test @@ -0,0 +1,61 @@ +--source include/galera_cluster.inc + +CREATE TABLE IF NOT EXISTS wsrep_cluster +( + cluster_uuid CHAR(36) PRIMARY KEY, + view_id BIGINT NOT NULL, + view_seqno BIGINT NOT NULL, + protocol_version INT NOT NULL, + capabilities INT NOT NULL +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS wsrep_cluster_members +( + node_uuid CHAR(36) PRIMARY KEY, + cluster_uuid CHAR(36) NOT NULL, + node_name CHAR(32) NOT NULL, + node_incoming_address VARCHAR(256) NOT NULL +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS wsrep_cluster_members_history +( + node_uuid CHAR(36) PRIMARY KEY, + cluster_uuid CHAR(36) NOT NULL, + last_view_id BIGINT NOT NULL, + last_view_seqno BIGINT NOT NULL, + node_name CHAR(32) NOT NULL, + node_incoming_address VARCHAR(256) NOT NULL +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS wsrep_streaming_log +( + node_uuid CHAR(36), + trx_id BIGINT, + seqno BIGINT, + flags INT NOT NULL, + frag LONGBLOB NOT NULL, + PRIMARY KEY (node_uuid, trx_id, seqno) +) ENGINE=InnoDB; + +DELETE FROM wsrep_cluster; +DELETE FROM wsrep_cluster_members; + +ALTER TABLE wsrep_cluster STATS_PERSISTENT=0; +ALTER TABLE wsrep_cluster_members STATS_PERSISTENT=0; +ALTER TABLE wsrep_cluster_members_history STATS_PERSISTENT=0; +ALTER TABLE wsrep_streaming_log STATS_PERSISTENT=0; + +SHOW CREATE TABLE wsrep_cluster; +SHOW CREATE TABLE wsrep_cluster_members; +SHOW CREATE TABLE wsrep_cluster_members_history; +SHOW CREATE TABLE wsrep_streaming_log; + +SHOW CREATE TABLE mysql.wsrep_cluster; +SHOW CREATE TABLE mysql.wsrep_cluster_members; +#SHOW CREATE TABLE mysql.wsrep_cluster_members_history; +SHOW CREATE TABLE mysql.wsrep_streaming_log; + +DROP TABLE wsrep_cluster; +DROP TABLE wsrep_cluster_members; +DROP TABLE wsrep_cluster_members_history; +DROP TABLE wsrep_streaming_log; diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result index ba01eab0e26..f51eb815cd5 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result @@ -14,7 +14,7 @@ wsrep_cluster CREATE TABLE `wsrep_cluster` ( `protocol_version` int(11) NOT NULL, `capabilities` int(11) NOT NULL, PRIMARY KEY (`cluster_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_cluster_members; Table Create Table wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( @@ -23,7 +23,7 @@ wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; EXPECT_1 1 diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result index 2a29afd62be..d9d3e817bed 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema_init.result @@ -14,7 +14,7 @@ wsrep_cluster CREATE TABLE `wsrep_cluster` ( `protocol_version` int(11) NOT NULL, `capabilities` int(11) NOT NULL, PRIMARY KEY (`cluster_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 SHOW CREATE TABLE mysql.wsrep_cluster_members; Table Create Table wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( @@ -23,7 +23,7 @@ wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` ( `node_name` char(32) NOT NULL, `node_incoming_address` varchar(256) NOT NULL, PRIMARY KEY (`node_uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 SELECT @@sql_safe_updates; @@sql_safe_updates 1 diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 06f0f7840ab..5960a9934c1 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2019 Codership Oy <info@codership.com> +/* Copyright (C) 2015-2021 Codership Oy <info@codership.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ static const std::string create_cluster_table_str= "view_seqno BIGINT NOT NULL," "protocol_version INT NOT NULL," "capabilities INT NOT NULL" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; static const std::string create_members_table_str= "CREATE TABLE IF NOT EXISTS " + wsrep_schema_str + "." + members_table_str + @@ -63,7 +63,7 @@ static const std::string create_members_table_str= "cluster_uuid CHAR(36) NOT NULL," "node_name CHAR(32) NOT NULL," "node_incoming_address VARCHAR(256) NOT NULL" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; #ifdef WSREP_SCHEMA_MEMBERS_HISTORY static const std::string cluster_member_history_table_str= "wsrep_cluster_member_history"; @@ -76,7 +76,7 @@ static const std::string create_members_history_table_str= "last_view_seqno BIGINT NOT NULL," "node_name CHAR(32) NOT NULL," "node_incoming_address VARCHAR(256) NOT NULL" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; #endif /* WSREP_SCHEMA_MEMBERS_HISTORY */ static const std::string create_frag_table_str= @@ -88,7 +88,7 @@ static const std::string create_frag_table_str= "flags INT NOT NULL, " "frag LONGBLOB NOT NULL, " "PRIMARY KEY (node_uuid, trx_id, seqno)" - ") ENGINE=InnoDB"; + ") ENGINE=InnoDB STATS_PERSISTENT=0"; static const std::string delete_from_cluster_table= "DELETE FROM " + wsrep_schema_str + "." + cluster_table_str; @@ -96,6 +96,26 @@ static const std::string delete_from_cluster_table= static const std::string delete_from_members_table= "DELETE FROM " + wsrep_schema_str + "." + members_table_str; +/* For rolling upgrade we need to use ALTER. We do not want +persistent statistics to be collected from these tables. */ +static const std::string alter_cluster_table= + "ALTER TABLE " + wsrep_schema_str + "." + cluster_table_str + + " STATS_PERSISTENT=0"; + +static const std::string alter_members_table= + "ALTER TABLE " + wsrep_schema_str + "." + members_table_str + + " STATS_PERSISTENT=0"; + +#ifdef WSREP_SCHEMA_MEMBERS_HISTORY +static const std::string alter_members_history_table= + "ALTER TABLE " + wsrep_schema_str + "." + members_history_table_str + + " STATS_PERSISTENT=0"; +#endif + +static const std::string alter_frag_table= + "ALTER TABLE " + wsrep_schema_str + "." + sr_table_str + + " STATS_PERSISTENT=0"; + namespace Wsrep_schema_impl { @@ -657,13 +677,27 @@ int Wsrep_schema::init() Wsrep_schema_impl::execute_SQL(thd, create_members_history_table_str.c_str(), create_members_history_table_str.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_members_history_table.c_str(), + alter_members_history_table.size()) || #endif /* WSREP_SCHEMA_MEMBERS_HISTORY */ Wsrep_schema_impl::execute_SQL(thd, create_frag_table_str.c_str(), - create_frag_table_str.size())) { + create_frag_table_str.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_cluster_table.c_str(), + alter_cluster_table.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_members_table.c_str(), + alter_members_table.size()) || + Wsrep_schema_impl::execute_SQL(thd, + alter_frag_table.c_str(), + alter_frag_table.size())) + { ret= 1; } - else { + else + { ret= 0; } |