WAITLSN — wait for the target LSN to be replayed
LSN' [ INFINITELY ] WAITLSN '
WAITLSN provides a simple interprocess communication mechanism to wait for the target log sequence number (LSN) on standby in Postgres Pro databases with master-standby asynchronous replication. When run with the
LSN option, the
WAITLSN command waits for the specified LSN to be replayed. By default, wait time is unlimited. Waiting can be interrupted using
Ctrl+C, or by shutting down the
postgres server. You can also limit the wait time using the
TIMEOUT option, or check the target LSN status immediately using the
Specify the target log sequence number to wait for.
Wait until the target LSN is replayed on standby. This is an optional parameter reinforcing the default behavior.
Limit the time to wait for the LSN to be replayed. The specified
wait_timemust be an integer and is measured in milliseconds.
Report whether the target LSN has been replayed already, without any waiting.
WAITLSN from psql, limiting wait time to 10000 milliseconds:
WAITLSN '0/3F07A6B1' TIMEOUT 10000; NOTICE: LSN is not reached. Try to increase wait time. LSN reached ------------- f (1 row)
Wait until the specified LSN is replayed:
WAITLSN '0/3F07A611'; LSN reached ------------- t (1 row)
Limit LSN wait time to 500000 milliseconds, and then cancel the command:
WAITLSN '0/3F0FF791' TIMEOUT 500000; ^CCancel request sent NOTICE: LSN is not reached. Try to increase wait time. ERROR: canceling statement due to user request LSN reached ------------- f (1 row)
There is no
WAITLSN statement in the SQL standard.