MySQL 9.1.0
Source Code Documentation
recovery.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 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 XA_RECOVERY_H_INCLUDED
25#define XA_RECOVERY_H_INCLUDED
26
27#include "sql/handler.h" // XA_recover_txn
28#include "sql/sql_class.h" // THD
29#include "sql/xa.h" // Xid_commit_list, Xa_state_list, XID, ...
30
36 bool dry_run;
37};
38
39namespace xa {
40namespace recovery {
41/**
42 Callback to be invoked by `ha_recover` over each storage engine plugin.
43
44 1. It invokes `handler::recover_prepared_in_tc(XA_recover_txn[])`
45 callback from the plugin interface, in order to retrieve the list of
46 transactions that are, at the moment, in prepared in TC state within
47 the storage engine.
48 2. For all externally coordinated transactions that are in prepared in TC
49 state, adds each to the list of recoverable XA transactions
50 `xarecover_st::xa_list` in `PREPARED` state.
51
52 @param thd The THD session object to be used in recovering the
53 transactions.
54 @param plugin The plugin interface for the storage engine to recover the
55 transactions for.
56 @param arg A pointer to `struct xarecover_st` that hold the information
57 about the transaction coordinator state.
58
59 @return false if the recovery ended successfully, false otherwise.
60 */
61bool recover_prepared_in_tc_one_ht(THD *thd, plugin_ref plugin, void *arg);
62/**
63 Callback to be invoked by `ha_recover` over each storage engine plugin.
64
65 1. It invokes `handler::recover(XA_recover_txn[])` callback from the
66 plugin interface, in order to retrieve the list of transactions that
67 are, at the moment, in prepared state within the storage engine.
68 2. Invokes `recover_one_internal_trx` for all the retrieved transactions
69 that are internally coordinated transactions.
70 3. Invokes `recover_one_external_trx` for all the retrieved transactions
71 that are externally coordinated transactions.
72
73 @param thd The THD session object to be used in recovering the
74 transactions.
75 @param plugin The plugin interface for the storage engine to recover the
76 transactions for.
77 @param arg A pointer to `struct xarecover_st` that hold the information
78 about the transaction coordinator state.
79
80 @return false if the recovery ended successfully, false otherwise.
81 */
82bool recover_one_ht(THD *thd, plugin_ref plugin, void *arg);
83} // namespace recovery
84} // namespace xa
85#endif // XA_RECOVERY_H_INCLUDED
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Class to maintain list of externally coordinated transactions and their current state at recovery.
Definition: handler.h:1259
bool recover_one_ht(THD *thd, plugin_ref plugin, void *arg)
Callback to be invoked by ha_recover over each storage engine plugin.
Definition: recovery.cc:191
bool recover_prepared_in_tc_one_ht(THD *thd, plugin_ref plugin, void *arg)
Callback to be invoked by ha_recover over each storage engine plugin.
Definition: recovery.cc:179
Definition: recovery.h:39
std::unordered_set< my_xid, std::hash< my_xid >, std::equal_to< my_xid >, Mem_root_allocator< my_xid > > Xid_commit_list
Single occurrence set of XIDs of internally coordinated transactions found as been committed in the t...
Definition: handler.h:1253
Definition: sql_plugin_ref.h:45
Plain structure to store information about XA transaction id and a list of table names involved into ...
Definition: xa.h:290
Definition: recovery.h:31
int len
Definition: recovery.h:32
XA_recover_txn * list
Definition: recovery.h:33
Xid_commit_list const * commit_list
Definition: recovery.h:34
Xa_state_list * xa_list
Definition: recovery.h:35
bool dry_run
Definition: recovery.h:36
int found_foreign_xids
Definition: recovery.h:32
int found_my_xids
Definition: recovery.h:32