forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd493bed
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 parent970b1ae commitd493bed
2 files changed
+32
-28
lines changedLines changed: 18 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
461 | 461 |
| |
462 | 462 |
| |
463 | 463 |
| |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
| 464 | + | |
| 465 | + | |
468 | 466 |
| |
469 | 467 |
| |
470 | 468 |
| |
471 | 469 |
| |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
488 |
| - | |
489 |
| - | |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 | 470 |
| |
494 | 471 |
| |
495 | 472 |
| |
| |||
533 | 510 |
| |
534 | 511 |
| |
535 | 512 |
| |
536 |
| - | |
| 513 | + | |
537 | 514 |
| |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
538 | 529 |
| |
| 530 | + | |
539 | 531 |
| |
540 | 532 |
| |
541 | 533 |
| |
|
Lines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
298 | 298 |
| |
299 | 299 |
| |
300 | 300 |
| |
301 |
| - | |
302 |
| - | |
| 301 | + | |
303 | 302 |
| |
304 | 303 |
| |
305 | 304 |
| |
306 | 305 |
| |
307 | 306 |
| |
| 307 | + | |
308 | 308 |
| |
| 309 | + | |
309 | 310 |
| |
310 | 311 |
| |
311 | 312 |
| |
| |||
627 | 628 |
| |
628 | 629 |
| |
629 | 630 |
| |
| 631 | + | |
630 | 632 |
| |
631 | 633 |
| |
632 | 634 |
| |
633 | 635 |
| |
| 636 | + | |
634 | 637 |
| |
635 | 638 |
| |
636 | 639 |
| |
| |||
876 | 879 |
| |
877 | 880 |
| |
878 | 881 |
| |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
879 | 891 |
| |
880 | 892 |
| |
881 | 893 |
| |
|
0 commit comments
Comments
(0)