pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_stat_statements doesn't work with --disable-spinlocks
2+ messages / 2 participants
[nested] [flat]
* pg_stat_statements doesn't work with --disable-spinlocks
@ 2013-04-04 17:11 Heikki Linnakangas <hlinnakangas@vmware.com>
2013-04-04 17:22 ` Re: pg_stat_statements doesn't work with --disable-spinlocks Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Heikki Linnakangas @ 2013-04-04 17:11 UTC (permalink / raw)
To: pgsql-bugs
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.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pg_stat_statements doesn't work with --disable-spinlocks
2013-04-04 17:11 pg_stat_statements doesn't work with --disable-spinlocks Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-04-04 17:22 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2013-04-04 17:22 UTC (permalink / raw)
To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: pgsql-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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-04-04 17:22 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 17:11 pg_stat_statements doesn't work with --disable-spinlocks Heikki Linnakangas <hlinnakangas@vmware.com>
2013-04-04 17:22 ` Tom Lane <tgl@sss.pgh.pa.us>
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