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

Commit0e6e9a4

Browse files
committed
[Issue#364] honor the "--no-validate" flag when working with tablespace_map
1 parent91da77b commit0e6e9a4

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

‎src/dir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,8 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
11161116
elog(VERBOSE,"Create directory \"%s\"",dir->rel_path);
11171117

11181118
join_path_components(to_path,data_dir,dir->rel_path);
1119+
1120+
// TODO check exit code
11191121
fio_mkdir(to_path,dir->mode,location);
11201122
}
11211123

@@ -1191,7 +1193,7 @@ read_tablespace_map(parray *links, const char *backup_dir)
11911193
* 3. backup has tablespaces and some of them are not empty
11921194
*/
11931195
int
1194-
check_tablespace_mapping(pgBackup*backup,boolincremental,boolforce,boolpgdata_is_empty)
1196+
check_tablespace_mapping(pgBackup*backup,boolincremental,boolforce,boolpgdata_is_empty,boolno_validate)
11951197
{
11961198
parray*links=parray_new();
11971199
size_ti;
@@ -1205,7 +1207,7 @@ check_tablespace_mapping(pgBackup *backup, bool incremental, bool force, bool pg
12051207
/* validate tablespace map,
12061208
* if there are no tablespaces, then there is nothing left to do
12071209
*/
1208-
if (!validate_tablespace_map(backup))
1210+
if (!validate_tablespace_map(backup,no_validate))
12091211
{
12101212
/*
12111213
* Sanity check

‎src/pg_probackup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ extern int do_validate_all(void);
891891
externintvalidate_one_page(Pagepage,BlockNumberabsolute_blkno,
892892
XLogRecPtrstop_lsn,PageState*page_st,
893893
uint32checksum_version);
894-
externboolvalidate_tablespace_map(pgBackup*backup);
894+
externboolvalidate_tablespace_map(pgBackup*backup,boolno_validate);
895895

896896
externparray*get_history_streaming(ConnectionOptions*conn_opt,TimeLineIDtli,parray*backup_list);
897897

@@ -987,7 +987,7 @@ extern void create_data_directories(parray *dest_files,
987987
externvoidread_tablespace_map(parray*links,constchar*backup_dir);
988988
externvoidopt_tablespace_map(ConfigOption*opt,constchar*arg);
989989
externvoidopt_externaldir_map(ConfigOption*opt,constchar*arg);
990-
externintcheck_tablespace_mapping(pgBackup*backup,boolincremental,boolforce,boolpgdata_is_empty);
990+
externintcheck_tablespace_mapping(pgBackup*backup,boolincremental,boolforce,boolpgdata_is_empty,boolno_validate);
991991
externvoidcheck_external_dir_mapping(pgBackup*backup,boolincremental);
992992
externchar*get_external_remap(char*current_dir);
993993

‎src/restore.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
410410
{
411411
intrc=check_tablespace_mapping(dest_backup,
412412
params->incremental_mode!=INCR_NONE,params->force,
413-
pgdata_is_empty);
413+
pgdata_is_empty,params->no_validate);
414414

415415
/* backup contain no tablespaces */
416416
if (rc==NoTblspc)
@@ -2173,6 +2173,8 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
21732173
postmaster_is_up= true;
21742174
}
21752175

2176+
/* check that PG_VERSION is the same */
2177+
21762178
/* slurp pg_control and check that system ID is the same
21772179
* check that instance is not running
21782180
* if lsn_based, check that there is no backup_label files is around AND
@@ -2182,6 +2184,7 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
21822184
* data files content, because based on pg_control information we will
21832185
* choose a backup suitable for lsn based incremental restore.
21842186
*/
2187+
elog(INFO,"Trying to read pg_control file in destination direstory");
21852188

21862189
system_id_pgdata=get_system_identifier(pgdata);
21872190

@@ -2214,6 +2217,10 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
22142217
if (postmaster_is_up)
22152218
returnPOSTMASTER_IS_RUNNING;
22162219

2220+
/* PG_CONTROL MISSING */
2221+
2222+
/* PG_CONTROL unreadable */
2223+
22172224
if (!system_id_match)
22182225
returnSYSTEM_ID_MISMATCH;
22192226

‎src/validate.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ do_validate_instance(void)
709709
* already filled pgBackup.files
710710
*/
711711
bool
712-
validate_tablespace_map(pgBackup*backup)
712+
validate_tablespace_map(pgBackup*backup,boolno_validate)
713713
{
714714
charmap_path[MAXPGPATH];
715715
pgFile*dummy=NULL;
@@ -740,12 +740,15 @@ validate_tablespace_map(pgBackup *backup)
740740
map_path,base36enc(backup->backup_id));
741741

742742
/* check tablespace map checksumms */
743-
crc=pgFileGetCRC(map_path,use_crc32c, false);
743+
if (!no_validate)
744+
{
745+
crc=pgFileGetCRC(map_path,use_crc32c, false);
744746

745-
if ((*tablespace_map)->crc!=crc)
746-
elog(ERROR,"Invalid CRC of tablespace map file \"%s\" : %X. Expected %X, "
747-
"probably backup %s is corrupt, validate it",
748-
map_path,crc, (*tablespace_map)->crc,base36enc(backup->backup_id));
747+
if ((*tablespace_map)->crc!=crc)
748+
elog(ERROR,"Invalid CRC of tablespace map file \"%s\" : %X. Expected %X, "
749+
"probably backup %s is corrupt, validate it",
750+
map_path,crc, (*tablespace_map)->crc,base36enc(backup->backup_id));
751+
}
749752

750753
pgFileFree(dummy);
751754
parray_walk(files,pgFileFree);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp