Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Alexander Lakhin <exclusion@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2021-11-11T03:16:41Z
Lists: pgsql-bugs
Hi, On 2021-11-10 18:40:13 -0800, Peter Geoghegan wrote: > On Wed, Nov 10, 2021 at 6:16 PM Andres Freund <andres@anarazel.de> wrote: > > Hm. To me all of this is more general than vacuum[lazy].c. Or even than > > anything heap related. > > Here is a sensible compromise: put most of what you want to say > wherever (I guess procarray.c), and then move the vacuumlazy.c call to > GlobalVisTestFor() back, so that it comes immediately after the > vacuum_set_xid_limits() call. Then place a few breadcrumb comments > that reference the place in procarray.c that has the real discussion. I don't really think it's a good idea to move it to earlier. If anything I would want to move it later (and eventually occasionally re-compute it, that'd be a *huge* win for longrunning vacuums). We can't really do the same with the hard horizons. It's currently super likely that the horizon moves forward a lot between vacuum_set_xid_limits() and GlobalVisTestFor(), but moving it closer still is going in the wrong direction. So I'm inclined to add a comment saying that we need to do the GlobalVisTestFor(), pointing to the comment in ComputeXidHorizons(), and adding a TODO that we should find a heuristic when to recompute horizons? > We could probably *also* freeze tuples opportunistically (e.g., freeze > a few tuples on a page early to be able to mark it all-frozen sooner), We should definitely do that when a page is already being dirtied for other reasons. Greetings, Andres Freund
Commits
-
vacuumlazy.c: Standardize rel_pages terminology.
- e370f100f05d 15.0 landed
-
vacuumlazy.c: document vistest and OldestXmin.
- 73f6ec3d3c8d 15.0 landed
-
heap pruning: Only call BufferGetBlockNumber() once.
- c702d656a283 15.0 landed
-
Fix possible HOT corruption when RECENTLY_DEAD changes to DEAD while pruning.
- dad1539aec28 14.2 landed
- 18b87b201f73 15.0 landed
-
Assert redirect pointers are sensible after heap_page_prune().
- bb42bfb5ccb5 15.0 landed
-
Remove tupgone special case from vacuumlazy.c.
- 8523492d4e34 14.0 cited
-
Recycle nbtree pages deleted during same VACUUM.
- 9dd963ae2534 14.0 cited
-
snapshot scalability: Don't compute global horizons while building snapshots.
- dc7420c2c927 14.0 cited
-
Refactor heap_page_prune so that instead of changing item states on-the-fly,
- 6f10eb21118f 8.4.0 cited