Re: [HACKERS] WIP: long transactions on hot standby feedback replica / proof of concept

Поиск
Список
Период
Сортировка
От Alex Ignatov
Тема Re: [HACKERS] WIP: long transactions on hot standby feedback replica / proof of concept
Дата
Msg-id 007001d32584$f5a57b10$e0f07130$@postgrespro.ru
обсуждение исходный текст
Ответ на Re: [HACKERS] WIP: long transactions on hot standby feedback replica/ proof of concept  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: [HACKERS] WIP: long transactions on hot standby feedback replica/ proof of concept  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Список pgsql-hackers

-----Original Message-----
From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Amit Kapila
Sent: Monday, September 4, 2017 3:32 PM
To: i.kartyshov@postgrespro.ru
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] WIP: long transactions on hot standby feedback replica / proof of concept

On Mon, Sep 4, 2017 at 4:34 PM,  <i.kartyshov@postgrespro.ru> wrote:
> Our clients complain about this issue and therefore I want to raise
> the discussion and suggest several solutions to this problem:
>
> I. Why does PG use Fatal when Error is enough to release lock that
> rises lock conflict?
> "If (RecoveryConflictPending && DoingCommandRead)"
>
> II. Do we really need to truncate the table on hot standby exactly at
> the same time when truncate on master occurs?
>
> In my case conflict happens when the autovacuum truncates table tbl1
> on master while backend on replica is performing a long transaction
> involving the same table tbl1. This happens because truncate takes an
> AccessExclusiveLock. To tackle this issue we have several options:
>
> 1. We can postpone the truncate on the master until all the replicas
> have finished their transactions (in this case, feedback requests to
> the master should be sent frequently) Patch 1
> vacuum_lazy_truncate.patch
>
> 2. Maybe there is an option somehow not to send AccessExclusiveLock
> and not to truncate table on the replica right away. We could try to
> wait a little and truncate tbl1 on replica again.
>

Can max_standby_streaming_delay help in this situation (point number - 2)?


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


Hello!
In this situation this parameter (max_standby_streaming_delay) wont help because if you have subsequent statement on
standby(following info is from documentation and from our experience ): Thus, if one query has resulted in significant
delay,subsequent conflicting queries will have much less grace time until the standby server has caught up again. And
younever now how to set this parameter exept to -1 which mean up to infinity delayed standby.  

On our experience only autovacuum on master took AccesExclusiveLock that raise this Fatal message on standby. After
thisAccessExclusive reached standby and max_standby_streaming_delay > -1 you definitely sooner or later  get this Fatal
onrecovery .  
With this patch we try to get rid of AccessEclusiveLock applied on standby while we have active statement on it.



--
Alex Ignatov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers




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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] obsolete code in pg_upgrade
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] pgbench tap tests & minor fixes.