Re: Truncate in synchronous logical replication failed

From: Japin Li <japinli(at)hotmail(dot)com>
To: "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com>
Cc: 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com>, Petr Jelinek <petr(dot)jelinek(at)enterprisedb(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Truncate in synchronous logical replication failed
Date: 2021-04-17 07:35:17
Message-ID: MEYP282MB1669023EE1774D03B9EE10A9B64B9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Sat, 17 Apr 2021 at 12:03, osumi(dot)takamichi(at)fujitsu(dot)com <osumi(dot)takamichi(at)fujitsu(dot)com> wrote:
> On Saturday, April 17, 2021 12:53 AM Japin Li <japinli(at)hotmail(dot)com>
>> On Fri, 16 Apr 2021 at 17:19, osumi(dot)takamichi(at)fujitsu(dot)com
>> <osumi(dot)takamichi(at)fujitsu(dot)com> wrote:
>> > On Friday, April 16, 2021 5:50 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
>> wrote:
>> >> On Fri, Apr 16, 2021 at 12:56 PM osumi(dot)takamichi(at)fujitsu(dot)com
>> >> <osumi(dot)takamichi(at)fujitsu(dot)com> wrote:
>> >> >
>> >> > > Thanks for your reminder. It might be a way to solve this problem.
>> >> > Yeah. I've made the 1st patch for this issue.
>> >> >
>> >> > In my env, with the patch
>> >> > the TRUNCATE in synchronous logical replication doesn't hang.
>> >> >
>> >>
>> >> Few initial comments:
>> >> =====================
>> >> 1.
>> >> + relreplindex = relation->rd_replidindex;
>> >> +
>> >> + /*
>> >> + * build attributes to idindexattrs.
>> >> + */
>> >> + idindexattrs = NULL;
>> >> + foreach(l, indexoidlist)
>> >> + {
>> >> + Oid indexOid = lfirst_oid(l);
>> >> + Relation indexDesc;
>> >> + int i;
>> >> + bool isIDKey; /* replica identity index */
>> >> +
>> >> + indexDesc = RelationIdGetRelation(indexOid);
>> >>
>> >> When you have oid of replica identity index (relreplindex) then what
>> >> is the need to traverse all the indexes?
>> > Ok. No need to traverse all the indexes. Will fix this part.
>> >
>> >> 2.
>> >> It is better to name the function as RelationGet...
>> > You are right. I'll modify this in my next version.
>> >
>>
>> I took the liberty to address review comments and provide a v2 patch on top
>> of your's v1 patch, also merge the test case.
>>
>> Sorry for attaching.
> No problem. Thank you for updating the patch.
> I've conducted some cosmetic changes. Could you please check this ?
> That's already applied by pgindent.
>
> I executed RT for this and made no failure.
> Just in case, I executed 010_truncate.pl test 100 times in a tight loop,
> which also didn't fail.
>

LGTM, I made an entry in the commitfest[1], so that the patches will get a
chance to run on all the platforms.

[1] - https://commitfest.postgresql.org/33/3081/

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-04-17 09:23:09 Re: Bogus collation version recording in recordMultipleDependencies
Previous Message Amit Kapila 2021-04-17 07:13:11 Re: Forget close an open relation in ReorderBufferProcessTXN()