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

Commit836382f

Browse files
committed
[Issue#79] minor fixes
1 parenta4df3b4 commit836382f

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

‎src/restore.c‎

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
436436
inti;
437437

438438
/*
439-
* Get a list ofdbOid`s to skip if user requested the partial restore.
439+
* Get a list ofdbOids to skip if user requested the partial restore.
440440
* It is important that we do this after(!) validation so
441441
* database_map can be trusted.
442442
* NOTE: database_map could be missing for legal reasons, e.g. missing
@@ -692,11 +692,32 @@ restore_files(void *arg)
692692
if (interrupted||thread_interrupted)
693693
elog(ERROR,"Interrupted during restore database");
694694

695+
/* Directories were created before */
696+
if (S_ISDIR(file->mode))
697+
continue;
698+
695699
if (progress)
696700
elog(INFO,"Progress: (%d/%lu). Process file %s ",
697701
i+1, (unsigned long)parray_num(arguments->files),
698702
file->rel_path);
699703

704+
/* only files from pgdata can be skipped by partial restore */
705+
if (arguments->dbOid_exclude_list&&
706+
file->external_dir_num==0)
707+
{
708+
/* exclude map is not empty */
709+
if (parray_bsearch(arguments->dbOid_exclude_list,
710+
&file->dbOid,pgCompareOid))
711+
{
712+
/* got a match, destination file will truncated */
713+
create_empty_file(FIO_BACKUP_HOST,
714+
instance_config.pgdata,FIO_DB_HOST,file);
715+
716+
elog(VERBOSE,"Exclude file due to partial restore: \"%s\"",file->rel_path);
717+
continue;
718+
}
719+
}
720+
700721
/*
701722
* For PAGE and PTRACK backups skip datafiles which haven't changed
702723
* since previous backup and thus were not backed up.
@@ -717,10 +738,6 @@ restore_files(void *arg)
717738
}
718739
}
719740

720-
/* Directories were created before */
721-
if (S_ISDIR(file->mode))
722-
continue;
723-
724741
/* Do not restore tablespace_map file */
725742
if (path_is_prefix_of_path(PG_TABLESPACE_MAP_FILE,file->rel_path))
726743
{
@@ -729,7 +746,8 @@ restore_files(void *arg)
729746
}
730747

731748
/* Do not restore database_map file */
732-
if (path_is_prefix_of_path(DATABASE_MAP,file->rel_path))
749+
if ((file->external_dir_num==0)&&
750+
strcmp(DATABASE_MAP,file->rel_path)==0)
733751
{
734752
elog(VERBOSE,"Skip database_map");
735753
continue;
@@ -744,22 +762,6 @@ restore_files(void *arg)
744762
pgFileCompareRelPathWithExternal)==NULL)
745763
continue;
746764

747-
/* only files from pgdata can be skipped by partial restore */
748-
if (arguments->dbOid_exclude_list&& !file->external_dir_num)
749-
{
750-
/* exclude map is not empty */
751-
if (parray_bsearch(arguments->dbOid_exclude_list,
752-
&file->dbOid,pgCompareOid))
753-
{
754-
/* got a match, destination file will truncated */
755-
create_empty_file(FIO_BACKUP_HOST,
756-
instance_config.pgdata,FIO_DB_HOST,file);
757-
758-
elog(VERBOSE,"Exclude file due to partial restore: \"%s\"",file->rel_path);
759-
continue;
760-
}
761-
}
762-
763765
/*
764766
* restore the file.
765767
* We treat datafiles separately, cause they were backed up block by
@@ -1164,27 +1166,27 @@ parseRecoveryTargetOptions(const char *target_time,
11641166
returnrt;
11651167
}
11661168

1167-
/* ReturndbOidarray of databases that should not be restored
1168-
* Regardless of whatoptions user used, db-include or db-exclude,
1169-
* we convert it into exclude_list.
1169+
/* Return array of dbOids of databases that should not be restored
1170+
* Regardless of whatoption user used, db-include or db-exclude,
1171+
* wealwaysconvert it into exclude_list.
11701172
*/
11711173
parray*
11721174
get_dbOid_exclude_list(pgBackup*backup,parray*datname_list,boolpartial_restore_type)
11731175
{
11741176
inti;
11751177
intj;
11761178
parray*database_map=NULL;
1177-
parray*dbOid_exclude_list=NULL;
1179+
parray*dbOid_exclude_list=NULL;
11781180

11791181
/* get database_map from file */
11801182
database_map=read_database_map(backup);
11811183

11821184
/* partial restore requested but database_map is missing */
11831185
if (!database_map)
1184-
elog(ERROR,"Backup %s has empty database_map",base36enc(backup->start_time));
1186+
elog(ERROR,"Backup %s has emptyor mangleddatabase_map",base36enc(backup->start_time));
11851187

1186-
/* So we havedb-includelistand database list for it.
1187-
* We mustform upa list ofdatabases to exclude
1188+
/* So we have listof datnames and database_map for it.
1189+
* We mustconstructa list ofdbOids to exclude.
11881190
*/
11891191
if (partial_restore_type)
11901192
{
@@ -1263,7 +1265,7 @@ get_dbOid_exclude_list(pgBackup *backup, parray *datname_list, bool partial_rest
12631265
returndbOid_exclude_list;
12641266
}
12651267

1266-
/* Compare twoOid */
1268+
/* Compare twoOids */
12671269
int
12681270
pgCompareOid(constvoid*f1,constvoid*f2)
12691271
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp