mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Let the clone happen in a session with synchronous_commit off. This
is because in pg 9.1 the default configuration can easily allow sync rep to be activated even if no standby is present and will block pg_start_backup() and pg_stop_backup() in that case. Also remove a second connection we were opening to execute pg_stop_backup(), i'm not sure why that was there but now it was a problem because it was another session and not the one we set here.
This commit is contained in:
17
repmgr.c
17
repmgr.c
@@ -890,6 +890,20 @@ do_standby_clone(void)
|
|||||||
}
|
}
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* in pg 9.1 default is to wait for a sync standby to ack,
|
||||||
|
* avoid that by turning off sync rep for this session
|
||||||
|
*/
|
||||||
|
sqlquery_snprintf(sqlquery, "SET synchronous_commit TO OFF)");
|
||||||
|
res = PQexec(conn, sqlquery);
|
||||||
|
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
|
{
|
||||||
|
log_err("Can't set synchronous_commit: %s\n", PQerrorMessage(conn));
|
||||||
|
PQclear(res);
|
||||||
|
PQfinish(conn);
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* inform the master we will start a backup and get the first XLog filename
|
* inform the master we will start a backup and get the first XLog filename
|
||||||
* so we can say to the user we need those files
|
* so we can say to the user we need those files
|
||||||
@@ -1026,9 +1040,6 @@ stop_backup:
|
|||||||
* Don't have this one exit if it fails, so that a more informative
|
* Don't have this one exit if it fails, so that a more informative
|
||||||
* error message will also appear about the backup not being stopped.
|
* error message will also appear about the backup not being stopped.
|
||||||
*/
|
*/
|
||||||
log_info(_("%s connecting to master database to stop backup\n"), progname);
|
|
||||||
conn=establishDBConnectionByParams(keywords,values,false);
|
|
||||||
|
|
||||||
log_notice("Finishing backup...\n");
|
log_notice("Finishing backup...\n");
|
||||||
sqlquery_snprintf(sqlquery, "SELECT pg_xlogfile_name(pg_stop_backup())");
|
sqlquery_snprintf(sqlquery, "SELECT pg_xlogfile_name(pg_stop_backup())");
|
||||||
log_debug("standby clone: %s\n", sqlquery);
|
log_debug("standby clone: %s\n", sqlquery);
|
||||||
|
|||||||
Reference in New Issue
Block a user