pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Alexandre Garcia <alexandre@vmfarms.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: postgresql 9.6 - cannot freeze committed xmax
Date: Wed, 28 Feb 2018 15:49:44 -0800
Message-ID: <20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de> (raw)
In-Reply-To: <20180228233019.qydod7ez3xbgn5ot@alvherre.pgsql>
References: <CAPYLKR4BqAa-FBM6QoEj8OYZXafu9RUEusoecrpo0ZoBxoY4Wg@mail.gmail.com>
	<20180228233019.qydod7ez3xbgn5ot@alvherre.pgsql>

Hi,

On 2018-02-28 20:30:19 -0300, Alvaro Herrera wrote:
> From 4ecaa6cdc041d9f44d54f9d56588ea73c1c6f3c7 Mon Sep 17 00:00:00 2001
> From: Alvaro Herrera <alvherre@alvh.no-ip.org>
> Date: Wed, 28 Feb 2018 20:16:35 -0300
> Subject: [PATCH] Fix freeze xmax bug
> 
> ---
>  src/backend/access/heap/heapam.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
> index 8a846e7dba..dc762f913d 100644
> --- a/src/backend/access/heap/heapam.c
> +++ b/src/backend/access/heap/heapam.c
> @@ -6799,7 +6799,7 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple,
>  			 * independent of committedness, since a committed lock holder has
>  			 * released the lock).
>  			 */
> -			if (!(tuple->t_infomask & HEAP_XMAX_LOCK_ONLY) &&
> +			if (!HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask)
> &&

Good catch.

Wonder if this a big enough fix? Isn't the bug "one layer up"? We
shouldn't do the TransactionIdPrecedes() calls in the surrounding block,
in the first place, right? Right now we could very well hit both
ERROR: found xmax %u from before relfrozenxid %u
and
ERROR: cannot freeze committed xmax %u
and freeze_xmax, totally_frozen will be wrong.  I think that's largely
harmless, but we should fix it nonetheless, and inspect other relevant
sites.

Greetings,

Andres Freund




view thread (16+ messages)  latest in thread

Message-ID: <20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de>
Permalink:  ../20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: andres@anarazel.de, alvherre@alvh.no-ip.org, alexandre@vmfarms.com
  Subject: Re: postgresql 9.6 - cannot freeze committed xmax
  In-Reply-To: <20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de>
  References: <CAPYLKR4BqAa-FBM6QoEj8OYZXafu9RUEusoecrpo0ZoBxoY4Wg@mail.gmail.com> <20180228233019.qydod7ez3xbgn5ot@alvherre.pgsql> <20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox