- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit97ddda8
committed
Fix data loss in wal_level=minimal crash recovery of CREATE TABLESPACE.
If the system crashed between CREATE TABLESPACE and the next checkpoint,the result could be some files in the tablespace unexpectedly containingno rows. Affected files would be those for which the system did notwrite WAL; see the wal_skip_threshold documentation. Before v13, adifferent set of conditions governed the writing of WAL; see v12's<sect2>. (The v12 conditions were broader in someways and narrower in others.) Users may want to audit non-defaulttablespaces for unexpected short files. The bug could have truncated anindex without affecting the associated table, and reindexing the indexwould fix that particular problem.This fixes the bug by making create_tablespace_directories() more likeTablespaceCreateDbspace(). create_tablespace_directories() wasrecursively removing tablespace contents, reasoning that WAL redo wouldrecreate everything removed that way. That assumption holds for otherwal_level values. Under wal_level=minimal, the old approach coulddelete files for which no other copy existed. Back-patch to 9.6 (allsupported versions).Reviewed by Robert Haas and Prabhat Sahu. Reported by Robert Haas.Discussion:https://postgr.es/m/CA+TgmoaLO9ncuwvr2nN-J4VEP5XyAcy=zKiHxQzBbFRxxGxm0w@mail.gmail.com1 parent3778bcb commit97ddda8
File tree
2 files changed
+46
-27
lines changed- src
- backend/commands
- test/recovery/t
2 files changed
+46
-27
lines changedLines changed: 19 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
614 | 614 |
| |
615 | 615 |
| |
616 | 616 |
| |
617 |
| - | |
618 |
| - | |
619 |
| - | |
620 |
| - | |
621 |
| - | |
622 |
| - | |
623 |
| - | |
624 |
| - | |
625 |
| - | |
626 |
| - | |
627 |
| - | |
628 |
| - | |
629 |
| - | |
630 |
| - | |
631 |
| - | |
632 |
| - | |
633 |
| - | |
634 | 617 |
| |
635 | 618 |
| |
636 |
| - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
637 | 623 |
| |
638 |
| - | |
| 624 | + | |
639 | 625 |
| |
640 |
| - | |
| 626 | + | |
641 | 627 |
| |
642 |
| - | |
643 |
| - | |
| 628 | + | |
| 629 | + | |
644 | 630 |
| |
645 |
| - | |
| 631 | + | |
646 | 632 |
| |
647 | 633 |
| |
648 | 634 |
| |
649 | 635 |
| |
650 | 636 |
| |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
651 | 647 |
| |
652 | 648 |
| |
653 | 649 |
| |
|
Lines changed: 27 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 |
| - | |
63 |
| - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
64 | 87 |
| |
65 | 88 |
| |
66 | 89 |
| |
| |||
71 | 94 |
| |
72 | 95 |
| |
73 | 96 |
| |
74 |
| - | |
| 97 | + | |
75 | 98 |
| |
76 | 99 |
| |
77 | 100 |
| |
|
0 commit comments
Comments
(0)