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

Commit6e1f1fe

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 parentd6e7abe commit6e1f1fe

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
@@ -213,6 +213,7 @@ void
213213
RestoreArchive(Archive*AHX,RestoreOptions*ropt)
214214
{
215215
ArchiveHandle*AH= (ArchiveHandle*)AHX;
216+
boolparallel_mode;
216217
TocEntry*te;
217218
teReqsreqs;
218219
OutputContextsav;
@@ -238,6 +239,27 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
238239
if (ropt->createDB&&ropt->single_txn)
239240
die_horribly(AH,modulename,"-C and -1 are incompatible options\n");
240241

242+
/*
243+
* If we're going to do parallel restore, there are some restrictions.
244+
*/
245+
parallel_mode= (ropt->number_of_jobs>1&&ropt->useDB);
246+
if (parallel_mode)
247+
{
248+
/* We haven't got round to making this work for all archive formats */
249+
if (AH->ClonePtr==NULL||AH->ReopenPtr==NULL)
250+
die_horribly(AH,modulename,"parallel restore is not supported with this archive file format\n");
251+
252+
/* Doesn't work if the archive represents dependencies as OIDs */
253+
if (AH->version<K_VERS_1_8)
254+
die_horribly(AH,modulename,"parallel restore is not supported with archives made by pre-8.0 pg_dump\n");
255+
256+
/*
257+
* It's also not gonna work if we can't reopen the input file, so
258+
* let's try that immediately.
259+
*/
260+
(AH->ReopenPtr) (AH);
261+
}
262+
241263
/*
242264
* Make sure we won't need (de)compression we haven't got
243265
*/
@@ -385,7 +407,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
385407
*
386408
* In parallel mode, turn control over to the parallel-restore logic.
387409
*/
388-
if (ropt->number_of_jobs>1&&ropt->useDB)
410+
if (parallel_mode)
389411
restore_toc_entries_parallel(AH);
390412
else
391413
{
@@ -3257,20 +3279,6 @@ restore_toc_entries_parallel(ArchiveHandle *AH)
32573279

32583280
ahlog(AH,2,"entering restore_toc_entries_parallel\n");
32593281

3260-
/* we haven't got round to making this work for all archive formats */
3261-
if (AH->ClonePtr==NULL||AH->ReopenPtr==NULL)
3262-
die_horribly(AH,modulename,"parallel restore is not supported with this archive file format\n");
3263-
3264-
/* doesn't work if the archive represents dependencies as OIDs, either */
3265-
if (AH->version<K_VERS_1_8)
3266-
die_horribly(AH,modulename,"parallel restore is not supported with archives made by pre-8.0 pg_dump\n");
3267-
3268-
/*
3269-
* It's also not gonna work if we can't reopen the input file, so let's
3270-
* try that immediately.
3271-
*/
3272-
(AH->ReopenPtr) (AH);
3273-
32743282
slots= (ParallelSlot*)calloc(sizeof(ParallelSlot),n_slots);
32753283

32763284
/* Adjust dependency information */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp