Support PrefetchBuffer() in recovery.
authorThomas Munro <tmunro@postgresql.org>
Wed, 8 Apr 2020 01:36:45 +0000 (13:36 +1200)
committerThomas Munro <tmunro@postgresql.org>
Wed, 8 Apr 2020 02:56:57 +0000 (14:56 +1200)
commit3985b600f57d75b9743d86430cb5c21370057a23
treef367f4511386eeacf127a8e8b25afc9f8ea46101
parent981643dcdb70b6ce70d8a08417f71f465f236cb5
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
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/localbuf.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/include/storage/buf_internals.h
src/include/storage/bufmgr.h
src/include/storage/md.h
src/include/storage/smgr.h