|
Zero
0.1.0
|
Free-Page allocation/deallocation interface. More...
#include <alloc_cache.h>
Public Member Functions | |
| alloc_cache_t (stnode_cache_t &stcache, bool virgin, bool clustered) | |
| rc_t | sx_allocate_page (PageID &pid, StoreID stid=0) |
| rc_t | sx_deallocate_page (PageID pid) |
| rc_t | sx_format_alloc_page (PageID alloc_pid) |
| bool | is_allocated (PageID pid) |
| PageID | get_last_allocated_pid (StoreID s) const |
| Returns last allocated PID of a given store. More... | |
| PageID | get_last_allocated_pid () const |
| Returns last allocated PID of ALL stores. More... | |
| PageID | _get_last_allocated_pid_internal () const |
| lsn_t | get_page_lsn (PageID pid) |
Static Public Member Functions | |
| static bool | is_alloc_pid (PageID pid) |
Static Public Attributes | |
| static constexpr size_t | extent_size = alloc_page::bits_held |
Private Member Functions | |
| rc_t | load_alloc_page (StoreID stid, extent_id_t ext) |
Private Attributes | |
| std::vector< PageID > | last_alloc_page |
| stnode_cache_t & | stcache |
| srwlock_t | _latch |
Free-Page allocation/deallocation interface.
This object handles allocation/deallocation requests for one volume. All allocation/deallocation are logged and done in a critical section. To make it scalable, this object is designed to be as fast as possible.
| alloc_cache_t::alloc_cache_t | ( | stnode_cache_t & | stcache, |
| bool | virgin, | ||
| bool | clustered | ||
| ) |
| PageID alloc_cache_t::_get_last_allocated_pid_internal | ( | ) | const |
Returns last allocated PID of a given store.
| PageID alloc_cache_t::get_last_allocated_pid | ( | ) | const |
Returns last allocated PID of ALL stores.
|
inlinestatic |
| bool alloc_cache_t::is_allocated | ( | PageID | pid | ) |
|
private |
Reads the alloc page of given extent to update last_alloc_page
Allocates one page. (System transaction)
| [out] | pid | allocated page ID. |
| [in] | stid | StoreID to which this page will belong – this is used for clustering pages of the same store in the same extents |
Deallocates one page. (System transaction)
| [in] | pid | page ID to deallocate. |
Formats an alloc page for a new extent. Called internally in sx_allocate_page.
|
mutableprivate |
This lath protects access to last_alloc_page
|
static |
|
private |
Keep track of free pages using the ID of the last allocated page and a list of free pages whose IDs are lower than that.
Pages which are freed end up in the list of freed pages, again one for each store. Currently, these lists are only used to determine whether a certain page is allocated or not. To avoid fragmentation in a workload with many deletions, items should be removed from these lists when allocating a page to avoid fragmentation. One extreme policy would be to only use the contiguous space when the corresponding list is empty, i.e., when the non-contiguous space has been fully utilized. Policies that trade off allocation performance for fragmentation by managing allocations from both contiguous and non-contiguous space would be the more flexible and robust option.
In Feb 2017, this was extended to support clustering pages by store ID, which requires assigning extents to stores exclusively, which means that we must keep track of page allocation on a per-store basis.
|
private |
1.8.12