pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: R, Siva <sivasubr@amazon.com>
To: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: Sawada Masahiko <sawada.mshk@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun
Date: Thu, 6 Sep 2018 18:02:20 +0000
Message-ID: <1536256940595.4374@amazon.com> (raw)
In-Reply-To: <CAPpHfdv3HLMWY8W8eh-djG6ar_coZzQnVmRVYh3-EtrtxccgAw@mail.gmail.com>
References: <1536091151804.6588@amazon.com>
	<CAH2-WzneRxhYubPMh-x0L7h_1iH5kddVH5HWx2RFWKh=ELdgzw@mail.gmail.com>
	<1536101117759.63175@amazon.com>
	<CAPpHfdv1FkM3Lk7xGh1Wmo+u7xKV9GqNzLkc2mxiiX5OOqkN1Q@mail.gmail.com>
	<CAPpHfduH0P9onLnkGGMM_Pze5J47qjHFxFxouWkhYxBebq0mrQ@mail.gmail.com>
	<CAPpHfdtS2hHJBT4bOnk2FJDzE1yCvRDveAjrW_Oi3aAK1MtrGw@mail.gmail.com>
	<CAPpHfduRz9qeqxVQh+2FAj+uQ040qzijYOM6Lc2o7873UzVL3w@mail.gmail.com>
	<1536184145340.65860@amazon.com>
	<CAPpHfdv3HLMWY8W8eh-djG6ar_coZzQnVmRVYh3-EtrtxccgAw@mail.gmail.com>

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




view thread (13+ messages)  latest in thread

Message-ID: <1536256940595.4374@amazon.com>
Permalink:  ../1536256940595.4374@amazon.com/
Also on:    postgresql.org/message-id/1536256940595.4374@amazon.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: sivasubr@amazon.com, a.korotkov@postgrespro.ru, sawada.mshk@gmail.com
  Subject: Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun
  In-Reply-To: <1536256940595.4374@amazon.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox