Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRxa3-0005Ck-Mo for pgsql-committers@arkaria.postgresql.org; Thu, 21 Dec 2017 09:55:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRxa3-00047Z-AD for pgsql-committers@arkaria.postgresql.org; Thu, 21 Dec 2017 09:55:59 +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.84_2) (envelope-from ) id 1eRxa2-00047P-VF for pgsql-committers@lists.postgresql.org; Thu, 21 Dec 2017 09:55:59 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eRxZx-0002oJ-TT for pgsql-committers@postgresql.org; Thu, 21 Dec 2017 09:55:58 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5EE5120C5F; Thu, 21 Dec 2017 04:55:52 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Thu, 21 Dec 2017 04:55:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=FAJK7ZZJToavN/NX4tjqA0kwEKeED VPjUZX72OxXT70=; b=RaqTxVd3876jJfQLan0OdGWCgRxhYoReENWsyUNEnI0d1 LAWK9L34G7+DwEJDxn/dArlqAX0flteQo82kM3hm9JEXHXCF8IaxSaN+FolFe054 JTGpMrHjJwgNXfWmHV8m9Ot1wOtUCl9jD6LqxDTbDjuLttzyoclNv0GYgNtmQvHC rIGPI+ASjiZtNnCGLWdsOWof69JvBSO+nPgKFE0bgTMuZBFhsTwptKHgiurwWo0+ hlIAP9YGO4FSMAQiJ5UvsH0+Ar/1YIvJkyo8UpfipMQvlL5ppqWQPuxvKPmnPOcp v0w51L3WpQjfNJAY+tYgjQJje6U0TT21Rf9EqflSQ== X-ME-Sender: Received: from intern.anarazel.de (p5de63f33.dip0.t-ipconnect.de [93.230.63.51]) by mail.messagingengine.com (Postfix) with ESMTPA id D091E247FD; Thu, 21 Dec 2017 04:55:51 -0500 (EST) Date: Thu, 21 Dec 2017 01:55:50 -0800 From: Andres Freund To: pgsql-committers@postgresql.org, Thomas Munro Subject: Re: pgsql: Add parallel-aware hash joins. Message-ID: <20171221095550.d3e7xhoakcowhu5b@alap3.anarazel.de> References: <20171221092940.gbxcszbzsr5khsfr@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171221092940.gbxcszbzsr5khsfr@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2017-12-21 01:29:40 -0800, Andres Freund wrote: > On 2017-12-21 08:49:46 +0000, Andres Freund wrote: > > Add parallel-aware hash joins. > > There's to relatively mundane failures: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=tern&dt=2017-12-21%2008%3A48%3A12 > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=termite&dt=2017-12-21%2008%3A50%3A08 > > but also one that's a lot more interesting: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=capybara&dt=2017-12-21%2008%3A50%3A08 > > which shows an assert failure: > > #2 0x00000000008687d1 in ExceptionalCondition (conditionName=conditionName@entry=0xa76a98 "!(!accessor->sts->participants[i].writing)", errorType=errorType@entry=0x8b2c49 "FailedAssertion", fileName=fileName@entry=0xa76991 "sharedtuplestore.c", lineNumber=lineNumber@entry=273) at assert.c:54 > #3 0x000000000089883e in sts_begin_parallel_scan (accessor=0xfaf780) at sharedtuplestore.c:273 > #4 0x0000000000634de4 in ExecParallelHashRepartitionRest (hashtable=0xfaec18) at nodeHash.c:1369 > #5 ExecParallelHashIncreaseNumBatches (hashtable=0xfaec18) at nodeHash.c:1198 > #6 0x000000000063546b in ExecParallelHashTupleAlloc (hashtable=hashtable@entry=0xfaec18, size=40, shared=shared@entry=0x7ffee26a8868) at nodeHash.c:2778 > #7 0x00000000006357c8 in ExecParallelHashTableInsert (hashtable=hashtable@entry=0xfaec18, slot=slot@entry=0xfa76f8, hashvalue=) at nodeHash.c:1696 > #8 0x0000000000635b5f in MultiExecParallelHash (node=0xf7ebc8) at nodeHash.c:288 > #9 MultiExecHash (node=node@entry=0xf7ebc8) at nodeHash.c:112 > > which seems to suggest that something in the state machine logic is > borked. ExecParallelHashIncreaseNumBatches() should've ensured that > everyone has called sts_end_write()... Thomas, I wonder if the problem is that PHJ_GROW_BATCHES_ELECTING updates, via ExecParallelHashJoinSetUpBatches(), HashJoinTable->nbatch, while other backends also access ->nbatch in ExecParallelHashCloseBatchAccessors(). Both happens after waiting for the WAIT_EVENT_HASH_GROW_BATCHES_ELECTING phase. That'd lead to ExecParallelHashCloseBatchAccessors() likely not finish writing all batches (because nbatch < nbatch_old), which seems like it'd explain this? Greetings, Andres Freund