MXS-2011 Fix terminology and names
The variable storing the configuration index renamed from 'current_config' to 'config_index'. In the code the same terminology is used as in the documentation. "Default" is is used for referring to the default connections (earlier "primary" was used) and the secondary connections are referred to as "secondary" (earlier "alternative" was also used).
This commit is contained in:
parent
b835befe0f
commit
f5b73cf106
@ -817,7 +817,7 @@ static MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params
|
||||
* automatic master replication start phase
|
||||
*/
|
||||
|
||||
inst->current_config = 0;
|
||||
inst->config_index = 0;
|
||||
rc = blr_file_read_master_config(inst);
|
||||
|
||||
/*
|
||||
|
@ -838,7 +838,7 @@ struct ROUTER_INSTANCE: public MXS_ROUTER
|
||||
char *set_slave_hostname; /*< Send custom Hostname to Master */
|
||||
ROUTER_INSTANCE *next;
|
||||
std::vector<ChangeMasterConfig> configs;/*< Available configs. */
|
||||
int current_config; /*< The config currently being used. */
|
||||
int config_index; /*< The index of the config currently being used. */
|
||||
};
|
||||
|
||||
/** Master Semi-Sync capability */
|
||||
|
@ -3430,9 +3430,9 @@ blr_file_write_master_config(ROUTER_INSTANCE *router, char *error)
|
||||
// Assert that the configurarion as dispersed around blr and
|
||||
// as stored in the configuration item are identical.
|
||||
mxb_assert(router->configs.size() > 0);
|
||||
mxb_assert(router->current_config < static_cast<int>(router->configs.size()));
|
||||
mxb_assert(router->config_index < static_cast<int>(router->configs.size()));
|
||||
#ifdef SS_DEBUG
|
||||
const ChangeMasterConfig& current = router->configs[router->current_config];
|
||||
const ChangeMasterConfig& current = router->configs[router->config_index];
|
||||
|
||||
mxb_assert(current.host == router->service->dbref->server->address);
|
||||
mxb_assert(current.port == router->service->dbref->server->port);
|
||||
@ -3453,19 +3453,19 @@ blr_file_write_master_config(ROUTER_INSTANCE *router, char *error)
|
||||
mxb_assert(current.connect_retry == router->retry_interval);
|
||||
#endif
|
||||
|
||||
ChangeMasterConfig primary = router->configs[0]; // Copied, so that it can be modified.
|
||||
ChangeMasterConfig default_config = router->configs[0]; // Copied, so that it can be modified.
|
||||
|
||||
// If not SSL enabled, store old SSL config if there is one.
|
||||
// TODO: Why?
|
||||
if (!router->ssl_enabled)
|
||||
{
|
||||
primary.ssl_ca = router->ssl_ca ? router->ssl_ca : "";
|
||||
primary.ssl_cert = router->ssl_cert ? router->ssl_cert : "";
|
||||
primary.ssl_key = router->ssl_key ? router->ssl_key : "";
|
||||
default_config.ssl_ca = router->ssl_ca ? router->ssl_ca : "";
|
||||
default_config.ssl_cert = router->ssl_cert ? router->ssl_cert : "";
|
||||
default_config.ssl_key = router->ssl_key ? router->ssl_key : "";
|
||||
}
|
||||
|
||||
// Store the primary config.
|
||||
write_master_config(config_file, primary);
|
||||
// Store the default config.
|
||||
write_master_config(config_file, default_config);
|
||||
|
||||
/* write filestem only if binlog file is set */
|
||||
if (*router->binlog_name != 0)
|
||||
@ -3473,7 +3473,7 @@ blr_file_write_master_config(ROUTER_INSTANCE *router, char *error)
|
||||
fprintf(config_file, "filestem=%s\n", router->fileroot);
|
||||
}
|
||||
|
||||
// Store all alternative configs.
|
||||
// Store all secondary configs.
|
||||
for (size_t i = 1; i < router->configs.size(); ++i)
|
||||
{
|
||||
write_master_config(config_file, router->configs[i]);
|
||||
|
@ -378,14 +378,14 @@ blr_restart_master(ROUTER_INSTANCE *router)
|
||||
router->master_state = BLRM_UNCONNECTED;
|
||||
router->retry_count++;
|
||||
|
||||
int current_config = (router->current_config + 1) % router->configs.size();
|
||||
if (current_config != router->current_config) // Will be different unless there is but one.
|
||||
int config_index = (router->config_index + 1) % router->configs.size();
|
||||
if (config_index != router->config_index) // Will be different unless there is but one.
|
||||
{
|
||||
mxb_assert(current_config < static_cast<int>(router->configs.size()));
|
||||
mxb_assert(config_index < static_cast<int>(router->configs.size()));
|
||||
|
||||
const ChangeMasterConfig& old_config = router->configs[router->current_config];
|
||||
router->current_config = current_config;
|
||||
const ChangeMasterConfig& new_config = router->configs[router->current_config];
|
||||
const ChangeMasterConfig& old_config = router->configs[router->config_index];
|
||||
router->config_index = config_index;
|
||||
const ChangeMasterConfig& new_config = router->configs[router->config_index];
|
||||
|
||||
blr_master_set_config(router, new_config);
|
||||
|
||||
@ -3112,7 +3112,7 @@ static int blr_check_connect_retry(ROUTER_INSTANCE *router)
|
||||
}
|
||||
|
||||
mxb_assert(router->configs.size() > 0);
|
||||
if (router->current_config < static_cast<int>(router->configs.size() - 1))
|
||||
if (router->config_index < static_cast<int>(router->configs.size() - 1))
|
||||
{
|
||||
// We have unused configs; no need to sleep anything at all. We will
|
||||
// sleep only when we have unsuccessfully cycled through all available
|
||||
|
@ -3936,7 +3936,7 @@ blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
spinlock_acquire(&router->lock);
|
||||
router->master_state = BLRM_UNCONNECTED;
|
||||
router->retry_count = 0;
|
||||
router->current_config = 0; // Always start from the primary configuration.
|
||||
router->config_index = 0; // Always start from the default configuration.
|
||||
spinlock_release(&router->lock);
|
||||
|
||||
/**
|
||||
@ -4276,7 +4276,7 @@ int validate_connection_name(ROUTER_INSTANCE* router, const std::string& name, c
|
||||
snprintf(custom_message,
|
||||
BINLOG_ERROR_MSG_LEN,
|
||||
"The provided connection name '%s' is not valid. Currently "
|
||||
"no primary connection exists and it must be specified using "
|
||||
"no default connection exists and it must be specified using "
|
||||
"a 'CHANGE MASTER TO ...' command without a connection name.",
|
||||
name.c_str());
|
||||
message = custom_message;
|
||||
@ -4286,8 +4286,8 @@ int validate_connection_name(ROUTER_INSTANCE* router, const std::string& name, c
|
||||
snprintf(custom_message,
|
||||
BINLOG_ERROR_MSG_LEN,
|
||||
"The provided connection name '%s' is not valid. Currently "
|
||||
"the primary connection and %d alternative connections have "
|
||||
"been specified and the next valid name for an alternative "
|
||||
"the default connection and %d secondary connections have "
|
||||
"been specified and the next valid name for an secondary "
|
||||
"connection is ':%d'.",
|
||||
name.c_str(),
|
||||
(int)router->configs.size() - 1,
|
||||
@ -4553,7 +4553,7 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
|
||||
else if (index != 0)
|
||||
{
|
||||
mxb_assert(index == static_cast<int>(router->configs.size()));
|
||||
// A new configuration, pick defaults from the primary configuration.
|
||||
// A new configuration, pick defaults from the default configuration.
|
||||
options.set_defaults(router->configs[0]);
|
||||
options.host.clear();
|
||||
}
|
||||
@ -4585,7 +4585,7 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
|
||||
|
||||
if ((index == 0) && !options.host.empty())
|
||||
{
|
||||
// If we are manipulating the primary configuration and a host is specified,
|
||||
// If we are manipulating the default configuration and a host is specified,
|
||||
// even if it would be the same, then we reset the setup.
|
||||
router->configs.clear();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user