- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitf009591
committed
Cope with data-offset-less archive files during out-of-order restores.
pg_dump produces custom-format archive files that lack data offsetswhen it is unable to seek its output. Up to now that's been a hazardfor pg_restore. But if pg_restore is able to seek in the archivefile, there is no reason to throw up our hands when asked to restoredata blocks out of order. Instead, whenever we are searching for adata block, record the locations of the blocks we passed over (thatis, fill in the missing data-offset fields in our in-memory copy ofthe TOC data). Then, when we hit a case that requires goingbackwards, we can just seek back.Also track the furthest point that we've searched to, and seek backto there when beginning a search for a new data block. This avoidspossible O(N^2) time consumption, by ensuring that each data blockis examined at most twice. (On Unix systems, that's at most twiceper parallel-restore job; but since Windows uses threads here, thethreads can share block location knowledge, reducing the amount ofduplicated work.)We can also improve the code a bit by using fseeko() to skip overdata blocks during the search.This is all of some use even in simple restores, but it's reallysignificant for parallel pg_restore. In that case, we requireseekability of the input already, and we will very probably needto do out-of-order restores.Back-patch to v12, as this fixes a regression introduced by commit548e509. Before that, parallel restore avoided requestingout-of-order restores, so it would work on a data-offset-lessarchive. Now it will again.Ideally this patch would include some test coverage, but there areother open bugs that need to be fixed before we can extend ourcoverage of parallel restore very much. Plan to revisit that later.David Gilman and Tom Lane; reviewed by Justin PryzbyDiscussion:https://postgr.es/m/CALBH9DDuJ+scZc4MEvw5uO-=vRyR2=QF9+Yh=3hPEnKHWfS81A@mail.gmail.com1 parenta8d0732 commitf009591
File tree
2 files changed
+117
-34
lines changed- doc/src/sgml/ref
- src/bin/pg_dump
2 files changed
+117
-34
lines changedLines changed: 8 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
249 |
| - | |
250 |
| - | |
251 |
| - | |
252 |
| - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
253 | 254 |
| |
254 |
| - | |
| 255 | + | |
| 256 | + | |
255 | 257 |
| |
256 | 258 |
| |
257 | 259 |
| |
| |||
274 | 276 |
| |
275 | 277 |
| |
276 | 278 |
| |
277 |
| - | |
278 |
| - | |
| 279 | + | |
279 | 280 |
| |
280 | 281 |
| |
281 | 282 |
| |
|
Lines changed: 109 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
| 73 | + | |
| 74 | + | |
73 | 75 |
| |
74 | 76 |
| |
75 | 77 |
| |
| |||
181 | 183 |
| |
182 | 184 |
| |
183 | 185 |
| |
184 |
| - | |
185 | 186 |
| |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
186 | 193 |
| |
187 | 194 |
| |
188 | 195 |
| |
| |||
418 | 425 |
| |
419 | 426 |
| |
420 | 427 |
| |
421 |
| - | |
422 |
| - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
423 | 435 |
| |
424 |
| - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
425 | 441 |
| |
426 |
| - | |
| 442 | + | |
427 | 443 |
| |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
428 | 484 |
| |
429 | 485 |
| |
430 | 486 |
| |
| |||
440 | 496 |
| |
441 | 497 |
| |
442 | 498 |
| |
443 |
| - | |
444 | 499 |
| |
445 | 500 |
| |
446 | 501 |
| |
| |||
452 | 507 |
| |
453 | 508 |
| |
454 | 509 |
| |
455 |
| - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
456 | 514 |
| |
457 | 515 |
| |
458 |
| - | |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
463 |
| - | |
| 516 | + | |
464 | 517 |
| |
465 | 518 |
| |
466 | 519 |
| |
467 | 520 |
| |
468 |
| - | |
| 521 | + | |
469 | 522 |
| |
470 | 523 |
| |
471 | 524 |
| |
| |||
491 | 544 |
| |
492 | 545 |
| |
493 | 546 |
| |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
494 | 561 |
| |
495 | 562 |
| |
496 | 563 |
| |
| |||
548 | 615 |
| |
549 | 616 |
| |
550 | 617 |
| |
| 618 | + | |
551 | 619 |
| |
552 | 620 |
| |
553 | 621 |
| |
| |||
556 | 624 |
| |
557 | 625 |
| |
558 | 626 |
| |
559 |
| - | |
| 627 | + | |
560 | 628 |
| |
561 |
| - | |
562 |
| - | |
563 |
| - | |
564 |
| - | |
| 629 | + | |
| 630 | + | |
565 | 631 |
| |
566 |
| - | |
| 632 | + | |
567 | 633 |
| |
568 |
| - | |
569 |
| - | |
570 |
| - | |
571 |
| - | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
572 | 648 |
| |
573 | 649 |
| |
574 | 650 |
| |
| |||
804 | 880 |
| |
805 | 881 |
| |
806 | 882 |
| |
| 883 | + | |
| 884 | + | |
| 885 | + | |
807 | 886 |
| |
808 | 887 |
| |
809 | 888 |
| |
| |||
813 | 892 |
| |
814 | 893 |
| |
815 | 894 |
| |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
816 | 900 |
| |
817 |
| - | |
818 |
| - | |
819 |
| - | |
| 901 | + | |
820 | 902 |
| |
821 | 903 |
| |
822 | 904 |
| |
|
0 commit comments
Comments
(0)