From 954523cdfe229f1cb99a43a19e291a557ae2822d Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 1 Apr 2014 19:19:47 +0300 Subject: [PATCH] Fix bug in the new B-tree incomplete-split code. Inserting a downlink to an internal page clears the incomplete-split flag of the child's left sibling, so the left sibling's LSN also needs to be updated. --- src/backend/access/nbtree/nbtinsert.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 3fbeb41d6a..d2ca8d9350 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -910,6 +910,10 @@ _bt_insertonpg(Relation rel, { PageSetLSN(metapg, recptr); } + if (BufferIsValid(cbuf)) + { + PageSetLSN(BufferGetPage(cbuf), recptr); + } PageSetLSN(page, recptr); } @@ -1402,6 +1406,10 @@ _bt_split(Relation rel, Buffer buf, Buffer cbuf, OffsetNumber firstright, { PageSetLSN(spage, recptr); } + if (!isleaf) + { + PageSetLSN(BufferGetPage(cbuf), recptr); + } } END_CRIT_SECTION();