Re: PANIC: wrong buffer passed to visibilitymap_clear
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Andres Freund <andres@anarazel.de>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-04-12T16:19:48Z
Lists: pgsql-hackers
Attachments
- fix-missed-visibility-map-pins.patch (text/x-diff) patch
Peter Geoghegan <pg@bowt.ie> writes: > On Sun, Apr 11, 2021 at 11:16 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> It wasn't very clear, because I hadn't thought it through very much; >> but what I'm imagining is that we discard most of the thrashing around >> all-visible rechecks and have just one such test somewhere very late >> in heap_update, after we've successfully acquired a target buffer for >> the update and are no longer going to possibly need to release any >> buffer lock. If at that one point we see the page is all-visible >> and we don't have the vmbuffer, then we have to release all our locks >> and go back to "l2". Which is less efficient than some of the existing >> code paths, but given how hard this problem is to reproduce, it seems >> clear that optimizing for the occurrence is just not worth it. > Oh! That sounds way better. After poking at this for awhile, it seems like it won't work very nicely. The problem is that once we've invoked the toaster, we really don't want to just abandon that work; we'd leak any toasted out-of-line data that was created. So I think we have to stick with the current basic design, and just tighten things up to make sure that visibility pins are accounted for in the places that are missing it. Hence, I propose the attached. It passes check-world, but that proves absolutely nothing of course :-(. I wonder if there is any way to exercise these code paths deterministically. (I have realized BTW that I was exceedingly fortunate to reproduce the buildfarm report here --- I have run hundreds of additional cycles of the same test scenario without getting a second failure.) regards, tom lane
Commits
-
Avoid improbable PANIC during heap_update.
- 5f12bc94dcc6 12.7 landed
- 37e76546a2ba 13.3 landed
- 34f581c39e97 14.0 landed
-
Refactor lazy_scan_heap() loop.
- 7ab96cf6b312 14.0 cited