Re: snapshot too old issues, first around wraparound and then more.
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@bowt.ie>, Robert Haas <robertmhaas@gmail.com>, Kevin Grittner <kgrittn@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-04-02T01:46:46Z
Lists: pgsql-hackers
Hi, On 2020-04-01 17:54:06 -0700, Andres Freund wrote: > * Check whether the given snapshot is too old to have safely read the given > * page from the given table. If so, throw a "snapshot too old" error. > * > * This test generally needs to be performed after every BufferGetPage() call > * that is executed as part of a scan. It is not needed for calls made for > * modifying the page (for example, to position to the right place to insert a > * new index tuple or for vacuuming). It may also be omitted where calls to > * lower-level functions will have already performed the test. To me this sounds like we'd not need to check for an old snapshot in heap_delete/update/lock_tuple. And they were explictly not testing for old snapshots. But I don't understand why that'd be correct? In a lot of UPDATE/DELETE queries there's no danger that the target tuple will be pruned away, because the underlying scan node will hold a pin. But I don't think that's guaranteed. E.g. if a tidscan is below the ModifyTable node, it will not hold a pin by the time we heap_update, because there's no scan holding a pin, and the slot will have been materialized before updating. There are number of other ways, I think. So it's possible to get to heap_update/delete (and probably lock_tuple as well) with a tid that's already been pruned away. Neither contains a non-assert check ensuring the tid still is normal. With assertions we'd fail with an assertion in PageGetItem(). But without it looks like we'll interpret the page header as a tuple. Which can't be good. Greetings, Andres Freund
Commits
-
Remove the "snapshot too old" feature.
- f691f5b80a85 17.0 landed
-
Improve timeout.c's handling of repeated timeout set/cancel.
- 09cf1d522676 14.0 cited
-
Fix two bugs in MaintainOldSnapshotTimeMapping.
- 55b7e2f4d78d 14.0 cited