diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2025-08-29 07:33:50 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2025-08-29 07:39:58 +0200 |
commit | 991295f387a6a453fe061831bcc36294989fe77b (patch) | |
tree | 79077d230c1940102cb8babcb6d69fd4d9d3be33 /src/include/storage/lmgr.h | |
parent | 710e6c4301ee3c739a171ea12ed141b1f8df0d93 (diff) |
Mark ItemPointer arguments as const in tuple/table lock functions
The functions LockTuple, ConditionalLockTuple, UnlockTuple, and
XactLockTableWait take an ItemPointer argument that they do not
modify, so the argument can be const-qualified to better convey intent
and allow the compiler to enforce immutability.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2m9e4rECHBwpRE4%2BGCH%2BpbYZXLh2f4rB1Du5hDfKug%2BOg%40mail.gmail.com
Diffstat (limited to 'src/include/storage/lmgr.h')
-rw-r--r-- | src/include/storage/lmgr.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index 58eee4e0d54..b7abd18397d 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -71,16 +71,16 @@ extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE l extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode); /* Lock a tuple (see heap_lock_tuple before assuming you understand this) */ -extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); -extern bool ConditionalLockTuple(Relation relation, ItemPointer tid, +extern void LockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode); +extern bool ConditionalLockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode, bool logLockFailure); -extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode); +extern void UnlockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode); /* Lock an XID (used to wait for a transaction to finish) */ extern void XactLockTableInsert(TransactionId xid); extern void XactLockTableDelete(TransactionId xid); extern void XactLockTableWait(TransactionId xid, Relation rel, - ItemPointer ctid, XLTW_Oper oper); + const ItemPointerData *ctid, XLTW_Oper oper); extern bool ConditionalXactLockTableWait(TransactionId xid, bool logLockFailure); |