diff options
author | Alvaro Herrera | 2020-05-08 19:30:34 +0000 |
---|---|---|
committer | Alvaro Herrera | 2020-05-08 19:40:11 +0000 |
commit | b060dbe0001a1d6bf26cd294710f3cb203868d46 (patch) | |
tree | 6e9e980aa63ec1ec3655b93c92b9b5caa6689d38 /src/include/access/xlogutils.h | |
parent | 871696ba20e0251e86041576373809d1c7ca161d (diff) |
Rework XLogReader callback system
Code review for 0dc8ead46363, prompted by a bug closed by 91c40548d5f7.
XLogReader's system for opening and closing segments had gotten too
complicated, with callbacks being passed at both the XLogReaderAllocate
level (read_page) as well as at the WALRead level (segment_open). This
was confusing and hard to follow, so restructure things so that these
callbacks are passed together at XLogReaderAllocate time, and add
another callback to the set (segment_close) to make it a coherent whole.
Also, ensure XLogReaderState is an argument to all the callbacks, so
that they can grab at the ->private data if necessary.
Document the whole arrangement more clearly.
Author: Álvaro Herrera <[email protected]>
Reviewed-by: Kyotaro Horiguchi <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/include/access/xlogutils.h')
-rw-r--r-- | src/include/access/xlogutils.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h index 5181a077d96..68ce815476c 100644 --- a/src/include/access/xlogutils.h +++ b/src/include/access/xlogutils.h @@ -50,6 +50,11 @@ extern void FreeFakeRelcacheEntry(Relation fakerel); extern int read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *cur_page); +extern int wal_segment_open(XLogReaderState *state, + XLogSegNo nextSegNo, + WALSegmentContext *segcxt, + TimeLineID *tli_p); +extern void wal_segment_close(XLogReaderState *state); extern void XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wantLength); |