Re: END_OF_RECOVERY shutdowns and ResetUnloggedRelations()

Поиск
Список
Период
Сортировка
От Abhijit Menon-Sen
Тема Re: END_OF_RECOVERY shutdowns and ResetUnloggedRelations()
Дата
Msg-id 20140924113605.GA20227@toroid.org
обсуждение исходный текст
Ответ на Re: END_OF_RECOVERY shutdowns and ResetUnloggedRelations()  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: END_OF_RECOVERY shutdowns and ResetUnloggedRelations()  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
Hi Andres, Robert.

I've attached four patches here.

1. Move the call to ResetUnloggedRelations(UNLOGGED_RELATION_INIT) to
   earlier in StartupXLOG.

2. Inside that function, issue fsync()s for the main forks we create by
   copying the _init fork.

3. A small fixup to add a const to "typedef char *FileName", because the
   earlier patch gave me warnings about discarding const-ness. This is
   consistent with many other functions in fd.c that take const char *.

4. Issue an fsync() on the data directory at startup if we need to
   perform crash recovery.

I created some unlogged relations, performed an immediate shutdown, and
then straced postgres as it performed crash recovery. The changes in (2)
do indeed fsync the files we create by copying *_init, and don't fsync
anything else (at least not after I fixed a bug ;-).

I did not do anything about the END_OF_RECOVERY checkpoint setting the
ControlFile->state to DB_SHUTDOWNED, because it wasn't clear to me if
there was any agreement on what to do. I would be happy to submit a
followup patch if we reach some decision about it.

Is this what you had in mind?

-- Abhijit

Вложения

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

Предыдущее
От: Abhijit Menon-Sen
Дата:
Сообщение: Re: make pg_controldata accept "-D dirname"
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: make pg_controldata accept "-D dirname"