5151#define DIR_PERMISSION (0700)
5252#define FILE_PERMISSION (0600)
5353
54+ /* 64-bit xid support for PGPRO_EE */
5455#ifndef PGPRO_EE
5556#define XID_FMT "%u"
5657#endif
@@ -67,32 +68,24 @@ typedef struct pgFile
6768 that the file existed but was not backed up
6869 because not modified since last backup. */
6970pg_crc32 crc ;/* CRC value of the file, regular file only */
70- char * linked ;/* path of the linked file */
71+ char * linked ;/* path of the linked file */
7172bool is_datafile ;/* true if the file is PostgreSQL data file */
7273char * path ;/* path of the file */
73- char * ptrack_path ;
74+ char * ptrack_path ;/* path of the ptrack fork of the relation */
7475int segno ;/* Segment number for ptrack */
75- uint64 generation ;/* Generation of compressed file.
76- * -1 for non-compressed files */
77- int is_partial_copy ;/* for compressed files.
78- * 1 if backed up via copy_file_partly() */
79- volatile uint32 lock ;
80- datapagemap_t pagemap ;
76+ uint64 generation ;/* Generation of the compressed file. Set to '-1'
77+ * for non-compressed files. If generation has changed,
78+ we cannot backup compressed file partially. */
79+ int is_partial_copy ;/* for compressed files. Set to '1' if backed up
80+ * via copy_file_partly() */
81+ volatile uint32 lock ;/* lock for synchronization of parallel threads */
82+ datapagemap_t pagemap ;/* bitmap of pages updated since previous backup */
8183}pgFile ;
8284
83- #define IsValidTime (tm )\
84- ((tm.tm_sec >= 0 && tm.tm_sec <= 60) &&/* range check for tm_sec (0-60) */ \
85- (tm .tm_min >=0 && tm .tm_min <=59 )&& /* range check for tm_min (0-59) */ \
86- (tm .tm_hour >=0 && tm .tm_hour <=23 )&& /* range check for tm_hour(0-23) */ \
87- (tm .tm_mday >=1 && tm .tm_mday <=31 )&& /* range check for tm_mday(1-31) */ \
88- (tm .tm_mon >=0 && tm .tm_mon <=11 )&& /* range check for tm_mon (0-23) */ \
89- (tm .tm_year + 1900 >=1900 ))/* range check for tm_year(70-) */
90-
9185/* Effective data size */
9286#define MAPSIZE (BLCKSZ - MAXALIGN(SizeOfPageHeaderData))
9387
9488/* Backup status */
95- /* XXX re-order ? */
9689typedef enum BackupStatus
9790{
9891BACKUP_STATUS_INVALID ,/* the pgBackup is invalid */
@@ -113,47 +106,50 @@ typedef enum BackupMode
113106BACKUP_MODE_FULL /* full backup */
114107}BackupMode ;
115108
116- /*
117- * pg_probackup takes backup into the directroy $BACKUP_PATH/<date>/<time>.
118- *
119- * status == -1 indicates the pgBackup is invalid.
120- */
109+
110+ /* special values of pgBackup fields */
111+ #define KEEP_INFINITE (INT_MAX)
112+ #define BYTES_INVALID (-1)
113+
121114typedef struct pgBackup
122115{
123- /*Backup Level */
116+ /*Mode - one of BACKUP_MODE_xxx above */
124117BackupMode backup_mode ;
125118
126- /* Status - one of BACKUP_STATUS_xxx */
119+ /* Status - one of BACKUP_STATUS_xxxabove */
127120BackupStatus status ;
128121
129122/* Timestamp, etc. */
130- TimeLineID tli ;
131- XLogRecPtr start_lsn ;
132- XLogRecPtr stop_lsn ;
133- time_t start_time ;
134- time_t end_time ;
135- time_t recovery_time ;
136- TransactionId recovery_xid ;
137-
138- /* Different sizes (-1 means nothing was backed up) */
123+ TimeLineID tli ;/* timeline of start and stop baskup lsns */
124+ XLogRecPtr start_lsn ;/* backup's starting transaction log location */
125+ XLogRecPtr stop_lsn ;/* backup's finishing transaction log location */
126+ time_t start_time ;/* since this moment backup has status
127+ * BACKUP_STATUS_RUNNING */
128+ time_t end_time ;/* the moment when backup was finished, or the moment
129+ * when we realized that backup is broken*/
130+ time_t recovery_time ;/* FIXME */
131+ TransactionId recovery_xid ;/* FIXME */
132+
139133/*
140134 * Amount of raw data. For a full backup, this is the total amount of
141135 * data while for a differential backup this is just the difference
142136 * of data taken.
137+ * BYTES_INVALID means nothing was backed up.
143138 */
144139int64 data_bytes ;
145140
146141/* data/wal block size for compatibility check */
147142uint32 block_size ;
148143uint32 wal_block_size ;
149144uint32 checksum_version ;
145+
146+ /* TODO review the code below. */
150147bool stream ;
148+ /* Identifier of the previous backup.
149+ * Which is basic backup for current incremental backup. */
151150time_t parent_backup ;
152151}pgBackup ;
153152
154- /* special values of pgBackup */
155- #define KEEP_INFINITE (INT_MAX)
156- #define BYTES_INVALID (-1)
157153
158154typedef struct pgTimeLine
159155{