BUG #17226: hot standby mode, create database and drop database cause standby restrat failed

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: bchen90(at)163(dot)com
Subject: BUG #17226: hot standby mode, create database and drop database cause standby restrat failed
Date: 2021-10-13 08:19:26
Message-ID: 17226-eef675ff9a8a4f71@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17226
Logged by: Bo Chen
Email address: bchen90(at)163(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Boris Korzun 2021-10-13 08:22:49 Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES
Previous Message Michael Paquier 2021-10-13 03:42:00 Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable