1 /* Copyright (c) 2013, 2021, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software Foundation,
21 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22
23 #include "observer_server_state.h"
24 #include "delayed_plugin_initialization.h"
25
26 using std::string;
27
28 /*
29 DBMS lifecycle events observers.
30 */
group_replication_before_handle_connection(Server_state_param * param)31 int group_replication_before_handle_connection(Server_state_param *param)
32 {
33 if (wait_on_engine_initialization)
34 {
35 delayed_initialization_thread->signal_thread_ready();
36 delayed_initialization_thread->wait_for_read_mode();
37 }
38 return 0;
39 }
40
group_replication_before_recovery(Server_state_param * param)41 int group_replication_before_recovery(Server_state_param *param)
42 {
43 return 0;
44 }
45
group_replication_after_engine_recovery(Server_state_param * param)46 int group_replication_after_engine_recovery(Server_state_param *param)
47 {
48 return 0;
49 }
50
group_replication_after_recovery(Server_state_param * param)51 int group_replication_after_recovery(Server_state_param *param)
52 {
53 return 0;
54 }
55
group_replication_before_server_shutdown(Server_state_param * param)56 int group_replication_before_server_shutdown(Server_state_param *param)
57 {
58 return 0;
59 }
60
group_replication_after_server_shutdown(Server_state_param * param)61 int group_replication_after_server_shutdown(Server_state_param *param)
62 {
63 server_shutdown_status= true;
64 plugin_group_replication_stop();
65
66 return 0;
67 }
68
69 Server_state_observer server_state_observer = {
70 sizeof(Server_state_observer),
71
72 group_replication_before_handle_connection, //before the client connects to the server
73 group_replication_before_recovery, //before recovery
74 group_replication_after_engine_recovery, //after engine recovery
75 group_replication_after_recovery, //after recovery
76 group_replication_before_server_shutdown, //before shutdown
77 group_replication_after_server_shutdown, //after shutdown
78 };
79