Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun

From: "R, Siva" <sivasubr(at)amazon(dot)com>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun
Date: 2018-09-06 18:02:20
Message-ID: 1536256940595.4374@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 6, 2018 at 09:53 AM, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Coleman 2018-09-06 18:04:44 Re: [PATCH] Incremental sort (was: PoC: Partial sort)
Previous Message Tom Lane 2018-09-06 17:39:47 Re: [PATCH] Incremental sort (was: PoC: Partial sort)