- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit7863ee4
committed
Fix control file update done in restartpoints still running after promotion
If a cluster is promoted (aka the control file shows a state differentthan DB_IN_ARCHIVE_RECOVERY) while CreateRestartPoint() is stillprocessing, this function could miss an update of the control file for"checkPoint" and "checkPointCopy" but still do the recycling and/orremoval of the past WAL segments, assuming that the to-be-updated LSNvalues should be used as reference points for the cleanup. This causesa follow-up restart attempting crash recovery to fail with a PANIC on amissing checkpoint record if the end-of-recovery checkpoint triggered bythe promotion did not complete while the cluster abruptly stopped orcrashed before the completion of this checkpoint. The PANIC would becaused by the redo LSN referred in the control file as located in asegment already gone, recycled by the previous restartpoint with"checkPoint" out-of-sync in the control file.This commit fixes the update of the control file during restartpoints soas "checkPoint" and "checkPointCopy" are updated even if the cluster hasbeen promoted while a restartpoint is running, to be on par with the setof WAL segments actually recycled in the end of CreateRestartPoint().This problem exists in all the stable branches. However, commit7ff23c6, by removing the last call of CreateCheckPoint() from thestartup process, has made this bug much easier to reason about asconcurrent checkpoints are not possible anymore. No backpatch is doneyet, mostly out of caution from me as a point release is close by, butwe need to think harder about the case of concurrent checkpoints atpromotion if the bgwriter is not considered as running by the startupprocess in ~v14, so this change is done only on HEAD for the moment.Reported-by: Fujii Masao, Rui ZhaoAuthor: Kyotaro HoriguchiReviewed-by: Nathan Bossart, Michael PaquierDiscussion:https://postgr.es/m/20220316.102444.2193181487576617583.horikyota.ntt@gmail.com1 parenta22652e commit7863ee4
1 file changed
+33
-21
lines changedLines changed: 33 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6921 | 6921 |
| |
6922 | 6922 |
| |
6923 | 6923 |
| |
| 6924 | + | |
| 6925 | + | |
| 6926 | + | |
6924 | 6927 |
| |
6925 | 6928 |
| |
6926 | 6929 |
| |
| |||
7014 | 7017 |
| |
7015 | 7018 |
| |
7016 | 7019 |
| |
7017 |
| - | |
7018 |
| - | |
7019 |
| - | |
7020 |
| - | |
| 7020 | + | |
| 7021 | + | |
| 7022 | + | |
| 7023 | + | |
7021 | 7024 |
| |
7022 | 7025 |
| |
7023 |
| - | |
7024 |
| - | |
| 7026 | + | |
7025 | 7027 |
| |
| 7028 | + | |
| 7029 | + | |
| 7030 | + | |
| 7031 | + | |
| 7032 | + | |
7026 | 7033 |
| |
7027 | 7034 |
| |
7028 | 7035 |
| |
7029 | 7036 |
| |
7030 |
| - | |
| 7037 | + | |
| 7038 | + | |
7031 | 7039 |
| |
7032 | 7040 |
| |
7033 |
| - | |
7034 |
| - | |
7035 |
| - | |
7036 |
| - | |
7037 |
| - | |
7038 |
| - | |
| 7041 | + | |
| 7042 | + | |
| 7043 | + | |
| 7044 | + | |
| 7045 | + | |
| 7046 | + | |
| 7047 | + | |
7039 | 7048 |
| |
7040 |
| - | |
| 7049 | + | |
7041 | 7050 |
| |
7042 |
| - | |
7043 |
| - | |
| 7051 | + | |
| 7052 | + | |
| 7053 | + | |
| 7054 | + | |
7044 | 7055 |
| |
7045 |
| - | |
7046 |
| - | |
7047 |
| - | |
| 7056 | + | |
| 7057 | + | |
| 7058 | + | |
| 7059 | + | |
| 7060 | + | |
| 7061 | + | |
7048 | 7062 |
| |
7049 |
| - | |
7050 |
| - | |
7051 | 7063 |
| |
7052 | 7064 |
| |
7053 | 7065 |
| |
|
0 commit comments
Comments
(0)