Re: Bug in ginRedoRecompress that causes opaque data on page to beoverrun - Mailing list pgsql-hackers

From R, Siva
Subject Re: Bug in ginRedoRecompress that causes opaque data on page to beoverrun
Date
Msg-id 1536256940595.4374@amazon.com
Whole thread Raw
In response to Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Responses Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
List pgsql-hackers
On Tue, Sep 6, 2018 at 09:53 AM, Alexander Korotkov <a.korotkov@postgrespro.ru> wrote:
> With (fastupdate = on) GIN performs bulk update of posting lists,
> inserting multiple tuples at once if possible.  With (fastupdate =
> off) GIN always inserts tuples one-by-one.  It might be still possible
> to reproduce the issue with (fastupdate = off), but it seems even
> harder.

Ah I see. This is cool, I will keep in mind for future testing. Thanks!

> BTW, I've tried the patch you've posted. On my test case it fails
> with following assertion.
> TRAP: FailedAssertion("!(a_action == 2)", File: "ginxlog.c", Line: 243)

> I thought about fixing this issue more, and I decided we can fix it in
> less invasive way.  Once modification is started we can copy tail of
> the page into separately allocated chunk of memory, and the use it as
> the source of original segments.  See the patch attached.

I'm also running into this assert with the workload, I think my patch is
not handling the case where the action is add items on the last segment
of the page correctly. I'm still investigating the issue further to find the
source of the bug.

Meanwhile I reviewed your patch and it looks good to me. I agree that
copying out the entire tail out to the scratch space in one shot vs copying
out every segment reduces the number of memcpy calls and simplifies
the solution overall. Let us go ahead with this patch.

Best
Siva


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)
Next
From: James Coleman
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)