Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxyby-0005wZ-I3 for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Sep 2018 18:02:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fxybw-0001Au-St for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Sep 2018 18:02:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxybw-0001An-Iu for pgsql-hackers@lists.postgresql.org; Thu, 06 Sep 2018 18:02:32 +0000 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxybp-0001fD-A2 for pgsql-hackers@postgresql.org; Thu, 06 Sep 2018 18:02:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1536256945; x=1567792945; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ok+1UiFHxQTCwhDBxTsaMCwkrSeQNuzLuSNRtVVsnfQ=; b=HSGtTWL7SuJy+b3TruWL+N6lpnKTyrm+3F+dnp8Rw5Lr5JRzfz2Q/2mB bH6Na4/P1Q8T/24GmB3OAlYp/m7gaqGQxpSIOqSgoBRMKsXf6Cupe17BG VHZ/BL0qy7tdTZIPamgZ+fHCUhk+dXbAPLvEcfZE1tmJr/8f9FrdCwnxn I=; X-IronPort-AV: E=Sophos;i="5.53,339,1531785600"; d="scan'208";a="696296117" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Sep 2018 18:02:22 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-8cc5d68b.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w86I2Lca087882 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 6 Sep 2018 18:02:21 GMT Received: from EX13D08UWB001.ant.amazon.com (10.43.161.104) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 6 Sep 2018 18:02:21 +0000 Received: from EX13D08UWB001.ant.amazon.com (10.43.161.104) by EX13D08UWB001.ant.amazon.com (10.43.161.104) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 6 Sep 2018 18:02:20 +0000 Received: from EX13D08UWB001.ant.amazon.com ([10.43.161.104]) by EX13D08UWB001.ant.amazon.com ([10.43.161.104]) with mapi id 15.00.1367.000; Thu, 6 Sep 2018 18:02:20 +0000 From: "R, Siva" To: Alexander Korotkov CC: Sawada Masahiko , pgsql-hackers Subject: Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun Thread-Topic: Bug in ginRedoRecompress that causes opaque data on page to be overrun Thread-Index: AQHURITWziSocye1S0ygUmXh1SVXsaTgquEAgAANUlGAALPkAIAAJPwAgAAo8QCAAHJWAIAACpEYgADO3wCAAId0ig== Date: Thu, 6 Sep 2018 18:02:20 +0000 Message-ID: <1536256940595.4374@amazon.com> References: <1536091151804.6588@amazon.com> <1536101117759.63175@amazon.com> <1536184145340.65860@amazon.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.43.162.76] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Sep 6, 2018 at 09:53 AM, Alexander Korotkov wrote:=0A= > With (fastupdate =3D on) GIN performs bulk update of posting lists,=0A= > inserting multiple tuples at once if possible. With (fastupdate =3D=0A= > off) GIN always inserts tuples one-by-one. It might be still possible=0A= > to reproduce the issue with (fastupdate =3D off), but it seems even=0A= > harder.=0A= =0A= Ah I see. This is cool, I will keep in mind for future testing. Thanks!=0A= =0A= > BTW, I've tried the patch you've posted. On my test case it fails=0A= > with following assertion.=0A= > TRAP: FailedAssertion("!(a_action =3D=3D 2)", File: "ginxlog.c", Line: 24= 3)=0A= =0A= > I thought about fixing this issue more, and I decided we can fix it in=0A= > less invasive way. Once modification is started we can copy tail of=0A= > the page into separately allocated chunk of memory, and the use it as=0A= > the source of original segments. See the patch attached.=0A= =0A= I'm also running into this assert with the workload, I think my patch is=0A= not handling the case where the action is add items on the last segment=0A= of the page correctly. I'm still investigating the issue further to find th= e=0A= source of the bug.=0A= =0A= Meanwhile I reviewed your patch and it looks good to me. I agree that =0A= copying out the entire tail out to the scratch space in one shot vs copying= =0A= out every segment reduces the number of memcpy calls and simplifies=0A= the solution overall. Let us go ahead with this patch.=0A= =0A= Best=0A= Siva=0A=