mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user