Thread: pgsql: Support PrefetchBuffer() in recovery.

pgsql: Support PrefetchBuffer() in recovery.

From
Thomas Munro
Date:
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3985b600f57d75b9743d86430cb5c21370057a23

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c   | 125 +++++++++++++++++++++++-----------
src/backend/storage/buffer/localbuf.c |  22 +++---
src/backend/storage/smgr/md.c         |   9 ++-
src/backend/storage/smgr/smgr.c       |  10 ++-
src/include/storage/buf_internals.h   |   5 +-
src/include/storage/bufmgr.h          |  16 ++++-
src/include/storage/md.h              |   2 +-
src/include/storage/smgr.h            |   2 +-
8 files changed, 134 insertions(+), 57 deletions(-)