MySQL  8.0.27
Source Code Documentation
rpl_transaction_ctx.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2021, 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  Was GTID generated externally?
66 
67  @retval true GTID was generated.
68  @retval false GTID was not generated.
69  */
70  bool is_generated_gtid();
71 
72  /**
73  Get transaction sidno.
74 
75  @return sidno sidno value.
76  */
77  int get_sidno();
78 
79  /**
80  Get transaction gno.
81 
82  @return gno gno value.
83  */
84  rpl_gno get_gno();
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
bool is_generated_gtid()
Was GTID generated externally?
Definition: rpl_transaction_ctx.cc:71
rpl_gno get_gno()
Get transaction gno.
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
void cleanup()
Reset transaction context to default values.
Definition: rpl_transaction_ctx.cc:41
int get_sidno()
Get transaction sidno.
Definition: rpl_transaction_ctx.cc:76
std::int64_t rpl_gno
Type of GNO, the second (numeric) component of GTID.
Definition: rpl_gtid.h:100
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