Commit 0385c716 authored by Julius Goryavsky's avatar Julius Goryavsky

MDEV-20626: MariaDB crash if wsrep_sst_method enabled without wsrep_cluster_address

parent c3394870
......@@ -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'});
......
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;
--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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment