Skip to content

Commit 8bbbcb9

Browse files
committed
Fix bug in the new GIN 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 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.
1 parent 6eff0ac commit 8bbbcb9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/access/gin/ginbtree.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,8 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
543543

544544
MarkBufferDirty(rbuffer);
545545
MarkBufferDirty(stack->buffer);
546+
if (BufferIsValid(childbuf))
547+
MarkBufferDirty(childbuf);
546548

547549
/*
548550
* Restore the temporary copies over the real buffers. But don't free
@@ -571,6 +573,8 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
571573
PageSetLSN(BufferGetPage(rbuffer), recptr);
572574
if (stack->parent == NULL)
573575
PageSetLSN(BufferGetPage(lbuffer), recptr);
576+
if (BufferIsValid(childbuf))
577+
PageSetLSN(childpage, recptr);
574578
}
575579
END_CRIT_SECTION();
576580

0 commit comments

Comments
 (0)