diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2017-03-22 07:05:12 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2017-03-22 07:05:12 +0000 |
commit | 1148e22a82edc96172fc78855da392b6f0015c88 (patch) | |
tree | ba60e49124bf0eb9f003ee11f2d2a275dffddb1b /src/include/access/xlogreader.h | |
parent | 9ca2dd578db4086ae8a6eb6fd82ac376b7b2804e (diff) |
Teach xlogreader to follow timeline switches
Uses page-based mechanism to ensure we’re using the correct timeline.
Tests are included to exercise the functionality using a cold disk-level copy
of the master that's started up as a replica with slots intact, but the
intended use of the functionality is with later features.
Craig Ringer, reviewed by Simon Riggs and Andres Freund
Diffstat (limited to 'src/include/access/xlogreader.h')
-rw-r--r-- | src/include/access/xlogreader.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h index 663d3e7890b..a1beeb54965 100644 --- a/src/include/access/xlogreader.h +++ b/src/include/access/xlogreader.h @@ -161,6 +161,22 @@ struct XLogReaderState /* beginning of the WAL record being read. */ XLogRecPtr currRecPtr; + /* timeline to read it from, 0 if a lookup is required */ + TimeLineID currTLI; + /* + * Safe point to read to in currTLI if current TLI is historical + * (tliSwitchPoint) or InvalidXLogRecPtr if on current timeline. + * + * Actually set to the start of the segment containing the timeline + * switch that ends currTLI's validity, not the LSN of the switch + * its self, since we can't assume the old segment will be present. + */ + XLogRecPtr currTLIValidUntil; + /* + * If currTLI is not the most recent known timeline, the next timeline to + * read from when currTLIValidUntil is reached. + */ + TimeLineID nextTLI; /* Buffer for current ReadRecord result (expandable) */ char *readRecordBuf; |