MySQL 26.7.0
Source Code Documentation
buf_stat_per_index_t Class Reference

Per index buffer pool statistics. More...

#include <buf0stats.h>

Public Member Functions

 buf_stat_per_index_t ()
 Constructor. More...
 
 ~buf_stat_per_index_t ()
 Destructor. More...
 
void inc (const index_id_t &id)
 Increment the number of pages for a given index with 1. More...
 
void reset (const index_id_t &id)
 Set the count for given id to 0. More...
 
void dec (const index_id_t &id)
 Decrement the number of pages for a given index with 1. More...
 
void dec_if_tracked_page (const page_t *frame)
 Decrement the page count if a frame currently satisfies the accounting predicate. More...
 
void inc_if_tracked_page (const page_t *frame)
 Increment the page count if a frame currently satisfies the accounting predicate. More...
 
bool is_tracked_page (const page_t *frame)
 Check whether a frame currently satisfies the accounting predicate. More...
 
uint64_t get (const index_id_t &id)
 Get the number of pages in the buffer pool for a given index. More...
 

Private Member Functions

void change_if_tracked_page (const page_t *frame, bool increment)
 Change the page count if a frame currently satisfies the accounting predicate. More...
 
bool should_skip (const index_id_t &id)
 Assess if we should skip a page from accounting. More...
 

Static Private Member Functions

static space_id_t get_space_id (const page_t *frame)
 Gets the space id from a page image. More...
 

Private Attributes

ut_lock_free_hash_tm_store
 (key, value) storage. More...
 

Detailed Description

Per index buffer pool statistics.

This tracks the number of logical buffer pool file pages that currently satisfy all of these predicates:

  1. the page is present in the buffer pool page hash, not on the free list,
  2. the FIL page type is FIL_PAGE_INDEX or FIL_PAGE_RTREE,
  3. PAGE_LEVEL is 0, i.e. page_is_leaf() is true,
  4. the page id's space id and PAGE_INDEX_ID identify the tracked index.

For compressed tables, the compressed image and the uncompressed frame are two possible in-memory representations of the same buffer pool page. They are counted once while the page id remains cached. Discarding only the uncompressed frame must not decrement the count if the compressed descriptor remains cached.

This is a key,value store where the key is a packed index_id_t and the value is the number of cached leaf pages that belong to the index.

Constructor & Destructor Documentation

◆ buf_stat_per_index_t()

buf_stat_per_index_t::buf_stat_per_index_t ( )
inline

Constructor.

◆ ~buf_stat_per_index_t()

buf_stat_per_index_t::~buf_stat_per_index_t ( )
inline

Destructor.

Member Function Documentation

◆ change_if_tracked_page()

void buf_stat_per_index_t::change_if_tracked_page ( const page_t frame,
bool  increment 
)
inlineprivate

Change the page count if a frame currently satisfies the accounting predicate.

Parameters
[in]framebuffer frame
[in]incrementtrue to increment, false to decrement

◆ dec()

void buf_stat_per_index_t::dec ( const index_id_t id)
inline

Decrement the number of pages for a given index with 1.

Parameters
[in]idid of the index whose count to decrement

◆ dec_if_tracked_page()

void buf_stat_per_index_t::dec_if_tracked_page ( const page_t frame)
inline

Decrement the page count if a frame currently satisfies the accounting predicate.

Parameters
[in]framebuffer frame

◆ get()

uint64_t buf_stat_per_index_t::get ( const index_id_t id)
inline

Get the number of pages in the buffer pool for a given index.

Parameters
[in]idid of the index whose pages to peek
Returns
number of pages

◆ get_space_id()

static space_id_t buf_stat_per_index_t::get_space_id ( const page_t frame)
inlinestaticprivate

Gets the space id from a page image.

Do not use page_get_space_id() here: it asserts that the frame is page-aligned, but compressed page images are allocated by the buddy allocator and need not satisfy that assertion.

Parameters
[in]framepage image
Returns
tablespace identifier from the FIL header

◆ inc()

void buf_stat_per_index_t::inc ( const index_id_t id)
inline

Increment the number of pages for a given index with 1.

Parameters
[in]idid of the index whose count to increment

◆ inc_if_tracked_page()

void buf_stat_per_index_t::inc_if_tracked_page ( const page_t frame)
inline

Increment the page count if a frame currently satisfies the accounting predicate.

Parameters
[in]framebuffer frame

◆ is_tracked_page()

bool buf_stat_per_index_t::is_tracked_page ( const page_t frame)
inline

Check whether a frame currently satisfies the accounting predicate.

Parameters
[in]framebuffer frame
Returns
true if the frame is counted by this structure

◆ reset()

void buf_stat_per_index_t::reset ( const index_id_t id)
inline

Set the count for given id to 0.

Parameters
[in]idid of the index whose count will be reset

◆ should_skip()

bool buf_stat_per_index_t::should_skip ( const index_id_t id)
inlineprivate

Assess if we should skip a page from accounting.

Parameters
[in]idindex_id of the page
Returns
true if it should not be accounted

Member Data Documentation

◆ m_store

ut_lock_free_hash_t* buf_stat_per_index_t::m_store
private

(key, value) storage.


The documentation for this class was generated from the following file: