Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsv8j-0007jT-Sc for pgsql-committers@arkaria.postgresql.org; Fri, 15 Sep 2017 18:14:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dsv8j-0005c2-AW for pgsql-committers@arkaria.postgresql.org; Fri, 15 Sep 2017 18:14:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dsv8U-0005BW-2u for pgsql-committers@postgresql.org; Fri, 15 Sep 2017 18:14:42 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dsv8R-0002vM-7a for pgsql-committers@postgresql.org; Fri, 15 Sep 2017 18:14:40 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 85B9B20982; Fri, 15 Sep 2017 14:14:38 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Fri, 15 Sep 2017 14:14:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=ytFkjS+dfCq7RAoxFd tF6Nr3zcRpydehPiwLg3DuGNc=; b=OHPbU4diuSyIzp299m6wQlRWEx+kZd2ixf tH+aEM+qaVi+rMxyNRDSCOlkyWfR3ehpyWO0shr85WqPk9F8MiqXS6oVkI3+7Vip YkL7sSKrr5H4Psii2aoQGVoGiL1Pdgxqj8Vd3sgJFk+MBuFhy3A52kp6mIdfxiVN FVUoKqptDEWX7H70e8CxGQtxCfJA39S4gMKjx4epXR5xzbKkv7TuRQ/u3A/bPQem xrhZfVFrV/+2D0oSEJkOqyWQbesoVq4opVvuF9uxZ1+PjTFd9+zACFzc9sjWZKvq FbYLEQH0XXbD2jbT/XITNq01L47PjIosyKSTGosRSvxsEBppe4eA== X-ME-Sender: X-Sasl-enc: yhuAvYyEdpFq3qDXWVjEFI7oPbMx/lQPJnaii85ircpK 1505499278 Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id 3364D2450D; Fri, 15 Sep 2017 14:14:38 -0400 (EDT) Date: Fri, 15 Sep 2017 11:14:36 -0700 From: Andres Freund To: Tom Lane Cc: Thomas Munro , pgsql-committers Subject: Re: pgsql: Add support for coordinating record typmods among parallel worke Message-ID: <20170915181436.u6j27rx65giyntmk@alap3.anarazel.de> References: <13971.1505445491@sss.pgh.pa.us> <14932.1505447120@sss.pgh.pa.us> <29888.1505451575@sss.pgh.pa.us> <21075.1505486017@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21075.1505486017@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2017-09-15 10:33:37 -0400, Tom Lane wrote: > Thomas Munro writes: > > Yeah. The regress tests in d36f7efb39e1b9613193b2e12717dbe2418ddae5 > > tested this stuff in parallel mode, but only a happy case to > > demonstrate blessed RECORD types travelling through tqueue.c correctly > > before and after ripping out the remapping stuff. The problem here > > was that I do some cleanup in the DSM detach hook of the new session > > segment, and that involved reading data that could point to another > > segment (if the DSA area needed more space). That can blow up if that > > other segment happens to have been unmapped first in the arbitrary > > order of resource cleanup in an aborting worker. I do have some > > thoughts on how to solve that general problem, but in this case it's > > completely unnecessary anyway. The attached patch fixes the problem > > by getting rid of the code that accesses shmem in the detach hook. > > With this patch applied installcheck survives on a cluster with > > force_parallel_worker=regress. > > I don't much like your proposed comment; the only way that this code > is even approximately correct is if we're exiting the process and > will never touch the RecordCacheArray again. (Otherwise, it risks > reassigning a previously used local typmod.) How'd it reuse it after running the detach hook in workers? > My inclination is to just leave the local data structures alone. > There's nothing we can do to them that doesn't create more problems > than it solves, if the process continues to use the cache. The problem is that RecordCacheArray[n] can point into shared memory. Which means that the pushed change leaves around danging pointers into shared memory - unless I'm missing something (didn't yet have coffee, had to run to the store). Greetings, Andres Freund -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers