YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/* Type of the page */ enum pagecache_page_type
{ /* Usedonlyforcontrolpagetypechangingduringdebugging.Thisdefine shouldonlybeusingwhenusingDBUG.
*/
PAGECACHE_EMPTY_PAGE, /* the page does not contain LSN */
PAGECACHE_PLAIN_PAGE, /* the page contain LSN (maria tablespace page) */
PAGECACHE_LSN_PAGE, /* Page type used when scanning file and we don't care about the type */
PAGECACHE_READ_UNKNOWN_PAGE
};
/* file descriptor for Maria */ typedefstruct st_pagecache_file
{ /* Number of pages in the header which are not read with big blocks */
size_t head_blocks; /* size of a big block for S3 or 0 */
size_t big_block_size; /* File number */
File file;
typedefstruct st_pagecache
{
size_t mem_size; /* specified size of the cache memory */
size_t min_warm_blocks; /* min number of warm blocks; */
size_t age_threshold; /* age threshold for hot blocks */
ulonglong time; /* total number of block link operations */
size_t hash_entries; /* max number of entries in the hash table */
size_t changed_blocks_hash_size;/* Number of hash buckets for file blocks */
ssize_t hash_links; /* max number of hash links */
ssize_t hash_links_used; /* number of hash links taken from free links pool */
ssize_t disk_blocks; /* max number of blocks in the cache */
size_t blocks_used; /* maximum number of concurrently used blocks */
size_t blocks_unused; /* number of currently unused blocks */
size_t blocks_changed; /* number of currently dirty blocks */
size_t warm_blocks; /* number of blocks in warm sub-chain */
size_t cnt_for_resize_op; /* counter to block resize operation */
size_t blocks_available; /* number of blocks available in the LRU chain */
ssize_t blocks; /* max number of blocks in the cache */
uint32 block_size; /* size of the page buffer of a cache block */
PAGECACHE_HASH_LINK **hash_root;/* arr. of entries into hash table buckets */
PAGECACHE_HASH_LINK *hash_link_root;/* memory for hash table links */
PAGECACHE_HASH_LINK *free_hash_list;/* list of free hash links */
PAGECACHE_BLOCK_LINK *free_block_list;/* list of free blocks */
PAGECACHE_BLOCK_LINK *block_root;/* memory for block links */
uchar *block_mem; /* memory for block buffers */
PAGECACHE_BLOCK_LINK *used_last;/* ptr to the last block of the LRU chain */
PAGECACHE_BLOCK_LINK *used_ins;/* ptr to the insertion block in LRU chain */
mysql_mutex_t cache_lock; /* to lock access to the cache structure */
WQUEUE resize_queue; /* threads waiting during resize operation */
WQUEUE waiting_for_hash_link;/* waiting for a free hash link */
WQUEUE waiting_for_block; /* requests waiting for a free block */ /* hash for dirty file bl.*/
PAGECACHE_BLOCK_LINK **changed_blocks; /* hash for other file bl.*/
PAGECACHE_BLOCK_LINK **file_blocks;
ulonglong param_buff_size; /* size the memory allocated for the cache */
size_t param_block_size; /* size of the blocks in the key cache */
size_t param_division_limit; /* min. percentage of warm blocks */
size_t param_age_threshold; /* determines when hot block is downgraded */
/* Statistics variables. These are reset in reset_pagecache_counters(). */
size_t global_blocks_changed; /* number of currently dirty blocks */
ulonglong global_cache_w_requests;/* number of write requests (write hits) */
ulonglong global_cache_write; /* number of writes from cache to files */
ulonglong global_cache_r_requests;/* number of read requests (read hits) */
ulonglong global_cache_read; /* number of reads from files to cache */
uint shift; /* block size = 2 ^ shift */
myf readwrite_flags; /* Flags to pread/pwrite() */
myf org_readwrite_flags; /* Flags to pread/pwrite() at init */
my_bool inited;
my_bool resize_in_flush; /* true during flush of resize operation */
my_bool can_be_used; /* usage of cache for read/write is allowed */
my_bool in_init; /* Set to 1 in MySQL during init/resize */
my_bool multi; /* If part of segmented pagecache */
HASH files_in_flush; /**< files in flush_pagecache_blocks_int() */
} PAGECACHE;
/** @brief Return values for PAGECACHE_FLUSH_FILTER */ enum pagecache_flush_filter_result
{
FLUSH_FILTER_SKIP_TRY_NEXT= 0,/**< skip page and move on to next one */
FLUSH_FILTER_OK, /**< flush page and move on to next one */
FLUSH_FILTER_SKIP_ALL /**< skip page and all next ones */
}; /** @brief a filter function type for flush_pagecache_blocks_with_filter() */ typedefenum pagecache_flush_filter_result
(*PAGECACHE_FLUSH_FILTER)(enum pagecache_page_type type,
pgcache_page_no_t page,
LSN rec_lsn, void *arg);
/* The default key cache */ extern PAGECACHE dflt_pagecache_var, *dflt_pagecache;
/* Results of flush operation (bit field in fact) */
/* The flush is done. */ #define PCFLUSH_OK 0 /* There was errors during the flush process. */ #define PCFLUSH_ERROR 1 /* Pinned blocks was met and skipped. */ #define PCFLUSH_PINNED 2 /* PCFLUSH_ERROR and PCFLUSH_PINNED. */ #define PCFLUSH_PINNED_AND_ERROR (PCFLUSH_ERROR|PCFLUSH_PINNED)
// initialize file with empty hooks void pagecache_file_set_null_hooks(PAGECACHE_FILE*);
struct st_pagecache_stats
{
size_t blocks_used; /* maximum number of concurrently used blocks */
size_t blocks_unused; /* number of currently unused blocks */
size_t blocks_changed; /* number of currently dirty blocks */
size_t global_blocks_changed; /* number of currently dirty blocks */
ulonglong global_cache_w_requests;/* number of write requests (write hits) */
ulonglong global_cache_write; /* number of writes from cache to files */
ulonglong global_cache_r_requests;/* number of read requests (read hits) */
ulonglong global_cache_read; /* number of reads from files to cache */
};
/* Stats will be updated when multi_update_pagecache_stats() is called */ externstruct st_pagecache_stats pagecache_stats; externvoid multi_update_pagecache_stats(); extern ulonglong multi_global_cache_writes(PAGECACHES *pagecaches); externvoid multi_reset_pagecache_counters(PAGECACHES *pagecaches);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.