MySQL 8.3.0
Source Code Documentation
metadata_cache_gr.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019, 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
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 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
25#ifndef METADATA_CACHE_METADATA_CACHE_GR_INCLUDED
26#define METADATA_CACHE_METADATA_CACHE_GR_INCLUDED
27
29
30#include "metadata_cache.h"
31
33 public:
34 /**
35 * Initialize a connection to the MySQL Metadata server.
36 *
37 * @param router_id id of the router in the cluster metadata
38 * @param clusterset_id UUID of the ClusterSet the Cluster belongs to (if
39 * bootstrapped as a ClusterSet, empty otherwise)
40 * @param metadata_servers The servers that store the metadata
41 * @param cluster_metadata metadata of the cluster
42 * @param ttl_config metadata TTL configuration
43 * @param ssl_options SSL related options for connection
44 * @param target_cluster object identifying the Cluster this operation refers
45 * to
46 * @param router_attributes Router attributes to be registered in the metadata
47 * @param thread_stack_size The maximum memory allocated for thread's stack
48 * @param use_gr_notifications Flag indicating if the metadata cache should
49 * use GR notifications as an additional trigger
50 * for metadata refresh
51 */
53 const unsigned router_id, const std::string &clusterset_id,
54 const std::vector<mysql_harness::TCPAddress> &metadata_servers,
55 std::shared_ptr<MetaData> cluster_metadata,
57 const mysqlrouter::SSLOptions &ssl_options,
58 const mysqlrouter::TargetCluster &target_cluster,
59 const metadata_cache::RouterAttributes &router_attributes,
60 size_t thread_stack_size = mysql_harness::kDefaultStackSizeInKiloBytes,
61 bool use_gr_notifications = false)
62 : MetadataCache(router_id, clusterset_id, metadata_servers,
63 cluster_metadata, ttl_config, ssl_options, target_cluster,
64 router_attributes, thread_stack_size,
65 use_gr_notifications) {}
66
67 bool refresh(bool needs_writable_node) override;
68
69 mysqlrouter::ClusterType cluster_type() const noexcept override {
70 return meta_data_->get_cluster_type();
71 }
72
73 private:
74 void log_cluster_details() const;
75};
76
77#endif // METADATA_CACHE_METADATA_CACHE_GR_INCLUDED
Definition: metadata_cache_gr.h:32
mysqlrouter::ClusterType cluster_type() const noexcept override
Definition: metadata_cache_gr.h:69
GRMetadataCache(const unsigned router_id, const std::string &clusterset_id, const std::vector< mysql_harness::TCPAddress > &metadata_servers, std::shared_ptr< MetaData > cluster_metadata, const metadata_cache::MetadataCacheTTLConfig &ttl_config, const mysqlrouter::SSLOptions &ssl_options, const mysqlrouter::TargetCluster &target_cluster, const metadata_cache::RouterAttributes &router_attributes, size_t thread_stack_size=mysql_harness::kDefaultStackSizeInKiloBytes, bool use_gr_notifications=false)
Initialize a connection to the MySQL Metadata server.
Definition: metadata_cache_gr.h:52
The MetadataCache manages cached information fetched from the MySQL Server.
Definition: metadata_cache.h:57
virtual bool refresh(bool needs_writable_node)=0
Refreshes the cache.
Definition: cluster_metadata.h:161
#define METADATA_CACHE_EXPORT
Definition: metadata_cache_export.h:15
static const size_t kDefaultStackSizeInKiloBytes
Definition: mysql_router_thread.h:43
ClusterType
Definition: cluster_metadata.h:141
Metadata TTL configuration.
Definition: metadata_cache.h:213
Definition: metadata_cache_datatypes.h:238
SSL connection related options.
Definition: datatypes.h:38