Disallow switchover promotion of a server low on disk space

This protects the user and also prevents a neverending series of
automatic switchovers in the case when all servers are low.
This commit is contained in:
Esa Korhonen
2018-10-17 12:58:22 +03:00
parent 2c280e27f2
commit c5a54d2fe9

View File

@ -1137,6 +1137,11 @@ bool MariaDBServer::can_be_promoted(OperationType op, const MariaDBServer* demot
{
reason = "it is down or in maintenance.";
}
else if (op == OperationType::SWITCHOVER && is_low_on_disk_space())
{
// Failover promotion with low disk space is allowed since it's better than nothing.
reason = "it is low on disk space.";
}
else if (sstatus == NULL)
{
reason = string_printf("it is not replicating from '%s'.", demotion_target->name());