Re: pgsql: Fix freezing of a dead HOT-updated tuple

Peter Geoghegan <pg@bowt.ie>

From: Peter Geoghegan <pg@bowt.ie>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-committers <pgsql-committers@postgresql.org>, "Wood, Dan" <hexpert@amazon.com>
Date: 2017-09-28T18:34:35Z
Lists: pgsql-hackers
On Thu, Sep 28, 2017 at 7:47 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Fix freezing of a dead HOT-updated tuple

If I run Dan Wood's test case again, the obvious symptom (spurious
duplicates) goes away. However, the enhanced amcheck, and thus CREATE
INDEX/REINDEX, still isn't happy about this:

postgres=# select bt_index_check('t_pkey', true);
DEBUG:  00000: verifying presence of required tuples in index "t_pkey"
LOCATION:  bt_check_every_level, verify_nbtree.c:424
ERROR:  XX000: failed to find parent tuple for heap-only tuple at
(0,6) in table "t"
LOCATION:  IndexBuildHeapRangeScan, index.c:2597
Time: 3.699 ms

-- 
Peter Geoghegan


Commits

  1. Backport addition of rs_old_rel to rewriteheap's state.

  2. Perform a lot more sanity checks when freezing tuples.

  3. Revert bogus fixes of HOT-freezing bug

  4. Fix traversal of half-frozen update chains

  5. Fix freezing of a dead HOT-updated tuple

  6. During index build, check and elog (not just Assert) for broken HOT chain.

  7. Fix WAL replay of locking an updated tuple

  8. Change the way we mark tuples as frozen.