MySQL 8.4.0
Source Code Documentation
hold_transactions.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 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 HOLD_TRANSACTIONS_INCLUDE
25#define HOLD_TRANSACTIONS_INCLUDE
26
27#include "my_inttypes.h"
28#include "sql/sql_class.h"
29
30/**
31 @class Hold_transactions
32 Class that contains the logic to hold transactions when
33 group_replication_consistency is set to BEFORE_ON_PRIMARY_FAILOVER
34*/
35
37 public:
38 /**
39 Class constructor for hold transaction logic
40 */
42
43 /**
44 Class destructor for hold transaction logic
45 */
47
48 /**
49 Method to enable the hold of transactions when a primary election is
50 occurring
51 */
52 void enable();
53
54 /**
55 Method to resume transactions on hold, primary election ended
56 */
57 void disable();
58
59 /**
60 Method to wait for a primary failover to be complete
61
62 @param hold_timeout seconds to abort wait
63
64 @return the operation status
65 @retval 0 if success
66 @retval !=0 mysqld error code
67 */
68 int wait_until_primary_failover_complete(ulong hold_timeout);
69
70 private:
71 /**
72 Method to verify if thread is killed
73 */
75 return current_thd != nullptr && current_thd->is_killed();
76 }
77
78 /** is plugin currently applying backlog */
79 bool applying_backlog = false;
80
81 /** protect and notify changes on applying_backlog */
84};
85
86#endif /* HOLD_TRANSACTIONS_INCLUDE */
Class that contains the logic to hold transactions when group_replication_consistency is set to BEFOR...
Definition: hold_transactions.h:36
mysql_cond_t primary_promotion_policy_condition
Definition: hold_transactions.h:83
int wait_until_primary_failover_complete(ulong hold_timeout)
Method to wait for a primary failover to be complete.
Definition: hold_transactions.cc:63
void disable()
Method to resume transactions on hold, primary election ended.
Definition: hold_transactions.cc:52
bool applying_backlog
is plugin currently applying backlog
Definition: hold_transactions.h:79
mysql_mutex_t primary_promotion_policy_mutex
protect and notify changes on applying_backlog
Definition: hold_transactions.h:82
~Hold_transactions()
Class destructor for hold transaction logic.
Definition: hold_transactions.cc:37
bool is_thread_killed()
Method to verify if thread is killed.
Definition: hold_transactions.h:74
void enable()
Method to enable the hold of transactions when a primary election is occurring.
Definition: hold_transactions.cc:42
Hold_transactions()
Class constructor for hold transaction logic.
Definition: hold_transactions.cc:28
int is_killed() const final
Has the owner thread been killed?
Definition: sql_class.h:3073
thread_local THD * current_thd
Definition: current_thd.cc:26
Some integer typedefs for easier portability.
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50