File: gr_start_stop_parallel_applier_database.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 (114 lines) | stat: -rw-r--r-- 5,500 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
################################################################################
# Verify that parallel applier type cannot be changed to DATABASE on
# group_replication_applier channel when stopping and starting
# applier.
#
# Test:
# 0. The test requires one server.
#  - With member ONLINE. Check that default slave parallel type is DATABASE and
#    slave parallel workers is 0.
# 1. Stop applier thread. Test with default REPLICA_PARALLEL_TYPE and
#    REPLICA_PARALLEL_WORKERS > 0. Start applier thread should fail.
# 2. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=DATABASE and
#    REPLICA_PARALLEL_WORKERS > 0. Start applier thread should fail.
# 3. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=LOGICAL_CLOCK and
#    REPLICA_PARALLEL_WORKERS > 0. Start applier thread should fail.
# 4. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=LOGICAL_CLOCK,
#    REPLICA_PARALLEL_WORKERS > 0 and REPLICA_PRESERVE_COMMIT_ORDER=ON.
#    Start applier thread should succeed.
# 5. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=LOGICAL_CLOCK and
#    REPLICA_PARALLEL_WORKERS = 0. Start applier thread should succeed.
# 6. Stop applier thread. Test with default REPLICA_PARALLEL_TYPE and default
#    REPLICA_PARALLEL_WORKERS. Start applier thread should succeed.
################################################################################
--source include/only_mts_replica_parallel_workers.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start = 1
--source include/group_replication.inc

# If these assert fails there is no point in continue the test,
# since it relies on DATABASE as default value.
--let $assert_text= Default slave parallel type must be LOGICAL_CLOCK
--let $assert_cond= "[SELECT @@GLOBAL.REPLICA_PARALLEL_TYPE]" = "LOGICAL_CLOCK"
--source include/assert.inc

--let $assert_text= Default slave parallel workers must be 4
--let $assert_cond= [SELECT @@GLOBAL.REPLICA_PARALLEL_WORKERS] = 4
--source include/assert.inc

--let $assert_text= Default slave preserve commit order 1
--let $assert_cond= [SELECT @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER] = 1
--source include/assert.inc

# Start and stop Group Replication to ensure that `group_replication_applier`
# channel exists.
--source include/start_and_bootstrap_group_replication.inc
--source include/stop_group_replication.inc

# Save defaults.
SET @replica_parallel_type_saved= @@GLOBAL.REPLICA_PARALLEL_TYPE;
SET @replica_parallel_workers_saved= @@GLOBAL.REPLICA_PARALLEL_WORKERS;
SET @slave_preserver_commit_order_saved= @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER;
SET GLOBAL REPLICA_PRESERVE_COMMIT_ORDER= OFF;

--echo
--echo ############################################################
--echo # 1. Test with REPLICA_PARALLEL_TYPE default value and
--echo #    parallel workers number set to 4.
STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
SET GLOBAL REPLICA_PARALLEL_WORKERS=4;
--error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";

--echo
--echo ############################################################
--echo # 2. Test with REPLICA_PARALLEL_TYPE set to DATABASE and
--echo #    parallel workers number set to 4.
STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "DATABASE";
SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
--error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";

--echo
--echo ############################################################
--echo # 3. Test with REPLICA_PARALLEL_TYPE set to LOGICAL_CLOCK and
--echo #    parallel workers number set to 4.
STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "LOGICAL_CLOCK";
SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
--error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";

--echo
--echo ############################################################
--echo # 4. Test with REPLICA_PARALLEL_TYPE set to LOGICAL_CLOCK,
--echo #    parallel workers number set to 4 and
--echo #    REPLICA_PRESERVE_COMMIT_ORDER set to ON.
STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "LOGICAL_CLOCK";
SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
SET GLOBAL REPLICA_PRESERVE_COMMIT_ORDER= ON;
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";

--echo
--echo ############################################################
--echo # 5. Test with REPLICA_PARALLEL_TYPE set to LOGICAL_CLOCK and
--echo #    parallel workers number set to 0.
STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "LOGICAL_CLOCK";
SET GLOBAL REPLICA_PARALLEL_WORKERS= 0;
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";

--echo
--echo ############################################################
--echo # 6. Test with REPLICA_PARALLEL_TYPE default value and default
--echo #    parallel workers number.
STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
SET @@GLOBAL.REPLICA_PARALLEL_TYPE= @replica_parallel_type_saved;
SET @@GLOBAL.REPLICA_PARALLEL_WORKERS= @replica_parallel_workers_saved;
SET @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER= @slave_preserver_commit_order_saved;
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";

--source include/gr_stop_applier_sql_thread.inc
--source include/group_replication_end.inc