51
51
#define DIR_PERMISSION (0700)
52
52
#define FILE_PERMISSION (0600)
53
53
54
+ /* 64-bit xid support for PGPRO_EE */
54
55
#ifndef PGPRO_EE
55
56
#define XID_FMT "%u"
56
57
#endif
@@ -67,32 +68,24 @@ typedef struct pgFile
67
68
that the file existed but was not backed up
68
69
because not modified since last backup. */
69
70
pg_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 */
71
72
bool is_datafile ; /* true if the file is PostgreSQL data file */
72
73
char * path ; /* path of the file */
73
- char * ptrack_path ;
74
+ char * ptrack_path ; /* path of the ptrack fork of the relation */
74
75
int 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 */
81
83
} pgFile ;
82
84
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
-
91
85
/* Effective data size */
92
86
#define MAPSIZE (BLCKSZ - MAXALIGN(SizeOfPageHeaderData))
93
87
94
88
/* Backup status */
95
- /* XXX re-order ? */
96
89
typedef enum BackupStatus
97
90
{
98
91
BACKUP_STATUS_INVALID , /* the pgBackup is invalid */
@@ -113,47 +106,50 @@ typedef enum BackupMode
113
106
BACKUP_MODE_FULL /* full backup */
114
107
} BackupMode ;
115
108
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
+
121
114
typedef struct pgBackup
122
115
{
123
- /* Backup Level */
116
+ /* Mode - one of BACKUP_MODE_xxx above */
124
117
BackupMode backup_mode ;
125
118
126
- /* Status - one of BACKUP_STATUS_xxx */
119
+ /* Status - one of BACKUP_STATUS_xxx above */
127
120
BackupStatus status ;
128
121
129
122
/* 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
+
139
133
/*
140
134
* Amount of raw data. For a full backup, this is the total amount of
141
135
* data while for a differential backup this is just the difference
142
136
* of data taken.
137
+ * BYTES_INVALID means nothing was backed up.
143
138
*/
144
139
int64 data_bytes ;
145
140
146
141
/* data/wal block size for compatibility check */
147
142
uint32 block_size ;
148
143
uint32 wal_block_size ;
149
144
uint32 checksum_version ;
145
+
146
+ /* TODO review the code below. */
150
147
bool stream ;
148
+ /* Identifier of the previous backup.
149
+ * Which is basic backup for current incremental backup. */
151
150
time_t parent_backup ;
152
151
} pgBackup ;
153
152
154
- /* special values of pgBackup */
155
- #define KEEP_INFINITE (INT_MAX)
156
- #define BYTES_INVALID (-1)
157
153
158
154
typedef struct pgTimeLine
159
155
{
0 commit comments