@@ -550,80 +550,6 @@ list_data_directories(parray *files, const char *path, bool is_root,
550
550
path , strerror (prev_errno ));
551
551
}
552
552
553
- /*
554
- * List symlinks of tablespaces. Symlinks locate on pg_tblspc directory.
555
- */
556
- void
557
- create_tablespace_map (const char * pg_data , const char * backup_dir )
558
- {
559
- char path [MAXPGPATH ];
560
- FILE * fp = NULL ;
561
- DIR * dir ;
562
- struct dirent * dent ;
563
- int prev_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
- char child [MAXPGPATH ];
575
- struct stat st ;
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_t len ;
591
- char linked [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
- char map_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
-
627
553
/*
628
554
* Read names of symbolik names of tablespaces with links to directories from
629
555
* tablespace_map or tablespace_map.txt.
@@ -639,12 +565,11 @@ read_tablespace_map(parray *files, const char *backup_dir)
639
565
join_path_components (db_path , backup_dir , DATABASE_DIR );
640
566
join_path_components (map_path , db_path , "tablespace_map" );
641
567
642
- /* Exit if database/tablespace_map and tablespace_map.txt don't exists */
568
+ /* Exit if database/tablespace_map don't exists */
643
569
if (!fileExists (map_path ))
644
570
{
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 ;
648
573
}
649
574
650
575
fp = fopen (map_path , "rt" );
0 commit comments