Fix low disk space maintenance

The setting didn't work because the code updated a status flag which
would be overwritten before being read. Also, promotion code now checks
that the server is not in maintenance.
This commit is contained in:
Esa Korhonen
2018-10-12 15:50:23 +03:00
parent 0c203fa02d
commit 2d61b78439
4 changed files with 28 additions and 24 deletions

View File

@ -1121,9 +1121,8 @@ bool MariaDBServer::can_be_demoted_failover(string* reason_out)
return demotable;
}
bool MariaDBServer::can_be_promoted(OperationType op,
const MariaDBServer* demotion_target,
std::string* reason_out)
bool MariaDBServer::can_be_promoted(OperationType op, const MariaDBServer* demotion_target,
string* reason_out)
{
bool promotable = false;
string reason;
@ -1134,6 +1133,10 @@ bool MariaDBServer::can_be_promoted(OperationType op,
{
reason = "it is already the master.";
}
else if (!is_usable())
{
reason = "it is down or in maintenance.";
}
else if (sstatus == NULL)
{
reason = string_printf("it is not replicating from '%s'.", demotion_target->name());