Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: "Wood, Dan" <hexpert@amazon.com>, Peter Geoghegan <pg@bowt.ie>, pgsql-committers@postgresql.org, "Wong, Yi Wen" <yiwong@amazon.com>, Michael Paquier <michael.paquier@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2017-12-15T02:30:59Z
Lists: pgsql-hackers
On 2017-12-14 17:00:29 -0800, Andres Freund wrote: > Hi, > > On 2017-11-13 19:03:41 -0800, Andres Freund wrote: > > diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c > > index f93c194e182..7d163c91379 100644 > > --- a/src/backend/access/heap/rewriteheap.c > > +++ b/src/backend/access/heap/rewriteheap.c > > @@ -407,7 +407,10 @@ rewrite_heap_tuple(RewriteState state, > > * While we have our hands on the tuple, we may as well freeze any > > * eligible xmin or xmax, so that future VACUUM effort can be saved. > > */ > > - heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid, > > + heap_freeze_tuple(new_tuple->t_data, > > + state->rs_old_rel->rd_rel->relfrozenxid, > > + state->rs_old_rel->rd_rel->relminmxid, > > + state->rs_freeze_xid, > > state->rs_cutoff_multi); > > Hm. So this requires backpatching the introduction of > RewriteStateData->rs_old_rel into 9.3, which in turn requires a new > argument to begin_heap_rewrite(). It originally was added in the > logical decoding commit (i.e. 9.4). > > I'm fine with that, but it could theoretically cause issues for somebody > with an extension that calls begin_heap_rewrite() - which seems unlikely > and I couldn't find any that does so. > > Does anybody have a problem with that? Pushed this way. Moved some more relfrozenxid/relminmxid tests outside of the cutoff changes, polished some error messages. Alvaro, Michael, Peter, and everyone else I'd greatly appreciate if you could have a look at the backported version, just about everything but v10 had conflicts, some of them not insubstantial. Greetings, Andres Freund
Commits
-
Backport addition of rs_old_rel to rewriteheap's state.
- 152a56905658 9.3.21 landed
-
Perform a lot more sanity checks when freezing tuples.
- ed8e1aff6ace 9.4.16 landed
- d3044f8b0732 10.2 landed
- 986a9153b970 9.6.7 landed
- 94d1c88103ff 9.5.11 landed
- 4800f16a7ad0 9.3.21 landed
- 699bf7d05c68 11.0 landed
-
Revert bogus fixes of HOT-freezing bug
- c6764eb3aea6 11.0 landed
- f05ae2fa94b4 9.3.20 landed
- ef0339ee5dcf 9.4.15 landed
- b3888b60d3f0 9.5.10 landed
- 7a95966bc03c 10.1 landed
- 08ba67d596a1 9.6.6 landed
-
Fix traversal of half-frozen update chains
- a5736bf754c8 11.0 landed
- fc0df3bdafd6 9.5.10 landed
- d441cff14249 9.6.6 landed
- b052d524ca71 9.3.20 landed
- 8b6d85f2dc1e 9.4.15 landed
- 22576734b805 10.1 landed
-
Fix freezing of a dead HOT-updated tuple
- 46c35116ae1a 10.0 cited
- 20b655224249 11.0 cited
-
During index build, check and elog (not just Assert) for broken HOT chain.
- d70cf811f7dd 9.4.0 cited
-
Fix WAL replay of locking an updated tuple
- 6bfa88acd3df 9.4.0 cited
-
Change the way we mark tuples as frozen.
- 37484ad2aace 9.4.0 cited