Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 0C18317B105B for ; Fri, 11 May 2012 06:42:43 -0300 (ADT) Received: from exprod7og122.obsmtp.com ([64.18.2.22]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SSmMz-0006ws-Iv for pgsql-bugs@postgresql.org; Fri, 11 May 2012 09:42:43 +0000 Received: from mail-lb0-f179.google.com ([209.85.217.179]) (using TLSv1) by exprod7ob122.postini.com ([64.18.6.12]) with SMTP ID DSNKT6zfA+47vCSwATRx1+adRDZAwDOgFF9G@postini.com; Fri, 11 May 2012 02:42:41 PDT Received: by lban1 with SMTP id n1so2106353lba.24 for ; Fri, 11 May 2012 02:42:26 -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=zV+jjtOyIVu1QDxkmFSEURbLo2XficY2s9w2m4UEK1M=; b=VQqosHAeFee6pcLp3qSb2V3z1AmbiJwDygEPohSBfe5bWmcVxSx1QHuJ/VJpa7gzpD kDIwMO72UaJ/uKJENiFUmGXC+11OLpyBmYbOCpNVRvIkVNnZ6HR40U3O3aKIIwOsMXn/ ChoOP67el2KXmDjyp2nG192Qtak03ENr7AsAECJYXYXZccUWFUtEbuTINr6fQJot7KPD XHLDgtz7Ol32C+xsYHhB1jUcGDyfn+qK/m6dt26UF6Indx0971yefhOHyAniFwliDdr+ KyC6sVnfhlsPjeBqj6B82hMuJ3jteL+pjTFMTk+pddxo2puhafgi5hEnBuNiMmG32N4i Us3Q== Received: by 10.152.129.74 with SMTP id nu10mr7456956lab.50.1336729346231; Fri, 11 May 2012 02:42:26 -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 o9sm11091060lbm.14.2012.05.11.02.42.23 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 May 2012 02:42:24 -0700 (PDT) Message-ID: <4FACDEFE.4020901@enterprisedb.com> Date: Fri, 11 May 2012 12:42:22 +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: tom@tomforb.es, pgsql-bugs@postgresql.org Subject: Re: BUG #6629: Creating a gist index fails with "too many LWLocks taken" References: <4FA7EC37.5070703@enterprisedb.com> <27017.1336405902@sss.pgh.pa.us> In-Reply-To: <27017.1336405902@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkgiKJEDfU3BYhGxywObivknnZkCsQVfZHwK8/7c4LNiUioO/GTZ935JiF1p7Qi3Ht+kSMO X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201205/57 X-Sequence-Number: 33028 On 07.05.2012 18:51, Tom Lane wrote: > Heikki Linnakangas writes: >> We could rearrange the page splitting algorithm to release locks >> earlier, before traversing to the next parent level. > > That seems like a good idea just on concurrency grounds; I'm worried > about both the performance implications and the risk of deadlock. Ok, committed a patch to release locks earlier when recursing up the tree. This still doesn't completely eliminate the problem: when a page is split into more than two halves, the downlinks are inserted separately for each of the extra right pages. While that's done, the rest of the siblings are kept locked. So in effect, we still have the same issue when all the splits are 3 (or more)-way splits. I'm not going to try fixing that now, because it's an exceedingly rare corner-case, and would be rather difficult to fix. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com