Re: pg_rewind just doesn't fsync *anything*?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_rewind just doesn't fsync *anything*?
Дата
Msg-id 20160327215250.GC20662@awork2.anarazel.de
обсуждение исходный текст
Ответ на pg_rewind just doesn't fsync *anything*?  (Andres Freund <andres@anarazel.de>)
Ответы Re: pg_rewind just doesn't fsync *anything*?  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On 2016-03-09 19:43:52 -0800, Andres Freund wrote:
> Hi,
> 
> how come that the only comment in pg_rewind about fsyncing is '
> void
> close_target_file(void)
> {
> ...
>     /* fsync? */
> }
> 
> Isn't that a bit, uh, minimal for a utility that's likely to be used in
> failover scenarios?
> 
> I think we might actually be "saved" due to
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2ce439f33
> because pg_rewind appears to leave the cluster in
> 
>     ControlFile_new.state = DB_IN_ARCHIVE_RECOVERY;
>     updateControlFile(&ControlFile_new);
> 
> a state that StartupXLOG will treat as needing recovery:
> 
> if (ControlFile->state != DB_SHUTDOWNED &&
>         ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
>         SyncDataDirectory();
> 
> but that code went in after pg_rewind, so this certainly can't be an
> intentional save.
> 
> I also don't think it's ok that you need to start the cluster to make it
> safe against a crash?
> 
> I guess the easiest fix would be to shell out to initdb -s?

I've pushed a modified version of the fix that Michael posted in
http://archives.postgresql.org/message-id/CAB7nPqRmM%2BCX6bVxw0Y7mMVGMFj1S8kwhevt8TaP83yeFRfbXA%40mail.gmail.com

Andres



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Automatically add -Wold-style-definition?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c