Skip to content

Commit 200e47b

Browse files
committed
[Issue #203] error out if FIO_FDMAX is exceeded in fio_open
1 parent b33f93c commit 200e47b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/backup.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync)
352352
dir_list_file(backup_files_list, parray_get(external_dirs, i),
353353
false, true, false, i+1, FIO_DB_HOST);
354354

355+
/* close ssh session in main thread */
356+
fio_disconnect();
357+
355358
/* Sanity check for backup_files_list, thank you, Windows:
356359
* https://github.com/postgrespro/pg_probackup/issues/48
357360
*/
@@ -526,9 +529,6 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync)
526529
arg->ret = 1;
527530
}
528531

529-
/* close ssh session in main thread */
530-
fio_disconnect();
531-
532532
/* Run threads */
533533
thread_interrupted = false;
534534
elog(INFO, "Start transferring data files");

src/utils/file.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ int fio_open(char const* path, int mode, fio_location location)
348348

349349
mask = fio_fdset;
350350
for (i = 0; (mask & 1) != 0; i++, mask >>= 1);
351-
if (i == FIO_FDMAX) {
352-
return -1;
353-
}
351+
if (i == FIO_FDMAX)
352+
elog(ERROR, "FIO_FDMAX is exceeded, probably too many remote files has been opened");
353+
354354
hdr.cop = FIO_OPEN;
355355
hdr.handle = i;
356356
hdr.size = strlen(path) + 1;

0 commit comments

Comments
 (0)