Re: postgresql 9.6 - cannot freeze committed xmax

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Alexandre Garcia <alexandre(at)vmfarms(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: postgresql 9.6 - cannot freeze committed xmax
Date: 2018-02-28 23:49:44
Message-ID: 20180228234944.hjastb2mqr7rdnw5@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)alvh(dot)no-ip(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Rui DeSousa 2018-03-01 01:10:59 Re: Reliable WAL file shipping over unreliable network
Previous Message Alvaro Herrera 2018-02-28 23:30:19 Re: postgresql 9.6 - cannot freeze committed xmax