File: gr_lock_tables_unblock.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 (71 lines) | stat: -rw-r--r-- 2,594 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
################################################################################
# This test verifies that during in GR the set super_read_only is blocked
# due to a table being locked. Subsequently, an unlock of the table in another
# connection will unblock the setting of super_read_only mode and the recovery
# proceeds further.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With both members ONLINE. Group replication is then blocked on one of
#    the node M1.
# 2. Add some data on the remaining member of the GROUP.
# 3. On the member which is not a member of the GROUP lock the table and start
#    GR so that it enters the recovering stage. This should be blocked as the
#    set super_read_only cannot execute further.
# 4. In another connection unlock the tables and see that the recovery proceeds
#    and the data exists on the two members.
# 5. Clean up.
################################################################################

--source include/big_test.inc
--source include/not_windows.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc

--connection server2
CREATE TABLE t1 (i INT PRIMARY KEY);
--source include/rpl_sync.inc

--connection server1
--source include/stop_group_replication.inc

--connection server2
INSERT INTO t1 VALUES(1);

--echo # Add lock tables here to block setting super_read_only mode on server.
--connection server_1
LOCK TABLE t1 WRITE;

--echo # Start GR on the server. It should be blocked as we have a table locked.
--connection server1
--disable_query_log
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--enable_query_log
--send START GROUP_REPLICATION

--echo # Ensure that the server is actually blocked while setting the
--echo # super_read_only mode.
--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.threads WHERE NAME = 'thread/group_rpl/THD_mysql_thread_handler_read_only_mode' AND PROCESSLIST_STATE = 'Waiting for global read lock'
--source include/wait_condition.inc

--connection server_1
UNLOCK TABLES;

--connection server1
--reap

--let $group_replication_member_state= ONLINE
--source include/gr_wait_for_member_state.inc

--echo # Add ASSERT to check that the recovery passes successfully and a row
--echo # is inserted.
--let $assert_text= There should be one row inserted in the table.
--let $assert_cond= [SELECT COUNT(*) FROM t1] = 1
--source include/assert.inc

--echo # Cleanup
DROP TABLE t1;

--source include/group_replication_end.inc