]> granicus.if.org Git - postgresql/commit
When building with LWLOCK_STATS, initialize the stats in LWLockWaitUntilFree.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 7 Feb 2012 07:38:25 +0000 (09:38 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 7 Feb 2012 08:11:54 +0000 (10:11 +0200)
commit15ad6f1510f8979a39e4c39078c742b5fdb121ce
tree8dbe561e53e047c8e279aa74e8a2e009cf67efcd
parent442231d7f71764b8c628044e7ce2225f9aa43b67
When building with LWLOCK_STATS, initialize the stats in LWLockWaitUntilFree.

If LWLockWaitUntilFree was called before the first LWLockAcquire call, you
would either crash because of access to uninitialized array or account the
acquisition incorrectly. LWLockConditionalAcquire doesn't have this problem
because it doesn't update the lwlock stats.

In practice, this never happens because there is no codepath where you would
call LWLockWaitUntilfree before LWLockAcquire after a new process is
launched. But that's just accidental, there's no guarantee that that's
always going to be true in the future.

Spotted by Jeff Janes.
src/backend/storage/lmgr/lwlock.c