diff options
author | Tom Lane | 2016-05-29 17:18:48 +0000 |
---|---|---|
committer | Tom Lane | 2016-05-29 17:18:48 +0000 |
commit | 826c94a43e5946b474bef50fbf027a9df10f3945 (patch) | |
tree | 549a9e1c5322a9b151a4357bab047cb9a2911ec7 | |
parent | 2ee6bf59e51b4a9f86ef41832ae7fa92d427311b (diff) |
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.
-rw-r--r-- | src/bin/pg_dump/pg_backup_directory.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c index 39e29d80221..29c2daafa21 100644 --- a/src/bin/pg_dump/pg_backup_directory.c +++ b/src/bin/pg_dump/pg_backup_directory.c @@ -405,7 +405,12 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt) buflen = ZLIB_OUT_SIZE; while ((cnt = cfread(buf, buflen, cfp))) + { + /* Are we aborting? */ + checkAborting(AH); + ahwrite(buf, 1, cnt, AH); + } free(buf); if (cfclose(cfp) !=0) @@ -542,6 +547,9 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len) { lclContext *ctx = (lclContext *) AH->formatData; + /* Are we aborting? */ + checkAborting(AH); + /* * If there was an I/O error, we already exited in cfread(), so here we * exit on short reads. |