From: | Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
Subject: | Re: Conflict detection for multiple_unique_conflicts in logical replication |
Date: | 2025-03-20 07:05:53 |
Message-ID: | CABdArM5xXLaPwSn1nNstWP2p5iVTGghgqc4G50c3c+Km3+queQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Mar 19, 2025 at 4:18 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Wed, Mar 19, 2025 at 11:11 AM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
> >
> > Please find the attached v5-0001 patch without the stats part.
> >
>
> Review:
> =======
> 1.
> + foreach_ptr(TupleTableSlot, slot, conflictSlots)
> + {
> + indexoid = lfirst_oid(list_nth_cell(conflictIndexes, conflictNum));
> +
> + Assert(!OidIsValid(indexoid) ||
> + CheckRelationOidLockedByMe(indexoid, RowExclusiveLock, true));
> +
> + if (!localorigin)
> + GetTupleTransactionInfo(slot, &localxmin, &localorigin, &localts);
> +
> + /*
> + * Build the error detail message containing the conflicting key and
> + * tuple information. The details for each conflict will be appended
> + * to err_detail.
> + */
> + errdetail_apply_conflict(estate, relinfo, type, searchslot,
> + slot, remoteslot, indexoid,
> + localxmin, localorigin, localts, &err_detail);
> +
> + conflictNum++;
> + }
>
> Won't this get TupleTransactionInfo only for the first conflicting
> tuple instead of getting it separately for each tuple?
>
Fixed.
> 2. We make an array/list of local tuple's origin info from the caller
> and send it to this ReportApplyConflict. Additionally, we can use
> do...while loop to avoid calling errdetail_apply_conflict multiple
> times in the function ReportApplyConflict(). We break the loop if
> there are no conflictSlots after generating the first detail message.
>
Implemented the suggestions.
> 3. Related to the new test file 't/035_multiple_unique_conflicts.pl',
> is it worth to add a separate test file only for
> multiple_unique_conflicts? I see that for all other conflicts, we have
> tests spread over existing tests where such conflict-related tests
> were present. Shall we name it as t/035_conflicts.pl? That will allow
> us to add more tests related to other conflicts like update_delete in
> the same file?
>
+1, renamed the test file as t/035_conflicts.pl.
Attached is v6 patch with above comments addressed.
--
Thanks,
Nisha
Attachment | Content-Type | Size |
---|---|---|
v6-0001-Implement-the-conflict-detection-for-multiple_uni.patch | application/octet-stream | 21.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Rahila Syed | 2025-03-20 07:39:45 | Re: Enhancing Memory Context Statistics Reporting |
Previous Message | Andrei Lepikhov | 2025-03-20 07:03:58 | Re: making EXPLAIN extensible |