| 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 */ |
| 23 | extern char *datadir_target; |
| 24 | extern char *datadir_source; |
| 25 | extern char *connstr_source; |
| 26 | extern bool showprogress; |
| 27 | extern bool dry_run; |
| 28 | extern int WalSegSz; |
| 29 | |
| 30 | /* Target history */ |
| 31 | extern TimeLineHistoryEntry *targetHistory; |
| 32 | extern int targetNentries; |
| 33 | |
| 34 | /* Progress counters */ |
| 35 | extern uint64 fetch_size; |
| 36 | extern 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 */ |
| 42 | extern void (const char *datadir, XLogRecPtr startpoint, |
| 43 | int tliIndex, XLogRecPtr endpoint); |
| 44 | extern void findLastCheckpoint(const char *datadir, XLogRecPtr searchptr, |
| 45 | int tliIndex, |
| 46 | XLogRecPtr *lastchkptrec, TimeLineID *lastchkpttli, |
| 47 | XLogRecPtr *lastchkptredo); |
| 48 | extern XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr, |
| 49 | int tliIndex); |
| 50 | |
| 51 | /* in pg_rewind.c */ |
| 52 | extern void progress_report(bool force); |
| 53 | |
| 54 | /* in timeline.c */ |
| 55 | extern TimeLineHistoryEntry *rewind_parseTimeLineHistory(char *buffer, |
| 56 | TimeLineID targetTLI, int *nentries); |
| 57 | |
| 58 | #endif /* PG_REWIND_H */ |
| 59 | |