Re: [HACKERS] Restrict concurrent update/delete with UPDATE of partition key

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: amul sul <sulamul(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Restrict concurrent update/delete with UPDATE of partition key
Date: 2018-02-07 11:41:46
Message-ID: CAA4eK1+HopDbA3h0oYXE1kuhsU0rLT-hONeeS0SoG36YpeSnGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 3, 2018 at 4:04 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, Jan 26, 2018 at 1:28 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> So, this means that in case of logical replication, it won't generate
>> the error this patch is trying to introduce. I think if we want to
>> handle this we need some changes in WAL and logical decoding as well.
>>
>> Robert, others, what do you think? I am not very comfortable leaving
>> this unaddressed, if we don't want to do anything about it, at least
>> we should document it.
>
> As I said on the other thread, I'm not sure how reasonable it really
> is to try to do anything about this. For both the issue you raised
> there, I think we'd need to introduce a new WAL record type that
> represents a delete from one table and an insert to another that
> should be considered as a single operation.
>

I think to solve the issue in this thread, a flag should be sufficient
that can be used in logical replication InvalidBlockNumber in CTID for
Deletes.

> I'm not keen on that idea,
> but you can make an argument that it's the Right Thing To Do. I would
> be more inclined, at least for v11, to just document that the
> delete+insert will be replayed separately on replicas.
>

Even if we do what you are suggesting, we need something in WAL
(probably a flag to indicate this special type of Delete), otherwise,
wal consistency checker will fail. Another idea would be to mask the
ctid change so that wal consistency checker doesn't cry.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2018-02-07 11:58:36 Re: In logical replication concurrent update of partition key creates a duplicate record on standby.
Previous Message Metin Doslu 2018-02-07 11:32:12 Re: Add PGDLLIMPORT to enable_hashagg