1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Write exact xlog position of timeline switch in the timeline history file.

This allows us to do some more rigorous sanity checking for various
incorrect point-in-time recovery scenarios, and provides more information
for debugging purposes. It will also come handy in the upcoming patch to
allow timeline switches to be replicated by streaming replication.
This commit is contained in:
Heikki Linnakangas
2012-12-04 15:28:58 +02:00
parent a84c30dda5
commit 32f4de0adf
3 changed files with 248 additions and 91 deletions

View File

@@ -14,10 +14,28 @@
#include "access/xlogdefs.h"
#include "nodes/pg_list.h"
/*
* A list of these structs describes the timeline history of the server. Each
* TimeLineHistoryEntry represents a piece of WAL belonging to the history,
* from newest to oldest. All WAL positions between 'begin' and 'end' belong to
* the timeline represented by the entry. Together the 'begin' and 'end'
* pointers of all the entries form a contiguous line from beginning of time
* to infinity.
*/
typedef struct
{
TimeLineID tli;
XLogRecPtr begin; /* inclusive */
XLogRecPtr end; /* exclusive, 0 means infinity */
} TimeLineHistoryEntry;
extern List *readTimeLineHistory(TimeLineID targetTLI);
extern bool existsTimeLineHistory(TimeLineID probeTLI);
extern TimeLineID findNewestTimeLine(TimeLineID startTLI);
extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
TimeLineID endTLI, XLogSegNo endLogSegNo, char *reason);
XLogRecPtr switchpoint, char *reason);
extern bool tliInHistory(TimeLineID tli, List *expectedTLIs);
extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history);
extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history);
#endif /* TIMELINE_H */