Header And Logo

PostgreSQL
| The world's most advanced open source database.

timeline.h

Go to the documentation of this file.
00001 /*
00002  * timeline.h
00003  *
00004  * Functions for reading and writing timeline history files.
00005  *
00006  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00007  * Portions Copyright (c) 1994, Regents of the University of California
00008  *
00009  * src/include/access/timeline.h
00010  */
00011 #ifndef TIMELINE_H
00012 #define TIMELINE_H
00013 
00014 #include "access/xlogdefs.h"
00015 #include "nodes/pg_list.h"
00016 
00017 /*
00018  * A list of these structs describes the timeline history of the server. Each
00019  * TimeLineHistoryEntry represents a piece of WAL belonging to the history,
00020  * from newest to oldest. All WAL positions between 'begin' and 'end' belong to
00021  * the timeline represented by the entry. Together the 'begin' and 'end'
00022  * pointers of all the entries form a contiguous line from beginning of time
00023  * to infinity.
00024  */
00025 typedef struct
00026 {
00027     TimeLineID  tli;
00028     XLogRecPtr  begin;  /* inclusive */
00029     XLogRecPtr  end;    /* exclusive, 0 means infinity */
00030 } TimeLineHistoryEntry;
00031 
00032 extern List *readTimeLineHistory(TimeLineID targetTLI);
00033 extern bool existsTimeLineHistory(TimeLineID probeTLI);
00034 extern TimeLineID findNewestTimeLine(TimeLineID startTLI);
00035 extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
00036                      XLogRecPtr switchpoint, char *reason);
00037 extern void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size);
00038 extern void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end);
00039 extern bool tliInHistory(TimeLineID tli, List *expectedTLIs);
00040 extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history);
00041 extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history,
00042                TimeLineID *nextTLI);
00043 
00044 #endif   /* TIMELINE_H */