The following bug has been logged on the website:
Bug reference: 17226
Logged by: Bo Chen
Email address: bchen90@163.com
PostgreSQL version: 11.8
Operating system: Suse linux 11.3 x86_64
Description:
Hi, all
Recently, I got a FATAL while restarts standby, which can be reproduced by
the following steps, based on pg 11:
1. create a database test
2. create another database test1 using test as template
3. drop database test
4. stop standby using 'pg_ctl stop -mi'
5. start standby, start failed
6. stop primary using 'pg_ctl stop -mi'
7. start primary, start OK
The starting log for standby failed is:
2021-10-13 15:57:43.294 CST startup 2420219 1/0 0 %LOG: 00000: redo starts
at 0/6000024 xlog.c (7043 StartupXLOG)
2021-10-13 15:57:43.297 CST startup 2420219 1/0 0 %FATAL: 58P01: could not
open directory "base/16385": No such file or directory fd.c (2714
ReadDirExtended)
2021-10-13 15:57:43.297 CST startup 2420219 1/0 0 %CONTEXT: WAL redo at
0/7001200 for Database/CREATE: copy dir 16385/1663 to 16386/1663
2021-10-13 15:57:43.298 CST postmaster 2420180 0 %LOG: 00000: startup
process (PID 2420219) exited with exit code 1 postmaster.c (3772
LogChildExit)
I think the reason for the above error is as follows:
For standby, the redo of XLOG_DBASE_DROP and XLOG_DBASE_CREATE just remove
and copy the databse directory but not peform checkpoint like create or drop
database in primary. So, when we restart, it redo from the log of create
database but now the directory of the source database has been deleted, so
redo failed.
So, do we need a force chechpoint in the dbase_redo as we do for create
database or drop database.
Hope to get your reply
Thanks & Best Regard