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-0001EU-Sf@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
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/425bef6ee7f210c991f35dff4b3ed6691818c610

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


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

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