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