Re: [HACKERS] Restrict concurrent update/delete with UPDATE ofpartition key - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [HACKERS] Restrict concurrent update/delete with UPDATE ofpartition key
Date
Msg-id 20180407201959.76zbie3m5ay6o3u5@alap3.anarazel.de
Whole thread Raw
In response to Re: [HACKERS] Restrict concurrent update/delete with UPDATE ofpartition key  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On 2018-04-06 09:41:07 +0530, Amit Kapila wrote:
> >> Won't the same question applies to the similar usage in
> >> EvalPlanQualFetch and heap_lock_updated_tuple_rec.
> >
> > I don't think so?
> >
> >
> >> In EvalPlanQualFetch, we consider such a tuple to be deleted and will
> >> silently miss/skip it which seems contradictory to the places where we
> >> have detected such a situation and raised an error.
> >
> > if (ItemPointerIndicatesMovedPartitions(&hufd.ctid))
> >         ereport(ERROR,
> >                         (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> >                          errmsg("tuple to be locked was already moved to another partition due to concurrent
update")));
> >
> >
> 
> I was talking about the case when the tuple version is not visible aka
> the below code:

> I think if we return an error in EvalPlanQualFetch at the place
> mentioned above, the behavior will be sane.

I think you're right. I've adapted the code, added a bunch of tests.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: WIP: Covering + unique indexes.
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] Restrict concurrent update/delete with UPDATE ofpartition key