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 */ 30 extern TimeLineHistoryEntry *targetHistory; 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 finished); 57 58 /* in timeline.c */ 59 extern TimeLineHistoryEntry *rewind_parseTimeLineHistory(char *buffer, 60 TimeLineID targetTLI, 61 int *nentries); 62 63 #endif /* PG_REWIND_H */ 64