Add function resume_wal_replay()

This commit is contained in:
Ian Barwick
2019-02-07 11:32:44 +09:00
parent b89941f218
commit c7b325e2a4
2 changed files with 36 additions and 0 deletions

View File

@@ -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 */ /* Node record functions */
/* ===================== */ /* ===================== */

View File

@@ -440,6 +440,7 @@ ExtensionStatus get_repmgr_extension_status(PGconn *conn, t_extension_versions *
void checkpoint(PGconn *conn); void checkpoint(PGconn *conn);
bool vacuum_table(PGconn *conn, const char *table); bool vacuum_table(PGconn *conn, const char *table);
bool promote_standby(PGconn *conn, bool wait, int wait_seconds); bool promote_standby(PGconn *conn, bool wait, int wait_seconds);
bool resume_wal_replay(PGconn *conn);
/* node record functions */ /* node record functions */
t_server_type parse_node_type(const char *type); t_server_type parse_node_type(const char *type);