diff --git a/dbutils.c b/dbutils.c index 252dd2c1..a7c6f172 100644 --- a/dbutils.c +++ b/dbutils.c @@ -2000,6 +2000,41 @@ promote_standby(PGconn *conn, bool wait, int wait_seconds) } +bool +resume_wal_replay(PGconn *conn) +{ + PGresult *res = NULL; + PQExpBufferData query; + bool success = true; + + initPQExpBuffer(&query); + + if (PQserverVersion(conn) >= 100000) + { + appendPQExpBufferStr(&query, + "SELECT pg_catalog.pg_wal_replay_resume()"); + } + else + { + appendPQExpBufferStr(&query, + "SELECT pg_catalog.pg_xlog_replay_resume()"); + } + + res = PQexec(conn, query.data); + + if (PQresultStatus(res) != PGRES_TUPLES_OK) + { + log_db_error(conn, query.data, _("resume_wal_replay(): unable to resume WAL replay")); + success = false; + } + + termPQExpBuffer(&query); + PQclear(res); + + return success; +} + + /* ===================== */ /* Node record functions */ /* ===================== */ diff --git a/dbutils.h b/dbutils.h index c95674ec..ef94b84c 100644 --- a/dbutils.h +++ b/dbutils.h @@ -440,6 +440,7 @@ ExtensionStatus get_repmgr_extension_status(PGconn *conn, t_extension_versions * void checkpoint(PGconn *conn); bool vacuum_table(PGconn *conn, const char *table); bool promote_standby(PGconn *conn, bool wait, int wait_seconds); +bool resume_wal_replay(PGconn *conn); /* node record functions */ t_server_type parse_node_type(const char *type);