Skip to content

Commit e78c61a

Browse files
committed
Merge branch 'REL_2_6' into try-merge-2.6
2 parents 0bed194 + 2f2d879 commit e78c61a

File tree

15 files changed

+394
-286
lines changed

15 files changed

+394
-286
lines changed

src/archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ setup_push_filelist(const char *archive_status_dir, const char *first_file,
646646

647647
/* get list of files from archive_status */
648648
status_files = parray_new();
649-
dir_list_file(status_files, archive_status_dir, false, false, false, false, true, 0, FIO_DB_HOST);
649+
db_list_dir(status_files, archive_status_dir, false, false, 0);
650650
parray_qsort(status_files, pgFileCompareName);
651651

652652
for (i = 0; i < parray_num(status_files); i++)

src/backup.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
269269
join_path_components(external_prefix, current.root_dir, EXTERNAL_DIR);
270270

271271
/* list files with the logical path. omit $PGDATA */
272-
fio_list_dir(backup_files_list, instance_config.pgdata,
273-
true, true, false, backup_logs, true, 0);
272+
db_list_dir(backup_files_list, instance_config.pgdata, true, backup_logs, 0);
273+
exclude_files(backup_files_list, backup_logs);
274274

275275
/*
276276
* Get database_map (name to oid) for use in partial restore feature.
@@ -288,12 +288,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
288288
{
289289
/* External dirs numeration starts with 1.
290290
* 0 value is not external dir */
291-
if (fio_is_remote(FIO_DB_HOST))
292-
fio_list_dir(backup_files_list, parray_get(external_dirs, i),
293-
false, true, false, false, true, i+1);
294-
else
295-
dir_list_file(backup_files_list, parray_get(external_dirs, i),
296-
false, true, false, false, true, i+1, FIO_LOCAL_HOST);
291+
db_list_dir(backup_files_list, parray_get(external_dirs, i), false, false, i+1);
297292
}
298293
}
299294

src/catalog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,8 +1548,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance)
15481548
char end_segno_str[MAXFNAMELEN];
15491549

15501550
/* read all xlog files that belong to this archive */
1551-
dir_list_file(xlog_files_list, instanceState->instance_wal_subdir_path,
1552-
false, true, false, false, true, 0, FIO_BACKUP_HOST);
1551+
backup_list_dir(xlog_files_list, instanceState->instance_wal_subdir_path);
15531552
parray_qsort(xlog_files_list, pgFileCompareName);
15541553

15551554
timelineinfos = parray_new();

src/catchup.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,9 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
647647
if (current.backup_mode != BACKUP_MODE_FULL)
648648
{
649649
dest_filelist = parray_new();
650-
dir_list_file(dest_filelist, dest_pgdata,
651-
true, true, false, backup_logs, true, 0, FIO_LOCAL_HOST);
650+
db_list_dir(dest_filelist, dest_pgdata, true, backup_logs, 0);
652651
filter_filelist(dest_filelist, dest_pgdata, exclude_absolute_paths_list, exclude_relative_paths_list, "Destination");
652+
exclude_files(dest_filelist, backup_logs);
653653

654654
// fill dest_redo.lsn and dest_redo.tli
655655
get_redo(FIO_LOCAL_HOST, dest_pgdata, &dest_redo);
@@ -714,12 +714,8 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
714714
source_filelist = parray_new();
715715

716716
/* list files with the logical path. omit $PGDATA */
717-
if (fio_is_remote(FIO_DB_HOST))
718-
fio_list_dir(source_filelist, source_pgdata,
719-
true, true, false, backup_logs, true, 0);
720-
else
721-
dir_list_file(source_filelist, source_pgdata,
722-
true, true, false, backup_logs, true, 0, FIO_LOCAL_HOST);
717+
db_list_dir(source_filelist, source_pgdata, true, backup_logs, 0);
718+
exclude_files(source_filelist, backup_logs);
723719

724720
//REVIEW FIXME. Let's fix that before release.
725721
// TODO what if wal is not a dir (symlink to a dir)?

src/checkdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ do_block_validation(char *pgdata, uint32 checksum_version)
207207
files_list = parray_new();
208208

209209
/* list files with the logical path. omit $PGDATA */
210-
dir_list_file(files_list, pgdata, true, true,
211-
false, false, true, 0, FIO_DB_HOST);
210+
db_list_dir(files_list, pgdata, true, false, 0);
211+
exclude_files(files_list, false);
212212

213213
/*
214214
* Sort pathname ascending.

src/delete.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,7 @@ do_retention_wal(InstanceState *instanceState, bool dry_run)
731731
void
732732
delete_backup_files(pgBackup *backup)
733733
{
734-
size_t i;
735734
char timestamp[100];
736-
parray *files;
737-
size_t num_files;
738-
char full_path[MAXPGPATH];
739735

740736
/*
741737
* If the backup was deleted already, there is nothing to do.
@@ -761,32 +757,8 @@ delete_backup_files(pgBackup *backup)
761757
*/
762758
write_backup_status(backup, BACKUP_STATUS_DELETING, false);
763759

764-
/* list files to be deleted */
765-
files = parray_new();
766-
dir_list_file(files, backup->root_dir, false, false, true, false, false, 0, FIO_BACKUP_HOST);
767-
768-
/* delete leaf node first */
769-
parray_qsort(files, pgFileCompareRelPathWithExternalDesc);
770-
num_files = parray_num(files);
771-
for (i = 0; i < num_files; i++)
772-
{
773-
pgFile *file = (pgFile *) parray_get(files, i);
774-
775-
join_path_components(full_path, backup->root_dir, file->rel_path);
776-
777-
if (interrupted)
778-
elog(ERROR, "interrupted during delete backup");
779-
780-
if (progress)
781-
elog(INFO, "Progress: (%zd/%zd). Delete file \"%s\"",
782-
i + 1, num_files, full_path);
783-
784-
if (fio_remove(FIO_BACKUP_HOST, full_path, false) != 0)
785-
elog(ERROR, "Cannot remove file or directory \"%s\": %s", full_path, strerror(errno));
786-
}
787-
788-
parray_walk(files, pgFileFree);
789-
parray_free(files);
760+
pioDrive_i drive = pioDriveForLocation(FIO_BACKUP_HOST);
761+
$i(pioRemoveDir, drive, .root = backup->root_dir, .root_as_well = true);
790762
backup->status = BACKUP_STATUS_DELETED;
791763

792764
return;

0 commit comments

Comments
 (0)