mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
Only attempt to set synchronous transaction mode with valid connection
This commit is contained in:
36
dbutils.c
36
dbutils.c
@@ -90,9 +90,8 @@ _establish_db_connection(const char *conninfo, const bool exit_on_error, const b
|
|||||||
* set "synchronous_commit" to "local" in case synchronous replication is in use
|
* set "synchronous_commit" to "local" in case synchronous replication is in use
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (set_config(conn, "synchronous_commit", "local") == false)
|
else if (set_config(conn, "synchronous_commit", "local") == false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (exit_on_error)
|
if (exit_on_error)
|
||||||
{
|
{
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
@@ -157,25 +156,26 @@ establish_db_connection_by_params(const char *keywords[], const char *values[],
|
|||||||
exit(ERR_DB_CON);
|
exit(ERR_DB_CON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
|
||||||
/*
|
|
||||||
* set "synchronous_commit" to "local" in case synchronous replication is in
|
|
||||||
* use (provided this is not a replication connection)
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = 0; keywords[i]; i++)
|
|
||||||
{
|
{
|
||||||
if (strcmp(keywords[i], "replication") == 0)
|
/*
|
||||||
replication_connection = true;
|
* set "synchronous_commit" to "local" in case synchronous replication is in
|
||||||
}
|
* use (provided this is not a replication connection)
|
||||||
|
*/
|
||||||
|
|
||||||
if (replication_connection == false && set_config(conn, "synchronous_commit", "local") == false)
|
for (i = 0; keywords[i]; i++)
|
||||||
{
|
|
||||||
if (exit_on_error)
|
|
||||||
{
|
{
|
||||||
PQfinish(conn);
|
if (strcmp(keywords[i], "replication") == 0)
|
||||||
exit(ERR_DB_CON);
|
replication_connection = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replication_connection == false && set_config(conn, "synchronous_commit", "local") == false)
|
||||||
|
{
|
||||||
|
if (exit_on_error)
|
||||||
|
{
|
||||||
|
PQfinish(conn);
|
||||||
|
exit(ERR_DB_CON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user