You've already forked pg_probackup
							
							
				mirror of
				https://github.com/postgrespro/pg_probackup.git
				synced 2025-10-31 00:17:52 +02:00 
			
		
		
		
	fix check_tablespace_mapping
This commit is contained in:
		
							
								
								
									
										3
									
								
								dir.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								dir.c
									
									
									
									
									
								
							| @@ -616,7 +616,7 @@ read_tablespace_map(parray *files, const char *backup_dir) | ||||
| 	join_path_components(db_path, backup_dir, DATABASE_DIR); | ||||
| 	join_path_components(map_path, db_path, PG_TABLESPACE_MAP_FILE); | ||||
|  | ||||
| 	/* Exit if database/tablespace_map don't exists */ | ||||
| 	/* Exit if database/tablespace_map doesn't exist */ | ||||
| 	if (!fileExists(map_path)) | ||||
| 	{ | ||||
| 		elog(LOG, "there is no file tablespace_map"); | ||||
| @@ -648,6 +648,7 @@ read_tablespace_map(parray *files, const char *backup_dir) | ||||
| 		parray_append(files, file); | ||||
| 	} | ||||
|  | ||||
| 	parray_qsort(files, pgFileCompareLinked); | ||||
| 	fclose(fp); | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										11
									
								
								restore.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								restore.c
									
									
									
									
									
								
							| @@ -210,6 +210,7 @@ do_restore_or_validate(time_t target_backup_id, | ||||
| 	/* | ||||
| 	 * Validate backups from base_full_backup to dest_backup. | ||||
| 	 * And restore if subcommand is RESTORE. | ||||
| 	 * TODO what if we found out that backup is not valid? | ||||
| 	 */ | ||||
| 	for (i = base_full_backup_index; i >= dest_backup_index; i--) | ||||
| 	{ | ||||
| @@ -270,6 +271,10 @@ restore_backup(pgBackup *backup) | ||||
| 	pthread_t	restore_threads[num_threads]; | ||||
| 	restore_files_args *restore_threads_args[num_threads]; | ||||
|  | ||||
| 	if (backup->status != BACKUP_STATUS_OK) | ||||
| 		elog(ERROR, "Backup %s cannot be restored because it is not valid", | ||||
| 			 base36enc(backup->start_time)); | ||||
|  | ||||
| 	/* confirm block size compatibility */ | ||||
| 	if (backup->block_size != BLCKSZ) | ||||
| 		elog(ERROR, | ||||
| @@ -541,7 +546,7 @@ create_directory: | ||||
|  | ||||
| /* | ||||
|  * Check that all tablespace mapping entries have correct linked directory | ||||
|  * paths. Linked directories should be empty or do not exist. | ||||
|  * paths. Linked directories must be empty or do not exist. | ||||
|  * | ||||
|  * If tablespace-mapping option is supplied all OLDDIR entries should have | ||||
|  * entries in tablespace_map file. | ||||
| @@ -561,7 +566,7 @@ check_tablespace_mapping(pgBackup *backup) | ||||
| 	pgBackupGetPath(backup, backup_path, lengthof(backup_path), NULL); | ||||
| 	read_tablespace_map(links, backup_path); | ||||
|  | ||||
| 	elog(LOG, "check tablespace directories..."); | ||||
| 	elog(LOG, "check tablespace directories of backup %s", base36enc(backup->start_time)); | ||||
|  | ||||
| 	/* 1 - OLDDIR should has an entry in links */ | ||||
| 	for (cell = tablespace_dirs.head; cell; cell = cell->next) | ||||
| @@ -570,7 +575,7 @@ check_tablespace_mapping(pgBackup *backup) | ||||
|  | ||||
| 		if (parray_bsearch(links, tmp_file, pgFileCompareLinked) == NULL) | ||||
| 			elog(ERROR, "--tablespace-mapping option's old directory " | ||||
| 				 "has not an entry in tablespace_map file: \"%s\"", | ||||
| 				 "doesn't have an entry in tablespace_map file: \"%s\"", | ||||
| 				 cell->old_dir); | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user