pgsql: Make the handling of interrupted B-tree page splits more robust.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Make the handling of interrupted B-tree page splits more robust.
Дата
Msg-id E1WPz94-0007xc-QT@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Make the handling of interrupted B-tree page splits more robust.

Splitting a page consists of two separate steps: splitting the child page,
and inserting the downlink for the new right page to the parent. Previously,
we handled the case that you crash in between those steps with a cleanup
routine after the WAL recovery had finished, which finished the incomplete
split. However, that doesn't help if the page split is interrupted but the
database doesn't crash, so that you don't perform WAL recovery. That could
happen for example if you run out of disk space.

Remove the end-of-recovery cleanup step. Instead, when a page is split, the
left page is marked with a new INCOMPLETE_SPLIT flag, and when the downlink
is inserted to the parent, the flag is cleared again. If an insertion sees
a page with the flag set, it knows that the split was interrupted for some
reason, and inserts the missing downlink before proceeding.

I used the same approach to fix GIN and GiST split algorithms earlier. This
was the last WAL cleanup routine, so we could get rid of that whole
machinery now, but I'll leave that for a separate patch.

Reviewed by Peter Geoghegan.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/40dae7ec537c5619fc93ad602c62f37be786d161

Modified Files
--------------
src/backend/access/nbtree/README      |   53 +++++-
src/backend/access/nbtree/nbtinsert.c |  286 ++++++++++++++++++++++-------
src/backend/access/nbtree/nbtpage.c   |   91 +++++++++-
src/backend/access/nbtree/nbtsearch.c |   68 +++++--
src/backend/access/nbtree/nbtxlog.c   |  323 ++++++++++++++-------------------
src/include/access/nbtree.h           |   26 ++-
src/include/access/rmgrlist.h         |    2 +-
src/include/access/xlog_internal.h    |    2 +-
8 files changed, 561 insertions(+), 290 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix some remaining int64 vestiges in contrib/test_shm_mq.
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Fix uninitialized variable.