diff options
Diffstat (limited to 'src/backend/access/transam/xlogutils.c')
-rw-r--r-- | src/backend/access/transam/xlogutils.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index 6cb143e161d..bbd801513a8 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -783,10 +783,10 @@ XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wa } } -/* openSegment callback for WALRead */ -static int -wal_segment_open(XLogSegNo nextSegNo, WALSegmentContext * segcxt, - TimeLineID *tli_p) +/* XLogReaderRoutine->segment_open callback for local pg_wal files */ +int +wal_segment_open(XLogReaderState *state, XLogSegNo nextSegNo, + WALSegmentContext *segcxt, TimeLineID *tli_p) { TimeLineID tli = *tli_p; char path[MAXPGPATH]; @@ -811,8 +811,17 @@ wal_segment_open(XLogSegNo nextSegNo, WALSegmentContext * segcxt, return -1; /* keep compiler quiet */ } +/* stock XLogReaderRoutine->segment_close callback */ +void +wal_segment_close(XLogReaderState *state) +{ + close(state->seg.ws_file); + /* need to check errno? */ + state->seg.ws_file = -1; +} + /* - * read_page callback for reading local xlog files + * XLogReaderRoutine->page_read callback for reading local xlog files * * Public because it would likely be very helpful for someone writing another * output method outside walsender, e.g. in a bgworker. @@ -937,8 +946,9 @@ read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, * as 'count', read the whole page anyway. It's guaranteed to be * zero-padded up to the page boundary if it's incomplete. */ - if (!WALRead(cur_page, targetPagePtr, XLOG_BLCKSZ, tli, &state->seg, - &state->segcxt, wal_segment_open, &errinfo)) + if (!WALRead(state, cur_page, targetPagePtr, XLOG_BLCKSZ, tli, + &state->seg, &state->segcxt, + &errinfo)) WALReadRaiseError(&errinfo); /* number of valid bytes in the buffer */ |