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-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 "common/logging.h"
18 #include "libpq-fe.h"
19 #include "storage/block.h"
20 #include "storage/relfilenode.h"
21 
22 
23 /* Configuration options */
24 extern char *datadir_target;
25 extern char *datadir_source;
26 extern char *connstr_source;
27 extern bool showprogress;
28 extern bool dry_run;
29 extern int WalSegSz;
30 
31 /* Target history */
33 extern int targetNentries;
34 
35 /* general state */
36 extern PGconn *conn;
37 
38 /* Progress counters */
39 extern uint64 fetch_size;
40 extern uint64 fetch_done;
41 
42 /* logging support */
43 #define pg_fatal(...) do { pg_log_fatal(__VA_ARGS__); exit(1); } while(0)
44 
45 /* in parsexlog.c */
46 extern void extractPageMap(const char *datadir, XLogRecPtr startpoint,
47  int tliIndex, XLogRecPtr endpoint);
48 extern void findLastCheckpoint(const char *datadir, XLogRecPtr searchptr,
49  int tliIndex,
50  XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli,
51  XLogRecPtr *lastchkptredo);
52 extern XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr,
53  int tliIndex);
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:54
uint32 TimeLineID
Definition: xlogdefs.h:52
char * connstr_source
Definition: pg_rewind.c:55
uint64 fetch_size
Definition: pg_rewind.c:67
PGconn * conn
Definition: streamutil.c:54
int targetNentries
Definition: pg_rewind.c:64
XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex)
Definition: parsexlog.c:109
int WalSegSz
Definition: pg_standby.c:38
void findLastCheckpoint(const char *datadir, XLogRecPtr searchptr, int tliIndex, XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli, XLogRecPtr *lastchkptredo)
Definition: parsexlog.c:149
char * datadir_target
Definition: pg_rewind.c:53
char * datadir
bool showprogress
Definition: pg_rewind.c:58
void progress_report(bool force)
Definition: pg_rewind.c:512
uint64 fetch_done
Definition: pg_rewind.c:68
uint64 XLogRecPtr
Definition: xlogdefs.h:21
TimeLineHistoryEntry * targetHistory
Definition: pg_rewind.c:63
TimeLineHistoryEntry * rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
Definition: timeline.c:29
bool dry_run
Definition: pg_rewind.c:59
void extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex, XLogRecPtr endpoint)
Definition: parsexlog.c:57