diff options
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 75ff9e7388f..1748eafa100 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -6165,8 +6165,8 @@ heap_abort_speculative(Relation relation, ItemPointer tid) * transaction. If compatible, return true with the buffer exclusive-locked, * and the caller must release that by calling * heap_inplace_update_and_unlock(), calling heap_inplace_unlock(), or raising - * an error. Otherwise, return false after blocking transactions, if any, - * have ended. + * an error. Otherwise, call release_callback(arg), wait for blocking + * transactions to end, and return false. * * Since this is intended for system catalogs and SERIALIZABLE doesn't cover * DDL, this doesn't guarantee any particular predicate locking. @@ -6200,7 +6200,8 @@ heap_abort_speculative(Relation relation, ItemPointer tid) */ bool heap_inplace_lock(Relation relation, - HeapTuple oldtup_ptr, Buffer buffer) + HeapTuple oldtup_ptr, Buffer buffer, + void (*release_callback) (void *), void *arg) { HeapTupleData oldtup = *oldtup_ptr; /* minimize diff vs. heap_update() */ TM_Result result; @@ -6265,6 +6266,7 @@ heap_inplace_lock(Relation relation, lockmode, NULL)) { LockBuffer(buffer, BUFFER_LOCK_UNLOCK); + release_callback(arg); ret = false; MultiXactIdWait((MultiXactId) xwait, mxact_status, infomask, relation, &oldtup.t_self, XLTW_Update, @@ -6280,6 +6282,7 @@ heap_inplace_lock(Relation relation, else { LockBuffer(buffer, BUFFER_LOCK_UNLOCK); + release_callback(arg); ret = false; XactLockTableWait(xwait, relation, &oldtup.t_self, XLTW_Update); @@ -6291,6 +6294,7 @@ heap_inplace_lock(Relation relation, if (!ret) { LockBuffer(buffer, BUFFER_LOCK_UNLOCK); + release_callback(arg); } } |