Repair two related errors in heap_lock_tuple: it was failing to recognize
Tom Lane <tgl@sss.pgh.pa.us>
Repair two related errors in heap_lock_tuple: it was failing to recognize cases where we already hold the desired lock "indirectly", either via membership in a MultiXact or because the lock was originally taken by a different subtransaction of the current transaction. These cases must be accounted for to avoid needless deadlocks and/or inappropriate replacement of an exclusive lock with a shared lock. Per report from Clarence Gardner and subsequent investigation.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/heap/heapam.c | modified | +63 −37 |
| src/backend/access/transam/multixact.c | modified | +45 −6 |
| src/backend/utils/time/tqual.c | modified | +5 −2 |
| src/include/access/multixact.h | modified | +2 −1 |