1
1
/*-------------------------------------------------------------------------
2
2
*
3
- * backup.c: backup DB cluster, archived WAL, serverlog.
3
+ * backup.c: backup DB cluster, archived WAL
4
4
*
5
5
* Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6
6
*
@@ -42,7 +42,6 @@ static void backup_files(const char *from_root, const char *to_root,
42
42
parray * files ,parray * prev_files ,const XLogRecPtr * lsn ,bool compress ,const char * prefix );
43
43
static parray * do_backup_database (parray * backup_list ,pgBackupOption bkupopt );
44
44
static parray * do_backup_arclog (parray * backup_list );
45
- static parray * do_backup_srvlog (parray * backup_list );
46
45
static void confirm_block_size (const char * name ,int blcksz );
47
46
static void pg_start_backup (const char * label ,bool smooth ,pgBackup * backup );
48
47
static void pg_stop_backup (pgBackup * backup );
@@ -567,100 +566,17 @@ do_backup_arclog(parray *backup_list)
567
566
return files ;
568
567
}
569
568
570
- /*
571
- * Take a backup of serverlog.
572
- */
573
- static parray *
574
- do_backup_srvlog (parray * backup_list )
575
- {
576
- int i ;
577
- parray * files ;
578
- parray * prev_files = NULL ;/* file list of previous database backup */
579
- char path [MAXPGPATH ];
580
- char prev_file_txt [MAXPGPATH ];
581
- pgBackup * prev_backup ;
582
- int64 srvlog_write_bytes = 0 ;
583
-
584
- if (!current .with_serverlog )
585
- return NULL ;
586
-
587
- /* Block backup operations on a standby */
588
- if (pg_is_standby ())
589
- elog (ERROR_SYSTEM ,_ ("Backup cannot run on a standby." ));
590
-
591
- if (verbose )
592
- {
593
- printf (_ ("========================================\n" ));
594
- printf (_ ("serverlog backup start\n" ));
595
- }
596
-
597
- /* initialize size summary */
598
- current .srvlog_bytes = 0 ;
599
-
600
- /*
601
- * To take incremental backup, the file list of the last completed database
602
- * backup is needed.
603
- */
604
- prev_backup = catalog_get_last_srvlog_backup (backup_list ,
605
- get_current_timeline ());
606
- if (verbose && prev_backup == NULL )
607
- printf (_ ("no previous full backup, performing a full backup instead\n" ));
608
-
609
- if (prev_backup )
610
- {
611
- pgBackupGetPath (prev_backup ,prev_file_txt ,lengthof (prev_file_txt ),
612
- SRVLOG_FILE_LIST );
613
- prev_files = dir_read_file_list (srvlog_path ,prev_file_txt );
614
- }
615
-
616
- /* list files with the logical path. omit SRVLOG_PATH */
617
- files = parray_new ();
618
- dir_list_file (files ,srvlog_path ,NULL , true, false);
619
-
620
- pgBackupGetPath (& current ,path ,lengthof (path ),SRVLOG_DIR );
621
- backup_files (srvlog_path ,path ,files ,prev_files ,NULL , false,NULL );
622
-
623
- /* create file list */
624
- create_file_list (files ,arclog_path ,SRVLOG_FILE_LIST ,NULL , false);
625
-
626
- /* print summary of size of backup mode files */
627
- for (i = 0 ;i < parray_num (files );i ++ )
628
- {
629
- pgFile * file = (pgFile * )parray_get (files ,i );
630
- if (!S_ISREG (file -> mode ))
631
- continue ;
632
- current .srvlog_bytes += file -> read_size ;
633
- if (file -> write_size != BYTES_INVALID )
634
- {
635
- current .backup_bytes += file -> write_size ;
636
- srvlog_write_bytes += file -> write_size ;
637
- }
638
- }
639
-
640
- if (verbose )
641
- {
642
- printf (_ ("serverlog backup completed(read: " INT64_FORMAT " write: " INT64_FORMAT ")\n" ),
643
- current .srvlog_bytes ,srvlog_write_bytes );
644
- printf (_ ("========================================\n" ));
645
- }
646
-
647
- return files ;
648
- }
649
-
650
569
int
651
570
do_backup (pgBackupOption bkupopt )
652
571
{
653
572
parray * backup_list ;
654
573
parray * files_database ;
655
574
parray * files_arclog ;
656
- parray * files_srvlog ;
657
575
int ret ;
658
576
659
577
/* repack the necesary options */
660
578
int keep_arclog_files = bkupopt .keep_arclog_files ;
661
579
int keep_arclog_days = bkupopt .keep_arclog_days ;
662
- int keep_srvlog_files = bkupopt .keep_srvlog_files ;
663
- int keep_srvlog_days = bkupopt .keep_srvlog_days ;
664
580
int keep_data_generations = bkupopt .keep_data_generations ;
665
581
int keep_data_days = bkupopt .keep_data_days ;
666
582
@@ -680,11 +596,6 @@ do_backup(pgBackupOption bkupopt)
680
596
_ ("Required parameter not specified: ARCLOG_PATH "
681
597
"(-A, --arclog-path)" ));
682
598
683
- /* SRVLOG_PATH is required only when backup serverlog */
684
- if (current .with_serverlog && srvlog_path == NULL )
685
- elog (ERROR_ARGS ,_ ("required parameter not specified: SRVLOG_PATH "
686
- "(-S, --srvlog-path)" ));
687
-
688
599
#ifndef HAVE_LIBZ
689
600
if (current .compress_data )
690
601
{
@@ -727,7 +638,6 @@ do_backup(pgBackupOption bkupopt)
727
638
current .end_time = (time_t )0 ;
728
639
current .data_bytes = BYTES_INVALID ;
729
640
current .arclog_bytes = BYTES_INVALID ;
730
- current .srvlog_bytes = BYTES_INVALID ;
731
641
current .backup_bytes = 0 ;
732
642
current .block_size = BLCKSZ ;
733
643
current .wal_block_size = XLOG_BLCKSZ ;
@@ -757,9 +667,6 @@ do_backup(pgBackupOption bkupopt)
757
667
758
668
/* backup archived WAL */
759
669
files_arclog = do_backup_arclog (backup_list );
760
-
761
- /* backup serverlog */
762
- files_srvlog = do_backup_srvlog (backup_list );
763
670
pgut_atexit_pop (backup_cleanup ,NULL );
764
671
765
672
/* update backup status to DONE */
@@ -781,10 +688,6 @@ do_backup(pgBackupOption bkupopt)
781
688
current .backup_mode == BACKUP_MODE_INCREMENTAL )
782
689
total_read += current .arclog_bytes ;
783
690
784
- /* Server logs */
785
- if (current .with_serverlog )
786
- total_read += current .srvlog_bytes ;
787
-
788
691
if (total_read == 0 )
789
692
printf (_ ("nothing to backup\n" ));
790
693
else
@@ -795,13 +698,10 @@ do_backup(pgBackupOption bkupopt)
795
698
}
796
699
797
700
/*
798
- * Delete old files (archived WAL and serverlog ) after update of status.
701
+ * Delete old files (archived WAL) after update of status.
799
702
*/
800
703
delete_old_files (arclog_path ,files_arclog ,keep_arclog_files ,
801
704
keep_arclog_days , true);
802
- if (current .with_serverlog )
803
- delete_old_files (srvlog_path ,files_srvlog ,keep_srvlog_files ,
804
- keep_srvlog_days , false);
805
705
806
706
/* Delete old backup files after all backup operation. */
807
707
pgBackupDelete (keep_data_generations ,keep_data_days );
@@ -813,9 +713,6 @@ do_backup(pgBackupOption bkupopt)
813
713
if (files_arclog )
814
714
parray_walk (files_arclog ,pgFileFree );
815
715
parray_free (files_arclog );
816
- if (files_srvlog )
817
- parray_walk (files_srvlog ,pgFileFree );
818
- parray_free (files_srvlog );
819
716
820
717
/*
821
718
* If this backup is full backup, delete backup of online WAL.