MySQL 9.1.0
Source Code Documentation
applier_handler.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SQL_THREAD_APPLIER_INCLUDE
25#define SQL_THREAD_APPLIER_INCLUDE
26
28
29#include "my_inttypes.h"
32
34 public:
36 int handle_event(Pipeline_event *ev, Continuation *cont) override;
38 int initialize() override;
39 int terminate() override;
40 bool is_unique() override;
41 int get_role() override;
42
43 /**
44 This method handles binary log events by storing them so they can be used on
45 next handler.
46
47 @param[in] pevent the event to be injected
48 @param[in] cont the object used to wait
49
50 @return the operation status
51 @retval 0 OK
52 @retval !=0 Error
53 */
55
56 /**
57 This method handles applier context events by storing them so they can be
58 used on next handler.
59
60 @param[in] pevent the event to be injected
61 @param[in] cont the object used to wait
62
63 @return the operation status
64 @retval 0 OK
65 @retval !=0 Error
66 */
68
69 /**
70 Initializes the SQL thread when receiving a configuration package
71
72 @param reset_logs if a reset was executed in the server
73 @param plugin_shutdown_timeout the plugin's timeout for component shutdown
74
75 @return the operation status
76 @retval 0 OK
77 @retval !=0 Error
78 */
79 int initialize_repositories(bool reset_logs, ulong plugin_shutdown_timeout);
80
81 /**
82 Starts the SQL thread when receiving a action package
83
84 @return the operation status
85 @retval 0 OK
86 @retval !=0 Error
87 */
89
90 /**
91 Stops the SQL thread when receiving a action package
92
93 @return the operation status
94 @retval 0 OK
95 @retval !=0 Error
96 */
98
99 /**
100 Checks if the applier, and its workers when parallel applier is
101 enabled, has already consumed all relay log, that is, applier is
102 waiting for transactions to be queued.
103
104 @return the applier status
105 @retval true the applier is waiting
106 @retval false otherwise
107 */
109
110 /**
111 Checks if all the queued transactions were executed.
112
113 @param timeout the time (seconds) after which the method returns if the
114 above condition was not satisfied
115
116 @return the operation status
117 @retval 0 All transactions were executed
118 @retval -1 A timeout occurred
119 @retval -2 An error occurred
120 */
122
123 /**
124 Checks if all the given transactions were executed.
125
126 @param retrieved_set the set in string format of transaction to wait for
127 @param timeout the time (seconds) after which the method returns if the
128 above condition was not satisfied
129 @param update_THD_status Shall the method update the THD stage
130
131 @return the operation status
132 @retval 0 All transactions were executed
133 @retval -1 A timeout occurred
134 @retval -2 An error occurred
135*/
136 int wait_for_gtid_execution(std::string &retrieved_set, double timeout,
137 bool update_THD_status = true);
138
139 /**
140 Checks if the channel's relay log contains partial transaction.
141
142 @retval true If relaylog contains partial transaction.
143 @retval false If relaylog does not contain partial transaction.
144 */
146
147 private:
149};
150
151#endif /* SQL_THREAD_APPLIER_INCLUDE */
Definition: applier_handler.h:33
bool is_applier_thread_waiting()
Checks if the applier, and its workers when parallel applier is enabled, has already consumed all rel...
Definition: applier_handler.cc:210
int handle_applier_event(Pipeline_event *pevent, Continuation *cont)
This method handles applier context events by storing them so they can be used on next handler.
Definition: applier_handler.cc:163
int handle_action(Pipeline_action *action) override
Handling of an action as defined in the handler implementation.
Definition: applier_handler.cc:168
int stop_applier_thread()
Stops the SQL thread when receiving a action package.
Definition: applier_handler.cc:95
int terminate() override
Terminate the execution as defined in the handler implementation.
Definition: applier_handler.cc:39
int is_partial_transaction_on_relay_log()
Checks if the channel's relay log contains partial transaction.
Definition: applier_handler.cc:237
int initialize() override
Initialization as defined in the handler implementation.
Definition: applier_handler.cc:34
int handle_event(Pipeline_event *ev, Continuation *cont) override
Handling of an event as defined in the handler implementation.
Definition: applier_handler.cc:110
int start_applier_thread()
Starts the SQL thread when receiving a action package.
Definition: applier_handler.cc:84
Replication_thread_api channel_interface
Definition: applier_handler.h:148
int get_role() override
This method returns the handler role.
Definition: applier_handler.cc:208
int wait_for_gtid_execution(double timeout)
Checks if all the queued transactions were executed.
Definition: applier_handler.cc:218
int initialize_repositories(bool reset_logs, ulong plugin_shutdown_timeout)
Initializes the SQL thread when receiving a configuration package.
Definition: applier_handler.cc:44
bool is_unique() override
This method identifies the handler as being unique.
Definition: applier_handler.cc:206
int handle_binary_log_event(Pipeline_event *pevent, Continuation *cont)
This method handles binary log events by storing them so they can be used on next handler.
Definition: applier_handler.cc:127
Class used to wait on the execution of some action.
Definition: pipeline_interfaces.h:536
Interface for the application of events, them being packets or log events.
Definition: pipeline_interfaces.h:663
A wrapper for pipeline actions.
Definition: pipeline_interfaces.h:633
A wrapper for log events/packets.
Definition: pipeline_interfaces.h:167
Definition: replication_threads_api.h:37
Some integer typedefs for easier portability.
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:498
repeated Action action
Definition: replication_group_member_actions.proto:43