aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistbuild.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-02-21 08:57:34 -0800
committerAndres Freund <andres@anarazel.de>2022-02-21 08:57:34 -0800
commit7c38ef2a5d6cf6d8dc3834399d7a1c364d64ce64 (patch)
tree2f1019286cd68771c5708ee02e7798b49bd46d4f /src/backend/access/gist/gistbuild.c
parent27b02e070fd1b6622b10937d9346b65ffacbc351 (diff)
downloadpostgresql-7c38ef2a5d6cf6d8dc3834399d7a1c364d64ce64.tar.gz
postgresql-7c38ef2a5d6cf6d8dc3834399d7a1c364d64ce64.zip
Fix temporary object cleanup failing due to toast access without snapshot.
When cleaning up temporary objects during process exit the cleanup could fail with: FATAL: cannot fetch toast data without an active snapshot The bug is caused by RemoveTempRelationsCallback() not setting up a snapshot. If an object with toasted catalog data needs to be cleaned up, init_toast_snapshot() could fail with the above error. Most of the time however the the problem is masked due to cached catalog snapshots being returned by GetOldestSnapshot(). But dropping an object can cause catalog invalidations to be emitted. If no further catalog accesses are necessary between the invalidation processing and the next toast datum deletion, the bug becomes visible. It's easy to miss this bug because it typically happens after clients disconnect and the FATAL error just ends up in the log. Luckily temporary table cleanup at the next use of the same temporary schema or during DISCARD ALL does not have the same problem. Fix the bug by pushing a snapshot in RemoveTempRelationsCallback(). Also add isolation tests for temporary object cleanup, including objects with toasted catalog data. A future HEAD only commit will add an assertion trying to make this more visible. Reported-By: Miles Delahunty Author: Andres Freund Discussion: https://postgr.es/m/CAOFAq3BU5Mf2TTvu8D9n_ZOoFAeQswuzk7yziAb7xuw_qyw5gw@mail.gmail.com Backpatch: 10-
Diffstat (limited to 'src/backend/access/gist/gistbuild.c')
0 files changed, 0 insertions, 0 deletions