Skip to content

Commit 612f4e2

Browse files
committed
MDEV-39798 : Galera test failure on galera_gcache_recover_manytrx
Problem was that file galera_wsrep_start_position.inc was not found. Reason is still unknown. Added error handling to galera_wsrep_recover.inc to find out the reason why file is missing.
1 parent 903e00b commit 612f4e2

8 files changed

Lines changed: 63 additions & 16 deletions

mysql-test/suite/galera/include/galera_wsrep_recover.inc

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ if (!$wsrep_recover_additional)
1010

1111
--perl
1212
use strict;
13-
my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'";
14-
my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
13+
my $file = "$ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log";
14+
if (! -e $file) {
15+
die "$file does not exists.";
16+
}
17+
my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $file | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
1518
chomp($wsrep_start_position);
16-
17-
die if $wsrep_start_position eq '';
18-
19-
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
20-
print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n";
21-
close FILE;
19+
if ($wsrep_start_position eq '') {
20+
die "No recovered position found $wsrep_start_position";
21+
}
22+
my $path = "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc";
23+
open(FILE, ">", $path) or die "Can't open file: '$path' $!";
24+
print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n" or die "Write to '$path' failed $!";
25+
close FILE or die "Closing $path failed $!";
2226
EOF
2327

2428
--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc

mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
1111
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
1212
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
1313
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
14+
COMMIT;
15+
set global innodb_log_checkpoint_now=ON;
1416
Killing server ...
1517
connection node_1;
1618
Performing --wsrep-recover ...
@@ -23,7 +25,6 @@ SELECT COUNT(*) FROM t1;
2325
COUNT(*)
2426
5
2527
connection node_2;
26-
SET SESSION wsrep_sync_wait = 15;
2728
SELECT COUNT(*) FROM t1;
2829
COUNT(*)
2930
5

mysql-test/suite/galera/t/galera_gcache_recover.cnf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
[mysqld.1]
44
wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S'
5+
loose-galera-gcache-recover=1
6+
innodb_log_file_size=256M
57

68
[mysqld.2]
79
wsrep_provider_options='gcache.recover=yes;gcache.size=128M;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S'
10+
loose-galera-gcache-recover=1
11+
innodb_log_file_size=256M

mysql-test/suite/galera/t/galera_gcache_recover.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
--source include/galera_cluster.inc
66
--source include/have_innodb.inc
77
--source include/big_test.inc
8+
--source include/force_restart.inc
9+
10+
# Remove if exists earlier log and start position, they might
11+
# be there if test using galera_wsrep_recover.inc failed
12+
--error 0,1,2
13+
--remove_file $MYSQL_TMP_DIR/galera_wsrep_recover.log
14+
--error 0,1,2
15+
--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.log
816

917
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
1018
INSERT INTO t1 VALUES (1);

mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
[mysqld.1]
44
max_allowed_packet=10M
5-
innodb_log_file_size=220M
5+
innodb_log_file_size=256M
66
wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S'
7+
loose-galera-gcache-recover-full=1
78

89
[mysqld.2]
910
wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S'
11+
innodb_log_file_size=256M
12+
loose-galera-gcache-recover-full=1

mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
--source include/galera_cluster.inc
66
--source include/have_innodb.inc
77
--source include/big_test.inc
8+
--source include/have_log_bin.inc
9+
--source include/force_restart.inc
10+
11+
# Remove if exists earlier log and start position, they might
12+
# be there if test using galera_wsrep_recover.inc failed
13+
--error 0,1,2
14+
--remove_file $MYSQL_TMP_DIR/galera_wsrep_recover.log
15+
--error 0,1,2
16+
--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.log
817

918
SET SESSION wsrep_sync_wait = 0;
1019
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
@@ -27,6 +36,10 @@ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
2736
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
2837
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
2938
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
39+
COMMIT;
40+
# Force checkpoint so that below select count is consistent
41+
set global innodb_log_checkpoint_now=ON;
42+
3043
--source include/kill_galera.inc
3144

3245
--connection node_1
@@ -45,12 +58,16 @@ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
4558
--connection node_1
4659
--source include/wait_until_connected_again.inc
4760
--source include/galera_wait_ready.inc
48-
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
61+
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
62+
--source include/wait_condition.inc
63+
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1
64+
--source include/wait_condition.inc
4965

5066
SELECT COUNT(*) FROM t1;
5167

5268
--connection node_2
53-
SET SESSION wsrep_sync_wait = 15;
69+
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1
70+
--source include/wait_condition.inc
5471
SELECT COUNT(*) FROM t1;
5572

5673
--let $diff_servers = 1 2
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
!include ../galera_2nodes.cnf
22

33
[mysqld.1]
4-
innodb_log_file_size=220M
5-
wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S'
4+
innodb_log_file_size=256M
5+
wsrep_provider_options='gcache.recover=yes;gcache.size=256M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S'
6+
loose-galera-gcache-recover-manytrx=1
67

78
[mysqld.2]
8-
innodb_log_file_size=220M
9-
wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S'
9+
innodb_log_file_size=256M
10+
wsrep_provider_options='gcache.recover=yes;gcache.size=256M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S'
11+
loose-galera-gcache-recover-manytrx=1

mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
--source include/big_test.inc
88
--source include/have_innodb.inc
99
--source include/have_log_bin.inc
10+
--source include/force_restart.inc
11+
12+
# Remove if exists earlier log and start position, they might
13+
# be there if test using galera_wsrep_recover.inc failed
14+
--error 0,1,2
15+
--remove_file $MYSQL_TMP_DIR/galera_wsrep_recover.log
16+
--error 0,1,2
17+
--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.log
1018

1119
SET SESSION wsrep_sync_wait = 0;
1220
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;

0 commit comments

Comments
 (0)