WAITLSN
WAITLSN — wait for the targetLSN to be replayed
Description
WAITLSN
provides a simple interprocess communication mechanism to wait for the target log sequence number (LSN) on standby inPostgres Pro databases with master-standby asynchronous replication. When run with theLSN
option, theWAITLSN
command waits for the specifiedLSN to be replayed. By default, wait time is unlimited. Waiting can be interrupted usingCtrl+C
, or by shutting down thepostgres
server. You can also limit the wait time using theTIMEOUT
option, or check the targetLSN status immediately using theNOWAIT
option.
Parameters
Examples
RunWAITLSN
frompsql, 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 specifiedLSN is replayed:
WAITLSN '0/3F07A611';LSN reached------------- t(1 row)
LimitLSN wait time to 500000 milliseconds, and then cancel the command:
WAITLSN '0/3F0FF791' TIMEOUT 500000;^CCancel request sentNOTICE: LSN is not reached. Try to increase wait time.ERROR: canceling statement due to user request LSN reached------------- f(1 row)