Merge branch '2.3' into develop
This commit is contained in:
@ -571,7 +571,7 @@ uint32_t MariaDBMonitor::do_rejoin(const ServerArray& joinable_servers, json_t**
|
|||||||
// Assume that server is an old master which was failed over. Even if this is not really
|
// Assume that server is an old master which was failed over. Even if this is not really
|
||||||
// the case, the following is unlikely to do damage.
|
// the case, the following is unlikely to do damage.
|
||||||
ServerOperation demotion(joinable, true);
|
ServerOperation demotion(joinable, true);
|
||||||
if (joinable->demote(general, demotion))
|
if (joinable->demote(general, demotion, OperationType::REJOIN))
|
||||||
{
|
{
|
||||||
MXS_NOTICE("Directing standalone server '%s' to replicate from '%s'.", name, master_name);
|
MXS_NOTICE("Directing standalone server '%s' to replicate from '%s'.", name, master_name);
|
||||||
// A slave connection description is required. As this is the only connection, no name
|
// A slave connection description is required. As this is the only connection, no name
|
||||||
@ -772,7 +772,7 @@ bool MariaDBMonitor::switchover_perform(SwitchoverParams& op)
|
|||||||
|
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
// Step 1: Set read-only to on, flush logs, update gtid:s.
|
// Step 1: Set read-only to on, flush logs, update gtid:s.
|
||||||
if (demotion_target->demote(op.general, op.demotion))
|
if (demotion_target->demote(op.general, op.demotion, OperationType::SWITCHOVER))
|
||||||
{
|
{
|
||||||
m_cluster_modified = true;
|
m_cluster_modified = true;
|
||||||
bool catchup_and_promote_success = false;
|
bool catchup_and_promote_success = false;
|
||||||
|
@ -1589,9 +1589,10 @@ bool MariaDBServer::promote(GeneralOpData& general, ServerOperation& promotion,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion)
|
bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion, OperationType type)
|
||||||
{
|
{
|
||||||
mxb_assert(demotion.target == this);
|
mxb_assert(demotion.target == this);
|
||||||
|
mxb_assert(type == OperationType::SWITCHOVER || type == OperationType::REJOIN);
|
||||||
json_t** const error_out = general.error_out;
|
json_t** const error_out = general.error_out;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
@ -1620,7 +1621,7 @@ bool MariaDBServer::demote(GeneralOpData& general, ServerOperation& demotion)
|
|||||||
// read_only doesn't stop them from doing writes. This does not stop them from immediately
|
// read_only doesn't stop them from doing writes. This does not stop them from immediately
|
||||||
// logging back in but it's better than nothing. This also stops super-user writes going
|
// logging back in but it's better than nothing. This also stops super-user writes going
|
||||||
// through MaxScale.
|
// through MaxScale.
|
||||||
if (!kick_out_super_users(general))
|
if (type == OperationType::SWITCHOVER && !kick_out_super_users(general))
|
||||||
{
|
{
|
||||||
demotion_error = true;
|
demotion_error = true;
|
||||||
}
|
}
|
||||||
|
@ -384,10 +384,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Demote this server. Removes all slave connections. If server was master, sets read_only.
|
* Demote this server. Removes all slave connections. If server was master, sets read_only.
|
||||||
*
|
*
|
||||||
* @param op Cluster operation descriptor
|
* @param general General operation data
|
||||||
|
* @param demotion Demotion-specific settings
|
||||||
|
* @param type Which specific operation is this part of
|
||||||
* @return True if successful
|
* @return True if successful
|
||||||
*/
|
*/
|
||||||
bool demote(GeneralOpData& general, ServerOperation& op);
|
bool demote(GeneralOpData& general, ServerOperation& demotion, OperationType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect the slave connection going to old master to replicate from new master.
|
* Redirect the slave connection going to old master to replicate from new master.
|
||||||
|
@ -223,6 +223,7 @@ enum class OperationType
|
|||||||
{
|
{
|
||||||
SWITCHOVER,
|
SWITCHOVER,
|
||||||
FAILOVER,
|
FAILOVER,
|
||||||
|
REJOIN,
|
||||||
UNDO_DEMOTION // Performed when switchover fails in its first stages.
|
UNDO_DEMOTION // Performed when switchover fails in its first stages.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user