MXS-2011 Enforce gtid based replication
If secondary masters are defined, MASTER_USE_GTID=Slave_pos must be specified for the default master. If MASTER_USE_GTID is specified, only Slave_pos is allowed as value.
This commit is contained in:
@ -4540,6 +4540,21 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index != 0)
|
||||||
|
{
|
||||||
|
string use_gtid = router->configs[0].use_mariadb10_gtid;
|
||||||
|
|
||||||
|
if (use_gtid.empty() || (strcasecmp(use_gtid.c_str(), "slave_pos") != 0))
|
||||||
|
{
|
||||||
|
static const char MESSAGE[] =
|
||||||
|
"Secondary masters can only be used in conjunction with GTID based replication. "
|
||||||
|
"Specify MASTER_USE_GTID=Slave_pos for the default master connection.";
|
||||||
|
mxb_assert(sizeof(MESSAGE) <= BINLOG_ERROR_MSG_LEN);
|
||||||
|
strcpy(error, MESSAGE);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<char> cmd_string(command, command + strlen(command) + 1); // Include the NULL
|
std::vector<char> cmd_string(command, command + strlen(command) + 1); // Include the NULL
|
||||||
|
|
||||||
/* Parse SQL command and populate the change_master struct */
|
/* Parse SQL command and populate the change_master struct */
|
||||||
@ -4572,6 +4587,17 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string use_gtid = options.use_mariadb10_gtid;
|
||||||
|
|
||||||
|
if (!use_gtid.empty() && (strcasecmp(use_gtid.c_str(), "slave_pos") != 0))
|
||||||
|
{
|
||||||
|
static const char MESSAGE[] =
|
||||||
|
"Only MASTER_USE_GTID=Slave_pos is allowed.";
|
||||||
|
mxb_assert(sizeof(MESSAGE) <= BINLOG_ERROR_MSG_LEN);
|
||||||
|
strcpy(error, MESSAGE);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ChangeMasterConfig config;
|
ChangeMasterConfig config;
|
||||||
if (!options.validate(router, error, &config))
|
if (!options.validate(router, error, &config))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user