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