MySQL 9.1.0
Source Code Documentation
|
#include "config_generator.h"
#include <sys/stat.h>
#include <algorithm>
#include <array>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stdexcept>
#include <system_error>
#include <rapidjson/rapidjson.h>
#include "certificate_handler.h"
#include "common.h"
#include "config_builder.h"
#include "dim.h"
#include "harness_assert.h"
#include "hostname_validator.h"
#include "keyring/keyring_manager.h"
#include "mysql/harness/config_option.h"
#include "mysql/harness/config_parser.h"
#include "mysql/harness/dynamic_config.h"
#include "mysql/harness/dynamic_state.h"
#include "mysql/harness/loader.h"
#include "mysql/harness/logging/logging.h"
#include "mysql/harness/logging/registry.h"
#include "mysql/harness/logging/supported_logger_options.h"
#include "mysql/harness/stdx/expected.h"
#include "mysql/harness/supported_config_options.h"
#include "mysql/harness/utility/string.h"
#include "mysql/harness/vt100.h"
#include "mysqld_error.h"
#include "mysqlrouter/cluster_metadata.h"
#include "mysqlrouter/connection_pool.h"
#include "mysqlrouter/default_paths.h"
#include "mysqlrouter/http_constants.h"
#include "mysqlrouter/routing.h"
#include "mysqlrouter/supported_connection_pool_options.h"
#include "mysqlrouter/supported_http_options.h"
#include "mysqlrouter/supported_metadata_cache_options.h"
#include "mysqlrouter/supported_rest_options.h"
#include "mysqlrouter/supported_router_options.h"
#include "mysqlrouter/supported_routing_options.h"
#include "mysqlrouter/uri.h"
#include "mysqlrouter/utils.h"
#include "mysqlrouter/utils_sqlstring.h"
#include "random_generator.h"
#include "router_app.h"
#include "router_config.h"
#include "scope_guard.h"
#include "sha1.h"
#include "cluster_metadata.h"
#include "mysqlrouter/cluster_metadata_dynamic_state.h"
Classes | |
struct | anonymous_namespace{config_generator.cc}::password_too_weak |
struct | anonymous_namespace{config_generator.cc}::account_exists |
class | ClusterAwareDecorator |
Cluster (GR or AR)-aware decorator for MySQL Sessions. More... | |
class | anonymous_namespace{config_generator.cc}::ChangeRouterAccountPlugin |
class | anonymous_namespace{config_generator.cc}::ConfigSectionPrinter |
Namespaces | |
namespace | anonymous_namespace{config_generator.cc} |
Macros | |
#define | MYSQL_ROUTER_LOG_DOMAIN ::mysql_harness::logging::kMainLogger |
#define | ADD_CONFIG_LINE_CHECKED(section, option, value, supported_options) |
#define | ADD_CONFIG_LINE_CHECKED_WITH_EMPTY(section, option, value, supported_options) |
Enumerations | |
enum class | MySQLErrorc { kSyntaxError = ER_PARSE_ERROR , kSuperReadOnly = ER_OPTION_PREVENTS_STATEMENT , kLostConnection = CR_SERVER_LOST } |
Error codes for MySQL Errors that we handle specifically. More... | |
Functions | |
static bool | is_valid_name (const std::string &name) |
std::string | get_opt (const std::map< std::string, std::string > &map, const std::string &key, const std::string &default_value) |
static stdx::expected< std::ofstream, std::error_code > | open_ofstream (const std::string &file_name) |
unsigned | anonymous_namespace{config_generator.cc}::get_password_retries (const std::map< std::string, std::string > &user_options) |
std::string | anonymous_namespace{config_generator.cc}::str (const mysqlrouter::ConfigGenerator::Options::Endpoint &ep) |
bool | anonymous_namespace{config_generator.cc}::is_valid_conf_ident (const std::string &name) |
std::map< std::string, std::string > | anonymous_namespace{config_generator.cc}::get_config_cmdln_options (const std::map< std::string, std::vector< std::string > > &multivalue_options) |
static std::string | generate_username (uint32_t router_id, mysql_harness::RandomGeneratorInterface &rg) |
static std::string | get_target_cluster_value (const std::string &target_cluster_option, const std::string &target_cluster_by_name_option, const ClusterInfo &cluster_info) |
void | anonymous_namespace{config_generator.cc}::add_endpoint_option (ConfigSectionPrinter &routing_section, const ConfigGenerator::Options &options, const ConfigGenerator::Options::Endpoint &ep) |
void | anonymous_namespace{config_generator.cc}::add_metadata_cache_routing_section (std::ostream &config_file, const routing::RoutingBootstrapSectionType section_type, const ConfigGenerator::Options::Endpoint endpoint, const ConfigGenerator::Options &options, const std::string &cluster_name, const std::map< std::string, std::string > &config_cmdln_options) |
static void | anonymous_namespace{config_generator.cc}::add_http_auth_backend_section (std::ostream &config_file, const mysql_harness::Path &datadir, const std::string_view auth_backend_name, const mysqlrouter::MetadataSchemaVersion schema_version, const std::map< std::string, std::string > &config_cmdln_options) |
Add proper authentication backend section to the config based on the metadata version. More... | |
void | anonymous_namespace{config_generator.cc}::add_rest_section (std::ostream &config_file, const ConfigGenerator::Options &options, const std::map< std::string, std::string > &default_paths, const std::map< std::string, std::string > &config_cmdln_options, const std::string &ssl_cert, const std::string &ssl_key, const mysqlrouter::MetadataSchemaVersion &schema_version) |
static void | save_initial_dynamic_state (std::ostream &state_stream, ClusterMetadata &cluster_metadata, const std::string &cluster_type_specific_id, const std::vector< std::string > &metadata_server_addresses) |
uint16_t | get_x_protocol_port (const mysql_harness::Config &conf, const std::string &role) |
std::string | anonymous_namespace{config_generator.cc}::get_cluster_type_specific_uuid (const mysql_harness::Config &conf, mysqlrouter::ClusterType cluster_type) |
static bool | files_equal (const std::string &f1, const std::string &f2) |
Variables | |
static const int | kDefaultRWPort = 6446 |
static const int | kDefaultROPort = 6447 |
static const int | kDefaultRWSplitPort = 6450 |
static const char * | kRWSocketName = "mysql.sock" |
static const char * | kROSocketName = "mysqlro.sock" |
static const char * | kRWSplitSocketName = "mysqlsplit.sock" |
static const int | kLegacyDefaultRWXPort = 64460 |
static const int | kLegacyDefaultROXPort = 64470 |
static const int | kBasePortDefault = -1 |
static const int | kBasePortLegacyDefault = 0 |
static const char * | kRWXSocketName = "mysqlx.sock" |
static const char * | kROXSocketName = "mysqlxro.sock" |
static const int | kMaxTCPPortNumber = 65535 |
static const int | kAllocatedTCPPortCount = 4 |
static const int | kMetadataServerPasswordLength = 16 |
static const int | kMaxRouterNameLength |
static const char * | kKeyringAttributePassword = "password" |
static const std::chrono::milliseconds | kDefaultAuthCacheTTL |
static const std::chrono::milliseconds | kDefaultAuthCacheRefreshInterval |
static constexpr unsigned | kNumRandomChars = 7 |
static constexpr unsigned | kDefaultPasswordRetries |
static constexpr unsigned | kMaxPasswordRetries = 10000 |
static const std::string | kDefaultMetadataCacheSectionKey = "bootstrap" |
const char | kAppArmorMsg [] |
#define ADD_CONFIG_LINE_CHECKED | ( | section, | |
option, | |||
value, | |||
supported_options | |||
) |
#define ADD_CONFIG_LINE_CHECKED_WITH_EMPTY | ( | section, | |
option, | |||
value, | |||
supported_options | |||
) |
#define MYSQL_ROUTER_LOG_DOMAIN ::mysql_harness::logging::kMainLogger |
|
strong |
|
static |
|
static |
|
inline |
|
static |
uint16_t get_x_protocol_port | ( | const mysql_harness::Config & | conf, |
const std::string & | role | ||
) |
|
static |
|
static |
|
static |
|
static |
const char kAppArmorMsg[] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
staticconstexpr |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
staticconstexpr |
|
static |
|
static |
|
static |
|
staticconstexpr |
|
static |
|
static |
|
static |
|
static |
|
static |