Re: Is this a problem in GenericXLogFinish()?

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Jeff Davis <pgsql(at)j-davis(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is this a problem in GenericXLogFinish()?
Date: 2023-11-14 03:42:29
Message-ID: CAA4eK1JkPSKETkczt7mhy0=D3RpViKyaoRpoxNCmESjs1AG-vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 13, 2023 at 10:51 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Mon, Nov 13, 2023 at 12:47 AM Hayato Kuroda (Fujitsu)
> <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
> > Moved.
>
> I see that this patch was committed, but I'm not very convinced that
> the approach is correct. The comment says this:
>
> + /*
> + * A write buffer needs to be registered even if no tuples are
> + * added to it to ensure that we can acquire a cleanup lock on it
> + * if it is the same as primary bucket buffer or update the
> + * nextblkno if it is same as the previous bucket buffer.
> + */
>
> But surely if the buffer is the same as one of those others, then it's
> registered anyway,

I don't think for others it's registered. For example, consider the
case when prevpage and the writepage are the same (aka
xlrec.is_prev_bucket_same_wrt is true), it won't be registered in
another code path (see comment [1]).

>
> and if it isn't, then it doesn't need to be.
>

In the previous example, we need it to update the nextblockno during replay.

I am not sure if I understand the scenario you are worried about, so
if my response doesn't address your concern, can you please explain a
bit more about the scenario you have in mind?

[1] -
/*
* If prevpage and the writepage (block in which we are moving tuples
* from overflow) are same, then no need to separately register
* prevpage. During replay, we can directly update the nextblock in
* writepage.
*/

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-11-14 03:54:16 Re: pg_upgrade and logical replication[
Previous Message Merlin Moncure 2023-11-14 02:03:23 Re: Re: How to solve the problem of one backend process crashing and causing other processes to restart?