Re: Torn page hazard in ginRedoUpdateMetapage()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Torn page hazard in ginRedoUpdateMetapage()
Дата
Msg-id 21243.1335810920@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Torn page hazard in ginRedoUpdateMetapage()  (Noah Misch <noah@leadboat.com>)
Ответы Re: Torn page hazard in ginRedoUpdateMetapage()  (Noah Misch <noah@leadboat.com>)
Список pgsql-hackers
Noah Misch <noah@leadboat.com> writes:
> When GIN changes a metapage, we WAL-log its ex-header content and never use a
> backup block.  This reduces WAL volume since the vast majority of the metapage
> is unused.  However, ginRedoUpdateMetapage() only restores the WAL-logged
> content if the metapage LSN predates the WAL record LSN.  If a metapage write
> tore and updated the LSN but not the other content, we would fail to complete
> the update.  Instead, unconditionally reinitialize the metapage similar to how
> _bt_restore_meta() handles the situation.

> I found this problem by code reading and did not attempt to build a test case
> illustrating its practical consequences.  It's possible that there's no
> problem in practice on account of some reason I haven't contemplated.

I think there's no problem in practice; the reason is that the
GinMetaPageData struct isn't large enough to extend past the first
physical sector of the page.  So it's in the same disk sector as the
LSN and tearing is impossible.  Still, this might be a good
future-proofing move, in case GinMetaPageData gets larger.
        regards, tom lane


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: Future In-Core Replication
Следующее
От: "Albe Laurenz"
Дата:
Сообщение: Re: Analyzing foreign tables & memory problems