forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd59ff6c
committed
Fix bug in determining when recovery has reached consistency.
When starting WAL replay from an online checkpoint, the last replayed WALrecord variable was initialized using the checkpoint record's location, eventhough the records between the REDO location and the checkpoint record hadnot been replayed yet. That was noted as "slightly confusing" but harmlessin the comment, but in some cases, it fooled CheckRecoveryConsistency toincorrectly conclude that we had already reached a consistent stateimmediately at the beginning of WAL replay. That caused the system to acceptread-only connections in hot standby mode too early, and also PANICs withmessage "WAL contains references to invalid pages".Fix by initializing the variables to the REDO location instead.In 9.2 and above, change CheckRecoveryConsistency() to uselastReplayedEndRecPtr variable when checking if backup end location hasbeen reached. It was inconsistently using EndRecPtr for that check, butlastReplayedEndRecPtr when checking min recovery point. It made nodifference before this patch, because in all the places whereCheckRecoveryConsistency was called the two variables were the same, butit was always an accident waiting to happen, and would have been wrongafter this patch anyway.Report and analysis by Tomonari Katsumata, bug #8686. Backpatch to 9.0,where hot standby was introduced.1 parentca607b1 commitd59ff6c
1 file changed
+18
-18
lines changedLines changed: 18 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6684 | 6684 |
| |
6685 | 6685 |
| |
6686 | 6686 |
| |
6687 |
| - | |
6688 |
| - | |
6689 |
| - | |
6690 |
| - | |
6691 |
| - | |
6692 |
| - | |
6693 |
| - | |
6694 |
| - | |
6695 |
| - | |
6696 |
| - | |
| 6687 | + | |
| 6688 | + | |
6697 | 6689 |
| |
6698 | 6690 |
| |
6699 |
| - | |
| 6691 | + | |
6700 | 6692 |
| |
6701 |
| - | |
| 6693 | + | |
6702 | 6694 |
| |
6703 | 6695 |
| |
6704 | 6696 |
| |
| |||
7388 | 7380 |
| |
7389 | 7381 |
| |
7390 | 7382 |
| |
| 7383 | + | |
| 7384 | + | |
7391 | 7385 |
| |
7392 | 7386 |
| |
7393 | 7387 |
| |
7394 | 7388 |
| |
7395 | 7389 |
| |
7396 | 7390 |
| |
7397 | 7391 |
| |
| 7392 | + | |
| 7393 | + | |
| 7394 | + | |
| 7395 | + | |
| 7396 | + | |
| 7397 | + | |
7398 | 7398 |
| |
7399 | 7399 |
| |
7400 | 7400 |
| |
7401 | 7401 |
| |
7402 |
| - | |
| 7402 | + | |
7403 | 7403 |
| |
7404 | 7404 |
| |
7405 | 7405 |
| |
| |||
7412 | 7412 |
| |
7413 | 7413 |
| |
7414 | 7414 |
| |
7415 |
| - | |
7416 |
| - | |
| 7415 | + | |
| 7416 | + | |
7417 | 7417 |
| |
7418 | 7418 |
| |
7419 | 7419 |
| |
| |||
7431 | 7431 |
| |
7432 | 7432 |
| |
7433 | 7433 |
| |
7434 |
| - | |
| 7434 | + | |
7435 | 7435 |
| |
7436 | 7436 |
| |
7437 | 7437 |
| |
| |||
7443 | 7443 |
| |
7444 | 7444 |
| |
7445 | 7445 |
| |
7446 |
| - | |
7447 |
| - | |
| 7446 | + | |
| 7447 | + | |
7448 | 7448 |
| |
7449 | 7449 |
| |
7450 | 7450 |
| |
|
0 commit comments
Comments
(0)