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

Commitb09140a

Browse files
committed
remove unused function: create_data_directories_manual()
1 parentead629b commitb09140a

File tree

2 files changed

+0
-157
lines changed

2 files changed

+0
-157
lines changed

‎src/dir.c

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,158 +1187,6 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
11871187
}
11881188
}
11891189

1190-
/*
1191-
* Create backup directories from **backup_dir** to **data_dir**. Doesn't raise
1192-
* an error if target directories exist.
1193-
*
1194-
* If **extract_tablespaces** is true then try to extract tablespace data
1195-
* directories into their initial path using tablespace_map file.
1196-
*/
1197-
void
1198-
create_data_directories_manual(constchar*data_dir,constchar*backup_dir,
1199-
boolextract_tablespaces,fio_locationlocation)
1200-
{
1201-
parray*dirs,
1202-
*links=NULL;
1203-
size_ti;
1204-
charbackup_database_dir[MAXPGPATH],
1205-
to_path[MAXPGPATH];
1206-
dirs=parray_new();
1207-
if (extract_tablespaces)
1208-
{
1209-
links=parray_new();
1210-
read_tablespace_map(links,backup_dir);
1211-
/* Sort links by a link name*/
1212-
parray_qsort(links,pgFileComparePath);
1213-
}
1214-
1215-
join_path_components(backup_database_dir,backup_dir,DATABASE_DIR);
1216-
list_data_directories(dirs,backup_database_dir,"", false,
1217-
FIO_BACKUP_HOST);
1218-
1219-
elog(LOG,"Restore directories and symlinks...");
1220-
1221-
for (i=0;i<parray_num(dirs);i++)
1222-
{
1223-
pgFile*dir= (pgFile*)parray_get(dirs,i);
1224-
1225-
Assert(S_ISDIR(dir->mode));
1226-
1227-
/* Try to create symlink and linked directory if necessary */
1228-
if (extract_tablespaces&&
1229-
path_is_prefix_of_path(PG_TBLSPC_DIR,dir->rel_path))
1230-
{
1231-
char*link_ptr=GetRelativePath(dir->rel_path,PG_TBLSPC_DIR),
1232-
*link_sep,
1233-
*tmp_ptr;
1234-
charlink_name[MAXPGPATH];
1235-
pgFile**link;
1236-
1237-
/* Extract link name from relative path */
1238-
link_sep=first_dir_separator(link_ptr);
1239-
if (link_sep!=NULL)
1240-
{
1241-
intlen=link_sep-link_ptr;
1242-
strncpy(link_name,link_ptr,len);
1243-
link_name[len]='\0';
1244-
}
1245-
else
1246-
gotocreate_directory;
1247-
1248-
tmp_ptr=dir->path;
1249-
dir->path=link_name;
1250-
/* Search only by symlink name without path */
1251-
link= (pgFile**)parray_bsearch(links,dir,pgFileComparePath);
1252-
dir->path=tmp_ptr;
1253-
1254-
if (link)
1255-
{
1256-
constchar*linked_path=get_tablespace_mapping((*link)->linked);
1257-
constchar*dir_created;
1258-
1259-
if (!is_absolute_path(linked_path))
1260-
elog(ERROR,"tablespace directory is not an absolute path: %s\n",
1261-
linked_path);
1262-
1263-
/* Check if linked directory was created earlier */
1264-
dir_created=get_tablespace_created(link_name);
1265-
if (dir_created)
1266-
{
1267-
/*
1268-
* If symlink and linked directory were created do not
1269-
* create it second time.
1270-
*/
1271-
if (strcmp(dir_created,linked_path)==0)
1272-
{
1273-
/*
1274-
* Create rest of directories.
1275-
* First check is there any directory name after
1276-
* separator.
1277-
*/
1278-
if (link_sep!=NULL&&*(link_sep+1)!='\0')
1279-
gotocreate_directory;
1280-
else
1281-
continue;
1282-
}
1283-
else
1284-
elog(ERROR,"tablespace directory \"%s\" of page backup does not "
1285-
"match with previous created tablespace directory \"%s\" of symlink \"%s\"",
1286-
linked_path,dir_created,link_name);
1287-
}
1288-
1289-
if (link_sep)
1290-
elog(VERBOSE,"create directory \"%s\" and symbolic link \"%.*s\"",
1291-
linked_path,
1292-
(int) (link_sep-dir->rel_path),dir->rel_path);
1293-
else
1294-
elog(VERBOSE,"create directory \"%s\" and symbolic link \"%s\"",
1295-
linked_path,dir->rel_path);
1296-
1297-
/* Firstly, create linked directory */
1298-
fio_mkdir(linked_path,DIR_PERMISSION,location);
1299-
1300-
join_path_components(to_path,data_dir,PG_TBLSPC_DIR);
1301-
/* Create pg_tblspc directory just in case */
1302-
fio_mkdir(to_path,DIR_PERMISSION,location);
1303-
1304-
/* Secondly, create link */
1305-
join_path_components(to_path,to_path,link_name);
1306-
if (fio_symlink(linked_path,to_path,location)<0)
1307-
elog(ERROR,"could not create symbolic link \"%s\": %s",
1308-
to_path,strerror(errno));
1309-
1310-
/* Save linked directory */
1311-
set_tablespace_created(link_name,linked_path);
1312-
1313-
/*
1314-
* Create rest of directories.
1315-
* First check is there any directory name after separator.
1316-
*/
1317-
if (link_sep!=NULL&&*(link_sep+1)!='\0')
1318-
gotocreate_directory;
1319-
1320-
continue;
1321-
}
1322-
}
1323-
1324-
create_directory:
1325-
elog(VERBOSE,"create directory \"%s\"",dir->rel_path);
1326-
1327-
/* This is not symlink, create directory */
1328-
join_path_components(to_path,data_dir,dir->rel_path);
1329-
fio_mkdir(to_path,DIR_PERMISSION,location);
1330-
}
1331-
1332-
if (extract_tablespaces)
1333-
{
1334-
parray_walk(links,pgFileFree);
1335-
parray_free(links);
1336-
}
1337-
1338-
parray_walk(dirs,pgFileFree);
1339-
parray_free(dirs);
1340-
}
1341-
13421190
/*
13431191
* Read names of symbolik names of tablespaces with links to directories from
13441192
* tablespace_map or tablespace_map.txt.

‎src/pg_probackup.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,6 @@ extern const char* deparse_compress_alg(int alg);
577577
externvoiddir_list_file(parray*files,constchar*root,boolexclude,
578578
boolomit_symlink,booladd_root,intexternal_dir_num,fio_locationlocation);
579579

580-
externvoidcreate_data_directories_manual(constchar*data_dir,
581-
constchar*backup_dir,
582-
boolextract_tablespaces,
583-
fio_locationlocation);
584-
585580
externvoidcreate_data_directories(parray*dest_files,
586581
constchar*data_dir,
587582
constchar*backup_dir,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp