On Mon, Nov 15, 2021 at 5:09 PM tanghy.f...@fujitsu.com
<tanghy.f...@fujitsu.com> wrote:
>
> I met a problem when using "ALTER PUBLICATION ... SET TABLE ... WHERE ...", 
> the
> publisher was crashed after executing this statement.
>
>
>
> Backtrace is attached. I think maybe the problem is related to the below 
> change in 0003 patch:
>
> +                       free(entry->exprstate);
>

I had a look at this crash problem and could reproduce it.

I made the following changes and it seemed to resolve the problem:

diff --git a/src/backend/replication/pgoutput/pgoutput.c
b/src/backend/replication/pgoutput/pgoutput.c
index e7f2fd4bad..f0cb9b8265 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -969,8 +969,6 @@ pgoutput_row_filter_init(PGOutputData *data,
Relation relation, RelationSyncEntr
             oldctx = MemoryContextSwitchTo(CacheMemoryContext);
             rfnode = n_filters > 1 ? makeBoolExpr(AND_EXPR, rfnodes,
-1) : linitial(rfnodes);
             entry->exprstate = pgoutput_row_filter_init_expr(rfnode);
-
-            list_free(rfnodes);
         }

         entry->rowfilter_valid = true;
@@ -1881,7 +1879,7 @@ rel_sync_cache_relation_cb(Datum arg, Oid relid)
         }
         if (entry->exprstate != NULL)
         {
-            free(entry->exprstate);
+            pfree(entry->exprstate);
             entry->exprstate = NULL;
         }
     }


Regards,
Greg Nancarrow
Fujitsu Australia


Reply via email to