1/*-------------------------------------------------------------------------
2 *
3 * pg_rewind.h
4 *
5 *
6 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 *-------------------------------------------------------------------------
10 */
11#ifndef PG_REWIND_H
12#define PG_REWIND_H
13
14#include "datapagemap.h"
15
16#include "access/timeline.h"
17#include "storage/block.h"
18#include "storage/relfilenode.h"
19
20#include "common/logging.h"
21
22/* Configuration options */
23extern char *datadir_target;
24extern char *datadir_source;
25extern char *connstr_source;
26extern bool showprogress;
27extern bool dry_run;
28extern int WalSegSz;
29
30/* Target history */
31extern TimeLineHistoryEntry *targetHistory;
32extern int targetNentries;
33
34/* Progress counters */
35extern uint64 fetch_size;
36extern uint64 fetch_done;
37
38/* logging support */
39#define pg_fatal(...) do { pg_log_fatal(__VA_ARGS__); exit(1); } while(0)
40
41/* in parsexlog.c */
42extern void extractPageMap(const char *datadir, XLogRecPtr startpoint,
43 int tliIndex, XLogRecPtr endpoint);
44extern void findLastCheckpoint(const char *datadir, XLogRecPtr searchptr,
45 int tliIndex,
46 XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli,
47 XLogRecPtr *lastchkptredo);
48extern XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr,
49 int tliIndex);
50
51/* in pg_rewind.c */
52extern void progress_report(bool force);
53
54/* in timeline.c */
55extern TimeLineHistoryEntry *rewind_parseTimeLineHistory(char *buffer,
56 TimeLineID targetTLI, int *nentries);
57
58#endif /* PG_REWIND_H */
59