Re: In logical replication concurrent update of partition key createsa duplicate record on standby.

Поиск
Список
Период
Сортировка
От Amit Khandekar
Тема Re: In logical replication concurrent update of partition key createsa duplicate record on standby.
Дата
Msg-id CAJ3gD9cm94Pxo6_CZyyF0hwNSH_7cHUOq1N7a-g9-uNEF4BPRg@mail.gmail.com
обсуждение исходный текст
Ответ на In logical replication concurrent update of partition key creates aduplicate record on standby.  (amul sul <sulamul@gmail.com>)
Ответы Re: In logical replication concurrent update of partition key createsa duplicate record on standby.
Re: In logical replication concurrent update of partition key createsa duplicate record on standby.
Список pgsql-hackers
On 7 February 2018 at 13:53, amul sul <sulamul@gmail.com> wrote:
> Hi,
>
> If an update of partition key involves tuple movement from one partition to
> another partition then there will be a separate delete on one partition and
> insert on the other partition made.
>
> In the logical replication if an update performed on the master and standby at
> the same moment, then replication worker tries to replicate delete + insert
> operation on standby. While replying master changes on standby for the delete
> operation worker will log "concurrent update, retrying" message (because the
> update on standby has already deleted) and move forward to reply the next
> insert operation. Standby update also did the same delete+insert is as part of
> the update of partition key in a result there will be two records inserted on
> standby.

A quick thinking on how to resolve this makes me wonder if we can
manage to pass some information through logical decoding that the
delete is part of a partition key update. This is analogous to how we
set some information locally in the tuple by setting
tp.t_data->t_ctid.ip_blkid to InvalidBlockNumber.

I guess, at the node 2 where this issue reproduces, this issue can
also be reproduced if there is a non-partition-key UPDATE going on,
and the tuple gets deleted as part of the replaying of partition-key
update ? This UPDATE will skip the update, thinking that the tuple is
deleted. This is similar to what's happening now in case of local
concurrent updates, for which the fix is being worked upon.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavan Deolasee
Дата:
Сообщение: Re: [HACKERS] MERGE SQL Statement for PG11
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: git instructions