File: gr_stop_wait_udf_finish.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 (116 lines) | stat: -rw-r--r-- 3,605 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
115
116
###############################################################################
#
#  STOP GROUP_REPLICATION will signal group coordination process and loop until
#  all UDF terminate.
#
# Test:
#   0. This test requires two servers on multi primary mode
#   1. Activate debug point will block action after verify plugin isn't
#      stopping
#   2. Start action switch to single primary mode
#   3. Wait for action hit the debug point
#   4. STOP Group Replication on server1
#   5. Wait for member state is OFFLINE
#   6. To improve test but without adding more debug code, sleep to allow
#      STOP Group Replication loop until UDF function finishes
#   7. Assert STOP GROUP_REPLICATION thread still runs
#   8. Signal the action to continue
#   9. Reap execution of action and confirm it failed
#  10. Reap with success the execution of STOP GROUP_REPLICATION
#  11. Cleanup
#
###############################################################################

--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--let $rpl_server_count= 2
--source include/group_replication.inc

--echo
--echo # 1. Activate debug point will block action after verify plugin isn't
--echo #    stopping

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

set session sql_log_bin=0;
call mtr.add_suppression("The function 'group_replication_switch_to_single_primary_mode' failed. The group coordination process is terminating.");
set session sql_log_bin=1;

--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

SET @debug_saved = @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG='+d,group_replication_hold_udf_after_plugin_is_stopping';

--echo
--echo # 2. Start action switch to single primary mode

--replace_result $server1_uuid MEMBER1_UUID
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")

--echo
--echo # 3. Wait for action hit the debug point

--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc

SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_resume_udf";

--echo
--echo # 4. STOP Group Replication on server1

--send STOP GROUP_REPLICATION;

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc

--echo
--echo # 5. Wait for member state is OFFLINE

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

--echo
--echo # 6. To improve test but without adding more debug code, sleep to allow
--echo #    STOP Group Replication loop until UDF function finishes

--sleep 2

--echo
--echo # 7. Assert STOP GROUP_REPLICATION thread still runs

--let $assert_text= 'There is a thread executing STOP GROUP_REPLICATION on server1'
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.threads WHERE processlist_INFO LIKE "STOP GROUP_REPLICATION", count, 1] = 1
--source include/assert.inc

--echo
--echo # 8. Signal the action to continue

SET DEBUG_SYNC = "now SIGNAL signal.group_replication_resume_udf_continue";

--echo
--echo # 9. Reap execution of action and confirm it failed

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--replace_result $server1_uuid MEMBER1_UUID
--error ER_CANT_INITIALIZE_UDF
--reap

--echo
--echo # 10. Reap with success the execution of STOP GROUP_REPLICATION

--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc

--reap

--echo
--echo # 11. Cleanup

SET @@GLOBAL.DEBUG= @debug_save;

--let $rpl_group_replication_single_primary_mode=1
--let $rpl_group_replication_reset_persistent_vars=1
--source include/group_replication_end.inc