forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcbc55da
committed
Rework order of end-of-recovery actions to delay timeline history write
A critical failure in some of the end-of-recovery actions before theend-of-recovery record is written can cause PostgreSQL to reactinconsistently with the rest of the cluster in the event of a crashbefore the final record is written. Two such failures are for examplean error while processing a two-phase state files or when operating onrecovery.conf. With this commit, the failures are still consideredFATAL, but the write of the timeline history file is delayed as much aspossible so as the window between the moment the file is written and theend-of-recovery record is generated gets minimized. This way, in theevent of a crash or a failure, the new timeline decided at promotionwill not seem taken by other nodes in the cluster. It is not reallypossible to reduce to zero this window, hence one could still seefailures if a crash happens between the history file write and theend-of-recovery record, so any future code should be careful whenadding new end-of-recovery actions. The original report from MagnusHagander mentioned a renamed recovery.conf as original end-of-recoveryfailure which caused a timeline to be seen as taken but the subsequentprocessing on the now-missing recovery.conf cause the startup process toissue stop on FATAL, which at follow-up startup made the systeminconsistent because of on-disk changes which already happened.Processing of two-phase state files still needs some work as corruptedentries are simply ignored now. This is left as a future item and thiscommit fixes the original complain.Reported-by: Magnus HaganderAuthor: Heikki LinnakangasReviewed-by: Alexander Korotkov, Michael Paquier, David SteeleDiscussion:https://postgr.es/m/CABUevEz09XY2EevA2dLjPCY-C5UO4Hq=XxmXLmF6ipNFecbShQ@mail.gmail.com1 parenta45adc7 commitcbc55da
1 file changed
+25
-12
lines changedLines changed: 25 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7494 | 7494 |
| |
7495 | 7495 |
| |
7496 | 7496 |
| |
| 7497 | + | |
| 7498 | + | |
| 7499 | + | |
| 7500 | + | |
| 7501 | + | |
| 7502 | + | |
| 7503 | + | |
7497 | 7504 |
| |
7498 | 7505 |
| |
7499 | 7506 |
| |
| |||
7548 | 7555 |
| |
7549 | 7556 |
| |
7550 | 7557 |
| |
| 7558 | + | |
| 7559 | + | |
| 7560 | + | |
| 7561 | + | |
| 7562 | + | |
| 7563 | + | |
| 7564 | + | |
| 7565 | + | |
| 7566 | + | |
| 7567 | + | |
| 7568 | + | |
| 7569 | + | |
| 7570 | + | |
| 7571 | + | |
| 7572 | + | |
| 7573 | + | |
| 7574 | + | |
| 7575 | + | |
7551 | 7576 |
| |
7552 | 7577 |
| |
7553 | 7578 |
| |
| |||
7556 | 7581 |
| |
7557 | 7582 |
| |
7558 | 7583 |
| |
7559 |
| - | |
7560 |
| - | |
7561 |
| - | |
7562 |
| - | |
7563 |
| - | |
7564 |
| - | |
7565 |
| - | |
7566 |
| - | |
7567 |
| - | |
7568 | 7584 |
| |
7569 | 7585 |
| |
7570 | 7586 |
| |
| |||
7617 | 7633 |
| |
7618 | 7634 |
| |
7619 | 7635 |
| |
7620 |
| - | |
7621 |
| - | |
7622 |
| - | |
7623 | 7636 |
| |
7624 | 7637 |
| |
7625 | 7638 |
| |
|
0 commit comments
Comments
(0)