[HACKERS] Re: Potential hot-standby bug around xacts committed but inxl_running_xacts

Поиск
Список
Период
Сортировка
От Andres Freund
Тема [HACKERS] Re: Potential hot-standby bug around xacts committed but inxl_running_xacts
Дата
Msg-id 20170502160618.gdh2cgn5mgbh5mjr@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [HACKERS] Potential hot-standby bug around xacts committed but in xl_running_xacts  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: [HACKERS] Potential hot-standby bug around xacts committed but in xl_running_xacts  (Simon Riggs <simon@2ndquadrant.com>)
Список pgsql-hackers
On 2017-05-02 07:12:41 +0200, Simon Riggs wrote:
> /*
>  * The running-xacts snapshot can contain xids that were still visible
>  * in the procarray when the snapshot was taken, but were already
>  * WAL-logged as completed. They're not running anymore, so ignore
>  * them.
>  */
>  if (TransactionIdDidCommit(xid) || TransactionIdDidAbort(xid))
>          continue;

Ah, right.   Phew ;)


> What I suggest is that with logical decoding in mind we do this
> 1. Inject a new record XLOG_SNAPSHOT_START at the start of
> LogStandbySnapshot(). We start logical decoding from there.
> 2. Record any transactions that end
> 3. Now the full XLOG_RUNNING_XACTS record arrives. We apply all xacts
> that are seen as running, minus any ended between 1 and 3

> This avoids the problems for the race but without holding locks while
> we log XLOG_RUNNING_XACTS, something that was considered painful for
> Hot Standby.

I don't think that really solves it, because other transactions could
just be stuck just after the XLogInsert() forever.  And it'd have the
issue of having to backpatch a new record.  I'm working on an
alternative approach, let's hope that that works out.

- Andres



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

Предыдущее
От: Rahila Syed
Дата:
Сообщение: Re: [HACKERS] Adding support for Default partition in partitioning
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] logical replication syntax (was DROP SUBSCRIPTION,query cancellations and slot handling)