pgsql: nbtree VACUUM: cope with right sibling link corruption.

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема pgsql: nbtree VACUUM: cope with right sibling link corruption.
Дата
Msg-id E1q2JWi-001j9A-H5@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
nbtree VACUUM: cope with right sibling link corruption.

Avoid "right sibling's left-link doesn't match" errors when vacuuming a
corrupt nbtree index.  Just LOG the issue and press on.  That way VACUUM
will have a decent chance of finishing off all required processing for
the index (and for the table as a whole).

This error was seen in the field from time to time (it's more than a
theoretical risk), so giving VACUUM the ability to press on like this
has real value.  Nothing short of a REINDEX is expected to fix the
underlying index corruption, so giving up (by throwing an error) risks
making a bad situation far worse.  Anything that blocks forward progress
by VACUUM like this might go unnoticed for a long time.  This could
eventually lead to a wraparound/xidStopLimit outage.

Note that _bt_unlink_halfdead_page() has always been able to bail on
page deletion when the target page's left sibling page was in an
inconsistent state.  It now does the same thing (returns false to back
out of the second phase of deletion) when it notices sibling link
corruption in the target page's right sibling page.

This is similar to the work from commit 5b861baa (later backpatched as
commit 43e409ce), which taught nbtree to press on with vacuuming an
index when page deletion fails to "re-find" a downlink in the target
page's parent page.  The "re-find" check seems to make VACUUM bail on
page deletion more often in practice, but there is no reason to take any
chances here.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CAH2-Wzko2q2kP1+UvgJyP9g0mF4hopK0NtQZcxwvMv9_ytGhkQ@mail.gmail.com
Backpatch: 11- (all supported versions).

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/322c9b340adae0b48eed6fe822cbb700a2e6cf34

Modified Files
--------------
src/backend/access/nbtree/nbtpage.c | 62 ++++++++++++++++++++++++++-----------
src/backend/access/nbtree/nbtree.c  |  3 +-
2 files changed, 45 insertions(+), 20 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix filtering of "cloned" outer-join quals some more.
Следующее
От: Jeff Davis
Дата:
Сообщение: pgsql: Doc fixes for commit 1e16af8ab5.