Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1adii0-0006ad-1h for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Mar 2016 18:19:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1adihz-0002bg-Ad for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Mar 2016 18:19:43 +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) (envelope-from ) id 1adigd-00015z-Tt for pgsql-hackers@postgresql.org; Wed, 09 Mar 2016 18:18:19 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1adigZ-0005Ft-JP for pgsql-hackers@postgresql.org; Wed, 09 Mar 2016 18:18:19 +0000 Received: by mail-wm0-x22d.google.com with SMTP id l68so204568043wml.0 for ; Wed, 09 Mar 2016 10:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=zZ5N+4Z37gyei7lLrUXdG/Xa6fTUFJFSX6ST5EC2fFA=; b=PoCUNyCq0hJFztrTTVN3/Cb65L+mU58yVJGlTNuwdwX2DUCywMuCJFijcMLGJRB7OA MNAlb4pJwAp6gOsdN8hpJDXxsTuZ6G8b3tu7JSg9zNnpXeStCgBXgyEyXAV/qcaOSK18 NKDQ3mz7SkKitiid79nO+8ZJhffdppIaqo0ZKGxi5JOFiSROYkRnWKXOMgB7JoOGQ7MD qJ5MHjtB2neFoMnegjwakzzpr98Rr309LWzEFdSDe0IK+sTI6b7niP+9a9HqHPKOu0Og 1WJJ9hJ9jN+nWF0vQdQPLzWnQf+/Vtnj5nW9DSt7MK7Non12l/BTFuG2bIRoKmFOXFRZ HWTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=zZ5N+4Z37gyei7lLrUXdG/Xa6fTUFJFSX6ST5EC2fFA=; b=RTxcosfd/35wXCKpmRtxyysBnRGbAO5StMqwAKiof0almtnaoc28ZlgkzIEEpWESJt aGYCM9F/ckWEUw20GOHtOtwsPOyckQzuZVqZstryzamcMLInB9663vYF83ia4rF51gUh tUMEDojfTIHBpSm3C4OoeejVbCOq3zeOccUkjtpGm9te9j4506kuqRBhDTTSddhoQycB xmVN+G8GWcN9zhS8q1NsuEiNj6yDndAfoWeOutRRpzwQjFrdCoKeI2VJa5wX+joZa3oV uA/AQ72IUkTWsONQqvoq1vIvS8pXpxhUDb2lloepplZrzbXPLzRiFlFplv9K26WRUnqQ EfMg== X-Gm-Message-State: AD7BkJIYj5HsIg1g2UQpqLGvnpBfRHqxo+NkA5cuXhF0B2Q1AXJ/BqGasGSRxCekLtKUXPVT X-Received: by 10.194.103.198 with SMTP id fy6mr42111987wjb.48.1457547494323; Wed, 09 Mar 2016 10:18:14 -0800 (PST) Received: from development (ip-78-45-216-26.net.upcbroadband.cz. [78.45.216.26]) by smtp.gmail.com with ESMTPSA id m6sm9058754wje.21.2016.03.09.10.18.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Mar 2016 10:18:13 -0800 (PST) Message-ID: <1457547490.24545.90.camel@2ndquadrant.com> Subject: Re: multivariate statistics v14 From: Tomas Vondra To: Jeff Janes Cc: Alvaro Herrera , pgsql-hackers Date: Wed, 09 Mar 2016 19:18:10 +0100 In-Reply-To: <1457544102.24545.79.camel@2ndquadrant.com> References: <20160309122245.GA958049@alvherre.pgsql> <1457535779.24545.71.camel@2ndquadrant.com> <1457544102.24545.79.camel@2ndquadrant.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Wed, 2016-03-09 at 18:21 +0100, Tomas Vondra wrote: > Hi, > > On Wed, 2016-03-09 at 08:45 -0800, Jeff Janes wrote: > > On Wed, Mar 9, 2016 at 7:02 AM, Tomas Vondra > > wrote: > > > Hi, > > > > > > thanks for the feedback. Attached is v14 of the patch series, fixing > > > most of the points you've raised. > > > > > > Hi Tomas, > > > > Applied to aa09cd242fa7e3a694a31f, I still get the seg faults in make > > check if I configure without --enable-cassert. > > Ah, after disabling asserts I can reproduce it too. And the reason why > it fails is quite simple - clauselist_selectivity modifies the original > list of clauses, which then confuses cost_qual_eval. More precisely, it gets confused because the first clause in the list gets deleted but cost_qual_eval never learns about that, and follows stale pointer to the next cell, thus a segfault. > > Can you try if the attached patch fixes the issue? I'll need to rework a > bit more of the code, but let's see if this fixes the issue on your > machine too. > > > With --enable-cassert, it passes the regression test. > > I wonder how can it work with casserts and fail without them. That's > kinda exactly the opposite to what I'd expect ... FWIW it seems to be somehow related to this assert in clausesel.c: Assert(count_mv_attnums(list_union(stat_clauses, stat_conditions), relid, MV_CLAUSE_TYPE_MCV | MV_CLAUSE_TYPE_HIST) >= 2); With the assert in place, the code passes without a failure. After removing the assert (commenting it out), or even just changing it to Assert(count_mv_attnums(stat_clauses, relid, MV_CLAUSE_TYPE_MCV | MV_CLAUSE_TYPE_HIST) + count_mv_attnums(stat_conditions, relid, MV_CLAUSE_TYPE_MCV | MV_CLAUSE_TYPE_HIST) >= 2); i.e. removing the list_union, it fails as expected. The only thing that I can think of is that list_union happens to place the right stuff at the right position in memory - pure luck. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers