RE: Replica Identity check of partition table on subscriber

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: RE: Replica Identity check of partition table on subscriber
Date: 2022-06-22 03:02:36
Message-ID: OS3PR01MB5718FD1635B5E97FB64AE03B94B29@OS3PR01MB5718.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, June 21, 2022 4:49 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
>
> On Tue, Jun 21, 2022 at 12:50 PM Amit Langote <amitlangote09(at)gmail(dot)com>
> wrote:
> >
> > On Tue, Jun 21, 2022 at 3:35 PM houzj(dot)fnst(at)fujitsu(dot)com
> > <houzj(dot)fnst(at)fujitsu(dot)com> wrote:
> >
> > Attached a patch containing the above to consider as an alternative.
> >
>
> Thanks, the patch looks good to me. I'll push this after doing some testing.

Since the patch has been committed. Attach the last patch to fix the memory leak.

The bug exists on PG10 ~ PG15(HEAD).

For HEAD,PG14,PG13, to fix the memory leak, I think we should use
free_attrmap instead of pfree and release the no-longer-useful attrmap
When rebuilding the map info.

For PG12,PG11,PG10, we only need to add the code to release the
no-longer-useful attrmap when rebuilding the map info. We can still use
pfree() because the attrmap in back-branch is a single array like:

entry->attrmap = palloc(desc->natts * sizeof(AttrNumber));

Best regards,
Hou zj

Attachment Content-Type Size
v12-HEAD-PG14-0001-fix-memory-leak-about-attrmap.patch application/octet-stream 2.1 KB
v12-PG13-0001-fix-memory-leak-about-attrmap.patch application/octet-stream 2.1 KB
v12-PG10-11-12-0001-Fix-memory-leak-about-attrmap.patch application/octet-stream 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-06-22 04:18:23 Re: tablesync copy ignores publication actions
Previous Message Tom Lane 2022-06-22 02:54:47 Re: pg15b1: FailedAssertion("val > base", File: "...src/include/utils/relptr.h", Line: 67, PID: 30485)