pg_get_wal_replay_pause_state()

A function returning the recovery pause state
This entry relates to a PostgreSQL feature which is part of PostgreSQL 14, due to be released in late 2021.

pg_get_wal_replay_pause_state() is a system function returning the recovery pause state.

pg_get_wal_replay_pause_state() was added in PostgreSQL 14.

Usage

pg_get_wal_replay_pause_state() → text

A call to pg_wal_replay_pause() may not immediately pause WAL replay. pg_get_wal_replay_pause_state() enables the current recovery pause state to be determined, and will return one of the following values:

  • not paused
  • paused requested
  • paused

Change history

Examples

Basic usage of pg_get_wal_replay_pause_state():

postgres=# SELECT pg_wal_replay_pause(); SELECT pg_get_wal_replay_pause_state();
 pg_wal_replay_pause
---------------------

(1 row)

 pg_get_wal_replay_pause_state
-------------------------------
 pause requested
(1 row)

postgres=# SELECT pg_get_wal_replay_pause_state();
 pg_get_wal_replay_pause_state
-------------------------------
 paused
(1 row)

Corresponding PostgreSQL logfile entries:

[2021-04-06 15:12:24 UTC] psql postgres postgres LOG:  00000: statement: SELECT pg_wal_replay_pause();
[2021-04-06 15:12:24 UTC] psql postgres postgres LOG:  00000: statement: SELECT pg_get_wal_replay_pause_state();
[2021-04-06 15:12:24 UTC]    LOG:  00000: recovery has paused
[2021-04-06 15:12:24 UTC]    HINT:  Execute pg_wal_replay_resume() to continue.
[2021-04-06 15:12:34 UTC] psql postgres postgres LOG:  00000: statement: SELECT pg_get_wal_replay_pause_state();

Categories

Replication, System function, WAL

See also

pg_is_wal_replay_paused(), pg_wal_replay_pause(), pg_wal_replay_resume()