public inbox for [email protected]
help / color / mirror / Atom feedFrom: =?gb18030?B?Y2NhNTUwNw==?= <[email protected]>
To: =?gb18030?B?QWppbiBDaGVyaWFu?= <[email protected]>
Cc: =?gb18030?B?QmVydHJhbmQgRHJvdXZvdA==?= <[email protected]>
Cc: =?gb18030?B?TWljaGFlbCBQYXF1aWVy?= <[email protected]>
Cc: =?gb18030?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>
Subject: Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state
Date: Sat, 28 Jun 2025 11:44:52 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFPTHDYSQipcO_+GNt-ZQsk6cidt9Lc4PkcdvO7jnrugiUw0eg@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CAFPTHDYSQipcO_+GNt-ZQsk6cidt9Lc4PkcdvO7jnrugiUw0eg@mail.gmail.com>
Hi,
If I understand correctly, this may break the basic principle:
The aim is to build a snapshot that behaves the same as a freshly taken MVCC snapshot would have at the time the XLogRecord was generated.
--
Regards,
ChangAo Chen
------------------ Original ------------------
From: "Ajin Cherian" <[email protected]>;
Date: Fri, Jun 27, 2025 06:29 PM
To: "cca5507"<[email protected]>;
Cc: "Bertrand Drouvot"<[email protected]>;"Michael Paquier"<[email protected]>;"pgsql-hackers"<[email protected]>;
Subject: Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state
On Fri, Jun 27, 2025 at 3:48 PM cca5507 <[email protected]> wrote:
>
> Hi,
>
> I refactor the code and fix the git apply warning according to [1].
>
> Here are the new version patches.
>
> --
> Regards,
> ChangAo Chen
>
> [1] https://www.postgresql.org/message-id/Zrmh7X8jYCbFYXjH%40ip-10-97-1-34.eu-west-3.compute.internal
I see this problem is similar to the bug reported in [1], and your fix
also addresses the issue reported there. Although I like your approach
of tracking changes starting from the BUILDING_SNAPSHOT state, I’d
like to suggest an alternative.
While debugging that issue, my plan was not to track catalog changes
prior to SNAPBUILD_CONSISTENT, but instead to ensure we don’t use
snapshots built before SNAPBUILD_CONSISTENT, since we don’t track
catalog changes in those states. We should discard previously built
snapshots and rebuild them once we reach the SNAPBUILD_CONSISTENT
state. At that point, all necessary transactions would have been
committed, and builder->xmin would have advanced enough to decode all
transactions from then on.
The problem is that previously built snapshots hang around without the
latest xmin and xmax, and we tend to reuse them. We should ensure that
all txn->base_snapshot and builder->snapshot snapshots built in the
SNAPBUILD_FULL_SNAPSHOT state are rebuilt once we reach
SNAPBUILD_CONSISTENT. For this, we need to track when the snapshot was
built. There is already a field in ReorderBufferTXN -
'base_snapshot_lsn' which we can use. If base_snapshot_lsn <
builder->start_decoding_at, then we should rebuild the snapshot. Just
a thought.
regards,
Ajin Cherian
Fujitsu Australia
[1] - https://www.postgresql.org/message-id/18509-983f064d174ea880%40postgresql.org
view thread (23+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox