From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
---|---|
To: | cca5507 <cca5507(at)qq(dot)com> |
Cc: | 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: | 2024-08-12 10:35:44 |
Message-ID: | ZrnlgJEH473Q1kTp@ip-10-97-1-34.eu-west-3.compute.internal |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On Mon, Aug 12, 2024 at 04:34:25PM +0800, cca5507 wrote:
> Hi,
>
>
> 4, 5 ===
>
>
> > if (SnapBuildCurrentState(builder) < SNAPBUILD_BUILDING_SNAPSHOT ||
> > (SnapBuildCurrentState(builder) == SNAPBUILD_BUILDING_SNAPSHOT && info != XLOG_HEAP_INPLACE) ||
> > ctx->fast_forward)
> > return;
>
>
>
> I think during fast forward, we also need handle the xlog that marks a transaction
> as catalog modifying, or the snapshot might lose some transactions?
I think it's fine to skip during fast forward as we are not generating logical
changes. It's done that way in master, in your proposal and in my "if" proposals.
Note that my proposals related to the if conditions are for heap2_decode and
heap_decode (not xact_decode).
> > That way we'd still rely on what's being done in the XLOG_HEAP_INPLACE case
>
>
> + if (SnapBuildCurrentState(builder) >= SNAPBUILD_BUILDING_SNAPSHOT)
> + {
> + /* Currently only XLOG_HEAP_INPLACE means a catalog modifying */
> + if (info == XLOG_HEAP_INPLACE && TransactionIdIsValid(xid))
> + ReorderBufferXidSetCatalogChanges(ctx->reorder, xid, buf->origptr);
> + }
>
>
>
> We only call ReorderBufferXidSetCatalogChanges() for the xlog that marks a transaction as catalog
> modifying, and we don't care about the other steps being done in the xlog, so I think the current
> approach is ok.
Yeah, I think your proposal does not do anything wrong. I just prefer to put
everything in a single if condition (as per my proposal) so that we can jump
directly in the appropriate case. I think that way the code is easier to maintain
instead of having to deal with the same info values in distinct places.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Ilia Evdokimov | 2024-08-12 10:42:07 | Add support for (Var op Var) clause in extended MCV statistics |
Previous Message | jian he | 2024-08-12 10:33:13 | Re: Remove dependence on integer wrapping |