Debian Codegraph @

mysql-test/suite/group_replication/t/gr_start_stop_parallel_applier_database.test

raw
1 ################################################################################
2 # Verify that parallel applier type cannot be changed to DATABASE on
3 # group_replication_applier channel when stopping and starting
4 # applier.
5 #
6 # Test:
7 # 0. The test requires one server.
8 # - With member ONLINE. Check that default slave parallel type is DATABASE and
9 # slave parallel workers is 0.
10 # 1. Stop applier thread. Test with default REPLICA_PARALLEL_TYPE and
11 # REPLICA_PARALLEL_WORKERS > 0. Start applier thread should fail.
12 # 2. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=DATABASE and
13 # REPLICA_PARALLEL_WORKERS > 0. Start applier thread should fail.
14 # 3. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=LOGICAL_CLOCK and
15 # REPLICA_PARALLEL_WORKERS > 0. Start applier thread should fail.
16 # 4. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=LOGICAL_CLOCK,
17 # REPLICA_PARALLEL_WORKERS > 0 and REPLICA_PRESERVE_COMMIT_ORDER=ON.
18 # Start applier thread should succeed.
19 # 5. Stop applier thread. Test with REPLICA_PARALLEL_TYPE=LOGICAL_CLOCK and
20 # REPLICA_PARALLEL_WORKERS = 0. Start applier thread should succeed.
21 # 6. Stop applier thread. Test with default REPLICA_PARALLEL_TYPE and default
22 # REPLICA_PARALLEL_WORKERS. Start applier thread should succeed.
23 ################################################################################
24 --source include/only_mts_replica_parallel_workers.inc
25 --source include/have_group_replication_plugin.inc
26 --let $rpl_skip_group_replication_start = 1
27 --source include/group_replication.inc
28
29 # If these assert fails there is no point in continue the test,
30 # since it relies on DATABASE as default value.
31 --let $assert_text= Default slave parallel type must be LOGICAL_CLOCK
32 --let $assert_cond= "[SELECT @@GLOBAL.REPLICA_PARALLEL_TYPE]" = "LOGICAL_CLOCK"
33 --source include/assert.inc
34
35 --let $assert_text= Default slave parallel workers must be 4
36 --let $assert_cond= [SELECT @@GLOBAL.REPLICA_PARALLEL_WORKERS] = 4
37 --source include/assert.inc
38
39 --let $assert_text= Default slave preserve commit order 1
40 --let $assert_cond= [SELECT @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER] = 1
41 --source include/assert.inc
42
43 # Start and stop Group Replication to ensure that `group_replication_applier`
44 # channel exists.
45 --source include/start_and_bootstrap_group_replication.inc
46 --source include/stop_group_replication.inc
47
48 # Save defaults.
49 SET @replica_parallel_type_saved= @@GLOBAL.REPLICA_PARALLEL_TYPE;
50 SET @replica_parallel_workers_saved= @@GLOBAL.REPLICA_PARALLEL_WORKERS;
51 SET @slave_preserver_commit_order_saved= @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER;
52 SET GLOBAL REPLICA_PRESERVE_COMMIT_ORDER= OFF;
53
54 --echo
55 --echo ############################################################
56 --echo # 1. Test with REPLICA_PARALLEL_TYPE default value and
57 --echo # parallel workers number set to 4.
58 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
59 SET GLOBAL REPLICA_PARALLEL_WORKERS=4;
60 --error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
61 START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
62
63 --echo
64 --echo ############################################################
65 --echo # 2. Test with REPLICA_PARALLEL_TYPE set to DATABASE and
66 --echo # parallel workers number set to 4.
67 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
68 SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "DATABASE";
69 SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
70 --error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
71 START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
72
73 --echo
74 --echo ############################################################
75 --echo # 3. Test with REPLICA_PARALLEL_TYPE set to LOGICAL_CLOCK and
76 --echo # parallel workers number set to 4.
77 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
78 SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "LOGICAL_CLOCK";
79 SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
80 --error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
81 START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
82
83 --echo
84 --echo ############################################################
85 --echo # 4. Test with REPLICA_PARALLEL_TYPE set to LOGICAL_CLOCK,
86 --echo # parallel workers number set to 4 and
87 --echo # REPLICA_PRESERVE_COMMIT_ORDER set to ON.
88 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
89 SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "LOGICAL_CLOCK";
90 SET GLOBAL REPLICA_PARALLEL_WORKERS= 4;
91 SET GLOBAL REPLICA_PRESERVE_COMMIT_ORDER= ON;
92 START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
93
94 --echo
95 --echo ############################################################
96 --echo # 5. Test with REPLICA_PARALLEL_TYPE set to LOGICAL_CLOCK and
97 --echo # parallel workers number set to 0.
98 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
99 SET @@GLOBAL.REPLICA_PARALLEL_TYPE= "LOGICAL_CLOCK";
100 SET GLOBAL REPLICA_PARALLEL_WORKERS= 0;
101 START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
102
103 --echo
104 --echo ############################################################
105 --echo # 6. Test with REPLICA_PARALLEL_TYPE default value and default
106 --echo # parallel workers number.
107 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
108 SET @@GLOBAL.REPLICA_PARALLEL_TYPE= @replica_parallel_type_saved;
109 SET @@GLOBAL.REPLICA_PARALLEL_WORKERS= @replica_parallel_workers_saved;
110 SET @@GLOBAL.REPLICA_PRESERVE_COMMIT_ORDER= @slave_preserver_commit_order_saved;
111 START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
112
113 --source include/gr_stop_applier_sql_thread.inc
114 --source include/group_replication_end.inc