mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Applying InnoDB Plugin 1.0.5 snapshot, part 4
From revision r5703 to r5716 Detailed revision comments: r5703 | marko | 2009-08-27 02:25:00 -0500 (Thu, 27 Aug 2009) | 41 lines branches/zip: Replace the constant 3/8 ratio that controls the LRU_old size with the settable global variable innodb_old_blocks_pct. The minimum and maximum values are 5 and 95 per cent, respectively. The default is 100*3/8, in line with the old behavior. ut_time_ms(): New utility function, to return the current time in milliseconds. TODO: Is there a more efficient timestamp function, such as rdtsc divided by a power of two? buf_LRU_old_threshold_ms: New variable, corresponding to innodb_old_blocks_time. The value 0 is the default behaviour: no timeout before making blocks 'new'. bpage->accessed, bpage->LRU_position, buf_pool->ulint_clock: Remove. bpage->access_time: New field, replacing bpage->accessed. Protected by buf_pool_mutex instead of bpage->mutex. Updated when a page is created or accessed the first time in the buffer pool. buf_LRU_old_ratio, innobase_old_blocks_pct: New variables, corresponding to innodb_old_blocks_pct buf_LRU_old_ratio_update(), innobase_old_blocks_pct_update(): Update functions for buf_LRU_old_ratio, innobase_old_blocks_pct. buf_page_peek_if_too_old(): Compare ut_time_ms() to bpage->access_time if buf_LRU_old_threshold_ms && bpage->old. Else observe buf_LRU_old_ratio and bpage->freed_page_clock. buf_pool_t: Add n_pages_made_young, n_pages_not_made_young, n_pages_made_young_old, n_pages_not_made_young, for statistics. buf_print(): Display buf_pool->n_pages_made_young, buf_pool->n_pages_not_made_young. This function is only for crash diagnostics. buf_print_io(): Display buf_pool->LRU_old_len and quantities derived from buf_pool->n_pages_made_young, buf_pool->n_pages_not_made_young. This function is invoked by SHOW ENGINE INNODB STATUS. rb://129 approved by Heikki Tuuri. This addresses Bug #45015. r5704 | marko | 2009-08-27 03:31:17 -0500 (Thu, 27 Aug 2009) | 32 lines branches/zip: Fix a critical bug in fast index creation that could corrupt the created indexes. row_merge(): Make "half" an in/out parameter. Determine the offset of half the output file. Copy the last blocks record-by-record instead of block-by-block, so that the records can be counted. Check that the input and output have matching n_rec. row_merge_sort(): Do not assume that two blocks of size N are merged into a block of size 2*N. The output block can be shorter than the input if the last page of each input block is almost empty. Use an accurate termination condition, based on the "half" computed by row_merge(). row_merge_read(), row_merge_write(), row_merge_blocks(): Add debug output. merge_file_t, row_merge_file_create(): Add n_rec, the number of records in the merge file. row_merge_read_clustered_index(): Update n_rec. row_merge_blocks(): Update and check n_rec. row_merge_blocks_copy(): New function, for copying the last blocks in row_merge(). Update and check n_rec. This bug was discovered with a user-supplied test case that creates an index where the initial temporary file is 249 one-megabyte blocks and the merged files become smaller. In the test, possible merge record sizes are 10, 18, and 26 bytes. rb://150 approved by Sunny Bains. This addresses Issue #320. r5705 | marko | 2009-08-27 06:56:24 -0500 (Thu, 27 Aug 2009) | 11 lines branches/zip: dict_index_find_cols(): On column name lookup failure, return DB_CORRUPTION (HA_ERR_CRASHED) instead of abnormally terminating the server. Also, disable the previously added diagnostic output to the error log, because mysql-test-run does not like extra output in the error log. (Bug #44571) dict_index_add_to_cache(): Handle errors from dict_index_find_cols(). mysql-test/innodb_bug44571.test: A test case for triggering the bug. rb://135 approved by Sunny Bains. r5706 | inaam | 2009-08-27 11:00:27 -0500 (Thu, 27 Aug 2009) | 20 lines branches/zip rb://147 Done away with following two status variables: innodb_buffer_pool_read_ahead_rnd innodb_buffer_pool_read_ahead_seq Introduced two new status variables: innodb_buffer_pool_read_ahead = number of pages read as part of readahead since server startup innodb_buffer_pool_read_ahead_evicted = number of pages that are read in as readahead but were evicted before ever being accessed since server startup i.e.: a measure of how badly our readahead is performing SHOW INNODB STATUS will show two extra numbers in buffer pool section: pages read ahead/sec and pages evicted without access/sec Approved by: Marko r5707 | inaam | 2009-08-27 11:20:35 -0500 (Thu, 27 Aug 2009) | 6 lines branches/zip Remove unused macros as we erased the random readahead code in r5703. Also fixed some comments. r5708 | inaam | 2009-08-27 17:43:32 -0500 (Thu, 27 Aug 2009) | 4 lines branches/zip Remove redundant TRUE : FALSE from the return statement r5709 | inaam | 2009-08-28 01:22:46 -0500 (Fri, 28 Aug 2009) | 5 lines branches/zip rb://152 Disable display of deprecated parameter innodb_file_io_threads in 'show variables'. r5714 | marko | 2009-08-31 01:10:10 -0500 (Mon, 31 Aug 2009) | 5 lines branches/zip: buf_chunk_not_freed(): Do not acquire block->mutex unless block->page.state == BUF_BLOCK_FILE_PAGE. Check that block->page.state makes sense. Approved by Sunny Bains over the IM. r5716 | vasil | 2009-08-31 02:47:49 -0500 (Mon, 31 Aug 2009) | 9 lines branches/zip: Fix Bug#46718 InnoDB plugin incompatible with gcc 4.1 (at least: on PPC): "Undefined symbol" by implementing our own check in plug.in instead of using the result from the check from MySQL because it is insufficient. Approved by: Marko (rb://154)
This commit is contained in:
@@ -707,15 +707,6 @@ buf_page_belongs_to_unzip_LRU(
|
||||
/*==========================*/
|
||||
const buf_page_t* bpage) /*!< in: pointer to control block */
|
||||
__attribute__((pure));
|
||||
/*********************************************************************//**
|
||||
Determine the approximate LRU list position of a block.
|
||||
@return LRU list position */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_page_get_LRU_position(
|
||||
/*======================*/
|
||||
const buf_page_t* bpage) /*!< in: control block */
|
||||
__attribute__((pure));
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets the mutex of a block.
|
||||
@@ -816,22 +807,22 @@ buf_page_set_old(
|
||||
buf_page_t* bpage, /*!< in/out: control block */
|
||||
ibool old); /*!< in: old */
|
||||
/*********************************************************************//**
|
||||
Determine if a block has been accessed in the buffer pool.
|
||||
@return TRUE if accessed */
|
||||
Determine the time of last access a block in the buffer pool.
|
||||
@return ut_time_ms() at the time of last access, 0 if not accessed */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
unsigned
|
||||
buf_page_is_accessed(
|
||||
/*=================*/
|
||||
const buf_page_t* bpage) /*!< in: control block */
|
||||
__attribute__((pure));
|
||||
__attribute__((nonnull, pure));
|
||||
/*********************************************************************//**
|
||||
Flag a block accessed. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
buf_page_set_accessed(
|
||||
/*==================*/
|
||||
buf_page_t* bpage, /*!< in/out: control block */
|
||||
ibool accessed); /*!< in: accessed */
|
||||
buf_page_t* bpage) /*!< in/out: control block */
|
||||
__attribute__((nonnull));
|
||||
/*********************************************************************//**
|
||||
Gets the buf_block_t handle of a buffered file block if an uncompressed
|
||||
page frame exists, or NULL.
|
||||
@@ -1017,14 +1008,6 @@ buf_block_hash_get(
|
||||
/*===============*/
|
||||
ulint space, /*!< in: space id */
|
||||
ulint offset);/*!< in: offset of the page within space */
|
||||
/*******************************************************************//**
|
||||
Increments the pool clock by one and returns its new value. Remember that
|
||||
in the 32 bit version the clock wraps around at 4 billion!
|
||||
@return new clock value */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_pool_clock_tic(void);
|
||||
/*====================*/
|
||||
/*********************************************************************//**
|
||||
Gets the current length of the free list of buffer blocks.
|
||||
@return length of the free list */
|
||||
@@ -1064,16 +1047,10 @@ struct buf_page_struct{
|
||||
flushed to disk, this tells the
|
||||
flush_type.
|
||||
@see enum buf_flush */
|
||||
unsigned accessed:1; /*!< TRUE if the page has been accessed
|
||||
while in the buffer pool: read-ahead
|
||||
may read in pages which have not been
|
||||
accessed yet; a thread is allowed to
|
||||
read this for heuristic purposes
|
||||
without holding any mutex or latch */
|
||||
unsigned io_fix:2; /*!< type of pending I/O operation;
|
||||
also protected by buf_pool_mutex
|
||||
@see enum buf_io_fix */
|
||||
unsigned buf_fix_count:24;/*!< count of how manyfold this block
|
||||
unsigned buf_fix_count:25;/*!< count of how manyfold this block
|
||||
is currently bufferfixed */
|
||||
/* @} */
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
@@ -1152,17 +1129,7 @@ struct buf_page_struct{
|
||||
#endif /* UNIV_DEBUG */
|
||||
unsigned old:1; /*!< TRUE if the block is in the old
|
||||
blocks in the LRU list */
|
||||
unsigned LRU_position:31;/*!< value which monotonically
|
||||
decreases (or may stay
|
||||
constant if old==TRUE) toward
|
||||
the end of the LRU list, if
|
||||
buf_pool->ulint_clock has not
|
||||
wrapped around: NOTE that this
|
||||
value can only be used in
|
||||
heuristic algorithms, because
|
||||
of the possibility of a
|
||||
wrap-around! */
|
||||
unsigned freed_page_clock:32;/*!< the value of
|
||||
unsigned freed_page_clock:31;/*!< the value of
|
||||
buf_pool->freed_page_clock
|
||||
when this block was the last
|
||||
time put to the head of the
|
||||
@@ -1170,6 +1137,9 @@ struct buf_page_struct{
|
||||
to read this for heuristic
|
||||
purposes without holding any
|
||||
mutex or latch */
|
||||
unsigned access_time:32; /*!< time of first access, or
|
||||
0 if the block was never accessed
|
||||
in the buffer pool */
|
||||
/* @} */
|
||||
# ifdef UNIV_DEBUG_FILE_ACCESSES
|
||||
ibool file_page_was_freed;
|
||||
@@ -1314,6 +1284,31 @@ Compute the hash fold value for blocks in buf_pool->zip_hash. */
|
||||
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
|
||||
/* @} */
|
||||
|
||||
/** @brief The buffer pool statistics structure. */
|
||||
struct buf_pool_stat_struct{
|
||||
ulint n_page_gets; /*!< number of page gets performed;
|
||||
also successful searches through
|
||||
the adaptive hash index are
|
||||
counted as page gets; this field
|
||||
is NOT protected by the buffer
|
||||
pool mutex */
|
||||
ulint n_pages_read; /*!< number read operations */
|
||||
ulint n_pages_written;/*!< number write operations */
|
||||
ulint n_pages_created;/*!< number of pages created
|
||||
in the pool with no read */
|
||||
ulint n_ra_pages_read;/*!< number of pages read in
|
||||
as part of read ahead */
|
||||
ulint n_ra_pages_evicted;/*!< number of read ahead
|
||||
pages that are evicted without
|
||||
being accessed */
|
||||
ulint n_pages_made_young; /*!< number of pages made young, in
|
||||
calls to buf_LRU_make_block_young() */
|
||||
ulint n_pages_not_made_young; /*!< number of pages not made
|
||||
young because the first access
|
||||
was not long enough ago, in
|
||||
buf_page_peek_if_too_old() */
|
||||
};
|
||||
|
||||
/** @brief The buffer pool structure.
|
||||
|
||||
NOTE! The definition appears here only for other modules of this
|
||||
@@ -1338,28 +1333,16 @@ struct buf_pool_struct{
|
||||
ulint n_pend_reads; /*!< number of pending read operations */
|
||||
ulint n_pend_unzip; /*!< number of pending decompressions */
|
||||
|
||||
time_t last_printout_time; /*!< when buf_print was last time
|
||||
time_t last_printout_time;
|
||||
/*!< when buf_print_io was last time
|
||||
called */
|
||||
ulint n_pages_read; /*!< number read operations */
|
||||
ulint n_pages_written;/*!< number write operations */
|
||||
ulint n_pages_created;/*!< number of pages created
|
||||
in the pool with no read */
|
||||
ulint n_page_gets; /*!< number of page gets performed;
|
||||
also successful searches through
|
||||
the adaptive hash index are
|
||||
counted as page gets; this field
|
||||
is NOT protected by the buffer
|
||||
pool mutex */
|
||||
ulint n_page_gets_old;/*!< n_page_gets when buf_print was
|
||||
last time called: used to calculate
|
||||
hit rate */
|
||||
ulint n_pages_read_old;/*!< n_pages_read when buf_print was
|
||||
last time called */
|
||||
ulint n_pages_written_old;/*!< number write operations */
|
||||
ulint n_pages_created_old;/*!< number of pages created in
|
||||
the pool with no read */
|
||||
buf_pool_stat_t stat; /*!< current statistics */
|
||||
buf_pool_stat_t old_stat; /*!< old statistics */
|
||||
|
||||
/* @} */
|
||||
|
||||
/** @name Page flushing algorithm fields */
|
||||
|
||||
/* @{ */
|
||||
|
||||
UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
|
||||
@@ -1375,10 +1358,6 @@ struct buf_pool_struct{
|
||||
/*!< this is in the set state
|
||||
when there is no flush batch
|
||||
of the given type running */
|
||||
ulint ulint_clock; /*!< a sequence number used to count
|
||||
time. NOTE! This counter wraps
|
||||
around at 4 billion (if ulint ==
|
||||
32 bits)! */
|
||||
ulint freed_page_clock;/*!< a sequence number used
|
||||
to count the number of buffer
|
||||
blocks removed from the end of
|
||||
@@ -1402,9 +1381,11 @@ struct buf_pool_struct{
|
||||
block list */
|
||||
UT_LIST_BASE_NODE_T(buf_page_t) LRU;
|
||||
/*!< base node of the LRU list */
|
||||
buf_page_t* LRU_old; /*!< pointer to the about 3/8 oldest
|
||||
blocks in the LRU list; NULL if LRU
|
||||
length less than BUF_LRU_OLD_MIN_LEN;
|
||||
buf_page_t* LRU_old; /*!< pointer to the about
|
||||
buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
|
||||
oldest blocks in the LRU list;
|
||||
NULL if LRU length less than
|
||||
BUF_LRU_OLD_MIN_LEN;
|
||||
NOTE: when LRU_old != NULL, its length
|
||||
should always equal LRU_old_len */
|
||||
ulint LRU_old_len; /*!< length of the LRU list from
|
||||
|
@@ -72,9 +72,24 @@ buf_page_peek_if_too_old(
|
||||
/*=====================*/
|
||||
const buf_page_t* bpage) /*!< in: block to make younger */
|
||||
{
|
||||
return(buf_pool->freed_page_clock
|
||||
>= buf_page_get_freed_page_clock(bpage)
|
||||
+ 1 + (buf_pool->curr_size / 4));
|
||||
if (buf_LRU_old_threshold_ms && bpage->old) {
|
||||
unsigned access_time = buf_page_is_accessed(bpage);
|
||||
|
||||
if (access_time && ut_time_ms() - access_time
|
||||
>= buf_LRU_old_threshold_ms) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
buf_pool->stat.n_pages_not_made_young++;
|
||||
return(FALSE);
|
||||
} else {
|
||||
/* FIXME: bpage->freed_page_clock is 31 bits */
|
||||
return((buf_pool->freed_page_clock & ~(1 << 31))
|
||||
> bpage->freed_page_clock
|
||||
+ (buf_pool->curr_size
|
||||
* (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio)
|
||||
/ (BUF_LRU_OLD_RATIO_DIV * 4)));
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
@@ -118,22 +133,6 @@ buf_pool_get_oldest_modification(void)
|
||||
|
||||
return(lsn);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Increments the buf_pool clock by one and returns its new value. Remember
|
||||
that in the 32 bit version the clock wraps around at 4 billion!
|
||||
@return new clock value */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_pool_clock_tic(void)
|
||||
/*====================*/
|
||||
{
|
||||
ut_ad(buf_pool_mutex_own());
|
||||
|
||||
buf_pool->ulint_clock++;
|
||||
|
||||
return(buf_pool->ulint_clock);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/*********************************************************************//**
|
||||
@@ -279,21 +278,6 @@ buf_page_belongs_to_unzip_LRU(
|
||||
&& buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Determine the approximate LRU list position of a block.
|
||||
@return LRU list position */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_page_get_LRU_position(
|
||||
/*======================*/
|
||||
const buf_page_t* bpage) /*!< in: control block */
|
||||
{
|
||||
ut_ad(buf_page_in_file(bpage));
|
||||
ut_ad(buf_pool_mutex_own());
|
||||
|
||||
return(bpage->LRU_position);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets the mutex of a block.
|
||||
@return pointer to mutex protecting bpage */
|
||||
@@ -487,17 +471,17 @@ buf_page_set_old(
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Determine if a block has been accessed in the buffer pool.
|
||||
@return TRUE if accessed */
|
||||
Determine the time of last access a block in the buffer pool.
|
||||
@return ut_time_ms() at the time of last access, 0 if not accessed */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
unsigned
|
||||
buf_page_is_accessed(
|
||||
/*=================*/
|
||||
const buf_page_t* bpage) /*!< in: control block */
|
||||
{
|
||||
ut_ad(buf_page_in_file(bpage));
|
||||
|
||||
return(bpage->accessed);
|
||||
return(bpage->access_time);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
@@ -506,13 +490,15 @@ UNIV_INLINE
|
||||
void
|
||||
buf_page_set_accessed(
|
||||
/*==================*/
|
||||
buf_page_t* bpage, /*!< in/out: control block */
|
||||
ibool accessed) /*!< in: accessed */
|
||||
buf_page_t* bpage) /*!< in/out: control block */
|
||||
{
|
||||
ut_a(buf_page_in_file(bpage));
|
||||
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
|
||||
ut_ad(buf_pool_mutex_own());
|
||||
|
||||
bpage->accessed = accessed;
|
||||
if (!bpage->access_time) {
|
||||
/* Make this the time of the first access. */
|
||||
bpage->access_time = ut_time_ms();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
|
@@ -69,7 +69,7 @@ These are low-level functions
|
||||
#########################################################################*/
|
||||
|
||||
/** Minimum LRU list length for which the LRU_old pointer is defined */
|
||||
#define BUF_LRU_OLD_MIN_LEN 80
|
||||
#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
|
||||
|
||||
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
|
||||
#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
|
||||
@@ -84,15 +84,6 @@ void
|
||||
buf_LRU_invalidate_tablespace(
|
||||
/*==========================*/
|
||||
ulint id); /*!< in: space id */
|
||||
/******************************************************************//**
|
||||
Gets the minimum LRU_position field for the blocks in an initial segment
|
||||
(determined by BUF_LRU_INITIAL_RATIO) of the LRU list. The limit is not
|
||||
guaranteed to be precise, because the ulint_clock may wrap around.
|
||||
@return the limit; zero if could not determine it */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
buf_LRU_get_recent_limit(void);
|
||||
/*==========================*/
|
||||
/********************************************************************//**
|
||||
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
|
||||
UNIV_INTERN
|
||||
@@ -201,6 +192,18 @@ void
|
||||
buf_LRU_make_block_old(
|
||||
/*===================*/
|
||||
buf_page_t* bpage); /*!< in: control block */
|
||||
/**********************************************************************//**
|
||||
Updates buf_LRU_old_ratio.
|
||||
@return updated old_pct */
|
||||
UNIV_INTERN
|
||||
uint
|
||||
buf_LRU_old_ratio_update(
|
||||
/*=====================*/
|
||||
uint old_pct,/*!< in: Reserve this percentage of
|
||||
the buffer pool for "old" blocks. */
|
||||
ibool adjust);/*!< in: TRUE=adjust the LRU list;
|
||||
FALSE=just assign buf_LRU_old_ratio
|
||||
during the initialization of InnoDB */
|
||||
/********************************************************************//**
|
||||
Update the historical stats that we are collecting for LRU eviction
|
||||
policy at the end of each interval. */
|
||||
@@ -227,6 +230,35 @@ buf_LRU_print(void);
|
||||
/*===============*/
|
||||
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
|
||||
|
||||
/** @name Heuristics for detecting index scan @{ */
|
||||
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
|
||||
"old" blocks. Protected by buf_pool_mutex. */
|
||||
extern uint buf_LRU_old_ratio;
|
||||
/** The denominator of buf_LRU_old_ratio. */
|
||||
#define BUF_LRU_OLD_RATIO_DIV 1024
|
||||
/** Maximum value of buf_LRU_old_ratio.
|
||||
@see buf_LRU_old_adjust_len
|
||||
@see buf_LRU_old_ratio_update */
|
||||
#define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
|
||||
/** Minimum value of buf_LRU_old_ratio.
|
||||
@see buf_LRU_old_adjust_len
|
||||
@see buf_LRU_old_ratio_update
|
||||
The minimum must exceed
|
||||
(BUF_LRU_OLD_TOLERANCE + 5) * BUF_LRU_OLD_RATIO_DIV / BUF_LRU_OLD_MIN_LEN. */
|
||||
#define BUF_LRU_OLD_RATIO_MIN 51
|
||||
|
||||
#if BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX
|
||||
# error "BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX"
|
||||
#endif
|
||||
#if BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV
|
||||
# error "BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV"
|
||||
#endif
|
||||
|
||||
/** Move blocks to "new" LRU list only if the first access was at
|
||||
least this many milliseconds ago. Not protected by any mutex or latch. */
|
||||
extern uint buf_LRU_old_threshold_ms;
|
||||
/* @} */
|
||||
|
||||
/** @brief Statistics for selecting the LRU list for eviction.
|
||||
|
||||
These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O
|
||||
|
@@ -33,12 +33,10 @@ Created 11/5/1995 Heikki Tuuri
|
||||
High-level function which reads a page asynchronously from a file to the
|
||||
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
|
||||
an exclusive lock on the buffer frame. The flag is cleared and the x-lock
|
||||
released by the i/o-handler thread. Does a random read-ahead if it seems
|
||||
sensible.
|
||||
@return number of page read requests issued: this can be greater than
|
||||
1 if read-ahead occurred */
|
||||
released by the i/o-handler thread.
|
||||
@return TRUE if page has been read in, FALSE in case of failure */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
ibool
|
||||
buf_read_page(
|
||||
/*==========*/
|
||||
ulint space, /*!< in: space id */
|
||||
|
@@ -34,6 +34,8 @@ typedef struct buf_block_struct buf_block_t;
|
||||
typedef struct buf_chunk_struct buf_chunk_t;
|
||||
/** Buffer pool comprising buf_chunk_t */
|
||||
typedef struct buf_pool_struct buf_pool_t;
|
||||
/** Buffer pool statistics struct */
|
||||
typedef struct buf_pool_stat_struct buf_pool_stat_t;
|
||||
|
||||
/** A buffer frame. @see page_t */
|
||||
typedef byte buf_frame_t;
|
||||
|
@@ -712,7 +712,7 @@ dict_index_find_on_id_low(
|
||||
dulint id); /*!< in: index id */
|
||||
/**********************************************************************//**
|
||||
Adds an index to the dictionary cache.
|
||||
@return DB_SUCCESS or error code */
|
||||
@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
dict_index_add_to_cache(
|
||||
|
@@ -285,7 +285,7 @@ os_fast_mutex_free(
|
||||
/**********************************************************//**
|
||||
Atomic compare-and-swap and increment for InnoDB. */
|
||||
|
||||
#ifdef HAVE_GCC_ATOMIC_BUILTINS
|
||||
#ifdef HAVE_IB_GCC_ATOMIC_BUILTINS
|
||||
/**********************************************************//**
|
||||
Returns true if swapped, ptr is pointer to target, old_val is value to
|
||||
compare to, new_val is the value to swap in. */
|
||||
@@ -377,7 +377,7 @@ InterlockedExchange() operates on LONG, and the LONG will be
|
||||
clobbered */
|
||||
# define os_atomic_test_and_set_byte(ptr, new_val) \
|
||||
((byte) InterlockedExchange(ptr, new_val))
|
||||
#endif /* HAVE_GCC_ATOMIC_BUILTINS */
|
||||
#endif /* HAVE_IB_GCC_ATOMIC_BUILTINS */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "os0sync.ic"
|
||||
|
@@ -315,10 +315,6 @@ extern ulint srv_buf_pool_flushed;
|
||||
/** Number of buffer pool reads that led to the
|
||||
reading of a disk page */
|
||||
extern ulint srv_buf_pool_reads;
|
||||
/** Number of sequential read-aheads */
|
||||
extern ulint srv_read_ahead_seq;
|
||||
/** Number of random read-aheads */
|
||||
extern ulint srv_read_ahead_rnd;
|
||||
|
||||
/** Status variables to be passed to MySQL */
|
||||
typedef struct export_var_struct export_struc;
|
||||
@@ -605,13 +601,13 @@ struct export_var_struct{
|
||||
#ifdef UNIV_DEBUG
|
||||
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
|
||||
#endif /* UNIV_DEBUG */
|
||||
ulint innodb_buffer_pool_read_requests; /*!< buf_pool->n_page_gets */
|
||||
ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
|
||||
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
|
||||
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
|
||||
ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
|
||||
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
|
||||
ulint innodb_buffer_pool_read_ahead_seq;/*!< srv_read_ahead_seq */
|
||||
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
|
||||
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
|
||||
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
|
||||
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
|
||||
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
|
||||
ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
|
||||
@@ -623,9 +619,9 @@ struct export_var_struct{
|
||||
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
|
||||
ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */
|
||||
ulint innodb_page_size; /*!< UNIV_PAGE_SIZE */
|
||||
ulint innodb_pages_created; /*!< buf_pool->n_pages_created */
|
||||
ulint innodb_pages_read; /*!< buf_pool->n_pages_read */
|
||||
ulint innodb_pages_written; /*!< buf_pool->n_pages_written */
|
||||
ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
|
||||
ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
|
||||
ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
|
||||
ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
|
||||
ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */
|
||||
ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
|
||||
|
@@ -125,11 +125,11 @@ if we are compiling on Windows. */
|
||||
# include <sched.h>
|
||||
# endif
|
||||
|
||||
# if defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_SOLARIS_ATOMICS) \
|
||||
# if defined(HAVE_IB_GCC_ATOMIC_BUILTINS) || defined(HAVE_SOLARIS_ATOMICS) \
|
||||
|| defined(HAVE_WINDOWS_ATOMICS)
|
||||
/* If atomics are defined we use them in InnoDB mutex implementation */
|
||||
# define HAVE_ATOMIC_BUILTINS
|
||||
# endif /* (HAVE_GCC_ATOMIC_BUILTINS) || (HAVE_SOLARIS_ATOMICS)
|
||||
# endif /* (HAVE_IB_GCC_ATOMIC_BUILTINS) || (HAVE_SOLARIS_ATOMICS)
|
||||
|| (HAVE_WINDOWS_ATOMICS) */
|
||||
|
||||
/* For InnoDB rw_locks to work with atomics we need the thread_id
|
||||
|
@@ -239,6 +239,15 @@ ullint
|
||||
ut_time_us(
|
||||
/*=======*/
|
||||
ullint* tloc); /*!< out: us since epoch, if non-NULL */
|
||||
/**********************************************************//**
|
||||
Returns the number of milliseconds since some epoch. The
|
||||
value may wrap around. It should only be used for heuristic
|
||||
purposes.
|
||||
@return ms since epoch */
|
||||
UNIV_INTERN
|
||||
uint
|
||||
ut_time_ms(void);
|
||||
/*============*/
|
||||
|
||||
/**********************************************************//**
|
||||
Returns the difference of two times in seconds.
|
||||
|
Reference in New Issue
Block a user