diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-03-28 08:26:08 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-03-28 08:26:08 -0400 |
commit | 9d2e90f379654fb65c0eab006213d772302bcff7 (patch) | |
tree | a9d4a9340cf301c180df704fa4c667840038bfc9 | |
parent | 02ba2bfdb444531e6fe61716a4eaeab40e210bbd (diff) | |
parent | a500865c133251416604255028802b550d6941a8 (diff) | |
download | mariadb-git-9d2e90f379654fb65c0eab006213d772302bcff7.tar.gz |
Merged revision 3471, 3472 & 3473 from maria-5.5-galera.
34 files changed, 624 insertions, 11 deletions
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index e91163dde1c..bfd0c3c635a 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -98,6 +98,11 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; +void cleanup_and_exit(int exit_code) +{ + my_end(0); + exit(exit_code); +} static void usage(my_bool version) { @@ -112,7 +117,7 @@ static void usage(my_bool version) my_print_default_files(config_file); my_print_variables(my_long_options); printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); - exit(0); + cleanup_and_exit(0); } @@ -125,7 +130,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_defaults_file_used= 1; break; case 'n': - exit(0); + cleanup_and_exit(0); case 'I': case '?': usage(0); @@ -174,7 +179,7 @@ int main(int argc, char **argv) /* Check out the args */ if (get_options(&argc,&argv)) - exit(1); + cleanup_and_exit(1); nargs= argc + 1; if (opt_mysqld) diff --git a/mysql-test/include/galera_cluster.inc b/mysql-test/include/galera_cluster.inc new file mode 100644 index 00000000000..bc652225722 --- /dev/null +++ b/mysql-test/include/galera_cluster.inc @@ -0,0 +1,10 @@ +# galera_cluster.inc +# ================== +# +# Description +# ----------- +# Configure galera cluster with 2 nodes. +# + +--let $galera_cluster_size = 2 +--source include/galera_init.inc diff --git a/mysql-test/include/galera_connect.inc b/mysql-test/include/galera_connect.inc new file mode 100644 index 00000000000..bfd9b188667 --- /dev/null +++ b/mysql-test/include/galera_connect.inc @@ -0,0 +1,45 @@ +# galera_connect.inc +# ================== +# +# Description +# ----------- +# Open a connection to the specified server number ($galera_server_number). +# The connection itself would be identified by $galera_connection_name. +# +# Parameters +# ---------- +# $galera_connection_name +# Name of the resulting connection. +# +# $galera_server_number +# Sequence number of the node in the galera cluster. +# +# $galera_debug +# Print debug information. +# + +if (!$galera_connection_name) +{ + --die ERROR IN TEST: $galera_connection_name must be set before sourcing include/galera_connect.inc +} + +if (!$galera_server_number) +{ + --die ERROR IN TEST: $galera_server_number must be set before sourcing include/galera_connect.inc +} + +--let $_galera_port= \$NODE_MYPORT_$galera_server_number +if (!$_galera_port) +{ + --echo Bug in test case: '\$NODE_MYPORT_$galera_server_number' not initialized. Check the test's .cfg file. + --die Not all NODE_MYPORT_* environment variables are setup correctly. +} + +if ($galera_debug) +{ + --echo connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,) +} + +# Open a connection +--connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,) + diff --git a/mysql-test/include/galera_diff.inc b/mysql-test/include/galera_diff.inc new file mode 100644 index 00000000000..6043b582647 --- /dev/null +++ b/mysql-test/include/galera_diff.inc @@ -0,0 +1,100 @@ +# galera_diff.inc +# =============== +# +# Description +# ----------- +# Compare the output of the given statement on all the nodes of the cluster. +# +# Parameters +# ---------- +# $galera_diff_statement +# Statement for which the output would be compared. +# +# $galera_diff_database +# Database against which the above statement would be executed. +# (Default : test) +# +# $galera_diff_servers +# Comma separated list of servers to executed the diff statement on. If not +# set, a list of servers will be generated based on $galera_cluster_size. +# +# $galerra_debug +# Print debug information. +# + +if (!$galera_diff_statement) +{ + --die ERROR IN TEST: $galera_diff_statement must be set before sourcing include/galera_diff.inc +} + +--let $_galera_diff_database = $galera_diff_database +if (!$_galera_diff_database) +{ + --let $_galera_diff_database = test +} + +--let $_galera_diff_servers= $galera_diff_servers +if (!$_galera_diff_servers) +{ + --let $_i= $galera_cluster_size + --let $_galera_diff_servers= + while ($_i) + { + --let $_galera_diff_servers= $_i,$_galera_diff_servers + --dec $_i + } +} +if ($galera_debug) +{ + --echo \$galera_diff_servers= '$_galera_diff_servers' +} + +if (!$galera_debug) +{ + --disable_query_log +} + +# Generate file containing $galera_diff_statement. We don't pass the +# statement on the command line, because it would be subject to shell +# substitutions. +--let $write_to_file= GENERATE +--let $write_var= $galera_diff_statement +--source include/write_var_to_file.inc +--let $_galera_diff_statement_file= $write_to_file + +if (!$galera_debug) +{ + --enable_query_log +} + +# Compare all servers. +--let $_galera_diff_first= 1 +while ($_galera_diff_servers) +{ + # Set $_galera_diff_server_i to the first number in the list + --let $_galera_diff_server_i= `SELECT SUBSTRING_INDEX('$_galera_diff_servers', ',', 1)` + # Remove $_galera_diff_server_i from the list + --let $_galera_diff_servers= `SELECT SUBSTRING('$_galera_diff_servers', LENGTH('$_galera_diff_server_i') + 2)` + + # Execute statement + --let $_galera_diff_file= $MYSQLTEST_VARDIR/tmp/_galera_diff_server-$_galera_diff_server_i.tmp + --exec $MYSQL --defaults-group-suffix=.$_galera_diff_server_i $_galera_diff_database < $_galera_diff_statement_file > $_galera_diff_file + + # Compare + if (!$_galera_diff_first) + { + if ($galera_debug) + { + --echo diffing $_galera_diff_file and $_galera_diff_prev_file + } + --diff_files $_galera_diff_file $_galera_diff_prev_file + --remove_file $_galera_diff_prev_file + } + --let $_galera_diff_prev_file= $_galera_diff_file + --let $_galera_diff_first= 0 +} + +# Cleanup +--remove_file $_galera_diff_prev_file +--remove_file $_galera_diff_statement_file + diff --git a/mysql-test/include/galera_end.inc b/mysql-test/include/galera_end.inc new file mode 100644 index 00000000000..0fb5479844e --- /dev/null +++ b/mysql-test/include/galera_end.inc @@ -0,0 +1,25 @@ +# galera_end.inc +# ============== +# +# Description +# ----------- +# Closes the connections opened via include/galera_init.inc +# +# Parameters +# ---------- +# $galera_cluster_size +# Number of nodes in the cluster. +# + +--let $_galera_node= $galera_cluster_size + +while ($_galera_node) +{ + if ($galera_debug) + { + --echo Disconnecting node_$_galera_node + } + --disconnect node_$_galera_node + --dec $_galera_node +} + diff --git a/mysql-test/include/galera_init.inc b/mysql-test/include/galera_init.inc new file mode 100644 index 00000000000..79591973862 --- /dev/null +++ b/mysql-test/include/galera_init.inc @@ -0,0 +1,26 @@ +# galera_init.inc +# =============== +# +# Description +# ----------- +# Set up a Galera cluster with $wsrep_cluster_size nodes. +# +# Parameters +# ---------- +# $galera_cluster_size +# Number of nodes in the cluster. +# + +--source include/have_wsrep_enabled.inc + +--let $_galera_node= $galera_cluster_size + +while ($_galera_node) +{ + --let $galera_connection_name= node_$_galera_node + --let $galera_server_number= $_galera_node + --source include/galera_connect.inc + + --dec $_galera_node +} + diff --git a/mysql-test/include/have_wsrep.inc b/mysql-test/include/have_wsrep.inc index f8f7e7a82fc..a3ceae41d40 100644 --- a/mysql-test/include/have_wsrep.inc +++ b/mysql-test/include/have_wsrep.inc @@ -1,4 +1,8 @@ --- require r/have_wsrep.require -disable_query_log; -show variables like 'wsrep_on'; -enable_query_log; +# To be used in a test which requires server to be compiled with wsrep support +# (-DWITH_WSREP=ON) and wsrep plugin is ACTIVE. + +if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsrep' AND PLUGIN_STATUS='ACTIVE'`) +{ + --skip Test required wsrep plugin. +} + diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc new file mode 100644 index 00000000000..edb919fd852 --- /dev/null +++ b/mysql-test/include/have_wsrep_enabled.inc @@ -0,0 +1,9 @@ +# To be used in a test which requires wsrep plugin to be ACTIVE and enabled +# (i.e. wsrep_on=ON). It includes have_wsrep.inc. + +--source include/have_wsrep.inc + +--require r/have_wsrep.require +disable_query_log; +SHOW VARIABLES LIKE 'wsrep_on'; +enable_query_log; diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 0ad1079cd92..06a7b49e979 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -226,6 +226,14 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"), ("Slave I/O: Setting master-side filtering of @@skip_replication failed with error:.*"), ("Slave I/O: Setting @mariadb_slave_capability failed with error:.*"), + + /* + Galera-related warnings. + */ + ("WSREP: Could not open saved state file for reading: .*"), + ("WSREP: last inactive check more than .* skipping check"), + ("WSREP: Gap in state sequence. Need state transfer."), + ("WSREP: Failed to prepare for incremental state transfer: .*"), ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/include/not_wsrep.inc b/mysql-test/include/not_wsrep.inc new file mode 100644 index 00000000000..3314b5c8717 --- /dev/null +++ b/mysql-test/include/not_wsrep.inc @@ -0,0 +1,7 @@ +# To be used in a test which should be skipped if server is compiled with wsrep +# support (-DWITH_WSREP=ON) and wsrep plugin is ACTIVE. + +-- require r/not_wsrep.require +disable_query_log; +SELECT VERSION() LIKE '%wsrep%' AS 'HAVE_WSREP'; +enable_query_log; diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 59216f41cff..c795683c771 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -862,6 +862,8 @@ sub collect_one_test_case { # Suite has no config, autodetect which one to use if ($tinfo->{rpl_test}) { $config= "suite/rpl/my.cnf"; + } elsif ($tinfo->{galera_test}) { + $config= "suite/galera/my.cnf"; } else { $config= "include/default_my.cnf"; } @@ -982,6 +984,7 @@ my $tags_map= {'big_test' => ['big_test', 1], 'master-slave' => ['rpl_test', 1], 'ndb_master-slave' => ['rpl_test', 1, 'ndb_test', 1], 'long_test' => ['long_test', 1], + 'galera_init' => ['galera_test', 1], }; my $tags_regex_string= join('|', keys %$tags_map); my $tags_regex= qr:include/($tags_regex_string)\.inc:o; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 689320f7cd4..03c9d00df87 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4832,6 +4832,9 @@ sub extract_warning_lines ($$) { qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|, qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind + # Galera-related warnings. + qr|WSREP:.*down context.*|, + qr|WSREP: Failed to send state UUID:.*|, ); my $matched_lines= []; diff --git a/mysql-test/r/not_wsrep.require b/mysql-test/r/not_wsrep.require new file mode 100644 index 00000000000..7c8e74af144 --- /dev/null +++ b/mysql-test/r/not_wsrep.require @@ -0,0 +1,2 @@ +HAVE_WSREP +0 diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf new file mode 100644 index 00000000000..b950ae1fe4d --- /dev/null +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -0,0 +1,21 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +binlog-format=row +wsrep_provider=/usr/lib/libgalera_smm.so +wsrep_cluster_address='gcomm://' + +[mysqld.2] +binlog-format=row +wsrep_provider=/usr/lib/libgalera_smm.so +wsrep_cluster_address='gcomm://127.0.0.1:4567' +wsrep_provider_options='gmcast.listen_addr=tcp://127.0.0.1:4568' + +[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 + diff --git a/mysql-test/suite/galera/my.cnf b/mysql-test/suite/galera/my.cnf new file mode 100644 index 00000000000..ca163a540d9 --- /dev/null +++ b/mysql-test/suite/galera/my.cnf @@ -0,0 +1 @@ +!include galera_2nodes.cnf diff --git a/mysql-test/suite/galera/r/basic.result b/mysql-test/suite/galera/r/basic.result new file mode 100644 index 00000000000..d4efe348b61 --- /dev/null +++ b/mysql-test/suite/galera/r/basic.result @@ -0,0 +1,30 @@ +USE test; +CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB; +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); +SELECT * FROM t1; +c1 +1 +2 +3 +4 +5 + +# On node_1 +SELECT * FROM test.t1; +c1 +1 +2 +3 +4 +5 + +# On node_2 +SELECT * FROM test.t1; +c1 +1 +2 +3 +4 +5 +DROP TABLE t1; +# End of test diff --git a/mysql-test/suite/galera/r/unique_key.result b/mysql-test/suite/galera/r/unique_key.result new file mode 100644 index 00000000000..ffb4f01c1f8 --- /dev/null +++ b/mysql-test/suite/galera/r/unique_key.result @@ -0,0 +1,47 @@ +# +# MDEV#5552 Deadlock when inserting NULL column value in column with +# UNIQUE index +# +USE test; + +# On node_1 +CREATE TABLE t1(c1 INT DEFAULT NULL, UNIQUE KEY c1(c1)) ENGINE=INNODB; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM test.t1; +c1 +NULL +NULL + +# On node_2 +SELECT * FROM test.t1; +c1 +NULL +NULL + +# On node_1 +INSERT INTO t1 VALUES (1); +UPDATE t1 SET c1=NULL WHERE c1=1; +SELECT * FROM test.t1; +c1 +NULL +NULL +NULL + +# On node_2 +SELECT * FROM test.t1; +c1 +NULL +NULL +NULL + +# On node_1 +DELETE FROM t1 WHERE c1<=>NULL; +SELECT * FROM test.t1; +c1 + +# On node_2 +SELECT * FROM test.t1; +c1 +DROP TABLE t1; +# End of test diff --git a/mysql-test/suite/galera/t/basic.test b/mysql-test/suite/galera/t/basic.test new file mode 100644 index 00000000000..8fc6eee3b3b --- /dev/null +++ b/mysql-test/suite/galera/t/basic.test @@ -0,0 +1,26 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +USE test; +CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB; +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); +SELECT * FROM t1; + +--echo +--echo # On node_1 +--connection node_1 +SELECT * FROM test.t1; + +--echo +--echo # On node_2 +--connection node_2 +SELECT * FROM test.t1; + +--let $galera_diff_statement = SELECT * FROM t1 +--source include/galera_diff.inc + +# Cleanup +DROP TABLE t1; + +--source include/galera_end.inc +--echo # End of test diff --git a/mysql-test/suite/galera/t/unique_key.test b/mysql-test/suite/galera/t/unique_key.test new file mode 100644 index 00000000000..00b85d57165 --- /dev/null +++ b/mysql-test/suite/galera/t/unique_key.test @@ -0,0 +1,54 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--echo # +--echo # MDEV#5552 Deadlock when inserting NULL column value in column with +--echo # UNIQUE index +--echo # + +USE test; +--echo +--echo # On node_1 +--connection node_1 +CREATE TABLE t1(c1 INT DEFAULT NULL, UNIQUE KEY c1(c1)) ENGINE=INNODB; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM test.t1; + +--echo +--echo # On node_2 +--connection node_2 +SELECT * FROM test.t1; + + +--echo +--echo # On node_1 +--connection node_1 +INSERT INTO t1 VALUES (1); +UPDATE t1 SET c1=NULL WHERE c1=1; +SELECT * FROM test.t1; + +--echo +--echo # On node_2 +--connection node_2 +SELECT * FROM test.t1; + +--echo +--echo # On node_1 +--connection node_1 +DELETE FROM t1 WHERE c1<=>NULL; +SELECT * FROM test.t1; + +--echo +--echo # On node_2 +--connection node_2 +SELECT * FROM test.t1; + +--let $galera_diff_statement = SELECT * FROM t1 +--source include/galera_diff.inc + +# Cleanup +DROP TABLE t1; + +--source include/galera_end.inc +--echo # End of test diff --git a/mysql-test/suite/wsrep/README b/mysql-test/suite/wsrep/README new file mode 100644 index 00000000000..988096071a4 --- /dev/null +++ b/mysql-test/suite/wsrep/README @@ -0,0 +1,7 @@ +* 'wsrep' suite is designated for tests which do not require a multi-node + galera cluster. + +* As these tests are specific to wsrep-related functionalities, they must skip + on server built without wsrep patch (vanilla). (-DWITH_WSREP=OFF) + See : include/have_wsrep.inc, include/have_wsrep_enabled.inc, not_wsrep.inc + diff --git a/mysql-test/suite/wsrep/r/binlog_format.result b/mysql-test/suite/wsrep/r/binlog_format.result index d87cd3bf1a8..5b8da51f829 100644 --- a/mysql-test/suite/wsrep/r/binlog_format.result +++ b/mysql-test/suite/wsrep/r/binlog_format.result @@ -1,3 +1,5 @@ +call mtr.add_suppression("WSREP: cannot get fake InnoDB transaction ID"); +call mtr.add_suppression("WSREP: Could not open saved state file for reading:.*"); SHOW VARIABLES LIKE 'binlog_format'; Variable_name Value binlog_format ROW diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result new file mode 100644 index 00000000000..f77a655773a --- /dev/null +++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result @@ -0,0 +1,70 @@ +# +# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above +# +# Verbose run +SET GLOBAL wsrep_replicate_myisam= ON; +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it. +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. +Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. +ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; +ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +SET GLOBAL wsrep_replicate_myisam= OFF; +# Silent run +SET GLOBAL wsrep_replicate_myisam= ON; +TRUNCATE TABLE time_zone; +TRUNCATE TABLE time_zone_name; +TRUNCATE TABLE time_zone_transition; +TRUNCATE TABLE time_zone_transition_type; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; +ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +SET GLOBAL wsrep_replicate_myisam= OFF; +# +# Testing with explicit timezonefile +# +SET GLOBAL wsrep_replicate_myisam= ON; +INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); +SET @time_zone_id= LAST_INSERT_ID(); +INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); +INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (@time_zone_id, 0, 0, 0, 'GMT') +; +SET GLOBAL wsrep_replicate_myisam= OFF; +# +# Testing --leap +# +SET GLOBAL wsrep_replicate_myisam= ON; +TRUNCATE TABLE time_zone_leap_second; +ALTER TABLE time_zone_leap_second ORDER BY Transition_time; +SET GLOBAL wsrep_replicate_myisam= OFF; diff --git a/mysql-test/suite/wsrep/r/pool_of_threads.result b/mysql-test/suite/wsrep/r/pool_of_threads.result new file mode 100644 index 00000000000..ffe309f2580 --- /dev/null +++ b/mysql-test/suite/wsrep/r/pool_of_threads.result @@ -0,0 +1,8 @@ + +# +# MDEV#5687: Maria doesn't shutdown following upgrade to 5.5.35-galera +# +SELECT @@GLOBAL.thread_handling; +@@GLOBAL.thread_handling +pool-of-threads +# End of test. diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 5417906ff37..1b778f835e0 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -1,3 +1,16 @@ + +# MDEV#5534: mysql_tzinfo_to_sql generates wrong query +# +# Testing wsrep_replicate_myisam variable. +SELECT @@session.wsrep_replicate_myisam; +ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable +SELECT @@global.wsrep_replicate_myisam; +@@global.wsrep_replicate_myisam +0 +SET SESSION wsrep_replicate_myisam= ON; +ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL +SET GLOBAL wsrep_replicate_myisam= ON; +SET GLOBAL wsrep_replicate_myisam= OFF; # # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of # variables when using "_" diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test index 907fae5f4fb..99d34873512 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.test +++ b/mysql-test/suite/wsrep/t/binlog_format.test @@ -1,8 +1,11 @@ ---source include/have_wsrep.inc +--source include/have_wsrep_enabled.inc --source include/have_binlog_format_row.inc # # MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT # +call mtr.add_suppression("WSREP: cannot get fake InnoDB transaction ID"); +call mtr.add_suppression("WSREP: Could not open saved state file for reading:.*"); + SHOW VARIABLES LIKE 'binlog_format'; -- error ER_WRONG_VALUE_FOR_VAR SET binlog_format=STATEMENT; diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test new file mode 100644 index 00000000000..100e09d3afb --- /dev/null +++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test @@ -0,0 +1,40 @@ +--source include/have_wsrep.inc +--source include/have_symlink.inc +--source include/not_windows.inc + +--echo # +--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above +--echo # + +--exec mkdir $MYSQLTEST_VARDIR/zoneinfo +--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix +--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT +--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage +--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab + +--echo # Verbose run +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1 + +--echo # Silent run +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1 + +--echo # +--echo # Testing with explicit timezonefile +--echo # + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1 + +--echo # +--echo # Testing --leap +--echo # + +--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 + +# +# Cleanup +# + +--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt new file mode 100644 index 00000000000..92994ddfb68 --- /dev/null +++ b/mysql-test/suite/wsrep/t/pool_of_threads.opt @@ -0,0 +1 @@ +--binlog-format=row --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --wsrep-provider=/usr/lib/galera/libgalera_smm.so --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.test b/mysql-test/suite/wsrep/t/pool_of_threads.test new file mode 100644 index 00000000000..f4fffaf4f9a --- /dev/null +++ b/mysql-test/suite/wsrep/t/pool_of_threads.test @@ -0,0 +1,11 @@ +--source include/have_wsrep.inc + +--echo +--echo # +--echo # MDEV#5687: Maria doesn't shutdown following upgrade to 5.5.35-galera +--echo # + +# Note: This test is to ensure that server shuts down properly. +SELECT @@GLOBAL.thread_handling; + +--echo # End of test. diff --git a/mysql-test/suite/wsrep/t/trans.test b/mysql-test/suite/wsrep/t/trans.test index 9278ef12072..d8c4a4722a0 100644 --- a/mysql-test/suite/wsrep/t/trans.test +++ b/mysql-test/suite/wsrep/t/trans.test @@ -1,3 +1,4 @@ +--source include/have_wsrep.inc --source include/have_innodb.inc --echo # diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 637e0084e81..ccc662a7f7f 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -1,5 +1,21 @@ --source include/have_wsrep.inc +--echo +--echo # MDEV#5534: mysql_tzinfo_to_sql generates wrong query +--echo # +--echo # Testing wsrep_replicate_myisam variable. + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.wsrep_replicate_myisam; +SELECT @@global.wsrep_replicate_myisam; + +--error ER_GLOBAL_VARIABLE +SET SESSION wsrep_replicate_myisam= ON; +SET GLOBAL wsrep_replicate_myisam= ON; + +# Reset it back. +SET GLOBAL wsrep_replicate_myisam= OFF; + --echo # --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of --echo # variables when using "_" @@ -18,4 +34,3 @@ SHOW VARIABLES LIKE 'wsrep_%'; SHOW VARIABLES LIKE 'x'; --echo # End of test. - diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test index 1ba4e91be3c..61ae3d2bffd 100644 --- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test +++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test @@ -1,6 +1,11 @@ --source include/have_symlink.inc --source include/not_windows.inc +# Note: The output of mysql_tzinfo_to_sql is different if server is compiled +# with wsrep. Hence a copy of this test has been placed under wsrep suite with +# the updated result. (lp:1161432) +--source include/not_wsrep.inc + --echo # --echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above --echo # diff --git a/sql/handler.cc b/sql/handler.cc index 9144ab8e92a..af0e1c74b15 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6218,7 +6218,7 @@ void ha_wsrep_fake_trx_id(THD *thd) } else { - WSREP_WARN("cannot get get fake InnoDB transaction ID"); + WSREP_WARN("cannot get fake InnoDB transaction ID"); } DBUG_VOID_RETURN; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a0d7b346854..0bd06fd57e7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2055,6 +2055,10 @@ extern "C" void unireg_abort(int exit_code) wsrep_close_threads(thd); /* this won't close all threads */ sleep(1); /* so give some time to exit for those which can */ WSREP_INFO("Some threads may fail to exit."); + + /* In bootstrap mode we deinitialize wsrep here. */ + if (opt_bootstrap && wsrep_inited) + wsrep_deinit(); } #endif // WITH_WSREP clean_up(!opt_abort && (exit_code || !opt_bootstrap)); /* purecov: inspected */ diff --git a/sql/tztime.cc b/sql/tztime.cc index 857039eb1e8..82f26ca4da4 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2709,8 +2709,10 @@ main(int argc, char **argv) return 1; } +#ifdef WITH_WSREP // Replicate MyISAM DDL for this session, cf. lp:1161432 - printf("SET SESSION wsrep_replicate_myisam=ON;\n"); + printf("SET GLOBAL wsrep_replicate_myisam= ON;\n"); +#endif /* WITH_WSREP */ if (argc == 1 && !opt_leap) { @@ -2759,6 +2761,11 @@ main(int argc, char **argv) free_root(&tz_storage, MYF(0)); } +#ifdef WITH_WSREP + // Reset wsrep_replicate_myisam. lp:1161432 + printf("SET GLOBAL wsrep_replicate_myisam= OFF;\n"); +#endif /* WITH_WSREP */ + free_defaults(default_argv); my_end(0); return 0; |