DDL result is lost by CREATE DATABASE with WAL_LOG strategy

Поиск
Список
Период
Сортировка
От Ryo Matsumura (Fujitsu)
Тема DDL result is lost by CREATE DATABASE with WAL_LOG strategy
Дата
Msg-id TYCPR01MB6868677E499C9AD5123084B5E8A39@TYCPR01MB6868.jpnprd01.prod.outlook.com
обсуждение исходный текст
Ответы Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy  (Justin Pryzby <pryzby@telsasoft.com>)
Re: DDL result is lost by CREATE DATABASE with WAL_LOG strategy  (Nathan Bossart <nathandbossart@gmail.com>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Следующее
От: Tom Lane
Дата:
Сообщение: Re: some namespace.c refactoring