|From:||Andres Freund <andres(at)anarazel(dot)de>|
|To:||pgsql-hackers(at)postgresql(dot)org, Kevin Grittner <kgrittn(at)gmail(dot)com>|
|Subject:||TestForOldSnapshot() seems to be in the wrong place|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Currently TestForOldSnapshot() is defined as
extern void TestForOldSnapshot_impl(Snapshot snapshot, Relation relation);
* 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.
* Note that a NULL snapshot argument is allowed and causes a fast return
* without error; this is to support call sites which can be called from
* either scans or index modification areas.
* For best performance, keep the tests that are fastest and/or most likely to
* exclude a page from old snapshot testing near the front.
static inline void
TestForOldSnapshot(Snapshot snapshot, Relation relation, Page page)
Assert(relation != NULL);
if (old_snapshot_threshold >= 0
&& (snapshot) != NULL
&& ((snapshot)->satisfies == HeapTupleSatisfiesMVCC
|| (snapshot)->satisfies == HeapTupleSatisfiesToast)
&& PageGetLSN(page) > (snapshot)->lsn)
to me it seems wrong from a layering POV to have this in
bufmgr.[ch]. Due to the inline functions this makes bufmgr.h have a
dependency on snapmgr.h and tqual.h, which to me seems wrong from a
layer POV. Why isn't this declared in snapmgr.h or a new header file?
|Next Messageemail@example.com||2019-01-18 21:23:30||Re: Protect syscache from bloating with negative cache entries|
|Previous Message||Tom Lane||2019-01-18 20:57:17||Re: Protect syscache from bloating with negative cache entries|