Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNnrZ-0008EH-3g for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Apr 2013 17:22:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UNnrY-0001Sy-8B for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Apr 2013 17:22:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNnrX-0001Ss-OB for pgsql-bugs@postgresql.org; Thu, 04 Apr 2013 17:22:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UNnrU-0006m7-F5 for pgsql-bugs@postgresql.org; Thu, 04 Apr 2013 17:22:11 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r34HM7eS020278; Thu, 4 Apr 2013 13:22:07 -0400 (EDT) From: Tom Lane To: Heikki Linnakangas cc: Pg Bugs Subject: Re: pg_stat_statements doesn't work with --disable-spinlocks In-reply-to: <515DB441.3050506@vmware.com> References: <515DB441.3050506@vmware.com> Comments: In-reply-to Heikki Linnakangas message dated "Thu, 04 Apr 2013 20:11:29 +0300" Date: Thu, 04 Apr 2013 13:22:07 -0400 Message-ID: <20277.1365096127@sss.pgh.pa.us> X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Heikki Linnakangas writes: > pg_stat_statements (re-)initializes spinlocks as part of normal > operation. With --disable-spinlock, spinlocks are implemented using > semaphores, and semaphores are expected to be created at postmaster > startup. Hence, you get an assertion failure: > postgres=# select * from pg_stat_statements ; > The connection to the server was lost. Attempting reset: Failed. > !> > TRAP: FailedAssertion("!(!IsUnderPostmaster)", File: "pg_sema.c", Line: 326) > Even if that worked, re-initializing a spinlock with SpinLockInit, like > pg_stat_statement does, would always allocate a new semaphore, so you > would run out very quickly. You'd run out even without that, since we're only leaving a dozen or two extra semaphores available, and this code wants a spinlock per hash entry. I think that we can probably write this off as an unsupported combination. If you're running without real spinlocks, any sort of performance optimization is a complete waste of time until you fix that, so what's the point of using pg_stat_statements? Having said that, though, I agree that assuming that spinlocks can be reinitialized is being overly intimate with the implementation details. It's not too hard to imagine it failing with some future version of spinlocks, even disregarding the rather dubious assumption that no two processes would be touching the new entry at about the same time. We should probably try to find a way of avoiding that. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs