PostgreSQL Source Code  git master
timeline.h
Go to the documentation of this file.
1 /*
2  * timeline.h
3  *
4  * Functions for reading and writing timeline history files.
5  *
6  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/access/timeline.h
10  */
11 #ifndef TIMELINE_H
12 #define TIMELINE_H
13 
14 #include "access/xlogdefs.h"
15 #include "nodes/pg_list.h"
16 
17 /*
18  * A list of these structs describes the timeline history of the server. Each
19  * TimeLineHistoryEntry represents a piece of WAL belonging to the history,
20  * from newest to oldest. All WAL locations between 'begin' and 'end' belong to
21  * the timeline represented by the entry. Together the 'begin' and 'end'
22  * pointers of all the entries form a contiguous line from beginning of time
23  * to infinity.
24  */
25 typedef struct
26 {
28  XLogRecPtr begin; /* inclusive */
29  XLogRecPtr end; /* exclusive, InvalidXLogRecPtr means infinity */
31 
32 extern List *readTimeLineHistory(TimeLineID targetTLI);
33 extern bool existsTimeLineHistory(TimeLineID probeTLI);
35 extern void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
36  XLogRecPtr switchpoint, char *reason);
37 extern void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size);
38 extern void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end);
39 extern bool tliInHistory(TimeLineID tli, List *expectedTLEs);
40 extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history);
41 extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history,
42  TimeLineID *nextTLI);
43 
44 #endif /* TIMELINE_H */
static pg_noinline void Size size
Definition: slab.c:607
Definition: pg_list.h:54
XLogRecPtr begin
Definition: timeline.h:28
TimeLineID tli
Definition: timeline.h:27
XLogRecPtr end
Definition: timeline.h:29
TimeLineID findNewestTimeLine(TimeLineID startTLI)
Definition: timeline.c:264
void writeTimeLineHistoryFile(TimeLineID tli, char *content, int size)
Definition: timeline.c:463
TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history)
Definition: timeline.c:544
XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history, TimeLineID *nextTLI)
Definition: timeline.c:572
bool existsTimeLineHistory(TimeLineID probeTLI)
Definition: timeline.c:222
void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
Definition: timeline.c:50
void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, XLogRecPtr switchpoint, char *reason)
Definition: timeline.c:304
List * readTimeLineHistory(TimeLineID targetTLI)
Definition: timeline.c:76
bool tliInHistory(TimeLineID tli, List *expectedTLEs)
Definition: timeline.c:526
uint64 XLogRecPtr
Definition: xlogdefs.h:21
uint32 TimeLineID
Definition: xlogdefs.h:59
static List * expectedTLEs
Definition: xlogrecovery.c:123