Re: Problem with logical replication
От | Euler Taveira |
---|---|
Тема | Re: Problem with logical replication |
Дата | |
Msg-id | CAH503wAs7EH2aaMZpF2PuSgPFoM_r4OBN7ePqBsozb4_pm8czQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Problem with logical replication (Masahiko Sawada <masahiko.sawada@2ndquadrant.com>) |
Ответы |
Re: Problem with logical replication
|
Список | pgsql-hackers |
On Mon, 20 Apr 2020 at 10:25, Masahiko Sawada <masahiko.sawada@2ndquadrant.com> wrote:
On Thu, 16 Apr 2020 at 17:48, Dilip Kumar <dilipbalaut@gmail.com> wrote:
I could reproduce this issue by the steps you shared. For the bug fix
patch, I basically agree to remove that assertion from
build_replindex_scan_key() but I think it's better to update the
assertion instead of removal and update the following comment:
IMO the assertion is using the wrong function because it should test a replica
identity or primary key (GetRelationIdentityOrPK). RelationGetReplicaIndex
returns InvalidOid even though the table has a primary key.
GetRelationIdentityOrPK tries to obtain a replica identity and if it fails, it
tries a primary key. That's exact what this assertion should use. We should
also notice that FindReplTupleInLocalRel uses GetRelationIdentityOrPK and after
a code path like RelationFindReplTupleByIndex -> build_replindex_scan_key it
should also use the same function.
Since GetRelationIdentityOrPK is a fallback function that
uses RelationGetReplicaIndex and RelationGetPrimaryKeyIndex, I propose that we
move this static function to execReplication.c.
I attached a patch with the described solution. I also included a test that
covers this scenario.
identity or primary key (GetRelationIdentityOrPK). RelationGetReplicaIndex
returns InvalidOid even though the table has a primary key.
GetRelationIdentityOrPK tries to obtain a replica identity and if it fails, it
tries a primary key. That's exact what this assertion should use. We should
also notice that FindReplTupleInLocalRel uses GetRelationIdentityOrPK and after
a code path like RelationFindReplTupleByIndex -> build_replindex_scan_key it
should also use the same function.
Since GetRelationIdentityOrPK is a fallback function that
uses RelationGetReplicaIndex and RelationGetPrimaryKeyIndex, I propose that we
move this static function to execReplication.c.
I attached a patch with the described solution. I also included a test that
covers this scenario.
Euler Taveira http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: