Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5988e6b

Browse files
author
Michael Paquier
committed
Remove server backup feature
In order to keep only the core of pg_rman for incremental/differentialbackup, this looks necessary and makes the code more simple. Includingserver log files in a backup could be subject to discussion as well,as for example a Postgres base backup does not include them, justbecause in this case server instance is not aware of the log files.
1 parentf9a3d79 commit5988e6b

File tree

21 files changed

+34
-333
lines changed

21 files changed

+34
-333
lines changed

‎backup.c

Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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,
4242
parray*files,parray*prev_files,constXLogRecPtr*lsn,boolcompress,constchar*prefix);
4343
staticparray*do_backup_database(parray*backup_list,pgBackupOptionbkupopt);
4444
staticparray*do_backup_arclog(parray*backup_list);
45-
staticparray*do_backup_srvlog(parray*backup_list);
4645
staticvoidconfirm_block_size(constchar*name,intblcksz);
4746
staticvoidpg_start_backup(constchar*label,boolsmooth,pgBackup*backup);
4847
staticvoidpg_stop_backup(pgBackup*backup);
@@ -567,100 +566,17 @@ do_backup_arclog(parray *backup_list)
567566
returnfiles;
568567
}
569568

570-
/*
571-
* Take a backup of serverlog.
572-
*/
573-
staticparray*
574-
do_backup_srvlog(parray*backup_list)
575-
{
576-
inti;
577-
parray*files;
578-
parray*prev_files=NULL;/* file list of previous database backup */
579-
charpath[MAXPGPATH];
580-
charprev_file_txt[MAXPGPATH];
581-
pgBackup*prev_backup;
582-
int64srvlog_write_bytes=0;
583-
584-
if (!current.with_serverlog)
585-
returnNULL;
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-
returnfiles;
648-
}
649-
650569
int
651570
do_backup(pgBackupOptionbkupopt)
652571
{
653572
parray*backup_list;
654573
parray*files_database;
655574
parray*files_arclog;
656-
parray*files_srvlog;
657575
intret;
658576

659577
/* repack the necesary options */
660578
intkeep_arclog_files=bkupopt.keep_arclog_files;
661579
intkeep_arclog_days=bkupopt.keep_arclog_days;
662-
intkeep_srvlog_files=bkupopt.keep_srvlog_files;
663-
intkeep_srvlog_days=bkupopt.keep_srvlog_days;
664580
intkeep_data_generations=bkupopt.keep_data_generations;
665581
intkeep_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
#ifndefHAVE_LIBZ
689600
if (current.compress_data)
690601
{
@@ -727,7 +638,6 @@ do_backup(pgBackupOption bkupopt)
727638
current.end_time= (time_t)0;
728639
current.data_bytes=BYTES_INVALID;
729640
current.arclog_bytes=BYTES_INVALID;
730-
current.srvlog_bytes=BYTES_INVALID;
731641
current.backup_bytes=0;
732642
current.block_size=BLCKSZ;
733643
current.wal_block_size=XLOG_BLCKSZ;
@@ -757,9 +667,6 @@ do_backup(pgBackupOption bkupopt)
757667

758668
/* backup archived WAL */
759669
files_arclog=do_backup_arclog(backup_list);
760-
761-
/* backup serverlog */
762-
files_srvlog=do_backup_srvlog(backup_list);
763670
pgut_atexit_pop(backup_cleanup,NULL);
764671

765672
/* update backup status to DONE */
@@ -781,10 +688,6 @@ do_backup(pgBackupOption bkupopt)
781688
current.backup_mode==BACKUP_MODE_INCREMENTAL)
782689
total_read+=current.arclog_bytes;
783690

784-
/* Server logs */
785-
if (current.with_serverlog)
786-
total_read+=current.srvlog_bytes;
787-
788691
if (total_read==0)
789692
printf(_("nothing to backup\n"));
790693
else
@@ -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
*/
800703
delete_old_files(arclog_path,files_arclog,keep_arclog_files,
801704
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);
805705

806706
/* Delete old backup files after all backup operation. */
807707
pgBackupDelete(keep_data_generations,keep_data_days);
@@ -813,9 +713,6 @@ do_backup(pgBackupOption bkupopt)
813713
if (files_arclog)
814714
parray_walk(files_arclog,pgFileFree);
815715
parray_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.

‎catalog.c

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ catalog_get_backup_list(const pgBackupRange *range)
160160
if (!IsDir(backup_path,date_dir,date_ent)||date_ent->d_name[0]=='.')
161161
continue;
162162

163-
/* skip online WAL& serverlogbackup directory */
163+
/* skip online WAL backup directory */
164164
if (strcmp(date_ent->d_name,RESTORE_WORK_DIR)==0)
165165
continue;
166166

@@ -292,38 +292,13 @@ catalog_get_last_arclog_backup(parray *backup_list, TimeLineID tli)
292292
returnNULL;
293293
}
294294

295-
/*
296-
* Find the last completed serverlog backup from the backup list
297-
* on current timeline.
298-
*/
299-
pgBackup*
300-
catalog_get_last_srvlog_backup(parray*backup_list,TimeLineIDtli)
301-
{
302-
inti;
303-
pgBackup*backup=NULL;
304-
305-
/* backup_list is sorted in order of descending ID */
306-
for (i=0;i<parray_num(backup_list);i++)
307-
{
308-
backup= (pgBackup*)parray_get(backup_list,i);
309-
310-
/* we need completed serverlog backup */
311-
if (backup->status==BACKUP_STATUS_OK&&
312-
backup->with_serverlog&&
313-
backup->tli==tli)
314-
returnbackup;
315-
}
316-
317-
returnNULL;
318-
}
319-
320295
/* create backup directory in $BACKUP_PATH */
321296
int
322297
pgBackupCreateDir(pgBackup*backup)
323298
{
324299
inti;
325300
charpath[MAXPGPATH];
326-
char*subdirs[]= {DATABASE_DIR,ARCLOG_DIR,SRVLOG_DIR,NULL };
301+
char*subdirs[]= {DATABASE_DIR,ARCLOG_DIR,NULL };
327302

328303
pgBackupGetPath(backup,path,lengthof(path),NULL);
329304
dir_create_dir(path,DIR_PERMISSION);
@@ -349,7 +324,6 @@ pgBackupWriteConfigSection(FILE *out, pgBackup *backup)
349324
fprintf(out,"# configuration\n");
350325

351326
fprintf(out,"BACKUP_MODE=%s\n",modes[backup->backup_mode]);
352-
fprintf(out,"WITH_SERVERLOG=%s\n",BOOL_TO_STR(backup->with_serverlog));
353327
fprintf(out,"COMPRESS_DATA=%s\n",BOOL_TO_STR(backup->compress_data));
354328
}
355329

