Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Andres Freund <andres@anarazel.de>
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: 2022-03-04T03:31:32Z
Lists: pgsql-bugs
Attachments
- v5-0001-Make-heap-pruning-more-robust.patch (application/octet-stream) patch v5-0001
On Thu, Mar 3, 2022 at 4:22 PM Peter Geoghegan <pg@bowt.ie> wrote: > Following up on this now (will follow up on the "harden pruning" patch > separately). Attached is a new revision of my fix. This is more or less a combination of my v4 fix from November 12 [1] and Andres' already-committed fix (commit 18b87b20), rebased on top of HEAD. This patch was originally a bugfix, but now it's technically just refactoring/hardening of the logic in pruneheap.c. It hasn't changed all that much, though. We're still doing an up-front scan of the heap page to precalculate HTSV for each tuple (no change from commit 18b87b20), but we no longer do that on correctness grounds. It is purely a performance thing now. Note that I am making a working assumption that that still makes sense for now (I think that it probably does, but I haven't yet verified it for myself). We now do "3 passes" over the page. The first is the aforementioned "precalculate HTSV" pass, the second is for determining the extent of HOT chains, and the third is for any remaining disconnected/orphaned HOT chains. I suppose that that's okay, since the amount of work has hardly increased in proportion to this "extra pass over the page". Not 100% sure about everything myself right now, though. I guess that "3 passes" might be considered excessive. [1] https://postgr.es/m/CAH2-WzmNk6V6tqzuuabxoxM8HJRaWU6h12toaS-bqYcLiht16A@mail.gmail.com -- Peter Geoghegan
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