Re: Unlogged tables cleanup

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Unlogged tables cleanup
Дата
Msg-id CAB7nPqSMy3xnthiMNOvJxWRXEtL70g=_U5-izVKkPHX3w_WaVQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Unlogged tables cleanup  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Unlogged tables cleanup  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On Thu, Nov 10, 2016 at 4:33 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Thu, Nov 10, 2016 at 4:23 PM, konstantin knizhnik
> <k.knizhnik@postgrespro.ru> wrote:
>> No, it is latest sources from Postgres repository.
>> Please notice that you should create new database and tablespace to reproduce this issue.
>> So actually the whole sequence is
>>
>> mkdir fs
>> initdb -D pgsql
>> pg_ctl -D pgsql -l logfile start
>> psql postgres
>> # create tablespace fs location '/home/knizhnik/dtm-data/fs';
>> # set default_tablespace=fs;
>> # create unlogged table foo(x integer);
>> # insert into foo values(generate_series(1,100000));
>> # ^D
>> pkill -9 postgres
>> pg_ctl -D pgsql -l logfile start
>> # select * from foo;
>
> OK, I understood what I was missing. This can be reproduced with
> wal_level = minimal. When using hot_standby things are working
> properly.

Okay, so what happens is that the CREATE TABLESPACE record removes the
tablespace directory and recreates a fresh one, but as no CREATE
records are created for unlogged tables the init fork is not
re-created. It seems to me that we should log a record to recreate the
INIT fork, and that heap_create_with_catalog() is missing something.
Generating a record in RelationCreateStorage() is the more direct way,
and that actually fixes the issue. Now the comments at the top of it
mention that RelationCreateStorage() should only be used to create the
MAIN forknum. So, wouldn't a correct fix be to log this INIT record at
the end of heap_create()?
-- 
Michael



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

Предыдущее
От: Ali Akbar
Дата:
Сообщение: Re: Bug in comparison of empty jsonb arrays to scalars
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: Remove the comment on the countereffectiveness of large shared_buffers on Windows