- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit626d723
committed
pg_upgrade: Add --swap for faster file transfer.
This new option instructs pg_upgrade to move the data directoriesfrom the old cluster to the new cluster and then to replace thecatalog files with those generated for the new cluster. This modecan outperform --link, --clone, --copy, and --copy-file-range,especially on clusters with many relations.However, this mode creates many garbage files in the old cluster,which can prolong the file synchronization step if--sync-method=syncfs is used. To handle that, we recommend using--sync-method=fsync with this mode, and pg_upgrade internally uses"initdb --sync-only --no-sync-data-files" for file synchronization.pg_upgrade will synchronize the catalog files as they aretransferred. We assume that the database files transferred fromthe old cluster were synchronized prior to upgrade.This mode also complicates reverting to the old cluster, so werecommend restoring from backup upon failure during or after filetransfer. We did consider teaching pg_upgrade how to generate arevert script for such failures, but we decided against it due tothe rarity of failing during file transfer, the complexity ofgenerating the script, and the potential for misusing the script.The new mode is limited to clusters located in the same filesystem. With some effort, we could probably support upgradesbetween different file systems, but this mode is unlikely to offermuch benefit if we have to copy the files across file systemboundaries.It is also limited to upgrades from version 10 or newer. There area few known obstacles for using swap mode to upgrade from olderversions. For example, the visibility map format changed in v9.6,and the sequence tuple format changed in v10. In fact, swap modeomits the --sequence-data option in its uses of pg_dump and insteadreuses the old cluster's sequence data files. While teaching swapmode to deal with these kinds of changes is surely possible (and wemay have to deal with similar problems in the future, anyway), itdoesn't seem worth the effort to support upgrades fromlong-unsupported versions.Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>Reviewed-by: Robert Haas <robertmhaas@gmail.com>Discussion:https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan1 parent9c49f0e commit626d723
File tree
14 files changed
+540
-34
lines changed- doc/src/sgml/ref
- src
- bin/pg_upgrade
- t
- common
- include/common
14 files changed
+540
-34
lines changedLines changed: 58 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
244 | 244 |
| |
245 | 245 |
| |
246 | 246 |
| |
247 |
| - | |
| 247 | + | |
| 248 | + | |
248 | 249 |
| |
249 | 250 |
| |
250 | 251 |
| |
| |||
262 | 263 |
| |
263 | 264 |
| |
264 | 265 |
| |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
265 | 292 |
| |
266 | 293 |
| |
267 | 294 |
| |
| |||
530 | 557 |
| |
531 | 558 |
| |
532 | 559 |
| |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
533 | 564 |
| |
534 | 565 |
| |
535 | 566 |
| |
| |||
889 | 920 |
| |
890 | 921 |
| |
891 | 922 |
| |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
892 | 949 |
| |
893 | 950 |
| |
894 | 951 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
| 23 | + | |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
29 |
| - | |
| 28 | + | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
|
Lines changed: 28 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
709 | 709 |
| |
710 | 710 |
| |
711 | 711 |
| |
712 |
| - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
713 | 740 |
| |
714 | 741 |
| |
715 | 742 |
| |
|
Lines changed: 14 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
751 | 751 |
| |
752 | 752 |
| |
753 | 753 |
| |
754 |
| - | |
| 754 | + | |
755 | 755 |
| |
756 | 756 |
| |
757 | 757 |
| |
| |||
766 | 766 |
| |
767 | 767 |
| |
768 | 768 |
| |
769 |
| - | |
770 |
| - | |
771 |
| - | |
772 |
| - | |
773 |
| - | |
774 |
| - | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
775 | 782 |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
55 |
| - | |
| 55 | + | |
56 | 56 |
| |
57 | 57 |
| |
| 58 | + | |
| 59 | + | |
58 | 60 |
| |
59 | 61 |
| |
60 | 62 |
| |
|
Lines changed: 11 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
434 | 434 |
| |
435 | 435 |
| |
436 | 436 |
| |
437 |
| - | |
| 437 | + | |
438 | 438 |
| |
439 | 439 |
| |
440 | 440 |
| |
| |||
444 | 444 |
| |
445 | 445 |
| |
446 | 446 |
| |
447 |
| - | |
448 |
| - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
449 | 457 |
| |
450 | 458 |
| |
451 | 459 |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
490 | 490 |
| |
491 | 491 |
| |
492 | 492 |
| |
493 |
| - | |
| 493 | + | |
494 | 494 |
| |
495 | 495 |
| |
496 | 496 |
| |
| |||
499 | 499 |
| |
500 | 500 |
| |
501 | 501 |
| |
| 502 | + | |
| 503 | + | |
502 | 504 |
| |
503 | 505 |
| |
504 | 506 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
| 65 | + | |
65 | 66 |
| |
66 | 67 |
| |
67 | 68 |
| |
| |||
228 | 229 |
| |
229 | 230 |
| |
230 | 231 |
| |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
231 | 237 |
| |
232 | 238 |
| |
233 | 239 |
| |
| |||
325 | 331 |
| |
326 | 332 |
| |
327 | 333 |
| |
| 334 | + | |
328 | 335 |
| |
329 | 336 |
| |
330 | 337 |
| |
|
Lines changed: 10 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
173 |
| - | |
174 |
| - | |
175 |
| - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
176 | 177 |
| |
177 |
| - | |
178 |
| - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
179 | 181 |
| |
180 | 182 |
| |
181 | 183 |
| |
| |||
212 | 214 |
| |
213 | 215 |
| |
214 | 216 |
| |
215 |
| - | |
| 217 | + | |
216 | 218 |
| |
| 219 | + | |
| 220 | + | |
217 | 221 |
| |
218 | 222 |
| |
219 | 223 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
262 | 262 |
| |
263 | 263 |
| |
264 | 264 |
| |
| 265 | + | |
265 | 266 |
| |
266 | 267 |
| |
267 | 268 |
| |
| |||
391 | 392 |
| |
392 | 393 |
| |
393 | 394 |
| |
394 |
| - | |
| 395 | + | |
395 | 396 |
| |
396 | 397 |
| |
397 | 398 |
| |
| |||
423 | 424 |
| |
424 | 425 |
| |
425 | 426 |
| |
426 |
| - | |
| 427 | + | |
427 | 428 |
| |
428 | 429 |
| |
429 | 430 |
| |
|
0 commit comments
Comments
(0)