aboutsummaryrefslogtreecommitdiff
path: root/src/include/storage/bufmgr.h
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2020-04-08 13:36:45 +1200
committerThomas Munro <tmunro@postgresql.org>2020-04-08 14:56:57 +1200
commit3985b600f57d75b9743d86430cb5c21370057a23 (patch)
treef367f4511386eeacf127a8e8b25afc9f8ea46101 /src/include/storage/bufmgr.h
parent981643dcdb70b6ce70d8a08417f71f465f236cb5 (diff)
downloadpostgresql-3985b600f57d75b9743d86430cb5c21370057a23.tar.gz
postgresql-3985b600f57d75b9743d86430cb5c21370057a23.zip
Support PrefetchBuffer() in recovery.
Provide PrefetchSharedBuffer(), a variant that takes SMgrRelation, for use in recovery. Rename LocalPrefetchBuffer() to PrefetchLocalBuffer() for consistency. Add a return value to all of these. In recovery, tolerate and report missing files, so we can handle relations unlinked before crash recovery began. Also report cache hits and misses, so that callers can do faster buffer lookups and better I/O accounting. Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com
Diffstat (limited to 'src/include/storage/bufmgr.h')
-rw-r--r--src/include/storage/bufmgr.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index bf3b12a2de3..ee91b8fa26c 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -46,6 +46,15 @@ typedef enum
* replay; otherwise same as RBM_NORMAL */
} ReadBufferMode;
+/*
+ * Type returned by PrefetchBuffer().
+ */
+typedef struct PrefetchBufferResult
+{
+ Buffer recent_buffer; /* If valid, a hit (recheck needed!) */
+ bool initiated_io; /* If true, a miss resulting in async I/O */
+} PrefetchBufferResult;
+
/* forward declared, to avoid having to expose buf_internals.h here */
struct WritebackContext;
@@ -162,8 +171,11 @@ extern PGDLLIMPORT int32 *LocalRefCount;
/*
* prototypes for functions in bufmgr.c
*/
-extern void PrefetchBuffer(Relation reln, ForkNumber forkNum,
- BlockNumber blockNum);
+extern PrefetchBufferResult PrefetchSharedBuffer(struct SMgrRelationData *smgr_reln,
+ ForkNumber forkNum,
+ BlockNumber blockNum);
+extern PrefetchBufferResult PrefetchBuffer(Relation reln, ForkNumber forkNum,
+ BlockNumber blockNum);
extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum);
extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum,
BlockNumber blockNum, ReadBufferMode mode,