Re: POC: Lock updated tuples in tuple_update() and tuple_delete()

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Mason Sharp <masonlists(at)gmail(dot)com>
Cc: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: POC: Lock updated tuples in tuple_update() and tuple_delete()
Date: 2023-01-08 22:07:45
Message-ID: CAPpHfdu4UfmkZbLPLuZGGsKqdS39CsaZx=hT-POkUn6rQs30qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Mason!

Thank you very much for your review.

On Sun, Jan 8, 2023 at 9:33 PM Mason Sharp <masonlists(at)gmail(dot)com> wrote:
> On Fri, Jan 6, 2023 at 4:46 AM Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> wrote:
>> Besides, the new version has only some minor changes in the comments
>> and the commit message.
> It looks good, and the greater the concurrency the greater the benefit will be. Just a few minor suggestions regarding comments.
>
> "ExecDeleteAct() have already locked the old tuple for us", change "have" to "has".
>
> The comments in heapam_tuple_delete() and heapam_tuple_update() might be a little clearer with something like:
>
> "If the tuple has been concurrently updated, get lock already so that on
> retry it will succeed, provided that the caller asked to do this by
> providing a lockedSlot."

Thank you. These changes are incorporated into v6 of the patch.

> Also, not too important, but perhaps better clarify in the commit message that the repeated work is driven by ExecUpdate and ExecDelete and can happen multiple times depending on the concurrency.

Hmm... It can't happen arbitrary number of times. If tuple was
concurrently updated, the we lock it. Once we lock, nobody can change
it until we finish out work. So, I think no changes needed.

I'm going to push this if no objections.

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
0001-Allow-locking-updated-tuples-in-tuple_update-and--v6.patch application/octet-stream 36.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-01-08 22:18:58 Re: Todo: Teach planner to evaluate multiple windows in the optimal order
Previous Message Tom Lane 2023-01-08 20:58:56 Re: on placeholder entries in view rule action query's range table