From: Wong, Yi Wen <yiwong@amazon.com>
To: Peter Geoghegan <pg@bowt.ie>
To: Wood, Dan <hexpert@amazon.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple
Date: Wed, 4 Oct 2017 03:43:00 +0000
Message-ID: <1507088579842.74063@amazon.com> (raw)
In-Reply-To: <CAH2-WzmtGabEF75yg2nW1HqNyx0Tmq2xrcG40hvJ7-OfPKnzQQ@mail.gmail.com>
References: <CAH2-Wznm4rCrhFAiwKPWTpEw2bXDtgROZK7jWWGucXeH3D1fmA@mail.gmail.com>
<20171003164820.lmohsuyf7hygafdq@alvherre.pgsql>
<CAH2-WznBLP5s2fvUuwUyNJC6sSRUDkVCMcXjCuL7nTShqi4jig@mail.gmail.com>
<CAB7nPqQT6hSvL0Tn64QBNXpABcOF1bsGxW4WN+TRZu0GH5PZmA@mail.gmail.com>
<10CE2AE7-B1AC-4E81-BF00-E9EF4BA855EE@amazon.com>
<CAH2-WzmtGabEF75yg2nW1HqNyx0Tmq2xrcG40hvJ7-OfPKnzQQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
My interpretation of README.HOT is the check is just to ensure the chain is continuous; in which case the condition should be:
> if (TransactionIdIsValid(priorXmax) &&
> !TransactionIdEquals(priorXmax, HeapTupleHeaderGetRawXmin(htup)))
> break;
So the difference is GetRawXmin vs GetXmin, because otherwise we get the FreezeId instead of the Xmin when the transaction happened
The interesting consequence of changing that is the prune seems to get the entire chain altogether with Dan's repro... I've run it a couple of times and have consistently gotten the following page
lp | t_ctid | lp_off | lp_flags | t_infomask | t_infomask2
----+--------+--------+----------+------------+-------------
1 | (0,1) | 8152 | 1 | 2818 | 3
2 | | 7 | 2 | |
3 | | 0 | 0 | |
4 | | 0 | 0 | |
5 | | 0 | 0 | |
6 | | 0 | 0 | |
7 | (0,7) | 8112 | 1 | 11010 | 32771
(7 rows)
I've made this change to conditions in both heap_prune_chain and heap_get_root_tuples and this seems to cause things to pass my smoke tests.
I'll look into this deeper tomorrow.
Yi Wen
________________________________________
From: Peter Geoghegan <pg@bowt.ie>
Sent: Tuesday, October 3, 2017 6:19 PM
To: Wood, Dan
Cc: Michael Paquier; Alvaro Herrera; PostgreSQL Hackers; Wong, Yi Wen
Subject: Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple
On Tue, Oct 3, 2017 at 6:09 PM, Wood, Dan <hexpert@amazon.com> wrote:
> I’ve just started looking at this again after a few weeks break.
> if (TransactionIdIsValid(priorXmax) &&
> !TransactionIdEquals(priorXmax, HeapTupleHeaderGetXmin(htup)))
> break;
> We need to understand why these TXID equal checks exist. Can we differentiate the cases they are protecting against with the two exceptions I’ve found?
I haven't read your remarks here in full, since I'm about to stop
working for the day, but I will point out that
src/backend/access/heap/README.HOT says a fair amount about this,
under "Abort Cases".
--
Peter Geoghegan
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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-committers@postgresql.org
Cc: yiwong@amazon.com, pg@bowt.ie, hexpert@amazon.com, michael.paquier@gmail.com, alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple
In-Reply-To: <1507088579842.74063@amazon.com>
References: <CAH2-Wznm4rCrhFAiwKPWTpEw2bXDtgROZK7jWWGucXeH3D1fmA@mail.gmail.com> <20171003164820.lmohsuyf7hygafdq@alvherre.pgsql> <CAH2-WznBLP5s2fvUuwUyNJC6sSRUDkVCMcXjCuL7nTShqi4jig@mail.gmail.com> <CAB7nPqQT6hSvL0Tn64QBNXpABcOF1bsGxW4WN+TRZu0GH5PZmA@mail.gmail.com> <10CE2AE7-B1AC-4E81-BF00-E9EF4BA855EE@amazon.com> <CAH2-WzmtGabEF75yg2nW1HqNyx0Tmq2xrcG40hvJ7-OfPKnzQQ@mail.gmail.com> <1507088579842.74063@amazon.com>
* 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