mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Standardize cleanup lock terminology.
The term "super-exclusive lock" is a synonym for "buffer cleanup lock" that first appeared in nbtree many years ago. Standardize things by consistently using the term cleanup lock. This finishes work started by commit276db875
. There is no good reason to have two terms. But there is a good reason to only have one: to avoid confusion around why VACUUM acquires a full cleanup lock (not just an ordinary exclusive lock) in index AMs, during ambulkdelete calls. This has nothing to do with protecting the physical index data structure itself. It is needed to implement a locking protocol that ensures that TIDs pointing to the heap/table structure cannot get marked for recycling by VACUUM before it is safe (which is somewhat similar to how VACUUM uses cleanup locks during its first heap pass). Note that it isn't strictly necessary for index AMs to implement this locking protocol -- several index AMs use an MVCC snapshot as their sole interlock to prevent unsafe TID recycling. In passing, update the nbtree README. Cleanly separate discussion of the aforementioned index vacuuming locking protocol from discussion of the "drop leaf page pin" optimization added by commit2ed5b87f
. We now structure discussion of the latter by describing how individual index scans may safely opt out of applying the standard locking protocol (and so can avoid blocking progress by VACUUM). Also document why the optimization is not safe to apply during nbtree index-only scans. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-WzngHgQa92tz6NQihf4nxJwRzCV36yMJO_i8dS+2mgEVKw@mail.gmail.com Discussion: https://postgr.es/m/CAH2-WzkHPgsBBvGWjz=8PjNhDefy7XRkDKiT5NxMs-n5ZCf2dA@mail.gmail.com
This commit is contained in:
@@ -701,7 +701,7 @@ compactify_tuples(itemIdCompact itemidbase, int nitems, Page page, bool presorte
|
||||
* there is, in general, a good chance that even large groups of unused line
|
||||
* pointers that we see here will be recycled quickly.
|
||||
*
|
||||
* Caller had better have a super-exclusive lock on page's buffer. As a side
|
||||
* Caller had better have a full cleanup lock on page's buffer. As a side
|
||||
* effect the page's PD_HAS_FREE_LINES hint bit will be set or unset as
|
||||
* needed.
|
||||
*/
|
||||
@@ -820,9 +820,9 @@ PageRepairFragmentation(Page page)
|
||||
* arbitrary, but it seems like a good idea to avoid leaving a PageIsEmpty()
|
||||
* page behind.
|
||||
*
|
||||
* Caller can have either an exclusive lock or a super-exclusive lock on
|
||||
* page's buffer. The page's PD_HAS_FREE_LINES hint bit will be set or unset
|
||||
* based on whether or not we leave behind any remaining LP_UNUSED items.
|
||||
* Caller can have either an exclusive lock or a full cleanup lock on page's
|
||||
* buffer. The page's PD_HAS_FREE_LINES hint bit will be set or unset based
|
||||
* on whether or not we leave behind any remaining LP_UNUSED items.
|
||||
*/
|
||||
void
|
||||
PageTruncateLinePointerArray(Page page)
|
||||
|
Reference in New Issue
Block a user