]> granicus.if.org Git - postgresql/commitdiff
Fix bug in the new B-tree incomplete-split code.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 1 Apr 2014 16:19:47 +0000 (19:19 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 1 Apr 2014 16:19:47 +0000 (19:19 +0300)
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

index 3fbeb41d6a89a8f7d269e82e7ab47f0797c4e1d8..d2ca8d9350ed6473fd8b7edd9c1fab8f51388ab2 100644 (file)
@@ -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();