1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00
Files
postgres/src/backend/utils/probes.d
Heikki Linnakangas 9b38d46d9f Make group commit more effective.
When a backend needs to flush the WAL, and someone else is already flushing
the WAL, wait until it releases the WALInsertLock and check if we still need
to do the flush or if the other backend already did the work for us, before
acquiring WALInsertLock. This helps group commit, because when the WAL flush
finishes, all the backends that were waiting for it can be woken up in one
go, and the can all concurrently observe that they're done, rather than
waking them up one by one in a cascading fashion.

This is based on a new LWLock function, LWLockWaitUntilFree(), which has
peculiar semantics. If the lock is immediately free, it grabs the lock and
returns true. If it's not free, it waits until it is released, but then
returns false without grabbing the lock. This is used in XLogFlush(), so
that when the lock is acquired, the backend flushes the WAL, but if it's
not, the backend first checks the current flush location before retrying.

Original patch and benchmarking by Peter Geoghegan and Simon Riggs, although
this patch as committed ended up being very different from that.
2012-01-30 16:53:48 +02:00

96 lines
3.3 KiB
D

/* ----------
* DTrace probes for PostgreSQL backend
*
* Copyright (c) 2006-2012, PostgreSQL Global Development Group
*
* src/backend/utils/probes.d
* ----------
*/
/*
* Typedefs used in PostgreSQL.
*
* NOTE: Do not use system-provided typedefs (e.g. uintptr_t, uint32_t, etc)
* in probe definitions, as they cause compilation errors on Mac OS X 10.5.
*/
#define LocalTransactionId unsigned int
#define LWLockId int
#define LWLockMode int
#define LOCKMODE int
#define BlockNumber unsigned int
#define Oid unsigned int
#define ForkNumber int
#define bool char
provider postgresql {
probe transaction__start(LocalTransactionId);
probe transaction__commit(LocalTransactionId);
probe transaction__abort(LocalTransactionId);
probe lwlock__acquire(LWLockId, LWLockMode);
probe lwlock__release(LWLockId);
probe lwlock__wait__start(LWLockId, LWLockMode);
probe lwlock__wait__done(LWLockId, LWLockMode);
probe lwlock__condacquire(LWLockId, LWLockMode);
probe lwlock__condacquire__fail(LWLockId, LWLockMode);
probe lwlock__wait__until__free(LWLockId, LWLockMode);
probe lwlock__wait__until__free__fail(LWLockId, LWLockMode);
probe lock__wait__start(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
probe lock__wait__done(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, LOCKMODE);
probe query__parse__start(const char *);
probe query__parse__done(const char *);
probe query__rewrite__start(const char *);
probe query__rewrite__done(const char *);
probe query__plan__start();
probe query__plan__done();
probe query__execute__start();
probe query__execute__done();
probe query__start(const char *);
probe query__done(const char *);
probe statement__status(const char *);
probe sort__start(int, bool, int, int, bool);
probe sort__done(bool, long);
probe buffer__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid, int, bool);
probe buffer__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, bool, bool);
probe buffer__flush__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe buffer__flush__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe buffer__checkpoint__start(int);
probe buffer__checkpoint__sync__start();
probe buffer__checkpoint__done();
probe buffer__sync__start(int, int);
probe buffer__sync__written(int);
probe buffer__sync__done(int, int, int);
probe buffer__write__dirty__start(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe buffer__write__dirty__done(ForkNumber, BlockNumber, Oid, Oid, Oid);
probe deadlock__found();
probe checkpoint__start(int);
probe checkpoint__done(int, int, int, int, int);
probe clog__checkpoint__start(bool);
probe clog__checkpoint__done(bool);
probe subtrans__checkpoint__start(bool);
probe subtrans__checkpoint__done(bool);
probe multixact__checkpoint__start(bool);
probe multixact__checkpoint__done(bool);
probe twophase__checkpoint__start();
probe twophase__checkpoint__done();
probe smgr__md__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid, int);
probe smgr__md__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int, int);
probe smgr__md__write__start(ForkNumber, BlockNumber, Oid, Oid, Oid, int);
probe smgr__md__write__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int, int);
probe xlog__insert(unsigned char, unsigned char);
probe xlog__switch();
probe wal__buffer__write__dirty__start();
probe wal__buffer__write__dirty__done();
};