MySQL 26.7.0
Source Code Documentation
rescue_task.h
Go to the documentation of this file.
1// Copyright (c) 2026, 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 MYSQL_CSA_SERVICE_RESCUE_TASK_H
25#define MYSQL_CSA_SERVICE_RESCUE_TASK_H
26
27#include <future>
29#include "sql/rpl_rli.h"
30
31namespace mysql::csa {
32
33/// Types of rescue operations
35 rollback // rollback conflicting transaction
36};
37
38/// Rescue task to rollback conflicting transaction
40 public:
41 /// Constructor
42 /// @param rli RLI attached to the transaction to rescue
43 /// @param op_type Rescue operation type
44 /// @param action_promise Promise used to synchronize thread waiting for
45 /// rescue operation to finish
46 /// @param job_id Job internal identifier
48 std::promise<bool> &action_promise, int job_id);
49 /// Default constructor, required by synchronized queue
50 Rescue_task() = default;
51 /// Perform rescue operation
52 void operator()();
53 /// Sets promise value, e.g. in case when task cannot be executed (stop)
54 void set_promise();
55
56 private:
57 /// Rolls back transaction attached to RLI
58 void rollback_trx();
59 /// RLI attached to the transaction to rescue
61 /// Rescue operation type
64 /// Promise to synchronize on after operation is done
65 std::optional<std::reference_wrapper<std::promise<bool>>> m_action_promise;
66 /// Job internal identifier
67 int m_job_id{0};
68};
69
70} // namespace mysql::csa
71
72#endif // MYSQL_CSA_SERVICE_RESCUE_TASK_H
Definition: rpl_rli.h:208
Rescue task to rollback conflicting transaction.
Definition: rescue_task.h:39
void rollback_trx()
Rolls back transaction attached to RLI.
Definition: rescue_task.cpp:58
std::optional< std::reference_wrapper< std::promise< bool > > > m_action_promise
Promise to synchronize on after operation is done.
Definition: rescue_task.h:65
void operator()()
Perform rescue operation.
Definition: rescue_task.cpp:38
int m_job_id
Job internal identifier.
Definition: rescue_task.h:67
void set_promise()
Sets promise value, e.g. in case when task cannot be executed (stop)
Definition: rescue_task.cpp:50
Rescue_operation_type m_rescue_operation_type
Rescue operation type.
Definition: rescue_task.h:62
Rescue_task()=default
Default constructor, required by synchronized queue.
Relay_log_info * m_rli
RLI attached to the transaction to rescue.
Definition: rescue_task.h:60
Definition: channel.cpp:28
Rescue_operation_type
Types of rescue operations.
Definition: rescue_task.h:34
Experimental API header.