RE: Fix for segfault in logical replication on master

From: "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com>
To: 'Mark Dilger' <mark(dot)dilger(at)enterprisedb(dot)com>, "akapila(at)postgresql(dot)org" <akapila(at)postgresql(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Fix for segfault in logical replication on master
Date: 2021-06-17 05:19:48
Message-ID: OSBPR01MB488887F220AF4A53E4092868ED0E9@OSBPR01MB4888.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thursday, June 17, 2021 1:31 PM Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> wrote:
> In commit e7eea52b2d, you introduced a new function,
> RelationGetIdentityKeyBitmap(), which uses some odd logic for determining
> if a relation has a replica identity index. That code segfaults under certain
> conditions. A test case to demonstrate that is attached. Prior to patching
> the code, this new test gets stuck waiting for replication to finish, which never
> happens. You have to break out of the test and check
> tmp_check/log/021_no_replica_identity_publisher.log.
>
> I believe this bit of logic in src/backend/utils/cache/relcache.c:
>
> indexDesc = RelationIdGetRelation(relation->rd_replidindex);
> for (i = 0; i < indexDesc->rd_index->indnatts; i++)
>
> is unsafe without further checks, also attached.
>
> Would you mind taking a look?
Hi, Mark

Thanks for your reporting.
I started to analyze your report and
will reply after my idea to your modification is settled.

Best Regards,
Takamichi Osumi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amul Sul 2021-06-17 05:22:27 Re: [Patch] ALTER SYSTEM READ ONLY
Previous Message Kyotaro Horiguchi 2021-06-17 05:17:56 Re: pgbench logging broken by time logic changes