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

Commit71545d6

Browse files
committed
Merge branch 'master' into issue_92
2 parentseac3d8a +57da2e5 commit71545d6

File tree

4 files changed

+41
-21
lines changed

4 files changed

+41
-21
lines changed

‎src/delete.c‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,10 +832,13 @@ delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli,
832832
int
833833
do_delete_instance(void)
834834
{
835-
parray*backup_list;
836-
inti;
835+
parray*backup_list;
836+
parray*xlog_files_list;
837+
inti;
838+
intrc;
837839
charinstance_config_path[MAXPGPATH];
838840

841+
839842
/* Delete all backups. */
840843
backup_list=catalog_get_backup_list(INVALID_BACKUP_ID);
841844

@@ -852,23 +855,40 @@ do_delete_instance(void)
852855
parray_free(backup_list);
853856

854857
/* Delete all wal files. */
855-
delete_walfiles(InvalidXLogRecPtr,0,instance_config.xlog_seg_size);
858+
xlog_files_list=parray_new();
859+
dir_list_file(xlog_files_list,arclog_path, false, false, false,0,FIO_BACKUP_HOST);
860+
861+
for (i=0;i<parray_num(xlog_files_list);i++)
862+
{
863+
pgFile*wal_file= (pgFile*)parray_get(xlog_files_list,i);
864+
if (S_ISREG(wal_file->mode))
865+
{
866+
rc=unlink(wal_file->path);
867+
if (rc!=0)
868+
elog(WARNING,"Failed to remove file \"%s\": %s",
869+
wal_file->path,strerror(errno));
870+
}
871+
}
872+
873+
/* Cleanup */
874+
parray_walk(xlog_files_list,pgFileFree);
875+
parray_free(xlog_files_list);
856876

857877
/* Delete backup instance config file */
858878
join_path_components(instance_config_path,backup_instance_path,BACKUP_CATALOG_CONF_FILE);
859879
if (remove(instance_config_path))
860880
{
861-
elog(ERROR,"can't remove \"%s\": %s",instance_config_path,
881+
elog(ERROR,"Can't remove \"%s\": %s",instance_config_path,
862882
strerror(errno));
863883
}
864884

865885
/* Delete instance root directories */
866886
if (rmdir(backup_instance_path)!=0)
867-
elog(ERROR,"can't remove \"%s\": %s",backup_instance_path,
887+
elog(ERROR,"Can't remove \"%s\": %s",backup_instance_path,
868888
strerror(errno));
869889

870890
if (rmdir(arclog_path)!=0)
871-
elog(ERROR,"can't remove \"%s\": %s",arclog_path,
891+
elog(ERROR,"Can't remove \"%s\": %s",arclog_path,
872892
strerror(errno));
873893

874894
elog(INFO,"Instance '%s' successfully deleted",instance_name);

‎src/dir.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int BlackListCompare(const void *str1, const void *str2);
122122

123123
staticchardir_check_file(pgFile*file);
124124
staticvoiddir_list_file_internal(parray*files,pgFile*parent,boolexclude,
125-
boolomit_symlink,parray*black_list,
125+
boolfollow_symlink,parray*black_list,
126126
intexternal_dir_num,fio_locationlocation);
127127
staticvoidopt_path_map(ConfigOption*opt,constchar*arg,
128128
TablespaceList*list,constchar*type);
@@ -159,14 +159,14 @@ dir_create_dir(const char *dir, mode_t mode)
159159
}
160160

161161
pgFile*
162-
pgFileNew(constchar*path,constchar*rel_path,boolomit_symlink,
162+
pgFileNew(constchar*path,constchar*rel_path,boolfollow_symlink,
163163
intexternal_dir_num,fio_locationlocation)
164164
{
165165
structstatst;
166166
pgFile*file;
167167

168168
/* stat the file */
169-
if (fio_stat(path,&st,omit_symlink,location)<0)
169+
if (fio_stat(path,&st,follow_symlink,location)<0)
170170
{
171171
/* file not found is not an error case */
172172
if (errno==ENOENT)
@@ -445,11 +445,11 @@ BlackListCompare(const void *str1, const void *str2)
445445
* List files, symbolic links and directories in the directory "root" and add
446446
* pgFile objects to "files". We add "root" to "files" if add_root is true.
447447
*
448-
* Whenomit_symlink is true, symbolic link is ignored and only file or
448+
* Whenfollow_symlink is true, symbolic link is ignored and only file or
449449
* directory linked to will be listed.
450450
*/
451451
void
452-
dir_list_file(parray*files,constchar*root,boolexclude,boolomit_symlink,
452+
dir_list_file(parray*files,constchar*root,boolexclude,boolfollow_symlink,
453453
booladd_root,intexternal_dir_num,fio_locationlocation)
454454
{
455455
pgFile*file;
@@ -490,7 +490,7 @@ dir_list_file(parray *files, const char *root, bool exclude, bool omit_symlink,
490490
parray_qsort(black_list,BlackListCompare);
491491
}
492492

493-
file=pgFileNew(root,"",omit_symlink,external_dir_num,location);
493+
file=pgFileNew(root,"",follow_symlink,external_dir_num,location);
494494
if (file==NULL)
495495
{
496496
/* For external directory this is not ok */
@@ -512,7 +512,7 @@ dir_list_file(parray *files, const char *root, bool exclude, bool omit_symlink,
512512
if (add_root)
513513
parray_append(files,file);
514514

515-
dir_list_file_internal(files,file,exclude,omit_symlink,black_list,
515+
dir_list_file_internal(files,file,exclude,follow_symlink,black_list,
516516
external_dir_num,location);
517517

518518
if (!add_root)
@@ -731,7 +731,7 @@ dir_check_file(pgFile *file)
731731
*/
732732
staticvoid
733733
dir_list_file_internal(parray*files,pgFile*parent,boolexclude,
734-
boolomit_symlink,parray*black_list,
734+
boolfollow_symlink,parray*black_list,
735735
intexternal_dir_num,fio_locationlocation)
736736
{
737737
DIR*dir;
@@ -764,7 +764,7 @@ dir_list_file_internal(parray *files, pgFile *parent, bool exclude,
764764
join_path_components(child,parent->path,dent->d_name);
765765
join_path_components(rel_child,parent->rel_path,dent->d_name);
766766

767-
file=pgFileNew(child,rel_child,omit_symlink,external_dir_num,
767+
file=pgFileNew(child,rel_child,follow_symlink,external_dir_num,
768768
location);
769769
if (file==NULL)
770770
continue;
@@ -821,7 +821,7 @@ dir_list_file_internal(parray *files, pgFile *parent, bool exclude,
821821
* recursively.
822822
*/
823823
if (S_ISDIR(file->mode))
824-
dir_list_file_internal(files,file,exclude,omit_symlink,
824+
dir_list_file_internal(files,file,exclude,follow_symlink,
825825
black_list,external_dir_num,location);
826826
}
827827

‎src/pg_probackup.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ extern const char* deparse_compress_alg(int alg);
588588

589589
/* in dir.c */
590590
externvoiddir_list_file(parray*files,constchar*root,boolexclude,
591-
boolomit_symlink,booladd_root,intexternal_dir_num,fio_locationlocation);
591+
boolfollow_symlink,booladd_root,intexternal_dir_num,fio_locationlocation);
592592

593593
externvoidcreate_data_directories(parray*dest_files,
594594
constchar*data_dir,
@@ -621,7 +621,7 @@ extern bool fileExists(const char *path, fio_location location);
621621
externsize_tpgFileSize(constchar*path);
622622

623623
externpgFile*pgFileNew(constchar*path,constchar*rel_path,
624-
boolomit_symlink,intexternal_dir_num,
624+
boolfollow_symlink,intexternal_dir_num,
625625
fio_locationlocation);
626626
externpgFile*pgFileInit(constchar*path,constchar*rel_path);
627627
externvoidpgFileDelete(pgFile*file);

‎src/utils/file.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ int fio_fstat(int fd, struct stat* st)
663663
}
664664

665665
/* Get information about file */
666-
intfio_stat(charconst*path,structstat*st,boolfollow_symlinks,fio_locationlocation)
666+
intfio_stat(charconst*path,structstat*st,boolfollow_symlink,fio_locationlocation)
667667
{
668668
if (fio_is_remote(location))
669669
{
@@ -672,7 +672,7 @@ int fio_stat(char const* path, struct stat* st, bool follow_symlinks, fio_locati
672672

673673
hdr.cop=FIO_STAT;
674674
hdr.handle=-1;
675-
hdr.arg=follow_symlinks;
675+
hdr.arg=follow_symlink;
676676
hdr.size=path_len;
677677

678678
IO_CHECK(fio_write_all(fio_stdout,&hdr,sizeof(hdr)),sizeof(hdr));
@@ -691,7 +691,7 @@ int fio_stat(char const* path, struct stat* st, bool follow_symlinks, fio_locati
691691
}
692692
else
693693
{
694-
returnfollow_symlinks ?stat(path,st) :lstat(path,st);
694+
returnfollow_symlink ?stat(path,st) :lstat(path,st);
695695
}
696696
}
697697

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp