MySQL 9.1.0
Source Code Documentation
|
The ARClusterMetadata
class encapsulates a connection to the ReplicaSet Cluster metadata server.
More...
#include <cluster_metadata_ar.h>
Public Member Functions | |
ARClusterMetadata (const metadata_cache::MetadataCacheMySQLSessionConfig &session_config, const mysqlrouter::SSLOptions &ssl_options, uint64_t view_id) | |
Constructor. More... | |
ARClusterMetadata (const ARClusterMetadata &)=delete | |
ARClusterMetadata & | operator= (const ARClusterMetadata &)=delete |
~ARClusterMetadata () override | |
Destructor. More... | |
stdx::expected< metadata_cache::ClusterTopology, std::error_code > | fetch_cluster_topology (const std::atomic< bool > &terminated, mysqlrouter::TargetCluster &target_cluster, const unsigned router_id, const metadata_cache::metadata_servers_list_t &metadata_servers, bool needs_writable_node, const std::string &, bool, std::size_t &instance_id) override |
Returns cluster defined in the metadata given set of the metadata servers (cluster members) More... | |
mysqlrouter::ClusterType | get_cluster_type () override |
Returns cluster type this object is suppsed to handle. More... | |
void | setup_notifications_listener (const metadata_cache::ClusterTopology &, const GRNotificationListener::NotificationClb &) override |
void | shutdown_notifications_listener () override |
Deinitializes the notifications listener thread. More... | |
Public Member Functions inherited from ClusterMetadata | |
ClusterMetadata (const metadata_cache::MetadataCacheMySQLSessionConfig &session_config, const mysqlrouter::SSLOptions &ssl_options) | |
Constructor. More... | |
ClusterMetadata (const ClusterMetadata &)=delete | |
ClusterMetadata & | operator= (const ClusterMetadata &)=delete |
~ClusterMetadata () override | |
Destructor. More... | |
bool | connect_and_setup_session (const metadata_cache::metadata_server_t &metadata_server) noexcept override |
Connects with the Metadata server and sets up the session parameters. More... | |
void | disconnect () noexcept override |
Disconnects from the Metadata server. More... | |
std::shared_ptr< mysqlrouter::MySQLSession > | get_connection () override |
Gets the object representing the session to the metadata server. More... | |
bool | update_router_attributes (const metadata_cache::metadata_server_t &rw_server, const unsigned router_id, const metadata_cache::RouterAttributes &router_attributes) override |
bool | update_router_last_check_in (const metadata_cache::metadata_server_t &rw_server, const unsigned router_id) override |
auth_credentials_t | fetch_auth_credentials (const metadata_cache::metadata_server_t &md_server, const mysqlrouter::TargetCluster &target_cluster) override |
std::optional< metadata_cache::metadata_server_t > | find_rw_server (const std::vector< metadata_cache::ManagedInstance > &instances) |
std::optional< metadata_cache::metadata_server_t > | find_rw_server (const std::vector< metadata_cache::ManagedCluster > &clusters) |
std::optional< std::chrono::seconds > | get_periodic_stats_update_frequency () noexcept override |
Public Member Functions inherited from MetaData | |
MetaData ()=default | |
MetaData (const MetaData &)=delete | |
MetaData & | operator= (const MetaData &)=delete |
virtual | ~MetaData ()=default |
Private Member Functions | |
metadata_cache::ClusterTopology | fetch_topology_from_member (mysqlrouter::MySQLSession &session, unsigned view_id, const std::string &cluster_id="") |
Returns the current cluster topology according to the metadata of the given metadata server. More... | |
bool | get_member_view_id (mysqlrouter::MySQLSession &session, const std::string &cluster_id, uint64_t &result) |
Returns metadata view id the given member holds. More... | |
Private Attributes | |
uint64_t | view_id_ |
Additional Inherited Members | |
Public Types inherited from MetaData | |
using | JsonAllocator = rapidjson::CrtAllocator |
using | JsonDocument = rapidjson::Document |
using | auth_credentials_t = std::map< std::string, std::pair< std::string, JsonDocument > > |
Protected Member Functions inherited from ClusterMetadata | |
bool | do_connect (mysqlrouter::MySQLSession &connection, const metadata_cache::metadata_server_t &mi) |
Connects a MYSQL connection to the given instance. More... | |
mysqlrouter::MetadataSchemaVersion | get_and_check_metadata_schema_version (mysqlrouter::MySQLSession &session) |
Protected Attributes inherited from ClusterMetadata | |
mysql_ssl_mode | ssl_mode_ |
mysqlrouter::SSLOptions | ssl_options_ |
metadata_cache::MetadataCacheMySQLSessionConfig | session_config_ |
std::shared_ptr< mysqlrouter::MySQLSession > | metadata_connection_ |
RouterOptions | router_options_ |
The ARClusterMetadata
class encapsulates a connection to the ReplicaSet Cluster metadata server.
|
inline |
Constructor.
session_config | Metadata MySQL session configuration |
ssl_options | SSL related options to use for MySQL connections |
view_id | last known view_id of the cluster metadata |
|
explicitdelete |
|
overridedefault |
Destructor.
Disconnect and release the connection to the metadata node.
|
overridevirtual |
Returns cluster defined in the metadata given set of the metadata servers (cluster members)
terminated | flag indicating that the process is cterminating, allowing the function to leave earlier if possible | |
[in,out] | target_cluster | object identifying the Cluster this operation refers to |
router_id | id of the router in the cluster metadata | |
metadata_servers | set of the metadata servers to use to fetch the metadata | |
needs_writable_node | flag indicating if the caller needs us to query for writable node | |
[out] | instance_id | id of the server the metadata was fetched from |
metadata_cache::metadata_error |
Implements MetaData.
|
private |
Returns the current cluster topology according to the metadata of the given metadata server.
session | active connection to the member that is checked for the metadata |
view_id | last known view_id of the cluster metadata |
cluster_id | ID of the cluster this operation refers to |
|
inlineoverridevirtual |
Returns cluster type this object is suppsed to handle.
Implements MetaData.
|
private |
Returns metadata view id the given member holds.
session | active connection to the member that is checked for the view id | |
cluster_id | ID of the cluster this operation refers to | |
[out] | result | member's metadata view_id |
true | on success |
false | otherwise. |
|
delete |
|
inlineoverridevirtual |
Implements MetaData.
|
inlineoverridevirtual |
Deinitializes the notifications listener thread.
Implements MetaData.
|
private |