mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Fix bug in compressed GIN data leaf page splitting code.
The list of posting lists it's dealing with can contain placeholders for deleted posting lists. The placeholders are kept around so that they can be WAL-logged, but we must be careful to not try to access them. This fixes bug #11280, reported by Mårten Svantesson. Backpatch to 9.4, where the compressed data leaf page code was added.
This commit is contained in:
parent
c573e9d776
commit
08bff295a7
@ -642,20 +642,24 @@ dataPlaceToPageLeaf(GinBtree btree, Buffer buf, GinBtreeStack *stack,
|
|||||||
{
|
{
|
||||||
lastleftinfo = dlist_container(leafSegmentInfo, node, leaf->lastleft);
|
lastleftinfo = dlist_container(leafSegmentInfo, node, leaf->lastleft);
|
||||||
|
|
||||||
segsize = SizeOfGinPostingList(lastleftinfo->seg);
|
/* ignore deleted segments */
|
||||||
if (append)
|
if (lastleftinfo->action != GIN_SEGMENT_DELETE)
|
||||||
{
|
{
|
||||||
if ((leaf->lsize - segsize) - (leaf->lsize - segsize) < BLCKSZ / 4)
|
segsize = SizeOfGinPostingList(lastleftinfo->seg);
|
||||||
break;
|
if (append)
|
||||||
}
|
{
|
||||||
else
|
if ((leaf->lsize - segsize) - (leaf->lsize - segsize) < BLCKSZ / 4)
|
||||||
{
|
break;
|
||||||
if ((leaf->lsize - segsize) - (leaf->rsize + segsize) < 0)
|
}
|
||||||
break;
|
else
|
||||||
}
|
{
|
||||||
|
if ((leaf->lsize - segsize) - (leaf->rsize + segsize) < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
leaf->lsize -= segsize;
|
leaf->lsize -= segsize;
|
||||||
leaf->rsize += segsize;
|
leaf->rsize += segsize;
|
||||||
|
}
|
||||||
leaf->lastleft = dlist_prev_node(&leaf->segments, leaf->lastleft);
|
leaf->lastleft = dlist_prev_node(&leaf->segments, leaf->lastleft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user