Re:RE: BUG #18055: logical decoding core on AllocateSnapshotBuilder()

ocean_li_996 <ocean_li_996@163.com>

From: ocean_li_996 <ocean_li_996@163.com>
To: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
Cc: "Masahiko Sawada" <sawada.mshk@gmail.com>, "Amit Kapila" <amit.kapila16@gmail.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2023-08-20T16:51:30Z
Lists: pgsql-bugs
Excited! Thanks for the discussion and  the fix!


The bug seems to be solved well. And usage of PG_FINALLY can make it more elegantly.  However, for the version lacking of  PG_FINALLY, should the patch be written like that:


---
/* free context, call shutdown callback */
FreeDecodingContext(ctx);

ReplicationSlotRelease();
InvalidateSystemCaches();
}
PG_CATCH();
{
+
+    /* free context, call shutdown callback */
+     if (ctx != NULL)
+             FreeDecodingContext(ctx);
+
+    ReplicationSlotRelease();

----




Best regards!





At 2023-08-18 12:21:53, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com> wrote:

Here is a new version patch which addressed this based on PG15.