mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 05:46:52 +03:00
Assert in init_toast_snapshot() that some snapshot registered or active.
Commit <FIXME> fixed the bug that RemoveTempRelationsCallback() did not push/register a snapshot. That only went unnoticed because often a valid catalog snapshot exists and is returned by GetOldestSnapshot(). But due to invalidation processing that is not reliable. Thus assert in init_toast_snapshot() that there is a registered or active snapshot, using the new HaveRegisteredOrActiveSnapshot(). Author: Andres Freund Discussion: https://postgr.es/m/20220219180002.6tubjq7iw7m52bgd@alap3.anarazel.de
This commit is contained in:
@@ -660,5 +660,14 @@ init_toast_snapshot(Snapshot toast_snapshot)
|
||||
if (snapshot == NULL)
|
||||
elog(ERROR, "cannot fetch toast data without an active snapshot");
|
||||
|
||||
/*
|
||||
* Catalog snapshots can be returned by GetOldestSnapshot() even if not
|
||||
* registered or active. That easily hides bugs around not having a
|
||||
* snapshot set up - most of the time there is a valid catalog
|
||||
* snapshot. So additionally insist that the current snapshot is
|
||||
* registered or active.
|
||||
*/
|
||||
Assert(HaveRegisteredOrActiveSnapshot());
|
||||
|
||||
InitToastSnapshot(*toast_snapshot, snapshot->lsn, snapshot->whenTaken);
|
||||
}
|
||||
|
Reference in New Issue
Block a user