mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Check that there is no exclusive backup taking place while we perform
a switchover. We've found that this can cause some issues with postgres control metadata (could be a postgres bug) so best thing is *not* no switchover if there's a backup taking place. It's also a bad idea from an architectual point of view, as a switchover is supposed to be planed, so why perform it when we are taking backups. GitHub #476.
This commit is contained in:
committed by
Ian Barwick
parent
ef35d071bf
commit
8f13a66aaa
24
dbutils.c
24
dbutils.c
@@ -3953,7 +3953,31 @@ connection_ping(PGconn *conn)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function that checks if the primary is in exclusive backup mode.
|
||||
* We'll use this when executing an action can conflict with an exclusive
|
||||
* backup.
|
||||
*/
|
||||
bool
|
||||
server_not_in_exclusive_backup_mode(PGconn *conn)
|
||||
{
|
||||
PGresult *res = PQexec(conn, "SELECT pg_is_in_backup()");
|
||||
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
log_error(_("unable to retrieve information regarding backup mode of node"));
|
||||
log_detail("%s", PQerrorMessage(conn));
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(PQgetvalue(res, 0, 0), "t") == 0)
|
||||
{
|
||||
log_warning(_("node is in exclusive backup mode"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ==================== */
|
||||
/* monitoring functions */
|
||||
|
||||
Reference in New Issue
Block a user