Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 8C2F617B105B for ; Fri, 11 May 2012 11:11:56 -0300 (ADT) Received: from exprod7og110.obsmtp.com ([64.18.2.173]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SSqZW-0002tA-Jt for pgsql-bugs@postgresql.org; Fri, 11 May 2012 14:11:56 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) (using TLSv1) by exprod7ob110.postini.com ([64.18.6.12]) with SMTP ID DSNKT60eHOTtU4pdKhVwhg6ppqEBDpzlF6TZ@postini.com; Fri, 11 May 2012 07:11:54 PDT Received: by lbbgg6 with SMTP id gg6so2261341lbb.8 for ; Fri, 11 May 2012 07:11:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=rlzu2PFl1/Yvf0eUqjtddrvUo4MB8+abqmrMbPULA+I=; b=NzPxM6nqLVIX6T/SzD9hEpDXqtgVBlnbXnMNj5/0/eaZY0Dap1PrX4prbyresayauV 9/dYpEeZb7izUVntNxmThi8vtz5NGsq+pOmQEF6tv/bXvohf298jWdwfzlf+f2N1VZ+f /UZ79OSGyFcFxmtD0ZDeQqn34dM9XbWeLiNc5ZYqUcm+jDMAddB/jFb8fyn7ZBwXOv7H C5f0bWhor/ePh0W6EgMP68pYAxwFE9WBcllyvM+ygeCluRjPbHVAxZPWUP9UVDj/kRQe 3c3lT7xaf7uhwqzQTQI6h7/V/YvGRj845t8aMEuGyQ/QcdBxkiPGtsxWifkXOphkUnTY 4JPQ== Received: by 10.112.83.136 with SMTP id q8mr3587705lby.60.1336745499298; Fri, 11 May 2012 07:11:39 -0700 (PDT) Received: from [192.168.1.102] (dsl-hkibrasgw2-ff6cc300-200.dhcp.inet.fi. [88.195.108.200]) by mx.google.com with ESMTPS id h9sm11915953lbi.9.2012.05.11.07.11.37 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 May 2012 07:11:38 -0700 (PDT) Message-ID: <4FAD1E18.7020205@enterprisedb.com> Date: Fri, 11 May 2012 17:11:36 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120329 Icedove/10.0.3 MIME-Version: 1.0 To: Tom Lane CC: Ryan Kelly , tom Tom , pgsql-bugs@postgresql.org Subject: Re: BUG #6629: Creating a gist index fails with "too many LWLocks taken" References: <4FA7EC37.5070703@enterprisedb.com> <20120508011540.GA28140@llserver.lakeliving.com> <4FACE4C7.6070306@enterprisedb.com> <2941.1336744377@sss.pgh.pa.us> In-Reply-To: <2941.1336744377@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmHsZkg4hlXc4I8hb97jsno3ICWFvpyhTF5PM+JQa8yf9zvisnKulfIfFoyk6HGVsCF9DlW X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201205/62 X-Sequence-Number: 33033 On 11.05.2012 16:52, Tom Lane wrote: > Heikki Linnakangas writes: >> I wonder if we should reserve a few of the lwlock "slots" for critical >> sections, to make this less likely to happen. Not only in this case, but >> in general. We haven't seen this problem often, but it would be quite >> trivial to reserve a few slots. > > I'm against that: it would complicate a performance-critical and > correctness-critical part of the code, in return for what exactly? > IMO, no part of the system should ever get within an order of magnitude > of holding 100 LWLocks concurrently. I agree we should never get anywhere near that limit. But if we do - because of another bug like this one - it would be nice if it was just an ERROR, instead of a PANIC. > For one thing, I don't believe > it's possible to statically guarantee no deadlock once things get that > messy; and for another, it'd surely be horrible from a concurrency > standpoint. Well, for example in the case of a gist page split that splits a page into a hundred pages, all but one of the pages involved is previously unused. It's quite easy to guarantee that's deadlock free. It's nevertheless not a good idea in practice to do that, of course. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com