1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-41553 galera_restart_on_unknown_option test regression after MDEV-40023

The problem with the test was that it restarted node 2 by writing
"try:--galera-unknown-option" into the expect file. However, MariaDB mtr has
never supported a "try" command. Instead mtr skipped any expect file line not
starting with "restart", and node 2 was not started with the unknown option
(which was the idea in the test logic). The test only slept and then restarted
node 2 normally.
MDEV-40023 made mtr report unknown expect file commands as errors,
so the test now fails in 13.1 and later.

The fix is to start node 2 with the unknown option directly with --exec.
In cluster, the unknown option is found only after the state transfer has started.
The server should interrupt the state transfer and abort.

Galera version 26.4.25 or later is needed for graceful shutdown, and this is now
required by the test.
This commit is contained in:
sjaakola
2026-10-15 11:21:17 +03:00
committed by Jan Lindström
parent f6869f9068
commit 0f81a2f3bf
2 changed files with 54 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
connection node_2;
connection node_1;
# Correct Galera library found
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
connection node_1;
@@ -22,7 +23,10 @@ f1 f2
2 b
3 c
connection node_2;
Starting server ...
Starting server with an unknown option ...
FOUND 1 /unknown option '--galera-unknown-option'/ in galera_restart_on_unknown_option.err
FOUND 1 /State transfer interrupted, shutting down gracefully/ in galera_restart_on_unknown_option.err
NOT FOUND /Assertion .* failed/ in galera_restart_on_unknown_option.err
Starting server ...
SELECT * FROM t1;
f1 f2
@@ -39,7 +43,10 @@ f1 f2
2 d
3 d
connection node_2;
Starting server ...
Starting server with an unknown option ...
FOUND 1 /unknown option '--galera-unknown-option'/ in galera_restart_on_unknown_option.err
FOUND 1 /State transfer interrupted, shutting down gracefully/ in galera_restart_on_unknown_option.err
NOT FOUND /Assertion .* failed/ in galera_restart_on_unknown_option.err
Starting server ...
call mtr.add_suppression("WSREP: Failed to scan the last segment to the end\\. Last events may be missing\\. Last recovered event: ");
SELECT * FROM t1;

View File

@@ -1,6 +1,13 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# Galera library version with the graceful shutdown on an interrupted state
# transfer (MDEV-31517), which this test expects
#
--let $galera_version=26.4.25
source ../wsrep/include/check_galera_version.inc;
# Suppress expected warnings:
CALL mtr.add_suppression("Aborting");
@@ -11,22 +18,6 @@ CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
--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
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
@@ -59,14 +50,26 @@ SELECT * FROM t1;
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--let $start_mysqld_params=--galera-unknown-option
# The server must refuse to start, and exit without an assertion.
# Start it directly rather than through the expect file: mtr would treat
# a server that fails to start as a test failure.
# The unknown option is found only after the state transfer has started,
# which is then interrupted, and Galera aborts the process on purpose
# (SIGABRT, exit code 134).
--echo Starting server ...
--write_line "try:$start_mysqld_params" $_expect_file_name
# Sleep to ensure that server exited...
--sleep 30
--echo Starting server with an unknown option ...
--let $unknown_option_log= $MYSQLTEST_VARDIR/tmp/galera_restart_on_unknown_option.err
--error 134
--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$unknown_option_log --galera-unknown-option > $unknown_option_log.out 2>&1
--let SEARCH_FILE= $unknown_option_log
--let SEARCH_PATTERN= unknown option '--galera-unknown-option'
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= State transfer interrupted, shutting down gracefully
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Assertion .* failed
--source include/search_pattern_in_file.inc
--remove_file $unknown_option_log
--remove_file $unknown_option_log.out
# Restart node 2 without unknown option:
@@ -104,14 +107,26 @@ SELECT * FROM t1;
--connection node_2
--let $start_mysqld_params=--galera-unknown-option
# The server must refuse to start, and exit without an assertion.
# Start it directly rather than through the expect file: mtr would treat
# a server that fails to start as a test failure.
# The unknown option is found only after the state transfer has started,
# which is then interrupted, and Galera aborts the process on purpose
# (SIGABRT, exit code 134).
--echo Starting server ...
--write_line "try:$start_mysqld_params" $_expect_file_name
# Sleep to ensure that server exited...
--sleep 30
--echo Starting server with an unknown option ...
--let $unknown_option_log= $MYSQLTEST_VARDIR/tmp/galera_restart_on_unknown_option.err
--error 134
--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$unknown_option_log --galera-unknown-option > $unknown_option_log.out 2>&1
--let SEARCH_FILE= $unknown_option_log
--let SEARCH_PATTERN= unknown option '--galera-unknown-option'
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= State transfer interrupted, shutting down gracefully
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Assertion .* failed
--source include/search_pattern_in_file.inc
--remove_file $unknown_option_log
--remove_file $unknown_option_log.out
# Restart node 2 without unknown option:
@@ -133,27 +148,4 @@ SELECT * FROM t1;
DROP TABLE t1;
--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