From: | "Ryo Matsumura (Fujitsu)" <matsumura(dot)ryo(at)fujitsu(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | DDL result is lost by CREATE DATABASE with WAL_LOG strategy |
Date: | 2023-02-15 04:49:38 |
Message-ID: | TYCPR01MB6868677E499C9AD5123084B5E8A39@TYCPR01MB6868.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, hackers.
I found that CREATE DATABASE occurs lost of DDL result after crash server.
The direct cause is that the checkpoint skips sync for page of template1's main fork
because buffer status is not marked as BM_PERMANENT in BufferAlloc().
Have you any knowledge about it?
Reproduction:
1) Do initdb.
2) Start server.
3) Connect to 'postgres' database.
4) Execute CREATE DATABASE statement with WAL_LOG strategy.
5) Connect to 'template1' database.
6) Update pg_class by executing some DDL.
7) Do checkpoint.
8) Crash server.
[src/backend/storage/buffer/bufmgr.c]
1437 if (relpersistence == RELPERSISTENCE_PERMANENT || forkNum == INIT_FORKNUM)
1438 buf_state |= BM_TAG_VALID | BM_PERMANENT | BUF_USAGECOUNT_ONE;
1439 else
!!! walk this route !!!
1440 buf_state |= BM_TAG_VALID | BUF_USAGECOUNT_ONE;
The above is occured by the following call.
The argument 'permanent' of ReadBufferWithoutRelcache() is passed to
BufferAlloc() as 'relpersistence'.
[src/backend/commands/]
298 buf = ReadBufferWithoutRelcache(rnode, MAIN_FORKNUM, blkno,
299 RBM_NORMAL, bstrategy, false);
Regards
Ryo Matsumura
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-02-15 05:04:02 | Re: some namespace.c refactoring |
Previous Message | Amit Kapila | 2023-02-15 04:37:02 | Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher |