File: gr_super_read_only_version_module.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 (79 lines) | stat: -rw-r--r-- 3,032 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
################################################################################
# This test verifies that when a server with higher major version tries to
# join the group, its compatibility type is set to READ_COMPATIBLE. As such
# that node can only be a part of the group in READ ONLY mode and cannot
# execute any writes.
#
# Test:
# 0. The test requires three servers: M1, M2 and M3.
# 1. Bootstrap start a group on M1. Start GR on M2. Check both are running.
# 2. Set DEBUG point in M3 to ensure that the major version of that node is
#    higher than that of the group.
#  - Start GR on M3. It should be able to join the group but in read only mode.
#  - Try executing DDL (create table) on M3. It must fail.
# 3. Stop GR on M3. The server's super_read_only mode should be 0 now.
#  - Try executing DDL (create table) on M3. It must succeed.
# 4. Clean up.
################################################################################

--source include/big_test.inc
--source include/have_debug.inc
--let $group_replication_group_name= 5e3c00e0-8f04-11e5-a837-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc

--echo
--echo # Start group_replication on the first two nodes and check if the group
--echo # of two members is running.

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

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

--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc

--echo # Add the debug point on the third member to ensure that the major
--echo # version of that node is higher than that of the group. It should be able to
--echo # join the group but in read only mode.

--connection server3
SET @debug_saved= @@GLOBAL.DEBUG;
# Cause the member to broadcast and compare himself using a higher version
SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_higher_major_version';
SET SESSION sql_log_bin=0;
call mtr.add_suppression("Member version is read compatible with the group.");
SET SESSION sql_log_bin=1;

--source include/start_group_replication.inc

--let $group_replication_number_of_members= 3
--source include/gr_wait_for_number_of_members.inc

--echo # Verify that the server 3 joining the group is in super_read_only mode
--echo # and cannot execute writes.

--error ER_OPTION_PREVENTS_STATEMENT
CREATE TABLE t1 (i INT PRIMARY KEY NOT NULL);

--connection server3
--source include/stop_group_replication.inc
SET @@GLOBAL.DEBUG= @debug_saved;

--echo # The server's super_read_only mode should be 0 here.
--let $assert_text= The super_read_only mode should be 0 here.
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
--source include/assert.inc

#The create table now works
CREATE TABLE t1 (i INT PRIMARY KEY NOT NULL);

#Drop the table and reset the server allowing a clean test exit
DROP TABLE t1;
RESET MASTER;

--source include/group_replication_end.inc