From: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
---|---|
To: | akapila(at)postgresql(dot)org, "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Fix for segfault in logical replication on master |
Date: | 2021-06-17 04:31:22 |
Message-ID: | 4C99A862-69C8-431F-960A-81B1151F1B89@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Amit,
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?
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fixing-bug-in-logical-replication.patch | application/octet-stream | 3.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Zhihong Yu | 2021-06-17 04:51:00 | Re: Skip partition tuple routing with constant partition key |
Previous Message | Amit Langote | 2021-06-17 04:28:58 | Re: Skip partition tuple routing with constant partition key |