11/*-------------------------------------------------------------------------
22 *
3- * backup.c: backup DB cluster, archived WAL, serverlog.
3+ * backup.c: backup DB cluster, archived WAL
44 *
55 * Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
66 *
@@ -42,7 +42,6 @@ static void backup_files(const char *from_root, const char *to_root,
4242parray * files ,parray * prev_files ,const XLogRecPtr * lsn ,bool compress ,const char * prefix );
4343static parray * do_backup_database (parray * backup_list ,pgBackupOption bkupopt );
4444static parray * do_backup_arclog (parray * backup_list );
45- static parray * do_backup_srvlog (parray * backup_list );
4645static void confirm_block_size (const char * name ,int blcksz );
4746static void pg_start_backup (const char * label ,bool smooth ,pgBackup * backup );
4847static void pg_stop_backup (pgBackup * backup );
@@ -567,100 +566,17 @@ do_backup_arclog(parray *backup_list)
567566return files ;
568567}
569568
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-
650569int
651570do_backup (pgBackupOption bkupopt )
652571{
653572parray * backup_list ;
654573parray * files_database ;
655574parray * files_arclog ;
656- parray * files_srvlog ;
657575int ret ;
658576
659577/* repack the necesary options */
660578int keep_arclog_files = bkupopt .keep_arclog_files ;
661579int 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 ;
664580int keep_data_generations = bkupopt .keep_data_generations ;
665581int keep_data_days = bkupopt .keep_data_days ;
666582
@@ -680,11 +596,6 @@ do_backup(pgBackupOption bkupopt)
680596_ ("Required parameter not specified: ARCLOG_PATH "
681597"(-A, --arclog-path)" ));
682598
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-
688599#ifndef HAVE_LIBZ
689600if (current .compress_data )
690601{
@@ -727,7 +638,6 @@ do_backup(pgBackupOption bkupopt)
727638current .end_time = (time_t )0 ;
728639current .data_bytes = BYTES_INVALID ;
729640current .arclog_bytes = BYTES_INVALID ;
730- current .srvlog_bytes = BYTES_INVALID ;
731641current .backup_bytes = 0 ;
732642current .block_size = BLCKSZ ;
733643current .wal_block_size = XLOG_BLCKSZ ;
@@ -757,9 +667,6 @@ do_backup(pgBackupOption bkupopt)
757667
758668/* backup archived WAL */
759669files_arclog = do_backup_arclog (backup_list );
760-
761- /* backup serverlog */
762- files_srvlog = do_backup_srvlog (backup_list );
763670pgut_atexit_pop (backup_cleanup ,NULL );
764671
765672/* update backup status to DONE */
@@ -781,10 +688,6 @@ do_backup(pgBackupOption bkupopt)
781688current .backup_mode == BACKUP_MODE_INCREMENTAL )
782689total_read += current .arclog_bytes ;
783690
784- /* Server logs */
785- if (current .with_serverlog )
786- total_read += current .srvlog_bytes ;
787-
788691if (total_read == 0 )
789692printf (_ ("nothing to backup\n" ));
790693else
@@ -795,13 +698,10 @@ do_backup(pgBackupOption bkupopt)
795698}
796699
797700/*
798- * Delete old files (archived WAL and serverlog ) after update of status.
701+ * Delete old files (archived WAL) after update of status.
799702 */
800703delete_old_files (arclog_path ,files_arclog ,keep_arclog_files ,
801704keep_arclog_days , true);
802- if (current .with_serverlog )
803- delete_old_files (srvlog_path ,files_srvlog ,keep_srvlog_files ,
804- keep_srvlog_days , false);
805705
806706/* Delete old backup files after all backup operation. */
807707pgBackupDelete (keep_data_generations ,keep_data_days );
@@ -813,9 +713,6 @@ do_backup(pgBackupOption bkupopt)
813713if (files_arclog )
814714parray_walk (files_arclog ,pgFileFree );
815715parray_free (files_arclog );
816- if (files_srvlog )
817- parray_walk (files_srvlog ,pgFileFree );
818- parray_free (files_srvlog );
819716
820717/*
821718 * If this backup is full backup, delete backup of online WAL.