]> granicus.if.org Git - postgresql/commit
Fix potential corruption of lock table in CREATE/DROP INDEX CONCURRENTLY.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 8 Jan 2013 23:26:03 +0000 (18:26 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 8 Jan 2013 23:26:03 +0000 (18:26 -0500)
commitfe35c0b6e54d0787ccab17974010a48a8a3ba6d3
tree13334b3ee1d2e503de055ce4ece9d25e8c0a4c6d
parenta17da19ed9eeffd08c138ebd816552acf75b8261
Fix potential corruption of lock table in CREATE/DROP INDEX CONCURRENTLY.

If VirtualXactLock() has to wait for a transaction that holds its VXID lock
as a fast-path lock, it must first convert the fast-path lock to a regular
lock.  It failed to take the required "partition" lock on the main
shared-memory lock table while doing so.  This is the direct cause of the
assert failure in GetLockStatusData() recently observed in the buildfarm,
but more worryingly it could result in arbitrary corruption of the shared
lock table if some other process were concurrently engaged in modifying the
same partition of the lock table.  Fortunately, VirtualXactLock() is only
used by CREATE INDEX CONCURRENTLY and DROP INDEX CONCURRENTLY, so the
opportunities for failure are fewer than they might have been.

In passing, improve some comments and be a bit more consistent about
order of operations.
src/backend/storage/lmgr/lock.c