PostgreSQL Source Code  git master
pg_rewind.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_rewind.h
4  *
5  *
6  * Portions Copyright (c) 1996-2020, 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 "access/timeline.h"
15 #include "common/logging.h"
16 #include "datapagemap.h"
17 #include "libpq-fe.h"
18 #include "storage/block.h"
19 #include "storage/relfilenode.h"
20 
21 /* Configuration options */
22 extern char *datadir_target;
23 extern char *datadir_source;
24 extern char *connstr_source;
25 extern bool showprogress;
26 extern bool dry_run;
27 extern int WalSegSz;
28 
29 /* Target history */
31 extern int targetNentries;
32 
33 /* general state */
34 extern PGconn *conn;
35 
36 /* Progress counters */
37 extern uint64 fetch_size;
38 extern uint64 fetch_done;
39 
40 /* logging support */
41 #define pg_fatal(...) do { pg_log_fatal(__VA_ARGS__); exit(1); } while(0)
42 
43 /* in parsexlog.c */
44 extern void extractPageMap(const char *datadir, XLogRecPtr startpoint,
45  int tliIndex, XLogRecPtr endpoint,
46  const char *restoreCommand);
47 extern void findLastCheckpoint(const char *datadir, XLogRecPtr searchptr,
48  int tliIndex,
49  XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli,
50  XLogRecPtr *lastchkptredo,
51  const char *restoreCommand);
52 extern XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr,
53  int tliIndex, const char *restoreCommand);
54 
55 /* in pg_rewind.c */
56 extern void progress_report(bool force);
57 
58 /* in timeline.c */
60  TimeLineID targetTLI,
61  int *nentries);
62 
63 #endif /* PG_REWIND_H */
char * datadir_source
Definition: pg_rewind.c:56
uint32 TimeLineID
Definition: xlogdefs.h:52
char * connstr_source
Definition: pg_rewind.c:57
uint64 fetch_size
Definition: pg_rewind.c:71
PGconn * conn
Definition: streamutil.c:54
int targetNentries
Definition: pg_rewind.c:68
int WalSegSz
Definition: pg_standby.c:38
char * datadir_target
Definition: pg_rewind.c:55
char * datadir
char restoreCommand[MAXPGPATH]
Definition: pg_standby.c:61
bool showprogress
Definition: pg_rewind.c:61
void progress_report(bool force)
Definition: pg_rewind.c:526
XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex, const char *restoreCommand)
Definition: parsexlog.c:110
uint64 fetch_done
Definition: pg_rewind.c:72
uint64 XLogRecPtr
Definition: xlogdefs.h:21
TimeLineHistoryEntry * targetHistory
Definition: pg_rewind.c:67
void extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex, XLogRecPtr endpoint, const char *restoreCommand)
Definition: parsexlog.c:59
TimeLineHistoryEntry * rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
Definition: timeline.c:29
bool dry_run
Definition: pg_rewind.c:62
void findLastCheckpoint(const char *datadir, XLogRecPtr searchptr, int tliIndex, XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli, XLogRecPtr *lastchkptredo, const char *restoreCommand)
Definition: parsexlog.c:154