Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5181420

Browse files
author
Artur Zakirov
committed
Create rest or directories for tablespaces during restore page backup
1 parent faae297 commit 5181420

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

restore.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
416416
link_name[len] = '\0';
417417
}
418418
else
419-
strcpy(link_name, link_ptr);
419+
goto create_directory;
420420

421421
tmp_ptr = dir->path;
422422
dir->path = link_name;
@@ -442,7 +442,13 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
442442
* create it second time.
443443
*/
444444
if (strcmp(dir_created, linked_path) == 0)
445-
continue;
445+
{
446+
/* Create rest of directories */
447+
if (link_sep && (link_sep + 1))
448+
goto create_directory;
449+
else
450+
continue;
451+
}
446452
else
447453
elog(ERROR, "tablespace directory \"%s\" of page backup does not "
448454
"match with previous created tablespace directory \"%s\" of symlink \"%s\"",
@@ -467,12 +473,6 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
467473

468474
/* Firstly, create linked directory */
469475
dir_create_dir(linked_path, DIR_PERMISSION);
470-
/* Create rest of directories */
471-
if (link_sep && (link_sep + 1))
472-
{
473-
join_path_components(to_path, linked_path, link_sep + 1);
474-
dir_create_dir(to_path, DIR_PERMISSION);
475-
}
476476

477477
join_path_components(to_path, pg_data_dir, PG_TBLSPC_DIR);
478478
/* Create pg_tblspc directory just in case */
@@ -487,10 +487,15 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
487487
/* Save linked directory */
488488
set_tablespace_created(link_name, linked_path);
489489

490+
/* Create rest of directories */
491+
if (link_sep && (link_sep + 1))
492+
goto create_directory;
493+
490494
continue;
491495
}
492496
}
493497

498+
create_directory:
494499
elog(LOG, "create directory \"%s\"", relative_ptr);
495500

496501
/* This is not symlink, create directory */

0 commit comments

Comments
 (0)