MySQL  8.0.19
Source Code Documentation
applier_handler.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
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
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef SQL_THREAD_APPLIER_INCLUDE
24 #define SQL_THREAD_APPLIER_INCLUDE
25 
27 
28 #include "my_inttypes.h"
31 
33  public:
36  int handle_action(Pipeline_action *action);
37  int initialize();
38  int terminate();
39  bool is_unique();
40  int get_role();
41 
42  /**
43  Initializes the SQL thread when receiving a configuration package
44 
45  @param reset_logs if a reset was executed in the server
46  @param plugin_shutdown_timeout the plugin's timeout for component shutdown
47 
48  @return the operation status
49  @retval 0 OK
50  @retval !=0 Error
51  */
52  int initialize_repositories(bool reset_logs, ulong plugin_shutdown_timeout);
53 
54  /**
55  Starts the SQL thread when receiving a action package
56 
57  @return the operation status
58  @retval 0 OK
59  @retval !=0 Error
60  */
62 
63  /**
64  Stops the SQL thread when receiving a action package
65 
66  @return the operation status
67  @retval 0 OK
68  @retval !=0 Error
69  */
70  int stop_applier_thread();
71 
72  /**
73  Checks if the applier, and its workers when parallel applier is
74  enabled, has already consumed all relay log, that is, applier is
75  waiting for transactions to be queued.
76 
77  @return the applier status
78  @retval true the applier is waiting
79  @retval false otherwise
80  */
82 
83  /**
84  Checks if all the queued transactions were executed.
85 
86  @param timeout the time (seconds) after which the method returns if the
87  above condition was not satisfied
88 
89  @return the operation status
90  @retval 0 All transactions were executed
91  @retval -1 A timeout occurred
92  @retval -2 An error occurred
93  */
94  int wait_for_gtid_execution(double timeout);
95 
96  /**
97  Checks if all the given transactions were executed.
98 
99  @param retrieved_set the set in string format of transaction to wait for
100  @param timeout the time (seconds) after which the method returns if the
101  above condition was not satisfied
102  @param update_THD_status Shall the method update the THD stage
103 
104  @return the operation status
105  @retval 0 All transactions were executed
106  @retval -1 A timeout occurred
107  @retval -2 An error occurred
108 */
109  int wait_for_gtid_execution(std::string &retrieved_set, double timeout,
110  bool update_THD_status = true);
111 
112  /**
113  Checks if the channel's relay log contains partial transaction.
114  @return
115  @retval true If relaylog contains partial transaction.
116  @retval false If relaylog does not contain partial transaction.
117  */
119 
120  private:
122 };
123 
124 #endif /* SQL_THREAD_APPLIER_INCLUDE */
Applier_handler::wait_for_gtid_execution
int wait_for_gtid_execution(double timeout)
Checks if all the queued transactions were executed.
Definition: applier_handler.cc:189
Pipeline_event
Definition: pipeline_interfaces.h:122
Applier_handler::initialize
int initialize()
Initialization as defined in the handler implementation.
Definition: applier_handler.cc:33
pipeline_handlers.h
Applier_handler::is_applier_thread_waiting
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:181
Applier_handler::start_applier_thread
int start_applier_thread()
Starts the SQL thread when receiving a action package.
Definition: applier_handler.cc:75
Applier_handler::is_partial_transaction_on_relay_log
int is_partial_transaction_on_relay_log()
Checks if the channel's relay log contains partial transaction.
Definition: applier_handler.cc:208
Replication_thread_api
Definition: replication_threads_api.h:36
Event_handler
Definition: pipeline_interfaces.h:532
Applier_handler::channel_interface
Replication_thread_api channel_interface
Definition: applier_handler.h:121
Applier_handler::get_role
int get_role()
This method returns the handler role.
Definition: applier_handler.cc:179
my_inttypes.h
Applier_handler::handle_action
int handle_action(Pipeline_action *action)
Handling of an action as defined in the handler implementation.
Definition: applier_handler.cc:139
Applier_handler::stop_applier_thread
int stop_applier_thread()
Stops the SQL thread when receiving a action package.
Definition: applier_handler.cc:86
Applier_handler::is_unique
bool is_unique()
This method identifies the handler as being unique.
Definition: applier_handler.cc:177
Applier_handler::terminate
int terminate()
Terminate the execution as defined in the handler implementation.
Definition: applier_handler.cc:38
Pipeline_action
Definition: pipeline_interfaces.h:502
Applier_handler::initialize_repositories
int initialize_repositories(bool reset_logs, ulong plugin_shutdown_timeout)
Initializes the SQL thread when receiving a configuration package.
Definition: applier_handler.cc:43
Applier_handler::handle_event
int handle_event(Pipeline_event *ev, Continuation *cont)
Handling of an event as defined in the handler implementation.
Definition: applier_handler.cc:101
ulong
unsigned long ulong
Definition: my_inttypes.h:48
Applier_handler
Definition: applier_handler.h:32
Continuation
Definition: pipeline_interfaces.h:407
Applier_handler::Applier_handler
Applier_handler()
Definition: applier_handler.cc:31
group_replication_priv.h
replication_threads_api.h