Re: [HACKERS] BUG #13473: VACUUM FREEZE mistakenly cancel standby sessions

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>
Cc: pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] BUG #13473: VACUUM FREEZE mistakenly cancel standby sessions
Date: 2016-05-25 23:30:00
Message-ID: 20160525233000.GA634903@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Marco Nenciarini wrote:

> diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
> index eb8eada..434880a 100644
> --- a/src/backend/access/heap/heapam.c
> +++ b/src/backend/access/heap/heapam.c
> @@ -4764,7 +4764,13 @@ heap_xlog_freeze(XLogRecPtr lsn, XLogRecord *record)
> * consider the frozen xids as running.
> */
> if (InHotStandby)
> - ResolveRecoveryConflictWithSnapshot(cutoff_xid, xlrec->node);
> + {
> + TransactionId latestRemovedXid = cutoff_xid;
> +
> + TransactionIdRetreat(latestRemovedXid);
> +
> + ResolveRecoveryConflictWithSnapshot(latestRemovedXid, xlrec->node);
> + }
>
> /* If we have a full-page image, restore it and we're done */
> if (record->xl_info & XLR_BKP_BLOCK(0))

Actually, in 9.3 there's a heap_xlog_freeze routine and a separate
heap_xlog_freeze_page routine; see commit 8e9a16ab8f7f. Applying this
patch to that branch leaves heap_xlog_freeze itself unmodified, and only
heap_xlog_freeze_page is updated. I think this is pretty much harmless,
as the older routine would only be called by a standby running a minor
version earlier than that commit, which has its own set of much more
serious bugs. But I think the safest route is to patch them both, so
I'm going to do that.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Бутрин Денис 2016-05-26 13:07:10 postgresql dublicate content of primary key column
Previous Message Marco Nenciarini 2016-05-25 17:33:12 Re: [HACKERS] BUG #13473: VACUUM FREEZE mistakenly cancel standby sessions

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-05-26 00:13:15 Re: pg_bsd_indent - improvements around offsetof and sizeof
Previous Message Tom Lane 2016-05-25 22:32:38 Re: pg_bsd_indent - improvements around offsetof and sizeof