MySQL  8.0.28
Source Code Documentation
service_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 MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED
24 
25 /**
26  @file include/mysql/service_rpl_transaction_ctx.h
27  This service provides a function for plugins to report if a transaction of a
28  given THD should continue or be aborted.
29 
30  SYNOPSIS
31  set_transaction_ctx()
32  should be called during RUN_HOOK macro, on which we know that thread is
33  on plugin context and it is before
34  Rpl_transaction_ctx::is_transaction_rollback() check.
35 */
36 
37 #ifndef MYSQL_ABI_CHECK
38 #include <stdlib.h>
39 #endif
40 
41 #include <cstdint>
42 
44  unsigned long m_thread_id;
45  unsigned int m_flags; // reserved
46 
47  /*
48  If the instruction is to rollback the transaction,
49  then this flag is set to false.
50  */
52 
53  /*
54  If the plugin has generated a GTID, then the follwoing
55  fields MUST be set.
56  */
58  int m_sidno;
59  std::int64_t m_gno;
60 };
61 
62 extern "C" struct rpl_transaction_ctx_service_st {
64  Transaction_termination_ctx transaction_termination_ctx);
66 
67 #ifdef MYSQL_DYNAMIC_PLUGIN
68 
69 #define set_transaction_ctx(transaction_termination_ctx) \
70  (rpl_transaction_ctx_service->set_transaction_ctx( \
71  (transaction_termination_ctx)))
72 
73 #else
74 
76  Transaction_termination_ctx transaction_termination_ctx);
77 
78 #endif
79 
80 #define MYSQL_SERVICE_RPL_TRANSACTION_CTX_INCLUDED
81 #endif
struct rpl_transaction_ctx_service_st * rpl_transaction_ctx_service
int set_transaction_ctx(Transaction_termination_ctx transaction_termination_ctx)
Definition: rpl_transaction_ctx.cc:90
Definition: service_rpl_transaction_ctx.h:43
std::int64_t m_gno
Definition: service_rpl_transaction_ctx.h:59
bool m_rollback_transaction
Definition: service_rpl_transaction_ctx.h:51
unsigned long m_thread_id
Definition: service_rpl_transaction_ctx.h:44
int m_sidno
Definition: service_rpl_transaction_ctx.h:58
unsigned int m_flags
Definition: service_rpl_transaction_ctx.h:45
bool m_generated_gtid
Definition: service_rpl_transaction_ctx.h:57
Definition: service_rpl_transaction_ctx.h:62
int(* set_transaction_ctx)(Transaction_termination_ctx transaction_termination_ctx)
Definition: service_rpl_transaction_ctx.h:63