forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf2e6a2c
committed
Add API to check if an existing exclusive lock allows cleanup.
LockBufferForCleanup() acquires a cleanup lock unconditionally, andConditionalLockBufferForCleanup() acquires a cleanup lock if it ispossible to do so without waiting; this patch adds a new API,IsBufferCleanupOK(), which tests whether an exclusive lock alreadyheld happens to be a cleanup lock. This is possible because a cleanuplock simply means an exclusive lock plus the assurance any other pinson the buffer are newer than our own pin. Therefore, just as theexisting functions decide that the exclusive lock that they've justtaken is a cleanup lock if they observe the pin count to be 1, thisnew function allows us to observe that the pin count is 1 on a bufferwe've already locked.This is useful in situations where a backend definitely wishes tomodify the buffer and also wishes to perform cleanup operations ifpossible. The patch to eliminate heavyweight locking by hash indexesuses this, and it may have other applications as well.Amit Kapila, per a suggestion from me. Some comment adjustments by meas well.1 parent7016e4c commitf2e6a2c
2 files changed
+50
-0
lines changedLines changed: 49 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3745 | 3745 |
| |
3746 | 3746 |
| |
3747 | 3747 |
| |
| 3748 | + | |
| 3749 | + | |
| 3750 | + | |
| 3751 | + | |
| 3752 | + | |
| 3753 | + | |
| 3754 | + | |
| 3755 | + | |
| 3756 | + | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
| 3761 | + | |
| 3762 | + | |
| 3763 | + | |
| 3764 | + | |
| 3765 | + | |
| 3766 | + | |
| 3767 | + | |
| 3768 | + | |
| 3769 | + | |
| 3770 | + | |
| 3771 | + | |
| 3772 | + | |
| 3773 | + | |
| 3774 | + | |
| 3775 | + | |
| 3776 | + | |
| 3777 | + | |
| 3778 | + | |
| 3779 | + | |
| 3780 | + | |
| 3781 | + | |
| 3782 | + | |
| 3783 | + | |
| 3784 | + | |
| 3785 | + | |
| 3786 | + | |
| 3787 | + | |
| 3788 | + | |
| 3789 | + | |
| 3790 | + | |
| 3791 | + | |
| 3792 | + | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
| 3796 | + | |
3748 | 3797 |
| |
3749 | 3798 |
| |
3750 | 3799 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
| 230 | + | |
230 | 231 |
| |
231 | 232 |
| |
232 | 233 |
| |
|
0 commit comments
Comments
(0)