1
1
/*-------------------------------------------------------------------------
2
2
*
3
- * catalog.c: backup catalogopration
3
+ * catalog.c: backup catalogoperation
4
4
*
5
5
* Portions Copyright (c) 2009-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6
6
* Portions Copyright (c) 2015-2017, Postgres Professional
@@ -222,6 +222,15 @@ read_backup(time_t timestamp)
222
222
return readBackupControlFile (conf_path );
223
223
}
224
224
225
+ /*
226
+ * Get backup_mode in string representation.
227
+ */
228
+ const char *
229
+ pgBackupGetBackupMode (pgBackup * backup )
230
+ {
231
+ return backupModes [backup -> backup_mode ];
232
+ }
233
+
225
234
static bool
226
235
IsDir (const char * dirpath ,const char * entry )
227
236
{
@@ -370,15 +379,14 @@ pgBackupCreateDir(pgBackup *backup)
370
379
371
380
/*
372
381
* Write information about backup.in to stream "out".
373
- * TODO improve comments
374
382
*/
375
383
void
376
384
pgBackupWriteControl (FILE * out ,pgBackup * backup )
377
385
{
378
386
char timestamp [20 ];
379
387
380
388
fprintf (out ,"#Configuration\n" );
381
- fprintf (out ,"backup-mode = %s\n" ,backupModes [ backup -> backup_mode ] );
389
+ fprintf (out ,"backup-mode = %s\n" ,pgBackupGetBackupMode ( backup ) );
382
390
fprintf (out ,"stream = %s\n" ,backup -> stream ?"true" :"false" );
383
391
384
392
fprintf (out ,"\n#Compatibility\n" );
@@ -388,9 +396,11 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
388
396
389
397
fprintf (out ,"\n#Result backup info\n" );
390
398
fprintf (out ,"timelineid = %d\n" ,backup -> tli );
399
+ /* LSN returned by pg_start_backup */
391
400
fprintf (out ,"start-lsn = %x/%08x\n" ,
392
401
(uint32 ) (backup -> start_lsn >>32 ),
393
402
(uint32 )backup -> start_lsn );
403
+ /* LSN returned by pg_stop_backup */
394
404
fprintf (out ,"stop-lsn = %x/%08x\n" ,
395
405
(uint32 ) (backup -> stop_lsn >>32 ),
396
406
(uint32 )backup -> stop_lsn );
@@ -409,11 +419,16 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
409
419
fprintf (out ,"recovery-time = '%s'\n" ,timestamp );
410
420
}
411
421
412
- /* TODO rename the field? */
422
+ /*
423
+ * Size of PGDATA directory. The size does not include size of related
424
+ * WAL segments in archive 'wal' directory.
425
+ */
413
426
if (backup -> data_bytes != BYTES_INVALID )
414
427
fprintf (out ,"data-bytes = " INT64_FORMAT "\n" ,backup -> data_bytes );
415
428
416
429
fprintf (out ,"status = %s\n" ,status2str (backup -> status ));
430
+
431
+ /* 'parent_backup' is set if it is incremental backup */
417
432
if (backup -> parent_backup != 0 )
418
433
{
419
434
char * parent_backup = base36enc (backup -> parent_backup );