diff options
| author | Heikki Linnakangas | 2012-12-04 13:28:58 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2012-12-04 15:29:07 +0000 |
| commit | 32f4de0adfb2037f1402e40b54a5c4043227363f (patch) | |
| tree | 7f987db6ac130b6a4db3a4d667fb279f2976dbc3 /src/include | |
| parent | a84c30dda57a177487336785927503064c6bd529 (diff) | |
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.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/timeline.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/include/access/timeline.h b/src/include/access/timeline.h index f2a7658bc45..785195bd36a 100644 --- a/src/include/access/timeline.h +++ b/src/include/access/timeline.h @@ -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 */ |
