Re: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT - Mailing list pgsql-hackers

From cca5507
Subject Re: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT
Date
Msg-id tencent_F5B08C1B5EF901955D722859E17B6D780A06@qq.com
Whole thread Raw
In response to RE: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT  ("Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>)
List 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

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Remove PG_MMAP_FLAGS
Next
From: Dmitrii Bondar
Date:
Subject: Pgbench: remove synchronous prepare