Cache smgrnblocks() results in recovery.
authorThomas Munro <tmunro@postgresql.org>
Fri, 31 Jul 2020 02:15:18 +0000 (14:15 +1200)
committerThomas Munro <tmunro@postgresql.org>
Fri, 31 Jul 2020 02:29:52 +0000 (14:29 +1200)
commitc5315f4f44843c20ada876fdb0d0828795dfbdf5
treeb94c24609a31ae7243b217ae7d5358c8cff8fe20
parente3931d01f3afef14703827eda1dad0a3fb3b5d07
Cache smgrnblocks() results in recovery.

Avoid repeatedly calling lseek(SEEK_END) during recovery by caching
the size of each fork.  For now, we can't use the same technique in
other processes, because we lack a shared invalidation mechanism.

Do this by generalizing the pre-existing caching used by FSM and VM
to support all forks.

Discussion: https://postgr.es/m/CAEepm%3D3SSw-Ty1DFcK%3D1rU-K6GSzYzfdD4d%2BZwapdN7dTa6%3DnQ%40mail.gmail.com
contrib/pg_visibility/pg_visibility.c
src/backend/access/heap/visibilitymap.c
src/backend/catalog/storage.c
src/backend/storage/freespace/freespace.c
src/backend/storage/smgr/smgr.c
src/include/storage/smgr.h