aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-11-04 09:27:49 -0400
committerRobert Haas <rhaas@postgresql.org>2016-11-04 09:32:24 -0400
commitf2e6a2ccf1247bc15f6c03895c936b28cdeff181 (patch)
treecf6c1c2d6441d93f8bbff465e24b474717e55eff /src/backend/commands/trigger.c
parent7016e4c4f59c30d22f308dd29e8a5014d6427f69 (diff)
downloadpostgresql-f2e6a2ccf1247bc15f6c03895c936b28cdeff181.tar.gz
postgresql-f2e6a2ccf1247bc15f6c03895c936b28cdeff181.zip
Add API to check if an existing exclusive lock allows cleanup.
LockBufferForCleanup() acquires a cleanup lock unconditionally, and ConditionalLockBufferForCleanup() acquires a cleanup lock if it is possible to do so without waiting; this patch adds a new API, IsBufferCleanupOK(), which tests whether an exclusive lock already held happens to be a cleanup lock. This is possible because a cleanup lock simply means an exclusive lock plus the assurance any other pins on the buffer are newer than our own pin. Therefore, just as the existing functions decide that the exclusive lock that they've just taken is a cleanup lock if they observe the pin count to be 1, this new function allows us to observe that the pin count is 1 on a buffer we've already locked. This is useful in situations where a backend definitely wishes to modify the buffer and also wishes to perform cleanup operations if possible. The patch to eliminate heavyweight locking by hash indexes uses this, and it may have other applications as well. Amit Kapila, per a suggestion from me. Some comment adjustments by me as well.
Diffstat (limited to 'src/backend/commands/trigger.c')
0 files changed, 0 insertions, 0 deletions