From: | amul sul <sulamul(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] Restrict concurrent update/delete with UPDATE of partition key |
Date: | 2017-11-29 09:55:47 |
Message-ID: | CAAJ_b95Nc72DGGJk-_RBeNLq5P0OFQz+pMR4Z_xBDNbwy8kj3w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Nov 29, 2017 at 7:51 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Tue, Nov 28, 2017 at 5:58 PM, amul sul <sulamul(at)gmail(dot)com> wrote:
>> On Sat, Nov 25, 2017 at 11:39 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>> On Thu, Nov 23, 2017 at 5:18 PM, amul sul <sulamul(at)gmail(dot)com> wrote:
>>>> On Sat, Nov 11, 2017 at 1:05 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>>>> On Wed, Sep 27, 2017 at 7:07 AM, amul sul <sulamul(at)gmail(dot)com> wrote:
>>>>>>
>> [...]
>>> Few comments:
>>>
>> Thanks for looking at the patch, please find my comments inline:
>>
>>> 1.
>>> @@ -1480,6 +1493,10 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
>>> ereport(ERROR,
>>> (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
>>> errmsg("could not serialize access due to concurrent update")));
>>> + if (!BlockNumberIsValid(BlockIdGetBlockNumber(&((hufd.ctid).ip_blkid))))
>>> + ereport(ERROR,
>>> + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
>>> + errmsg("tuple to be updated was already moved to an another
>>> partition due to concurrent update")));
>>>
>>> Why do you think we need this check in the OnConflictUpdate path? I
>>> think we don't it here because we are going to relinquish this version
>>> of the tuple and will start again and might fetch some other row
>>> version. Also, we don't support Insert .. On Conflict Update with
>>> partitioned tables, see[1], which is also an indication that at the
>>> very least we don't need it now.
>>>
>> Agreed, even though this case will never going to be anytime soon
>> shouldn't we have a check for invalid block id? IMHO, we should have
>> this check and error report or assert, thoughts?
>>
>
> I feel adding code which can't be hit (even if it is error handling)
> is not a good idea. I think having an Assert should be okay, but
> please write comments to explain the reason for adding an Assert.
>
Agree, updated in the attached patch. Patch 0001 also includes your
previous review comment[1] and typo correction suggested by Alvaro[2].
Patch 0002 still missing tests for EvalPlanQualFetch() function. I think we
could skip that because direct/indirect callers of EvalPlanQualFetch() are
GetTupleForTrigger, ExecDelete, ExecUpdate & ExecLockRows got the required test
coverage in the attached patch.
1] https://postgr.es/m/CAA4eK1LQS6TmsGaEwR9HgF-9TZTHxrdAELuX6wOZBDbbjOfDjQ@mail.gmail.com
2] https://postgr.es/m/20171124160756.eyljpmpfzwd6jmnr@alvherre.pgsql
Regards,
Amul
Attachment | Content-Type | Size |
---|---|---|
0002-isolation-tests-v2.patch | application/octet-stream | 8.8 KB |
0001-Invalidate-ip_blkid-v3.patch | application/octet-stream | 11.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2017-11-29 10:00:17 | Re: [HACKERS] postgres_fdw super user checks |
Previous Message | Fabien COELHO | 2017-11-29 08:40:29 | Re: PATCH: pgbench - option to build using ppoll() for larger connection counts |