diff options
Diffstat (limited to 'mysql-test/suite/galera')
10 files changed, 465 insertions, 11 deletions
diff --git a/mysql-test/suite/galera/galera_2x2nodes.cnf b/mysql-test/suite/galera/galera_2x2nodes.cnf new file mode 100644 index 00000000000..922906eac6f --- /dev/null +++ b/mysql-test/suite/galera/galera_2x2nodes.cnf @@ -0,0 +1,77 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +loose-innodb +log-bin=mysqld-bin +log-slave-updates +binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +wsrep_gtid_mode=1 +gtid_ignore_duplicates +auto_increment_increment=3 + +wsrep-provider=@ENV.WSREP_PROVIDER +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +wsrep-sync-wait=15 + +[mysqld.1] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' + +[mysqld.2] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' + +[mysqld.3] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address=gcomm:// +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' + +[mysqld.4] +wsrep-on=1 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.3.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' +wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' + +[ENV] +NODE_MYPORT_1= @mysqld.1.port +NODE_MYSOCK_1= @mysqld.1.socket + +NODE_MYPORT_2= @mysqld.2.port +NODE_MYSOCK_2= @mysqld.2.socket + +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket + +NODE_MYPORT_4= @mysqld.4.port +NODE_MYSOCK_4= @mysqld.4.socket + + diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc index 56118df84f9..28a1b0f368c 100644 --- a/mysql-test/suite/galera/include/kill_galera.inc +++ b/mysql-test/suite/galera/include/kill_galera.inc @@ -6,8 +6,8 @@ if (!$kill_signal) } # Write file to make mysql-test-run.pl expect the crash, but don't start it ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Kill the connected server diff --git a/mysql-test/suite/galera/include/shutdown_mysqld.inc b/mysql-test/suite/galera/include/shutdown_mysqld.inc index 54bba1318e7..793be8d76ac 100644 --- a/mysql-test/suite/galera/include/shutdown_mysqld.inc +++ b/mysql-test/suite/galera/include/shutdown_mysqld.inc @@ -8,8 +8,8 @@ if ($rpl_inited) } # Write file to make mysql-test-run.pl expect the "crash", but don't start it ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name # Send shutdown to the connected server diff --git a/mysql-test/suite/galera/r/galera_query_cache_invalidate.result b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result new file mode 100644 index 00000000000..98438b3b527 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result @@ -0,0 +1,119 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_2; +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +connection node_4; +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +connection node_3; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;; +START SLAVE; +include/wait_for_slave_to_start.inc +connection node_1; +CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb; +SET AUTOCOMMIT=1; +INSERT INTO t1 VALUES (4000000, 'foobar'); +SELECT COUNT(*) FROM t1; +COUNT(*) +50001 +connection node_3; +connection node_1; +# node_1 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_2; +# node_2 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_3; +# node_3 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_4; +# node_4 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +connection node_1; +# node_1 insert new +INSERT INTO t1 values (5000000, 'foobar'); +connection node_3; +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_2; +# node_2 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_3; +# node_3 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_4; +# node_4 +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +SELECT * FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_2; +# node_3 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_4; +# node_6 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; +id msg +4000000 foobar +5000000 foobar +connection node_1; +drop table t1; +connection node_3; +connection node_3; +STOP SLAVE; +RESET SLAVE ALL; +connection node_1; +SET SESSION WSREP_ON=OFF; +RESET MASTER; +SET SESSION WSREP_ON=ON; +disconnect node_2; +disconnect node_1; +# End of test diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 7276cb8dbde..da669e6774e 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -1,6 +1,11 @@ connection node_2; connection node_1; connection node_1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure"); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_1; CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB; SHOW CREATE SEQUENCE seq; Table Create Table @@ -47,6 +52,58 @@ NEXT VALUE FOR Seq1_1 3001 connection node_1; DROP SEQUENCE Seq1_1; -CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_1; +CREATE TABLE t2 (d CHAR(1)KEY); +SET SESSION autocommit=0; +INSERT INTO t2 VALUES(1); +CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB; +CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB; +COMMIT; +SET SESSION AUTOCOMMIT=1; +SHOW CREATE TABLE seq1; +Table Create Table +seq1 CREATE TEMPORARY TABLE `seq1` ( + `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', + `increment` bigint(21) NOT NULL COMMENT 'increment value', + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', + `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=InnoDB SEQUENCE=1 connection node_2; -CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +SHOW CREATE SEQUENCE seq1; +ERROR 42S02: Table 'test.seq1' doesn't exist +SHOW CREATE SEQUENCE seq2; +Table Create Table +seq2 CREATE SEQUENCE `seq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB +connection node_1; +SET SESSION autocommit=1; +DROP SEQUENCE seq1; +DROP SEQUENCE seq2; +DROP TABLE t2; +SET SESSION AUTOCOMMIT=0; +SET SESSION wsrep_OSU_method='RSU'; +CREATE TABLE t1(c1 VARCHAR(10)); +INSERT INTO t1 (c1) VALUES(''); +create temporary sequence sq1 NOCACHE engine=innodb; +create sequence sq2 NOCACHE engine=innodb; +COMMIT; +SHOW CREATE SEQUENCE sq1; +Table Create Table +sq1 CREATE SEQUENCE `sq1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB +SHOW CREATE SEQUENCE sq2; +Table Create Table +sq2 CREATE SEQUENCE `sq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB +connection node_2; +SHOW CREATE SEQUENCE sq1; +ERROR 42S02: Table 'test.sq1' doesn't exist +SHOW CREATE SEQUENCE sq2; +ERROR 42S02: Table 'test.sq2' doesn't exist +connection node_1; +SET SESSION AUTOCOMMIT=1; +DROP TABLE t1; +DROP SEQUENCE sq1; +DROP SEQUENCE sq2; +SET SESSION wsrep_OSU_method='TOI'; diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test index c535ac455b9..b36a0de57b6 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test @@ -35,8 +35,8 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2; --connection node_2 # Write file to make mysql-test-run.pl expect the crash, but don't start it ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --exec echo "wait" > $_expect_file_name --let KILL_NODE_PIDFILE = `SELECT @@pid_file` diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf b/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf new file mode 100644 index 00000000000..49269422a35 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf @@ -0,0 +1,25 @@ +!include ../galera_2x2nodes.cnf + +[mysqld.1] +wsrep_gtid_domain_id=1 +server-id=11 +query_cache_type=1 +query_cache_size=15M + +[mysqld.2] +wsrep_gtid_domain_id=1 +server-id=12 +query_cache_type=1 +query_cache_size=15M + +[mysqld.3] +wsrep_gtid_domain_id=2 +server-id=13 +query_cache_type=1 +query_cache_size=15M + +[mysqld.4] +wsrep_gtid_domain_id=2 +server-id=21 +query_cache_type=1 +query_cache_size=15M diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test new file mode 100644 index 00000000000..d72d8a9ba40 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test @@ -0,0 +1,120 @@ +--source include/big_test.inc +--source include/force_restart.inc +--source include/galera_cluster.inc +--source include/have_sequence.inc + +# +# MDEV-28641 : Query cache entries not invalidated on slave of a Galera cluster +# +# We use two 2-node galera clusters as follows +# +# A(1) <-> B(2) {Galera cluster 1} +# | {Async replication} +# D(3) <-> E(4) {Galera cluster 2} +# +# Normal asyncronous replication is used between nodes 1 and 3 +# so that node_1 is master and node_3 a slave. +# +# In this test we can't test is some query fast or slow but we can +# test does all nodes see all rows (this is not true before fix) +# +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + +--connection node_2 +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); +--connection node_4 +call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); + +--connection node_3 + +--replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos; +START SLAVE; +--source include/wait_for_slave_to_start.inc + +--connection node_1 + +CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb; +--disable_query_log +INSERT INTO t1 SELECT seq, md5(rand()) from seq_1_to_50000; +COMMIT; +--enable_query_log +SET AUTOCOMMIT=1; +INSERT INTO t1 VALUES (4000000, 'foobar'); +SELECT COUNT(*) FROM t1; +--sync_slave_with_master node_3 + +# +# All nodes should see one row and first query is slow and second fast +# +--connection node_1 +--echo # node_1 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_2 +--echo # node_2 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_3 +--echo # node_3 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_4 +--echo # node_4 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +# +# Insert a new row in master, this should cause query cache +# invalidation +# +--connection node_1 +--echo # node_1 insert new +INSERT INTO t1 values (5000000, 'foobar'); +--sync_slave_with_master node_3 + +# +# All nodes should see 2 rows +# +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; + +--connection node_2 +--echo # node_2 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_3 +--echo # node_3 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; +--connection node_4 +--echo # node_4 +SELECT * FROM t1 WHERE msg='foobar'; +SELECT * FROM t1 WHERE msg='foobar'; + +--connection node_2 +--echo # node_3 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; + +--connection node_4 +--echo # node_6 different query same table +SELECT id, msg FROM t1 WHERE msg='foobar'; + +# +# Cleanup +# +--connection node_1 +drop table t1; +--sync_slave_with_master node_3 + +--connection node_3 +STOP SLAVE; +RESET SLAVE ALL; + +--connection node_1 +SET SESSION WSREP_ON=OFF; +RESET MASTER; +SET SESSION WSREP_ON=ON; + +--source include/galera_end.inc +--echo # End of test diff --git a/mysql-test/suite/galera/t/galera_sequences.cnf b/mysql-test/suite/galera/t/galera_sequences.cnf new file mode 100644 index 00000000000..98e724fb2d0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index d469cc73516..faa3b46d2a7 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -5,6 +5,13 @@ # --connection node_1 +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure"); +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_1 CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB; SHOW CREATE SEQUENCE seq; @@ -45,8 +52,48 @@ select NEXT VALUE FOR Seq1_1; --connection node_1 DROP SEQUENCE Seq1_1; -CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +# +# MDEV-24045 : Assertion client_state_.mode() != wsrep::client_state::m_toi failed in int wsrep::transaction::before_commit() +# +--connection node_1 +CREATE TABLE t2 (d CHAR(1)KEY); +SET SESSION autocommit=0; +INSERT INTO t2 VALUES(1); +CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB; +CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB; +COMMIT; +SET SESSION AUTOCOMMIT=1; +SHOW CREATE TABLE seq1; --connection node_2 - -CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE seq1; +SHOW CREATE SEQUENCE seq2; +--connection node_1 +SET SESSION autocommit=1; +DROP SEQUENCE seq1; +DROP SEQUENCE seq2; +DROP TABLE t2; +# +# Case2 +# +SET SESSION AUTOCOMMIT=0; +SET SESSION wsrep_OSU_method='RSU'; +CREATE TABLE t1(c1 VARCHAR(10)); +INSERT INTO t1 (c1) VALUES(''); +create temporary sequence sq1 NOCACHE engine=innodb; +create sequence sq2 NOCACHE engine=innodb; +COMMIT; +SHOW CREATE SEQUENCE sq1; +SHOW CREATE SEQUENCE sq2; +--connection node_2 +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE sq1; +--error ER_NO_SUCH_TABLE +SHOW CREATE SEQUENCE sq2; +--connection node_1 +SET SESSION AUTOCOMMIT=1; +DROP TABLE t1; +DROP SEQUENCE sq1; +DROP SEQUENCE sq2; +SET SESSION wsrep_OSU_method='TOI'; |