diff options
Diffstat (limited to 'src/include/storage/bufmgr.h')
-rw-r--r-- | src/include/storage/bufmgr.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 7d57c048714..4c15934f36b 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -14,11 +14,14 @@ #ifndef BUFMGR_H #define BUFMGR_H +#include "catalog/catalog.h" #include "storage/block.h" #include "storage/buf.h" #include "storage/bufpage.h" #include "storage/relfilenode.h" #include "utils/relcache.h" +#include "utils/snapmgr.h" +#include "utils/tqual.h" typedef void *Block; @@ -45,6 +48,19 @@ typedef enum * replay; otherwise same as RBM_NORMAL */ } ReadBufferMode; +/* + * Forced choice for whether BufferGetPage() must check snapshot age + * + * A scan must test for old snapshot, unless the test would be redundant (for + * example, to tests already made at a lower level on all code paths). + * Positioning for DML or vacuuming does not need this sort of test. + */ +typedef enum +{ + BGP_NO_SNAPSHOT_TEST, /* Not used for scan, or is redundant */ + BGP_TEST_FOR_OLD_SNAPSHOT /* Test for old snapshot is needed */ +} BufferGetPageAgeTest; + /* forward declared, to avoid having to expose buf_internals.h here */ struct WritebackContext; @@ -165,7 +181,11 @@ extern PGDLLIMPORT int32 *LocalRefCount; * BufferGetPage * Returns the page associated with a buffer. */ -#define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer)) +#define BufferGetPage(buffer, snapshot, relation, agetest) \ +( \ + AssertMacro((agetest) == BGP_NO_SNAPSHOT_TEST), \ + ((Page)BufferGetBlock(buffer)) \ +) /* * prototypes for functions in bufmgr.c @@ -233,6 +253,8 @@ extern bool BgBufferSync(struct WritebackContext *wb_context); extern void AtProcExit_LocalBuffers(void); +extern Page TestForOldSnapshot(Snapshot snapshot, Relation relation, Page page); + /* in freelist.c */ extern BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype); extern void FreeAccessStrategy(BufferAccessStrategy strategy); |