forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4e87c48
committed
Fix handling of WAL segments ready to be archived during crash recovery
78ea8b5 has fixed an issue related to the recycling of WAL segments onstandbys depending on archive_mode. However, it has introduced aregression with the handling of WAL segments ready to be archived duringcrash recovery, causing those files to be recycled without gettingarchived.This commit fixes the regression by tracking in shared memory if a livecluster is either in crash recovery or archive recovery as the handlingof WAL segments ready to be archived is different in both cases (thoseWAL segments should not be removed during crash recovery), and by usingthis new shared memory state to decide if a segment can be recycled ornot. Previously, it was not possible to know if a cluster was in crashrecovery or archive recovery as the shared state was able to track onlyif recovery was happening or not, leading to the problem.A set of TAP tests is added to close the gap here, making sure that WALsegments ready to be archived are correctly handled when a cluster is inarchive or crash recovery with archive_mode set to "on" or "always", forboth standby and primary.Reported-by: Benoît LobréauAuthor: Jehan-Guillaume de RorthaisReviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael PaquierDiscussion:https://postgr.es/m/20200331172229.40ee00dc@firostBackpatch-through: 9.51 parent3436c5e commit4e87c48
File tree
5 files changed
+286
-16
lines changed- src
- backend/access/transam
- include/access
- test/recovery/t
- tools/pgindent
5 files changed
+286
-16
lines changedLines changed: 48 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
221 | 221 |
| |
222 | 222 |
| |
223 | 223 |
| |
224 |
| - | |
225 |
| - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
226 | 227 |
| |
227 | 228 |
| |
228 | 229 |
| |
| |||
653 | 654 |
| |
654 | 655 |
| |
655 | 656 |
| |
656 |
| - | |
| 657 | + | |
657 | 658 |
| |
658 | 659 |
| |
659 |
| - | |
| 660 | + | |
660 | 661 |
| |
661 | 662 |
| |
662 | 663 |
| |
| |||
4434 | 4435 |
| |
4435 | 4436 |
| |
4436 | 4437 |
| |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
| 4447 | + | |
4437 | 4448 |
| |
4438 | 4449 |
| |
4439 | 4450 |
| |
| |||
5166 | 5177 |
| |
5167 | 5178 |
| |
5168 | 5179 |
| |
5169 |
| - | |
| 5180 | + | |
5170 | 5181 |
| |
5171 | 5182 |
| |
5172 | 5183 |
| |
| |||
6871 | 6882 |
| |
6872 | 6883 |
| |
6873 | 6884 |
| |
| 6885 | + | |
6874 | 6886 |
| |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
6875 | 6892 |
| |
6876 | 6893 |
| |
6877 | 6894 |
| |
| |||
6884 | 6901 |
| |
6885 | 6902 |
| |
6886 | 6903 |
| |
| 6904 | + | |
| 6905 | + | |
| 6906 | + | |
| 6907 | + | |
6887 | 6908 |
| |
6888 | 6909 |
| |
6889 | 6910 |
| |
| |||
7911 | 7932 |
| |
7912 | 7933 |
| |
7913 | 7934 |
| |
7914 |
| - | |
| 7935 | + | |
7915 | 7936 |
| |
7916 | 7937 |
| |
7917 | 7938 |
| |
| |||
8057 | 8078 |
| |
8058 | 8079 |
| |
8059 | 8080 |
| |
8060 |
| - | |
| 8081 | + | |
8061 | 8082 |
| |
8062 | 8083 |
| |
8063 | 8084 |
| |
| |||
8069 | 8090 |
| |
8070 | 8091 |
| |
8071 | 8092 |
| |
8072 |
| - | |
8073 |
| - | |
| 8093 | + | |
| 8094 | + | |
8074 | 8095 |
| |
8075 | 8096 |
| |
8076 | 8097 |
| |
| |||
8086 | 8107 |
| |
8087 | 8108 |
| |
8088 | 8109 |
| |
| 8110 | + | |
| 8111 | + | |
| 8112 | + | |
| 8113 | + | |
| 8114 | + | |
| 8115 | + | |
| 8116 | + | |
| 8117 | + | |
| 8118 | + | |
| 8119 | + | |
| 8120 | + | |
| 8121 | + | |
| 8122 | + | |
| 8123 | + | |
| 8124 | + | |
| 8125 | + | |
| 8126 | + | |
| 8127 | + | |
8089 | 8128 |
| |
8090 | 8129 |
| |
8091 | 8130 |
| |
|
Lines changed: 14 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
572 | 572 |
| |
573 | 573 |
| |
574 | 574 |
| |
575 |
| - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
576 | 579 |
| |
577 | 580 |
| |
578 |
| - | |
579 |
| - | |
580 |
| - | |
581 |
| - | |
| 581 | + | |
| 582 | + | |
582 | 583 |
| |
583 |
| - | |
584 |
| - | |
| 584 | + | |
| 585 | + | |
585 | 586 |
| |
586 | 587 |
| |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
587 | 594 |
| |
588 | 595 |
| |
589 | 596 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
169 | 177 |
| |
170 | 178 |
| |
171 | 179 |
| |
| |||
291 | 299 |
| |
292 | 300 |
| |
293 | 301 |
| |
| 302 | + | |
294 | 303 |
| |
295 | 304 |
| |
296 | 305 |
| |
|
0 commit comments
Comments
(0)