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

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Mason Sharp <masonlists(at)gmail(dot)com>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: POC: Lock updated tuples in tuple_update() and tuple_delete()
Date: 2023-01-09 09:56:12
Message-ID: CAJ7c6TNvAvGnyYgfn8=mx0=y8mZ0bwdkT60mnvsHBHiQmwgmTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alexander,

> I'm going to push this if no objections.

I took a fresh look at the patch and it LGTM. I only did a few
cosmetic changes, PFA v7.

Changes since v6 are:

```
@@ -318,12 +318,12 @@ heapam_tuple_delete(Relation relation,
ItemPointer tid, CommandId cid,
result = heap_delete(relation, tid, cid, crosscheck, wait, tmfd,
changingPart);

/*
- * 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.
+ * If lockUpdated is true and the tuple has been concurrently updated, get
+ * the lock immediately so that on retry we will succeed.
*/
if (result == TM_Updated && lockUpdated)
{
+ Assert(lockedSlot != NULL);
```

... and the same for heapam_tuple_update().

--
Best regards,
Aleksander Alekseev

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2023-01-09 09:58:11 Re: [PATCH] Simple code cleanup in tuplesort.c.
Previous Message Shinoda, Noriyoshi (PN Japan FSIP) 2023-01-09 09:32:01 RE: Perform streaming logical transactions by background workers and parallel apply