From d5497b95f3ca2fc50c6eef46d3394ab6e6855956 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 2 Oct 2012 13:37:19 +0300 Subject: Split off functions related to timeline history files and XLOG archiving. This is just refactoring, to make the functions accessible outside xlog.c. A followup patch will make use of that, to allow fetching timeline history files over streaming replication. --- src/include/access/timeline.h | 23 +++++++++++++++++++++++ src/include/access/xlog_internal.h | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/include/access/timeline.h (limited to 'src/include') diff --git a/src/include/access/timeline.h b/src/include/access/timeline.h new file mode 100644 index 00000000000..f2a7658bc45 --- /dev/null +++ b/src/include/access/timeline.h @@ -0,0 +1,23 @@ +/* + * timeline.h + * + * Functions for reading and writing timeline history files. + * + * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/access/timeline.h + */ +#ifndef TIMELINE_H +#define TIMELINE_H + +#include "access/xlogdefs.h" +#include "nodes/pg_list.h" + +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); + +#endif /* TIMELINE_H */ diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index b5bfb7b4072..2c66b2feb8a 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -229,6 +229,29 @@ extern const RmgrData RmgrTable[]; extern pg_time_t GetLastSegSwitchTime(void); extern XLogRecPtr RequestXLogSwitch(void); +extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli); + +/* + * Exported for the functions in timeline.c and xlogarchive.c. Only valid + * in the startup process. + */ +extern bool InArchiveRecovery; +extern bool StandbyMode; +extern char *recoveryRestoreCommand; + +/* + * Prototypes for functions in xlogarchive.c + */ +extern bool RestoreArchivedFile(char *path, const char *xlogfname, + const char *recovername, off_t expectedSize); +extern void ExecuteRecoveryCommand(char *command, char *commandName, + bool failOnerror); +extern void XLogArchiveNotify(const char *xlog); +extern void XLogArchiveNotifySeg(XLogSegNo segno); +extern bool XLogArchiveCheckDone(const char *xlog); +extern bool XLogArchiveIsBusy(const char *xlog); +extern void XLogArchiveCleanup(const char *xlog); + /* * These aren't in xlog.h because I'd rather not include fmgr.h there. */ -- cgit v1.2.3