Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E3DB917B105B for ; Fri, 11 May 2012 15:33:10 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SSueJ-0004ll-IU for pgsql-bugs@postgresql.org; Fri, 11 May 2012 18:33:10 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q4BIWmFO009945; Fri, 11 May 2012 14:32:48 -0400 (EDT) To: Simon Riggs cc: Heikki Linnakangas , Ryan Kelly , tom Tom , pgsql-bugs@postgresql.org Subject: Re: BUG #6629: Creating a gist index fails with "too many LWLocks taken" In-reply-to: References: <4FA7EC37.5070703@enterprisedb.com> <20120508011540.GA28140@llserver.lakeliving.com> <4FACE4C7.6070306@enterprisedb.com> <4FAD1EC1.2000502@enterprisedb.com> <4FAD42F5.9060706@enterprisedb.com> Comments: In-reply-to Simon Riggs message dated "Fri, 11 May 2012 18:15:53 +0100" Date: Fri, 11 May 2012 14:32:48 -0400 Message-ID: <9944.1336761168@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/70 X-Sequence-Number: 33041 Simon Riggs writes: > OK, I agree. I still think this is about solving a non-problem. > The implementation I would prefer would be to put the check in > START_CRIT_SECTION(); so we actually fail before we enter the section. ... and this is proposing adding significant overhead to solve a non-problem. The suggested warning can be added without any new cycles in the normal case, ie, where we currently have if (lockcount >= 100) elog(ERROR, ...); we can do something like if (lockcount >= 20) { if (lockcount >= 100) elog(ERROR, ...); else elog(WARNING, ...); } I think that's more than sufficient. We've had the LWLock mechanism for umpteen years now, and this hasn't come up before, and now that it has come up it was because of a locking usage that needed to be rewritten anyway. That is *not* good evidence for adding complexity and cycles to the mechanism to make it more failsoft. It shouldn't need to be failsoft. regards, tom lane