OSDN Git Service

Repair race condition introduced into heap_update() in 7.1 ---
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 16 May 2001 22:35:12 +0000 (22:35 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 16 May 2001 22:35:12 +0000 (22:35 +0000)
commit27336e4f7a2dddfcd31fbf68e98ca9bb0abd0165
tree469aa43f71911f685e3607b55277fb3bbb04a4c5
parentae38a1f5567f8043dee59ae8414b9aa5845b739e
Repair race condition introduced into heap_update() in 7.1 ---
PageGetFreeSpace() was being called while not holding the buffer lock, which
not only could yield a garbage answer, but even if it's the right answer there
might be less space available after we reacquire the buffer lock.

Also repair potential deadlock introduced by my recent performance improvement
in RelationGetBufferForTuple(): it was possible for two heap_updates to try to
lock two buffers in opposite orders.  The fix creates a global rule that
buffers of a single heap relation should be locked in decreasing block number
order.  Currently, this only applies to heap_update; VACUUM can get away with
ignoring the rule since it holds exclusive lock on the whole relation anyway.
However, if we try to implement a VACUUM that can run in parallel with other
transactions, VACUUM will also have to obey the lock order rule.
src/backend/access/heap/heapam.c
src/backend/access/heap/hio.c
src/include/access/hio.h