MySQL 8.0.39
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 Was GTID generated externally?
67
68 @retval true GTID was generated.
69 @retval false GTID was not generated.
70 */
71 bool is_generated_gtid();
72
73 /**
74 Get transaction sidno.
75
76 @return sidno sidno value.
77 */
78 int get_sidno();
79
80 /**
81 Get transaction gno.
82
83 @return gno gno value.
84 */
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
bool is_generated_gtid()
Was GTID generated externally?
Definition: rpl_transaction_ctx.cc:72
rpl_gno get_gno()
Get transaction gno.
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
void cleanup()
Reset transaction context to default values.
Definition: rpl_transaction_ctx.cc:42
int get_sidno()
Get transaction sidno.
Definition: rpl_transaction_ctx.cc:77
binary_log::gtids::gno_t rpl_gno
GNO, the second (numeric) component of a GTID, is an alias of binary_log::gtids::gno_t.
Definition: rpl_gtid.h:103
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