I have some Postgresql 10 instances running on Windows Server that are in continuous recovery mode. Once in a while they just stop recovering without giving any errors, like in this example log file (in CSV format, i've removed some of the fields for clarity):
2022年08月23日 19:42:02.391,"restored log file ""000000010000029F0000001A"" from archive"
2022年08月23日 19:42:07.638,"restored log file ""000000010000029F0000001B"" from archive"
2022年08月23日 19:42:13.276,"restored log file ""000000010000029F0000001C"" from archive"
2022年08月23日 19:42:18.464,"restored log file ""000000010000029F0000001D"" from archive"
2022年08月23日 19:42:18.699,"redo done at 29F/1CFFF7F8"
2022年08月23日 19:42:18.708,"last completed transaction was at log time 2022年07月20日 12:49:38.247406-03"
2022年08月23日 19:42:24.304,"restored log file ""000000010000029F0000001C"" from archive"
2022年08月23日 19:42:48.625,"selected new timeline ID: 2"
2022年08月23日 19:43:13.718,"archive recovery complete"
2022年08月23日 19:43:27.746,"database system is ready to accept connections"
This happens even thou the next wal file to be restored in the sequence (000000010000029F0000001D, 000000010000029F0000001E) is present in the archive directory. The restore command I'm using is something like this:
restore_command = '"C:/program files/postgresql/10/bin/pg_standby.exe" -s 2 D:/archive/127 %f %p %r 2>>D:/archive/127/pg_standby.log'
My question is, are there any way I can find out what caused the instance stop recovering?
1 Answer 1
If recovery stops and the server promotes without you explicitly telling it to do so, you are probably in archive recovery mode rather than in standby mode.
Since PostgreSQL v12, you activate standby mode by creating a file standby.signal
rather than recovery.signal
in the PostgreSQL data directory.
Before PostgreSQL v12, you have to set standby_mode = on
in recovery.conf
to achieve the same thing.
Explore related questions
See similar questions with these tags.
standby_mode = on
.