MySQL 8.3.0
Source Code Documentation
server_ongoing_transactions_handler.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2023, 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
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef SERVER_ONGOING_TRANSACTIONS_HANDLER_INCLUDED
24#define SERVER_ONGOING_TRANSACTIONS_HANDLER_INCLUDED
25
28
29#include <queue>
30
32 public:
33 /** Initialize the class and get the server service */
35
36 /** Class destructor */
38
39 /**
40 Fetch the registry and the service for this class
41 @param stage_handler the stage handler to report progress
42
43 @returns false in case of success, or true otherwise
44 */
46
47 /**
48 Get the list of running transactions from the server
49 @param[out] ids an array of thread ids
50 @param[out] size the size of the array returned on ids
51 @returns 0 in case of success, 1 in case of error
52 */
53 bool get_server_running_transactions(ulong **ids, ulong *size);
54
55 /**
56 Gets running transactions and waits for its end
57
58 @param abort_flag cancel flag
59 @param id_to_ignore if different from 0, the method does not wait for it
60
61 @returns 0 in case of success, 1 in case of error
62 */
64 bool *abort_flag, my_thread_id id_to_ignore = 0);
65
66 /** Abort any running waiting process */
68
70 ulong gr_consistency_level, ulong hold_timeout,
71 enum_rpl_channel_type rpl_channel_type,
72 const THD *thd) override;
73
74 int before_commit(
77
81
83
85 rpl_gno gno) override;
86
87 private:
88 /** The transactions that finished while the service is running */
89 std::queue<my_thread_id> thread_ids_finished;
90
91 /** The lock for the query wait */
93
94 /** The server service handle */
96
97 /** A stage handler for reporting progress*/
99};
100
101#endif /* SERVER_ONGOING_TRANSACTIONS_HANDLER_INCLUDED */
Listener for transaction life cycle events.
Definition: group_transaction_observation_manager.h:32
enum_transaction_origin
Enum for transaction origins.
Definition: group_transaction_observation_manager.h:35
Definition: stage_monitor_handler.h:29
Definition: server_ongoing_transactions_handler.h:31
Plugin_stage_monitor_handler * stage_handler
A stage handler for reporting progress.
Definition: server_ongoing_transactions_handler.h:98
mysql_mutex_t query_wait_lock
The lock for the query wait.
Definition: server_ongoing_transactions_handler.h:92
bool get_server_running_transactions(ulong **ids, ulong *size)
Get the list of running transactions from the server.
Definition: server_ongoing_transactions_handler.cc:56
Server_ongoing_transactions_handler()
Initialize the class and get the server service.
Definition: server_ongoing_transactions_handler.cc:29
~Server_ongoing_transactions_handler() override
Class destructor.
Definition: server_ongoing_transactions_handler.cc:45
bool initialize_server_service(Plugin_stage_monitor_handler *stage_handler)
Fetch the registry and the service for this class.
Definition: server_ongoing_transactions_handler.cc:35
int before_commit(my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin) override
Executed before commit.
Definition: server_ongoing_transactions_handler.cc:138
int before_transaction_begin(my_thread_id thread_id, ulong gr_consistency_level, ulong hold_timeout, enum_rpl_channel_type rpl_channel_type, const THD *thd) override
Executed before a transaction begins.
Definition: server_ongoing_transactions_handler.cc:133
std::queue< my_thread_id > thread_ids_finished
The transactions that finished while the service is running.
Definition: server_ongoing_transactions_handler.h:89
void abort_waiting_process()
Abort any running waiting process.
int after_rollback(my_thread_id thread_id) override
Executed after rollback.
Definition: server_ongoing_transactions_handler.cc:149
my_h_service generic_service
The server service handle.
Definition: server_ongoing_transactions_handler.h:95
int wait_for_current_transaction_load_execution(bool *abort_flag, my_thread_id id_to_ignore=0)
Gets running transactions and waits for its end.
Definition: server_ongoing_transactions_handler.cc:70
int after_commit(my_thread_id thread_id, rpl_sidno sidno, rpl_gno gno) override
Executed after commit.
Definition: server_ongoing_transactions_handler.cc:156
int before_rollback(my_thread_id thread_id, Group_transaction_listener::enum_transaction_origin origin) override
Executed before rollback.
Definition: server_ongoing_transactions_handler.cc:143
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32
static my_thread_id thread_id
Definition: my_thr_init.cc:62
uint32 my_thread_id
Definition: my_thread_local.h:33
enum_rpl_channel_type
Type of replication channel thread/transaction might be associated to.
Definition: rpl_context.h:49
mysql::gtid::gno_t rpl_gno
GNO, the second (numeric) component of a GTID, is an alias of mysql::gtid::gno_t.
Definition: rpl_gtid.h:111
cs::index::rpl_sidno rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:107
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49