Skip to content

Commit 3033e73

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 99e3298 commit 3033e73

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bin/pg_dump/pg_backup_directory.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,12 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
411411
buflen = ZLIB_OUT_SIZE;
412412

413413
while ((cnt = cfread(buf, buflen, cfp)))
414+
{
415+
/* Are we aborting? */
416+
checkAborting(AH);
417+
414418
ahwrite(buf, 1, cnt, AH);
419+
}
415420

416421
free(buf);
417422
if (cfclose(cfp) !=0)
@@ -556,6 +561,9 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len)
556561
lclContext *ctx = (lclContext *) AH->formatData;
557562
size_t res;
558563

564+
/* Are we aborting? */
565+
checkAborting(AH);
566+
559567
res = cfread(buf, len, ctx->dataFH);
560568

561569
return res;

0 commit comments

Comments
 (0)