From 970d7a136f218fb9119f533257f9424d806a7764 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 30 Oct 2020 14:25:11 +0900 Subject: [PATCH] Fix return value of pg_reload_conf() database utility function Would always return "false", but as the value wasn't used anywhere, the issue was inconsequential. However while we're at it, actually check the return value in the two places it's called, to help diagnose any issues in the unlikely event they occur. Per issue reported via GitHub PR #671 from user duzhgg. --- dbutils.c | 2 +- sysutils.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dbutils.c b/dbutils.c index 1d55a0c9..1e7315f4 100644 --- a/dbutils.c +++ b/dbutils.c @@ -1255,7 +1255,7 @@ bool pg_reload_conf(PGconn *conn) { PGresult *res = NULL; - bool success = false; + bool success = true; res = PQexec(conn, "SELECT pg_catalog.pg_reload_conf()"); diff --git a/sysutils.c b/sysutils.c index 2f2c99ee..9ba78ebc 100644 --- a/sysutils.c +++ b/sysutils.c @@ -289,10 +289,19 @@ disable_wal_receiver(PGconn *conn) if (wal_retrieve_retry_interval < WALRECEIVER_DISABLE_TIMEOUT_VALUE) { + bool success; + log_notice(_("setting \"wal_retrieve_retry_interval\" to %i milliseconds"), new_wal_retrieve_retry_interval); alter_system_int(conn, "wal_retrieve_retry_interval", new_wal_retrieve_retry_interval); - pg_reload_conf(conn); + + success = pg_reload_conf(conn); + + if (success == false) + { + log_warning(_("unable to reload configuration")); + return UNKNOWN_PID; + } } /* @@ -394,7 +403,13 @@ enable_wal_receiver(PGconn *conn, bool wait_startup) return UNKNOWN_PID; } - pg_reload_conf(conn); + success = pg_reload_conf(conn); + + if (success == false) + { + log_warning(_("unable to reload configuration")); + return UNKNOWN_PID; + } } else {