pgsql: Fix bug in determining when recovery has reached consistency.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Fix bug in determining when recovery has reached consistency.
Дата
Msg-id E1W0uYg-0001EQ-P0@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix bug in determining when recovery has reached consistency.

When starting WAL replay from an online checkpoint, the last replayed WAL
record variable was initialized using the checkpoint record's location, even
though the records between the REDO location and the checkpoint record had
not been replayed yet. That was noted as "slightly confusing" but harmless
in the comment, but in some cases, it fooled CheckRecoveryConsistency to
incorrectly conclude that we had already reached a consistent state
immediately at the beginning of WAL replay. That caused the system to accept
read-only connections in hot standby mode too early, and also PANICs with
message "WAL contains references to invalid pages".

Fix by initializing the variables to the REDO location instead.

In 9.2 and above, change CheckRecoveryConsistency() to use
lastReplayedEndRecPtr variable when checking if backup end location has
been reached. It was inconsistently using EndRecPtr for that check, but
lastReplayedEndRecPtr when checking min recovery point. It made no
difference before this patch, because in all the places where
CheckRecoveryConsistency was called the two variables were the same, but
it was always an accident waiting to happen, and would have been wrong
after this patch anyway.

Report and analysis by Tomonari Katsumata, bug #8686. Backpatch to 9.0,
where hot standby was introduced.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d59ff6c110162fc6f3f62b160ff451bfda871af0

Modified Files
--------------
src/backend/access/transam/xlog.c |   36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: pg_upgrade: Fix fatal error handling
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Fix bug in determining when recovery has reached consistency.