File: gr_certifier_message_same_member.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 (74 lines) | stat: -rw-r--r-- 3,433 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
################################################################################
# BUG#20776314 THE CERTIFIER BROADCAST THREAD IS PRONE TO CONCURRENCY PROBLEMS
#
# This test fixes the second issue with the bug :
#
# The member_id is introduced in to the member_vector before the member_id is
# checked. This generates the case of a same member sending the message again.
#
# Steps :
# 0. The test requires two servers: M1 and M2.
#
# 1. The test starts with two servers running group_replication, with a debug
#    flag set on one of the server. This debug flag inject duplicate member_id
#    in the members vector to simulate the case of the message being received
#    from a similar source.
#
# 2. After the first garbage collection round the
#    transaction_committed_all_member should be empty on server2 as the garbage
#    collection has not taken place.
#
# 3. We then remove the flag (although the code already does that) and rerun
#    the garbage collection. This time the transaction_committed_all_members is
#    not empty on server2.
#
# 4. Clean up.
################################################################################
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

--connection server1
SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,certifier_inject_duplicate_certifier_data_message';
--source include/start_and_bootstrap_group_replication.inc

--connection server2
--source include/start_group_replication.inc

--echo ############################################################
--echo # Execute a transaction on the server1 which is propagated to the
--echo # second server and applied on both of them.
--connection server1
CREATE TABLE t1(i INT PRIMARY KEY);
--source include/rpl_sync.inc

--echo # Start the first round of garbage collection here. Since we have set the DBUG
--echo # flag on the second server we expect a message to be logged in the error log
--echo # as the same member sent the message.
--connection server2
--let $wait_timeout= 65
--let $wait_condition= SELECT Transactions_committed_all_members<>"" FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)
--source include/wait_condition.inc

--echo # Transactions_committed_all_members has 1 transaction from when server 2 joined
--echo # No more info should have been received.
--connection server1
--let $expected_gtid="$group_replication_group_name:1"
--let $transactions_committed_all_members= query_get_value(SELECT Transactions_committed_all_members from performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid), Transactions_committed_all_members, 1)
--let $assert_text= Transactions committed on all members should only contain 1 transaction
--let $assert_cond= "$transactions_committed_all_members"= $expected_gtid
--source include/assert.inc

INSERT INTO t1 VALUES(1);
--echo # Checking that the garbage collection is working fine.
--let $wait_timeout= 65
--let $wait_condition= SELECT Transactions_committed_all_members<>$expected_gtid FROM performance_schema.replication_group_member_stats where member_id in (SELECT @@server_uuid)
--source include/wait_condition.inc

--connection server1
SET @@GLOBAL.DEBUG= @debug_save;
DROP TABLE t1;
--source include/group_replication_end.inc