Re: prevent immature WAL streaming

From: Amul Sul <sulamul(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, "Jakub(dot)Wartak(at)tomtom(dot)com" <Jakub(dot)Wartak(at)tomtom(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Ryo Matsumura <matsumura(dot)ryo(at)fujitsu(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, "masao(dot)fujii(at)oss(dot)nttdata(dot)com" <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, "mengjuan(dot)cmj(at)alibaba-inc(dot)com" <mengjuan(dot)cmj(at)alibaba-inc(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: prevent immature WAL streaming
Date: 2021-10-07 13:22:39
Message-ID: CAAJ_b97FcTG7Gu5f3Kd-zKGEkG=hXnVPQAOo9G8EvpTehS-uCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 7 Oct 2021 at 6:41 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:

> On 2021-Oct-07, Amul Sul wrote:
>
> > While reading this commit (ff9f111bce24), wondered can't we skip
> > missingContrecPtr global variable declaration and calculate that from
> > abortedRecPtr value whenever it needed. IIUC, missingContrecPtr is the
> > next page to the page that abortedRecPtr contain and that can be
> > calculated as "abortedRecPtr + (XLOG_BLCKSZ - (abortedRecPtr %
> > XLOG_BLCKSZ))", thoughts? Please correct me if I'm missing something,
> > thanks.
>
> I don't think that works -- what if the missing record is not on the
> next page but on some future one? Imagine an enormously large record
> that starts on segment 1, covers all of segment 2 and ends in segment 3.
> We could have flushed segment 2 already, so with your idea we would skip
> ahead only to that position, but really we need to skip all the way to
> the first page of segment 3.
>
> This is easier to imagine if you set wal segment size to 1 MB, but it is
> possible with the default segment size too, since commit records can be
> arbitrarily large, and "logical message" records as well.

Make sense, thanks for the explanation.

Regards,
Amul
--
Regards,
Amul Sul
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-10-07 13:27:55 Re: prevent immature WAL streaming
Previous Message Alvaro Herrera 2021-10-07 13:11:20 Re: prevent immature WAL streaming