pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: pg_stat_statements doesn't work with --disable-spinlocks
Date: Thu, 04 Apr 2013 13:22:07 -0400
Message-ID: <20277.1365096127@sss.pgh.pa.us> (raw)
In-Reply-To: <515DB441.3050506@vmware.com>
References: <515DB441.3050506@vmware.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Heikki Linnakangas <hlinnakangas@vmware.com> 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



view thread (2+ messages)

Message-ID: <20277.1365096127@sss.pgh.pa.us>
Permalink:  ../20277.1365096127@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20277.1365096127@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hlinnakangas@vmware.com
  Subject: Re: pg_stat_statements doesn't work with --disable-spinlocks
  In-Reply-To: <20277.1365096127@sss.pgh.pa.us>
  References: <515DB441.3050506@vmware.com> <20277.1365096127@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox