Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: cca5507 <cca5507(at)qq(dot)com>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state
Date: 2025-03-26 10:15:26
Message-ID: CAFPTHDZaKuS8j72C5s63Hisq6ZRCUu4+xTRSc31_vHgRhaHxzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 26, 2025 at 9:11 PM cca5507 <cca5507(at)qq(dot)com> wrote:
>
> Hi,
>
> Thanks for the comments!
>
> Here are the new version patches, I think it will be more clear.
>
> --

+ {
+ /*
+ * Note that during or after BUILDING_SNAPSHOT, we need handle the xlog
+ * that might mark a transaction as catalog modifying because
the snapshot
+ * only tracks catalog modifying transactions. The transaction before
+ * BUILDING_SNAPSHOT will not be tracked anyway(see
SnapBuildCommitTxn()
+ * for details), so just return.
+ */
+ if (SnapBuildCurrentState(builder) >= SNAPBUILD_BUILDING_SNAPSHOT)
+ {
+ /* Currently only XLOG_HEAP2_NEW_CID means a catalog modifying */
+ if (info == XLOG_HEAP2_NEW_CID && TransactionIdIsValid(xid))
+ ReorderBufferXidSetCatalogChanges(ctx->reorder, xid,
buf->origptr);
+ }

Any reason why you avoided calling SnapBuildProcessNewCid here and
only called ReorderBufferXidSetCatalogChanges? If any, please mention
in the comments the reason.

regards,
Ajin Cherian
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shubham Khanna 2025-03-26 10:32:47 Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.
Previous Message Dean Rasheed 2025-03-26 09:49:50 Re: gamma() and lgamma() functions