MySQL 8.4.0
Source Code Documentation
rpl_transaction_ctx.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 RPL_TRANSACTION_CTX_H
25#define RPL_TRANSACTION_CTX_H
26
27#include "mysql/service_rpl_transaction_ctx.h" // Transaction_termination_ctx
28#include "sql/rpl_gtid.h" // rpl_gno
29
30/**
31 Server side support to provide a service to plugins to report if
32 a given transaction should continue or be aborted.
33 Its value is reset on Transaction_ctx::cleanup().
34 Its value is set through service service_rpl_transaction_ctx.
35*/
37 public:
39 virtual ~Rpl_transaction_ctx() = default;
40
41 /**
42 Set transaction context, that is, notify the server that for
43 external reasons the ongoing transaction should continue or be
44 aborted.
45 See @file include/mysql/service_rpl_transaction_ctx.h
46
47 @param transaction_termination_ctx Transaction termination context
48 @retval 0 success
49 @retval !=0 error
50 */
52 Transaction_termination_ctx transaction_termination_ctx);
53
54 /**
55 Get transaction outcome decision.
56 When both sidno and gno are equal or greater than zero,
57 transaction should continue.
58 By default sidno and gno are 0, transaction will continue.
59
60 @retval true Transaction should abort
61 @retval false Transaction should continue
62 */
64
65 /**
66 Get transaction sidno.
67
68 @return sidno sidno value.
69 */
70 int get_sidno() const;
71
72 /**
73 Get transaction gno.
74
75 @return gno gno value.
76 */
77 rpl_gno get_gno() const;
78
79 /// @brief Sets transaction sidno.
80 /// @param sidno sidno value
81 void set_sidno(rpl_sidno sidno);
82
83 /// @brief Transaction GTID components accessor
84 /// @returns SIDNO, GTID GNO
85 std::pair<rpl_sidno, rpl_gno> get_gtid_components() const;
86
87 /**
88 Reset transaction context to default values.
89 */
90 void cleanup();
91
92 private:
94};
95
96#endif /* RPL_TRANSACTION_CTX_H */
Server side support to provide a service to plugins to report if a given transaction should continue ...
Definition: rpl_transaction_ctx.h:36
Rpl_transaction_ctx()
Definition: rpl_transaction_ctx.cc:37
int set_rpl_transaction_ctx(Transaction_termination_ctx transaction_termination_ctx)
Definition: rpl_transaction_ctx.cc:52
virtual ~Rpl_transaction_ctx()=default
std::pair< rpl_sidno, rpl_gno > get_gtid_components() const
Transaction GTID components accessor.
Definition: rpl_transaction_ctx.cc:82
Transaction_termination_ctx m_transaction_ctx
Definition: rpl_transaction_ctx.h:93
bool is_transaction_rollback()
Get transaction outcome decision.
Definition: rpl_transaction_ctx.cc:67
int get_sidno() const
Get transaction sidno.
Definition: rpl_transaction_ctx.cc:72
rpl_gno get_gno() const
Get transaction gno.
Definition: rpl_transaction_ctx.cc:77
void cleanup()
Reset transaction context to default values.
Definition: rpl_transaction_ctx.cc:42
void set_sidno(rpl_sidno sidno)
Sets transaction sidno.
Definition: rpl_transaction_ctx.cc:87
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:112
cs::index::rpl_sidno rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:108
This service provides a function for plugins to report if a transaction of a given THD should continu...
Definition: service_rpl_transaction_ctx.h:44