forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdf22071
committed
Handle interleavings between CREATE DATABASE steps and base backup.
Restoring a base backup taken in the middle of CreateDirAndVersionFile()or write_relmap_file() would lose the function's effects. The symptomwas absence of the database directory, PG_VERSION file, orpg_filenode.map. If missing the directory, recovery would fail. Eithermissing file would not fail recovery but would render the new databaseunusable. Fix CreateDirAndVersionFile() with the transam/README "actionfirst and then write a WAL entry" strategy. That has a side benefit ofmoving filesystem mutations out of a critical section, reducing the waysto PANIC. Fix the write_relmap_file() call with a lock acquisition, soit interacts with checkpoints like non-CREATE DATABASE calls do.Back-patch to v15, where commit9c08aeaintroduced STRATEGY=WAL_LOG and made it the default.Discussion:https://postgr.es/m/20240130195003.0a.nmisch@google.com1 parent272a7c3 commitdf22071
2 files changed
+32
-28
lines changedLines changed: 18 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
462 | 462 |
| |
463 | 463 |
| |
464 | 464 |
| |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
| 465 | + | |
| 466 | + | |
469 | 467 |
| |
470 | 468 |
| |
471 | 469 |
| |
472 | 470 |
| |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
488 |
| - | |
489 |
| - | |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 | 471 |
| |
495 | 472 |
| |
496 | 473 |
| |
| |||
534 | 511 |
| |
535 | 512 |
| |
536 | 513 |
| |
537 |
| - | |
| 514 | + | |
538 | 515 |
| |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
539 | 530 |
| |
| 531 | + | |
540 | 532 |
| |
541 | 533 |
| |
542 | 534 |
| |
|
Lines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
303 | 303 |
| |
304 | 304 |
| |
305 | 305 |
| |
306 |
| - | |
307 |
| - | |
| 306 | + | |
308 | 307 |
| |
309 | 308 |
| |
310 | 309 |
| |
311 | 310 |
| |
312 | 311 |
| |
| 312 | + | |
313 | 313 |
| |
| 314 | + | |
314 | 315 |
| |
315 | 316 |
| |
316 | 317 |
| |
| |||
633 | 634 |
| |
634 | 635 |
| |
635 | 636 |
| |
| 637 | + | |
636 | 638 |
| |
637 | 639 |
| |
638 | 640 |
| |
639 | 641 |
| |
| 642 | + | |
640 | 643 |
| |
641 | 644 |
| |
642 | 645 |
| |
| |||
891 | 894 |
| |
892 | 895 |
| |
893 | 896 |
| |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
894 | 906 |
| |
895 | 907 |
| |
896 | 908 |
| |
|
0 commit comments
Comments
(0)