summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2019-10-08 10:25:23 +0200
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2019-10-08 10:53:41 +0200
commit0385c716ecb8b84324b1c4ee103b1ed4f81c2094 (patch)
tree9a70fe807f09502cffe3080ed1827cca50f2449d
parentc3394870303090e3e58ec68f425cc46cc4762370 (diff)
downloadmariadb-git-bb-10.4-sysprg-MDEV-20626.tar.gz
MDEV-20626: MariaDB crash if wsrep_sst_method enabled without wsrep_cluster_addressbb-10.4-sysprg-MDEV-20626
-rwxr-xr-xmysql-test/mysql-test-run.pl17
-rw-r--r--mysql-test/suite/galera/r/MDEV-20626.result12
-rw-r--r--mysql-test/suite/galera/t/MDEV-20626.test97
3 files changed, 124 insertions, 2 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6d4549d7d7a..b55d4060b45 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -4996,18 +4996,31 @@ sub check_expected_crash_and_restart {
}
# Ignore any partial or unknown command
- next unless $last_line =~ /^restart/;
+ next unless $last_line =~ /^(restart|try)/;
# If last line begins "restart:", the rest of the line is read as
# extra command line options to add to the restarted mysqld.
# Anything other than 'wait' or 'restart:' (with a colon) will
# result in a restart with original mysqld options.
+ my $try=0;
if ($last_line =~ /restart:(.+)/) {
my @rest_opt= split(' ', $1);
$mysqld->{'restart_opts'}= \@rest_opt;
+ } elsif ($last_line =~ /try:(.+)/) {
+ my @rest_opt= split(' ', $1);
+ $mysqld->{'restart_opts'}= \@rest_opt;
+ $try=1;
} else {
delete $mysqld->{'restart_opts'};
}
- unlink($expect_file);
+
+ if ($try == 1) {
+ my $handle;
+ open ($handle,'>',$expect_file) or die("Cant open expect file for write");
+ print $handle "wait";
+ close ($handle);
+ } else {
+ unlink($expect_file);
+ }
# Start server with same settings as last time
mysqld_start($mysqld, $mysqld->{'started_opts'});
diff --git a/mysql-test/suite/galera/r/MDEV-20626.result b/mysql-test/suite/galera/r/MDEV-20626.result
new file mode 100644
index 00000000000..469166e6971
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-20626.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+CALL mtr.add_suppression("Aborting");
+connection node_1;
+connection node_2;
+connection node_2;
+Shutting down server ...
+connection node_1;
+connection node_2;
+Starting server ...
+Starting server ...
+connection node_1;
diff --git a/mysql-test/suite/galera/t/MDEV-20626.test b/mysql-test/suite/galera/t/MDEV-20626.test
new file mode 100644
index 00000000000..24afafe76b2
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-20626.test
@@ -0,0 +1,97 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Suppress expected warnings:
+
+CALL mtr.add_suppression("Aborting");
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
+#
+# We should count the number of "Assertion failed" warnings
+# in the log file before and after testing. To do this we need
+# to save original log file before testing:
+#
+--let TEST_LOG=$MYSQLTEST_VARDIR/log/mysqld.2.err
+--perl
+ use strict;
+ my $test_log=$ENV{'TEST_LOG'} or die "TEST_LOG not set";
+ my $test_log_copy=$test_log . '.copy';
+ if (-e $test_log_copy) {
+ unlink $test_log_copy;
+ }
+EOF
+--copy_file $TEST_LOG $TEST_LOG.copy
+
+--connection node_2
+
+--let $wsrep_provider_orig = `SELECT @@wsrep_provider`
+
+# Initiate normal shutdown on the node 2 and
+# waiting until shutdown has been completed:
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Remove the "grastate.dat" file (to initiate new SST)
+# and restart node 2 without cluster address:
+
+--connection node_2
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--let $start_mysqld_params=--no-defaults --wsrep_on=ON --wsrep_provider=$wsrep_provider_orig --wsrep_sst_method=mariabackup --user=mysql --binlog_format=ROW
+
+--echo Starting server ...
+--exec echo "try:$start_mysqld_params" > $_expect_file_name
+
+# Sleep to ensure that server exited...
+
+--sleep 30
+
+# Restart node 2 with original cluster address:
+
+--let $start_mysqld_params=
+
+--echo Starting server ...
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+--connection node_1
+
+--source include/auto_increment_offset_restore.inc
+
+#
+# We should count the number of "Assertion failed" warnings
+# in the log file during test phase - to print the error message
+# if quantity of such warnings in log file increased at the end
+# of the test:
+#
+--perl
+ use strict;
+ my $test_log=$ENV{'TEST_LOG'} or die "TEST_LOG not set";
+ my $test_log_copy=$test_log . '.copy';
+ open(FILE, $test_log_copy) or die("Unable to open $test_log_copy: $!\n");
+ my $initial=grep(/Assertion * failed/gi,<FILE>);
+ close(FILE);
+ open(FILE, $test_log) or die("Unable to open $test_log: $!\n");
+ my $count_warnings=grep(/Assertion * failed/gi,<FILE>);
+ close(FILE);
+ if ($count_warnings != $initial) {
+ my $diff=$count_warnings-$initial;
+ print "Assertion failed $diff times.\n";
+ }
+EOF
+--remove_file $TEST_LOG.copy
+
+--source include/auto_increment_offset_restore.inc