From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Make the handling of interrupted B-tree page splits more robust. |
Date: | 2014-03-18 18:53:50 |
Message-ID: | E1WPz94-0007xc-QT@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-03-18 18:54:57 | pgsql: Fix uninitialized variable. |
Previous Message | Tom Lane | 2014-03-18 18:26:50 | pgsql: Fix some remaining int64 vestiges in contrib/test_shm_mq. |