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