File: gr_recovery_conflicting_data_failure.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (99 lines) | stat: -rw-r--r-- 3,862 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
################################################################################
# This test evaluates that recovery fails properly when the donors available
# have conflicting data.
#
# The test steps are:
#   0) The test requires two servers: M1 and M2.
#   1) Bootstrap start M1. Create table t1 and insert some data for recovery.
#   2) Create table t1 on M2 before starting. Start GR on M2.
#   3) With a low number of retries watch recovery fail on M2. It should go
#      to ERROR state.
#   4) Remove the data in the joiner M2 and restart GR. All is OK. Validate
#      data.
#   5) Clean up.
################################################################################

--source include/big_test.inc
--let $group_replication_group_name=c1ef5e40-262a-11e5-867f-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

--echo #
--echo # Setup a new group
--echo #

--connection server1
--echo server1
--source include/start_and_bootstrap_group_replication.inc

--echo # Add some data for recovery

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

--echo #
--echo # Add the same data to member 2 before the joining phase
--echo #

--connection server2
--echo server2

--echo # Add some data to crash recovery

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2);

--echo #
--echo # Start group replication on member 2 and it goes to an ERROR state
--echo #

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Error 'Table 't1' already exists'*");
call mtr.add_suppression("Replica: Table 't1' already exists*");
call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Worker .* failed executing transaction .*; Error 'Table 't1' already exists' on query.");
call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': ... The replica coordinator and worker threads are stopped.*");
call mtr.add_suppression("Error while starting the group replication incremental recovery receiver/applier threads");
call mtr.add_suppression("Maximum number of retries when*");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression(".*This member has more executed transactions *.*");
call mtr.add_suppression("The member contains transactions not present in the group. It is only allowed to *.*");
call mtr.add_suppression("The member is leaving a group without being on one");
call mtr.add_suppression("The member is already leaving or joining a group.");
call mtr.add_suppression("Error leaving the group");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
SET SESSION sql_log_bin= 1;

SET @debug_save_retries= @@GLOBAL.group_replication_recovery_retry_count;
SET GLOBAL group_replication_recovery_retry_count= 1;
RESET MASTER;
--let $group_replication_start_member_state= ERROR
--source include/start_group_replication.inc

--echo #
--echo # Remove the conflicting data and see that all goes fine now
--echo #

--source include/stop_group_replication.inc

DROP TABLE t1;

# Reset the server GTIDs so rpl_end don't blocks
RESET MASTER;

SET @@GLOBAL.group_replication_recovery_retry_count= @debug_save_retries;

--source include/start_group_replication.inc

--let $assert_text= On the recovered member, the table should exist and have 1 elements
--let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
--source include/assert.inc

--echo #
--echo # Cleaning up
--echo #

DROP TABLE t1;

--source include/group_replication_end.inc