Re: Unlogged tables cleanup

Поиск
Список
Период
Сортировка
От Kuntal Ghosh
Тема Re: Unlogged tables cleanup
Дата
Msg-id CAGz5QCJZVGxfeK6s7Ui=aRHYnjTTZi54J0E-Lt7n6hqF2guFQA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Unlogged tables cleanup  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Unlogged tables cleanup
Список pgsql-hackers
On Thu, Nov 10, 2016 at 3:42 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Thu, Nov 10, 2016 at 5:15 PM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> 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()?
>
> Nah. Looking at the code the fix is quite obvious.
> heap_create_init_fork() is checking for XLogIsNeeded() to decide if
> the INIT forknum should be logged or not. But this is wrong, it needs
> to be done unconditionally to ensure that the relation gets created at
> replay.
I think that we should also update other *buildempty() functions as well.
For example, if the table has a primary key, we'll encounter the error again
for btree index.


-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: switching documentation build to XSLT
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Improving RLS planning