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

Commit5bc8d45

Browse files
author
Artur Zakirov
committed
Do not create tablespace_map.txt file
1 parentb8edd16 commit5bc8d45

File tree

4 files changed

+4
-86
lines changed

4 files changed

+4
-86
lines changed

‎backup.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ do_backup_database(parray *backup_list, bool smooth_checkpoint)
9696
{
9797
size_ti;
9898
parray*prev_files=NULL;/* file list of previous database backup */
99-
charcurrent_path[MAXPGPATH];
10099
chardatabase_path[MAXPGPATH];
101100
chardst_backup_path[MAXPGPATH];
102101
charlabel[1024];
@@ -193,11 +192,6 @@ do_backup_database(parray *backup_list, bool smooth_checkpoint)
193192
}
194193
}
195194

196-
pgBackupGetPath(&current,current_path,lengthof(current_path),NULL);
197-
/* Make tablespace_map.txt file on standby */
198-
if (from_replica)
199-
create_tablespace_map(pgdata,current_path);
200-
201195
/*
202196
* To take differential backup, the file list of the last completed database
203197
* backup is needed.

‎dir.c

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -550,80 +550,6 @@ list_data_directories(parray *files, const char *path, bool is_root,
550550
path,strerror(prev_errno));
551551
}
552552

553-
/*
554-
* List symlinks of tablespaces. Symlinks locate on pg_tblspc directory.
555-
*/
556-
void
557-
create_tablespace_map(constchar*pg_data,constchar*backup_dir)
558-
{
559-
charpath[MAXPGPATH];
560-
FILE*fp=NULL;
561-
DIR*dir;
562-
structdirent*dent;
563-
intprev_errno;
564-
565-
join_path_components(path,pg_data,PG_TBLSPC_DIR);
566-
567-
dir=opendir(path);
568-
if (dir==NULL)
569-
elog(ERROR,"cannot open directory \"%s\": %s",path,strerror(errno));
570-
571-
errno=0;
572-
while ((dent=readdir(dir)))
573-
{
574-
charchild[MAXPGPATH];
575-
structstatst;
576-
577-
/* skip entries point current dir or parent dir */
578-
if (strcmp(dent->d_name,".")==0||
579-
strcmp(dent->d_name,"..")==0)
580-
continue;
581-
582-
join_path_components(child,path,dent->d_name);
583-
584-
/* Check if file is symlink */
585-
if (lstat(child,&st)==-1)
586-
elog(ERROR,"cannot stat file \"%s\": %s",child,strerror(errno));
587-
588-
if (S_ISLNK(st.st_mode))
589-
{
590-
ssize_tlen;
591-
charlinked[MAXPGPATH];
592-
593-
len=readlink(child,linked,sizeof(linked));
594-
if (len<0)
595-
elog(ERROR,"cannot read link \"%s\": %s",child,
596-
strerror(errno));
597-
if (len >=sizeof(linked))
598-
elog(ERROR,"symbolic link \"%s\" target is too long\n",child);
599-
600-
linked[len]='\0';
601-
602-
/* Open file if this is first symlink */
603-
if (fp==NULL)
604-
{
605-
charmap_path[MAXPGPATH];
606-
607-
join_path_components(map_path,backup_dir,TABLESPACE_MAP_FILE);
608-
fp=pgut_fopen(map_path,"wt", false);
609-
}
610-
611-
fprintf(fp,"%s %s",dent->d_name,linked);
612-
}
613-
}
614-
615-
prev_errno=errno;
616-
617-
closedir(dir);
618-
if (fp)
619-
fclose(fp);
620-
621-
/* If we had error during readdir() */
622-
if (prev_errno&&prev_errno!=ENOENT)
623-
elog(ERROR,"cannot read directory \"%s\": %s",
624-
path,strerror(prev_errno));
625-
}
626-
627553
/*
628554
* Read names of symbolik names of tablespaces with links to directories from
629555
* tablespace_map or tablespace_map.txt.
@@ -639,12 +565,11 @@ read_tablespace_map(parray *files, const char *backup_dir)
639565
join_path_components(db_path,backup_dir,DATABASE_DIR);
640566
join_path_components(map_path,db_path,"tablespace_map");
641567

642-
/* Exit if database/tablespace_mapand tablespace_map.txtdon't exists */
568+
/* Exit if database/tablespace_map don't exists */
643569
if (!fileExists(map_path))
644570
{
645-
join_path_components(map_path,backup_dir,TABLESPACE_MAP_FILE);
646-
if (!fileExists(map_path))
647-
return;
571+
elog(LOG,"there is no file tablespace_map");
572+
return;
648573
}
649574

650575
fp=fopen(map_path,"rt");

‎pg_probackup.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#defineBACKUP_CATALOG_CONF_FILE"pg_probackup.conf"
4343
#defineMKDIRS_SH_FILE"mkdirs.sh"
4444
#defineDATABASE_FILE_LIST"file_database.txt"
45-
#defineTABLESPACE_MAP_FILE"tablespace_map.txt"
4645
#definePG_BACKUP_LABEL_FILE"backup_label"
4746
#definePG_BLACK_LIST"black_list"
4847

@@ -317,7 +316,6 @@ extern void dir_list_file(parray *files, const char *root, bool exclude,
317316
externvoidlist_data_directories(parray*files,constchar*path,
318317
boolis_root,boolexclude);
319318

320-
externvoidcreate_tablespace_map(constchar*pg_data,constchar*backup_dir);
321319
externvoidread_tablespace_map(parray*files,constchar*backup_dir);
322320

323321
externvoidprint_file_list(FILE*out,constparray*files,constchar*root);

‎tests/restore_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ def test_restore_with_tablespace_mapping_12(self):
524524
self.restore_pb(node))
525525

526526
# 3 - Restore using tablespace-mapping
527+
node.cleanup()
527528
tblspc_path_new=path.join(node.base_dir,"tblspc_new")
528529
self.assertIn(six.b("INFO: restore complete."),
529530
self.restore_pb(node,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp