1# ==== Purpose ====
2#
3# Issues START GROUP_REPLICATION on the current connection. Then waits
4# until member state is ONLINE or the specified by
5# $group_replication_start_member_state.
6#
7#
8# ==== Usage ====
9#
10# --let $group_replication_group_name= UUID
11# [--let $group_replication_start_member_state= STATE]
12# [--let $$wait_timeout= NUMBER]
13# [--let $rpl_debug= 1]
14# --source include/start_group_replication.inc
15#
16# Parameters:
17#   $group_replication_group_name
18#     Group name
19#
20#   $group_replication_start_member_state
21#     The state that the member must have after start, ONLINE
22#     if not specified
23#
24#   $wait_timeout
25#     See include/wait_condition.inc
26#
27#   $rpl_debug
28#     See include/rpl_init.inc
29
30--let $include_filename= start_group_replication.inc
31--source include/begin_include_file.inc
32
33if ($group_replication_group_name == '')
34{
35  --die ERROR IN TEST: the "group_replication_group_name" variable must be set
36}
37
38if (!$group_replication_start_member_state)
39{
40  --let $group_replication_start_member_state= ONLINE
41}
42
43if (!$rpl_debug)
44{
45  --disable_query_log
46}
47
48--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
49
50--source include/start_group_replication_command.inc
51
52--let $_member_id= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
53--let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_group_members group_members WHERE group_members.channel_name="group_replication_applier" AND group_members.member_id="$_member_id" AND group_members.member_state="$group_replication_start_member_state"
54--source include/wait_condition.inc
55if (!$success)
56{
57  --echo Current connection: $CURRENT_CONNECTION
58  --echo group_replication_group_name= "$group_replication_group_name"
59  --echo group_replication_member_id= "$_member_id"
60  --echo Expected group_replication_member_state= "$group_replication_start_member_state"
61  --echo
62  --echo performance_schema.replication_connection_status
63  --echo ------------------------------------------------
64  --query_vertical SELECT * FROM performance_schema.replication_connection_status
65  --echo
66  --echo performance_schema.replication_applier_status
67  --echo ---------------------------------------------
68  --query_vertical SELECT * FROM performance_schema.replication_applier_status
69  --echo
70  --echo performance_schema.replication_applier_status_by_coordinator
71  --echo ------------------------------------------------------------
72  --query_vertical SELECT * FROM performance_schema.replication_applier_status_by_coordinator
73  --echo
74  --echo performance_schema.replication_applier_status_by_worker
75  --echo -------------------------------------------------------
76  --query_vertical SELECT * FROM performance_schema.replication_applier_status_by_worker
77  --echo
78  --echo performance_schema.replication_group_members
79  --echo --------------------------------------------
80  --query_vertical SELECT * FROM performance_schema.replication_group_members
81  --echo
82  --echo performance_schema.replication_group_member_stats
83  --echo -------------------------------------------------
84  --query_vertical SELECT * FROM performance_schema.replication_group_member_stats
85  --die Timeout in wait_condition.inc on start_group_replication.inc
86}
87
88--let $group_replication_start_member_state=
89
90--let $include_filename= start_group_replication.inc
91--source include/end_include_file.inc
92