summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-08-28 21:48:58 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-08-28 21:49:32 -0400
commit2719a7478db67d5ec081daa76691892ced04077f (patch)
tree51bbd5b0243b55194580a463410d918f222f0e61 /src
parent427ba0e7146a79e73764d77a689b756b8fc37ec3 (diff)
Be more user-friendly about unsupported cases for parallel pg_restore.
If we are unable to do a parallel restore because the input file is stdin or is otherwise unseekable, we should complain and fail immediately, not after having done some of the restore. Complaining once per thread isn't so cool either, and the messages should be worded to make it clear this is an unsupported case not some weird race-condition bug. Per complaint from Lonni Friedman. Back-patch to 8.4, where parallel restore was introduced.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c6
-rw-r--r--src/bin/pg_dump/pg_backup_custom.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 6b930e2f234..31915ae94c1 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -3125,6 +3125,12 @@ restore_toc_entries_parallel(ArchiveHandle *AH)
if (AH->version < K_VERS_1_8)
die_horribly(AH, modulename, "parallel restore is not supported with archives made by pre-8.0 pg_dump\n");
+ /*
+ * It's also not gonna work if we can't reopen the input file, so let's
+ * try that immediately.
+ */
+ (AH->ReopenPtr) (AH);
+
slots = (ParallelSlot *) calloc(sizeof(ParallelSlot), n_slots);
/* Adjust dependency information */
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c
index e233e68e025..caa2c836bbe 100644
--- a/src/bin/pg_dump/pg_backup_custom.c
+++ b/src/bin/pg_dump/pg_backup_custom.c
@@ -866,10 +866,15 @@ _ReopenArchive(ArchiveHandle *AH)
if (AH->mode == archModeWrite)
die_horribly(AH, modulename, "can only reopen input archives\n");
+
+ /*
+ * These two cases are user-facing errors since they represent unsupported
+ * (but not invalid) use-cases. Word the error messages appropriately.
+ */
if (AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0)
- die_horribly(AH, modulename, "cannot reopen stdin\n");
+ die_horribly(AH, modulename, "parallel restore from stdin is not supported\n");
if (!ctx->hasSeek)
- die_horribly(AH, modulename, "cannot reopen non-seekable file\n");
+ die_horribly(AH, modulename, "parallel restore from non-seekable file is not supported\n");
errno = 0;
tpos = ftello(AH->FH);