@@ -390,9 +364,6 @@ pgBackupWriteResultSection(FILE *out, pgBackup *backup)
390364
if (backup->arclog_bytes!=BYTES_INVALID)
391365
fprintf(out,"ARCLOG_BYTES="INT64_FORMAT"\n",
392366
backup->arclog_bytes);
393-
if (backup->srvlog_bytes!=BYTES_INVALID)
394-
fprintf(out,"SRVLOG_BYTES="INT64_FORMAT"\n",
395-
backup->srvlog_bytes);
396367
if (backup->backup_bytes!=BYTES_INVALID)
397368
fprintf(out,"BACKUP_BYTES="INT64_FORMAT"\n",
398369
backup->backup_bytes);
@@ -443,7 +414,6 @@ catalog_read_ini(const char *path)
443414
pgut_optionoptions[]=
444415
{
445416
{'s',0,"backup-mode",NULL,SOURCE_ENV },
446-
{'b',0,"with-serverlog",NULL,SOURCE_ENV },
447417
{'b',0,"compress-data",NULL,SOURCE_ENV },
448418
{'u',0,"timelineid",NULL,SOURCE_ENV },
449419
{'s',0,"start-lsn",NULL,SOURCE_ENV },
@@ -454,7 +424,6 @@ catalog_read_ini(const char *path)
454424
{'t',0,"recovery-time",NULL,SOURCE_ENV },
455425
{'I',0,"data-bytes",NULL,SOURCE_ENV },
456426
{'I',0,"arclog-bytes",NULL,SOURCE_ENV },
457-
{'I',0,"srvlog-bytes",NULL,SOURCE_ENV },
458427
{'I',0,"backup-bytes",NULL,SOURCE_ENV },
459428
{'u',0,"block-size",NULL,SOURCE_ENV },
460429
{'u',0,"xlog-block-size",NULL,SOURCE_ENV },
@@ -471,7 +440,6 @@ catalog_read_ini(const char *path)
471440

472441
i=0;
473442
options[i++].var=&backup_mode;
474-
options[i++].var=&backup->with_serverlog;
475443
options[i++].var=&backup->compress_data;
476444
options[i++].var=&backup->tli;
477445
options[i++].var=&start_lsn;
@@ -482,7 +450,6 @@ catalog_read_ini(const char *path)
482450
options[i++].var=&backup->recovery_time;
483451
options[i++].var=&backup->data_bytes;
484452
options[i++].var=&backup->arclog_bytes;
485-
options[i++].var=&backup->srvlog_bytes;
486453
options[i++].var=&backup->backup_bytes;
487454
options[i++].var=&backup->block_size;
488455
options[i++].var=&backup->wal_block_size;
@@ -620,7 +587,6 @@ void
620587
catalog_init_config(pgBackup*backup)
621588
{
622589
backup->backup_mode=BACKUP_MODE_INVALID;
623-
backup->with_serverlog= false;
624590
backup->compress_data= false;
625591
backup->status=BACKUP_STATUS_INVALID;
626592
backup->tli=0;
@@ -632,6 +598,5 @@ catalog_init_config(pgBackup *backup)
632598
backup->recovery_time= (time_t)0;
633599
backup->data_bytes=BYTES_INVALID;
634600
backup->arclog_bytes=BYTES_INVALID;
635-
backup->srvlog_bytes=BYTES_INVALID;
636601
backup->backup_bytes=BYTES_INVALID;
637602
}

‎data/sample_backup/20090531/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# configuration
22
BACKUP_MODE=FULL
3-
WITH_SERVERLOG=NO
43
COMPRESS_DATA=NO
54
# result
65
TIMELINEID=1
@@ -10,7 +9,6 @@ START_TIME='2009-05-31 17:05:53'
109
END_TIME='2009-05-31 17:09:13'
1110
DATA_BYTES=1242102558
1211
ARCLOG_BYTES=9223372036854775807
13-
SRVLOG_BYTES=-1
1412
BACKUP_BYTES=242102558
1513
BLOCK_SIZE=8192
1614
XLOG_BLOCK_SIZE=8192

‎data/sample_backup/20090601/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# configuration
22
BACKUP_MODE=INCREMENTAL
3-
WITH_SERVERLOG=NO
43
COMPRESS_DATA=NO
54
# result
65
TIMELINEID=1
@@ -10,7 +9,6 @@ START_TIME='2009-06-01 17:05:53'
109
END_TIME='2009-06-01 17:09:13'
1110
DATA_BYTES=9223372036854775807
1211
ARCLOG_BYTES=16777216
13-
SRVLOG_BYTES=-1
1412
BACKUP_BYTES=162372983
1513
BLOCK_SIZE=8192
1614
XLOG_BLOCK_SIZE=8192

‎data/sample_backup/20090602/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# configuration
22
BACKUP_MODE=ARCHIVE
3-
WITH_SERVERLOG=YES
43
COMPRESS_DATA=NO
54
# result
65
TIMELINEID=1
@@ -10,7 +9,6 @@ START_TIME='2009-06-02 17:05:03'
109
END_TIME='2009-06-02 17:05:03'
1110
DATA_BYTES=-1
1211
ARCLOG_BYTES=-1
13-
SRVLOG_BYTES=4335423
1412
BACKUP_BYTES=162372983
1513
BLOCK_SIZE=8192
1614
XLOG_BLOCK_SIZE=8192

‎data/sample_backup/20090603/170553/backup.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# configuration
22
BACKUP_MODE=FULL
3-
WITH_SERVERLOG=YES
43
COMPRESS_DATA=NO
54
# result
65
TIMELINEID=1
@@ -10,7 +9,6 @@ START_TIME='2009-06-03 17:05:53'
109
END_TIME='2009-06-03 17:05:53'
1110
DATA_BYTES=-1
1211
ARCLOG_BYTES=-1
13-
SRVLOG_BYTES=-1
1412
BACKUP_BYTES=-1
1513
BLOCK_SIZE=8192
1614
XLOG_BLOCK_SIZE=8192

‎delete.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ pgBackupDeleteFiles(pgBackup *backup)
199199
dir_list_file(files,path,NULL, true, true);
200200
pgBackupGetPath(backup,path,lengthof(path),ARCLOG_DIR);
201201
dir_list_file(files,path,NULL, true, true);
202-
pgBackupGetPath(backup,path,lengthof(path),SRVLOG_DIR);
203-
dir_list_file(files,path,NULL, true, true);
204202

205203
/* delete leaf node first */
206204
parray_qsort(files,pgFileComparePathDesc);

‎dir.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const char *pgdata_exclude[] =
2525
"pg_stat_tmp",
2626
"pgsql_tmp",
2727
NULL,/* arclog_path will be set later */
28-
NULL,/* srvlog_path will be set later */
2928
NULL,/* 'pg_tblspc' will be set later */
3029
NULL,/* sentinel */
3130
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp