Commit 88231ec5 authored by Heikki Linnakangas's avatar Heikki Linnakangas

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.
parent 65c9dc23
......@@ -641,6 +641,9 @@ dataPlaceToPageLeaf(GinBtree btree, Buffer buf, GinBtreeStack *stack,
{
lastleftinfo = dlist_container(leafSegmentInfo, node, leaf->lastleft);
/* ignore deleted segments */
if (lastleftinfo->action != GIN_SEGMENT_DELETE)
{
segsize = SizeOfGinPostingList(lastleftinfo->seg);
if (append)
{
......@@ -655,6 +658,7 @@ dataPlaceToPageLeaf(GinBtree btree, Buffer buf, GinBtreeStack *stack,
leaf->lsize -= segsize;
leaf->rsize += segsize;
}
leaf->lastleft = dlist_prev_node(&leaf->segments, leaf->lastleft);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment