MySQL 8.1.0
Source Code Documentation
rpl_async_conn_failover.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2023, 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_ASYNC_CONN_FAILOVER_H
24#define RPL_ASYNC_CONN_FAILOVER_H
25
27#include "sql/rpl_mi.h"
28
29/*
30 The class is used to connect to new source in case the
31 current replica IO connection gets interrupted.
32*/
34 public:
36 /* Success. */
37 no_error = 0,
38
39 /* Failed to set/reset network configuration details. */
41
42 /* Failed to find alternative source to connect. */
44 };
45
46 enum class SourceQuorumStatus {
47 /* Success. */
48 no_error = 0,
49
50 /* Failed to detect if the source belongs to the group majority. */
52
53 /* Transient network error connecting to source. */
55
56 /* No Quorum. Source does not belong to the group majority. */
58 };
59
61
65 delete;
67 delete;
68
69 /**
70 Re-establishes connection to next available source.
71
72 @param[in] mi the mi of the failed connection which
73 needs to be reconnected to the new source.
74 @param[in] force_highest_weight When true, sender with highest weight is
75 chosen, otherwise the next sender from the current one is chosen.
76
77 @retval Please see DoAutoConnFailoverError.
78 */
80 Master_info *mi, bool force_highest_weight);
81
82 /*
83 Get source quorum status in case source has Group Replication enabled.
84
85 @param mysql MYSQL to request uuid from source.
86 @param mi Master_info to set master_uuid
87
88 @retval Please see SourceQuorumStatus.
89 */
91 Master_info *mi);
92
93 private:
94 /**
95 Sets source network configuration details <host, port, network_namespace>
96 for the provided Master_info object. The function is used by async conn
97 failure to set configuration details of new source.
98
99 @param[in] mi the channel of the failed connection which
100 needs to be reconnected to the new source.
101 @param[in] host the source hostname to be set for Master_info object
102 @param[in] port the source port to be set for Master_info object
103 @param[in] network_namespace the source network_namespace to be set for
104 Master_info object
105
106 @retval true Error
107 @retval false Success
108 */
109 static bool set_channel_conn_details(Master_info *mi, const std::string host,
110 const uint port,
111 const std::string network_namespace);
112};
113#endif /* RPL_ASYNC_CONN_FAILOVER_H */
Definition: rpl_async_conn_failover.h:33
Async_conn_failover_manager(Async_conn_failover_manager &&)=delete
static DoAutoConnFailoverError do_auto_conn_failover(Master_info *mi, bool force_highest_weight)
Re-establishes connection to next available source.
Definition: rpl_async_conn_failover.cc:54
static bool set_channel_conn_details(Master_info *mi, const std::string host, const uint port, const std::string network_namespace)
Sets source network configuration details <host, port, network_namespace> for the provided Master_inf...
Definition: rpl_async_conn_failover.cc:202
static SourceQuorumStatus get_source_quorum_status(MYSQL *mysql, Master_info *mi)
Definition: rpl_async_conn_failover.cc:271
DoAutoConnFailoverError
Definition: rpl_async_conn_failover.h:35
Async_conn_failover_manager(const Async_conn_failover_manager &)=delete
Async_conn_failover_manager & operator=(Async_conn_failover_manager &&)=delete
Async_conn_failover_manager & operator=(const Async_conn_failover_manager &)=delete
SourceQuorumStatus
Definition: rpl_async_conn_failover.h:46
Definition: rpl_mi.h:86
const char * host
Definition: mysqladmin.cc:63
Definition: instrumented_condition_variable.h:29
required string network_namespace
Definition: replication_asynchronous_connection_failover.proto:33
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:32
Definition: mysql.h:299