Debian Codegraph @

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

raw
1 ##
2 ## This test tests that transactions on the master will fail if the slave
3 ## is made completely unresponsive by suspending the process. Resuming the
4 ## process should allow replication to continue to run.
5 ##
6
7 --source include/galera_cluster.inc
8 --source include/have_innodb.inc
9
10 # Save original auto_increment_offset values.
11 --let $node_1=node_1
12 --let $node_2=node_2
13 --source include/auto_increment_offset_save.inc
14
15 --connection node_1
16 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
17
18 --connection node_2
19 --let NODE_2_PIDFILE = `SELECT @@pid_file`
20 --disconnect node_2
21
22 --connection node_1
23 --echo Suspending node_2 ...
24 --perl
25 my $pid_filename = $ENV{'NODE_2_PIDFILE'};
26 my $mysqld_pid = `cat $pid_filename`;
27 chomp($mysqld_pid);
28 system("kill -SIGSTOP $mysqld_pid");
29 exit(0);
30 EOF
31
32 SET SESSION wsrep_sync_wait = 0;
33
34 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
35 --source include/wait_condition.inc
36
37 SET SESSION wsrep_sync_wait = 15;
38
39 --error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
40 INSERT INTO t1 VALUES (1);
41
42 --echo Resuming node_2 ...
43 --perl
44 my $pid_filename = $ENV{'NODE_2_PIDFILE'};
45 my $mysqld_pid = `cat $pid_filename`;
46 chomp($mysqld_pid);
47 system("kill -SIGCONT $mysqld_pid");
48 exit(0);
49 EOF
50
51 SET SESSION wsrep_sync_wait = 0;
52 --source include/wait_until_ready.inc
53 INSERT INTO t1 VALUES (1);
54
55 --let $galera_connection_name = node_2a
56 --let $galera_server_number = 2
57 --source include/galera_connect.inc
58 --connection node_2a
59
60 SET SESSION wsrep_sync_wait = 0;
61 --source include/wait_until_ready.inc
62 SELECT COUNT(*) = 1 FROM t1;
63
64 SET SESSION wsrep_sync_wait = 15;
65 DROP TABLE t1;
66
67 # Restore original auto_increment_offset values.
68 --let $node_2=node_2a
69 --source include/auto_increment_offset_restore.inc