Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2de0fde

Browse files
committed
Actually, all of parallel restore's limitations should be tested earlier.
On closer inspection, whining in restore_toc_entries_parallel is reallymuch too late for any user-facing error case. The right place to do itis at the start of RestoreArchive(), before we've done anything interesting(suh as trying to DROP all the targets ...)Back-patch to 8.4, where parallel restore was introduced.
1 parentfbf776a commit2de0fde

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ void
204204
RestoreArchive(Archive*AHX,RestoreOptions*ropt)
205205
{
206206
ArchiveHandle*AH= (ArchiveHandle*)AHX;
207+
boolparallel_mode;
207208
TocEntry*te;
208209
teReqsreqs;
209210
OutputContextsav;
@@ -229,6 +230,27 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
229230
if (ropt->createDB&&ropt->single_txn)
230231
die_horribly(AH,modulename,"-C and -1 are incompatible options\n");
231232

233+
/*
234+
* If we're going to do parallel restore, there are some restrictions.
235+
*/
236+
parallel_mode= (ropt->number_of_jobs>1&&ropt->useDB);
237+
if (parallel_mode)
238+
{
239+
/* We haven't got round to making this work for all archive formats */
240+
if (AH->ClonePtr==NULL||AH->ReopenPtr==NULL)
241+
die_horribly(AH,modulename,"parallel restore is not supported with this archive file format\n");
242+
243+
/* Doesn't work if the archive represents dependencies as OIDs */
244+
if (AH->version<K_VERS_1_8)
245+
die_horribly(AH,modulename,"parallel restore is not supported with archives made by pre-8.0 pg_dump\n");
246+
247+
/*
248+
* It's also not gonna work if we can't reopen the input file, so
249+
* let's try that immediately.
250+
*/
251+
(AH->ReopenPtr) (AH);
252+
}
253+
232254
/*
233255
* Make sure we won't need (de)compression we haven't got
234256
*/
@@ -375,7 +397,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
375397
*
376398
* In parallel mode, turn control over to the parallel-restore logic.
377399
*/
378-
if (ropt->number_of_jobs>1&&ropt->useDB)
400+
if (parallel_mode)
379401
restore_toc_entries_parallel(AH);
380402
else
381403
{
@@ -3192,20 +3214,6 @@ restore_toc_entries_parallel(ArchiveHandle *AH)
31923214

31933215
ahlog(AH,2,"entering restore_toc_entries_parallel\n");
31943216

3195-
/* we haven't got round to making this work for all archive formats */
3196-
if (AH->ClonePtr==NULL||AH->ReopenPtr==NULL)
3197-
die_horribly(AH,modulename,"parallel restore is not supported with this archive file format\n");
3198-
3199-
/* doesn't work if the archive represents dependencies as OIDs, either */
3200-
if (AH->version<K_VERS_1_8)
3201-
die_horribly(AH,modulename,"parallel restore is not supported with archives made by pre-8.0 pg_dump\n");
3202-
3203-
/*
3204-
* It's also not gonna work if we can't reopen the input file, so let's
3205-
* try that immediately.
3206-
*/
3207-
(AH->ReopenPtr) (AH);
3208-
32093217
slots= (ParallelSlot*)calloc(sizeof(ParallelSlot),n_slots);
32103218

32113219
/* Adjust dependency information */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp