Re: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT

From: cca5507 <cca5507(at)qq(dot)com>
To: Zhijie Hou (Fujitsu) <houzj(dot)fnst(at)fujitsu(dot)com>, ocean_li_996 <ocean_li_996(at)163(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: kuroda(dot)hayato <kuroda(dot)hayato(at)fujitsu(dot)com>
Subject: Re: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT
Date: 2026-01-27 03:13:11
Message-ID: tencent_F5B08C1B5EF901955D722859E17B6D780A06@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I think the only ugly code in v6-0001 is:

```
if (SnapBuildCurrentState(builder) < SNAPBUILD_FULL_SNAPSHOT)
+ {
+ /*
+ * If we are building snapshot and the xlog means a catalog
+ * change, we need to mark it in the reorder buffer.
+ *
+ * Now only XLOG_HEAP2_NEW_CID means a catalog change.
+ */
+ if (SnapBuildCurrentState(builder) >= SNAPBUILD_BUILDING_SNAPSHOT &&
+ TransactionIdIsValid(xid) && info == XLOG_HEAP2_NEW_CID)
+ ReorderBufferXidSetCatalogChanges(ctx->reorder, xid, buf->origptr);
+
return;
+ }
```

If we can commit the patch in [1] first, it can just be replaced by:

```
- if (SnapBuildCurrentState(builder) < SNAPBUILD_FULL_SNAPSHOT)
+ if (SnapBuildCurrentState(builder) < SNAPBUILD_BUILDING_SNAPSHOT)
return;
```

Thoughts?

[1]: https://www.postgresql.org/message-id/flat/tencent_3A071B760AA1A38540B57F297332B7781C08%40qq.com

--
Regards,
ChangAo Chen

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Ashutosh Bapat 2026-01-27 03:12:35 Re: Remove PG_MMAP_FLAGS