Skip to content

Commit 3c8aa66

Browse files
committed
Fix missing abort checks in pg_backup_directory.c.
Parallel restore from directory format failed to respond to control-C in a timely manner, because there were no checkAborting() calls in the code path that reads data from a file and sends it to the backend. If any worker was in the midst of restoring data for a large table, you'd just have to wait. This fix doesn't do anything for the problem of aborting a long-running server-side command, but at least it fixes things for data transfers. Back-patch to 9.3 where parallel restore was introduced.
1 parent 210981a commit 3c8aa66

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bin/pg_dump/pg_backup_directory.c

+8
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,12 @@ _PrintFileData(ArchiveHandle *AH, char *filename)
406406
buflen = ZLIB_OUT_SIZE;
407407

408408
while ((cnt = cfread(buf, buflen, cfp)))
409+
{
410+
/* Are we aborting? */
411+
checkAborting(AH);
412+
409413
ahwrite(buf, 1, cnt, AH);
414+
}
410415

411416
free(buf);
412417
if (cfclose(cfp) !=0)
@@ -543,6 +548,9 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len)
543548
{
544549
lclContext *ctx = (lclContext *) AH->formatData;
545550

551+
/* Are we aborting? */
552+
checkAborting(AH);
553+
546554
/*
547555
* If there was an I/O error, we already exited in cfread(), so here we
548556
* exit on short reads.

0 commit comments

Comments
 (0)