Re: Hot standby and GiST page splits (was Re: WIP: Fast GiST index build)

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Hot standby and GiST page splits (was Re: WIP: Fast GiST index build)
Дата
Msg-id CA+U5nMJsX+A8T0UEOe_443FRxHTN1G3iLtfBBJWyUyQKYnxrEg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Hot standby and GiST page splits (was Re: WIP: Fast GiST index build)  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Ответы Re: Hot standby and GiST page splits (was Re: WIP: Fast GiST index build)  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
On Tue, Aug 2, 2011 at 12:03 PM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> On 01.08.2011 13:44, Heikki Linnakangas wrote:
>>
>> On 01.08.2011 13:13, Simon Riggs wrote:
>>>
>>> Did you want me to write the patch for 9.0?
>>
>> I'm looking at it now.
>
> So, in 9.0, we currently leave the rightlink and NSN invalid when replaying
> a page split. To set them correctly, we'd need the old rightlink and NSN
> from the page being split, but the WAL record doesn't currently include
> them. I can see two solutions to this:
>
> 1. Add them to the page split WAL record. That's straightforward, but breaks
> WAL format compatibility with older minor versions.
>
> 2. Read the old page version, and copy the rightlink and NSN from there.
> Since we're restoring what's basically a full-page image of the page after
> the split, in crash recovery the old contents might be a torn page, or a
> newer version of the page. I believe that's harmless, because we only care
> about the NSN and rightlink in hot standby mode, but it's a bit ugly.
>
> If we change the WAL record, we have to make it so that the new version can
> still read the old format, which complicates the implementation a bit.
> Neverthelss, I'm leaning towards option 1.

We may as well do (1), with two versions of the WAL record.

Hmm, the biggest issue is actually that existing GIST indexes are
corrupted, from the perspective of being unusable during HS.

We can fix the cause but that won't repair the existing damage. So the
requirement is for us to re/create new indexes, which can then use a
new WAL record format. We probably need to store some information in
the metapage saying whether or not the index has been maintained only
with v2 WAL records, or with a mixture of v1 and v2 records. If the
latter, then issue a WARNING to rebuild the index.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: Compressing the AFTER TRIGGER queue
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Hot standby and GiST page splits (was Re: WIP: Fast GiST index build)