Refactor per-page logic common to all redo routines to a new function.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Refactor per-page logic common to all redo routines to a new function. Every redo routine uses the same idiom to determine what to do to a page: check if there's a backup block for it, and if not read, the buffer if the block exists, and check its LSN. Refactor that into a common function, XLogReadBufferForRedo, making all the redo routines shorter and more readable. This has no user-visible effect, and makes no changes to the WAL format. Reviewed by Andres Freund, Alvaro Herrera, Michael Paquier.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/gin/ginxlog.c | modified | +88 −146 |
| src/backend/access/gist/gistxlog.c | modified | +78 −101 |
| src/backend/access/heap/heapam.c | modified | +466 −594 |
| src/backend/access/nbtree/nbtxlog.c | modified | +192 −285 |
| src/backend/access/spgist/spgxlog.c | modified | +401 −482 |
| src/backend/access/transam/README | modified | +19 −47 |
| src/backend/access/transam/xlogutils.c | modified | +81 −0 |
| src/include/access/xlogutils.h | modified | +22 −1 |