Re: BUG #18055: logical decoding core on AllocateSnapshotBuilder()

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "ocean_li_996(at)163(dot)com" <ocean_li_996(at)163(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18055: logical decoding core on AllocateSnapshotBuilder()
Date: 2023-08-21 12:41:46
Message-ID: CAD21AoB-H_rWRbRV5LhdJvgUVn9k=F1TRfugfwPrziue+VvwcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Aug 21, 2023 at 6:05 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
>
> I think the real problem is that 272248a0c added InitialRunningXacts a global
> variable. If it just lived in in struct SnapBuild, this whole thing wouldn't
> be an issue? The commit justified this choice with avoiding an ABI breakage -
> but isn't that bogus? The struct is private to snapbuild.c. It doesn't live on
> disk (that's SnapBuildOnDisk).

No, since SnapBuildOnDisk contains SnapBuild, if we add something to
SnapBuild, the on-disk format compatibility would break. See:

/*
* We store current state of struct SnapBuild on disk in the following manner:
*
* struct SnapBuildOnDisk;
* TransactionId * running.xcnt_space;
* TransactionId * committed.xcnt; (*not xcnt_space*)
*
*/
typedef struct SnapBuildOnDisk
{
/* first part of this struct needs to be version independent */

/* data not covered by checksum */
uint32 magic;
pg_crc32c checksum;

/* data covered by checksum */

/* version, in case we want to support pg_upgrade */
uint32 version;
/* how large is the on disk data, excluding the constant sized part */
uint32 length;

/* version dependent part */
SnapBuild builder;
:

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2023-08-21 13:32:27 Re: BUG #18059: Unexpected error 25001 in stored procedure
Previous Message Alvaro Herrera 2023-08-21 12:33:37 Re: BUG #17994: Invalidating relcache corrupts tupDesc inside ExecEvalFieldStoreDeForm()