]> granicus.if.org Git - postgresql/commitdiff
Fix bug in the new GIN incomplete-split code.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 1 Apr 2014 19:45:10 +0000 (22:45 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 1 Apr 2014 19:49:47 +0000 (22:49 +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 and it needs to be marked dirty. The codepath for an insertion got
this right, but the case where the internal node is split because of
inserting the new downlink missed that.

src/backend/access/gin/ginbtree.c

index a133a34e8d5182e35d1bc1b35b9aa50c51cf874b..9b0f82fc90461a84cb23010dee30aa105687f1ec 100644 (file)
@@ -543,6 +543,8 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
 
                MarkBufferDirty(rbuffer);
                MarkBufferDirty(stack->buffer);
+               if (BufferIsValid(childbuf))
+                       MarkBufferDirty(childbuf);
 
                /*
                 * Restore the temporary copies over the real buffers. But don't free
@@ -571,6 +573,8 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
                        PageSetLSN(BufferGetPage(rbuffer), recptr);
                        if (stack->parent == NULL)
                                PageSetLSN(BufferGetPage(lbuffer), recptr);
+                       if (BufferIsValid(childbuf))
+                               PageSetLSN(childpage, recptr);
                }
                END_CRIT_SECTION();