Commit b7a0c6ac authored by inaam's avatar inaam

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
parent dbe4b2f2
...@@ -957,7 +957,7 @@ btr_search_guess_on_hash( ...@@ -957,7 +957,7 @@ btr_search_guess_on_hash(
/* Increment the page get statistics though we did not really /* Increment the page get statistics though we did not really
fix the page: for user info only */ fix the page: for user info only */
buf_pool->n_page_gets++; buf_pool->stat.n_page_gets++;
return(TRUE); return(TRUE);
......
...@@ -1622,7 +1622,7 @@ buf_page_get_zip( ...@@ -1622,7 +1622,7 @@ buf_page_get_zip(
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside()); ut_ad(!ibuf_inside());
#endif #endif
buf_pool->n_page_gets++; buf_pool->stat.n_page_gets++;
for (;;) { for (;;) {
buf_pool_mutex_enter(); buf_pool_mutex_enter();
...@@ -1991,7 +1991,7 @@ buf_page_get_gen( ...@@ -1991,7 +1991,7 @@ buf_page_get_gen(
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL)); ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset, NULL));
#endif #endif
buf_pool->n_page_gets++; buf_pool->stat.n_page_gets++;
loop: loop:
block = guess; block = guess;
buf_pool_mutex_enter(); buf_pool_mutex_enter();
...@@ -2410,7 +2410,7 @@ buf_page_optimistic_get_func( ...@@ -2410,7 +2410,7 @@ buf_page_optimistic_get_func(
ut_a(ibuf_count_get(buf_block_get_space(block), ut_a(ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0); buf_block_get_page_no(block)) == 0);
#endif #endif
buf_pool->n_page_gets++; buf_pool->stat.n_page_gets++;
return(TRUE); return(TRUE);
} }
...@@ -2504,7 +2504,7 @@ buf_page_get_known_nowait( ...@@ -2504,7 +2504,7 @@ buf_page_get_known_nowait(
|| (ibuf_count_get(buf_block_get_space(block), || (ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0)); buf_block_get_page_no(block)) == 0));
#endif #endif
buf_pool->n_page_gets++; buf_pool->stat.n_page_gets++;
return(TRUE); return(TRUE);
} }
...@@ -2580,7 +2580,7 @@ buf_page_try_get_func( ...@@ -2580,7 +2580,7 @@ buf_page_try_get_func(
#endif /* UNIV_DEBUG_FILE_ACCESSES */ #endif /* UNIV_DEBUG_FILE_ACCESSES */
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
buf_pool->n_page_gets++; buf_pool->stat.n_page_gets++;
#ifdef UNIV_IBUF_COUNT_DEBUG #ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(buf_block_get_space(block), ut_a(ibuf_count_get(buf_block_get_space(block),
...@@ -2944,7 +2944,7 @@ buf_page_create( ...@@ -2944,7 +2944,7 @@ buf_page_create(
buf_LRU_add_block(&block->page, FALSE); buf_LRU_add_block(&block->page, FALSE);
buf_block_buf_fix_inc(block, __FILE__, __LINE__); buf_block_buf_fix_inc(block, __FILE__, __LINE__);
buf_pool->n_pages_created++; buf_pool->stat.n_pages_created++;
if (zip_size) { if (zip_size) {
void* data; void* data;
...@@ -3192,7 +3192,7 @@ corrupt: ...@@ -3192,7 +3192,7 @@ corrupt:
ut_ad(buf_pool->n_pend_reads > 0); ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--; buf_pool->n_pend_reads--;
buf_pool->n_pages_read++; buf_pool->stat.n_pages_read++;
if (uncompressed) { if (uncompressed) {
rw_lock_x_unlock_gen(&((buf_block_t*) bpage)->lock, rw_lock_x_unlock_gen(&((buf_block_t*) bpage)->lock,
...@@ -3212,7 +3212,7 @@ corrupt: ...@@ -3212,7 +3212,7 @@ corrupt:
BUF_IO_WRITE); BUF_IO_WRITE);
} }
buf_pool->n_pages_written++; buf_pool->stat.n_pages_written++;
break; break;
...@@ -3530,10 +3530,11 @@ buf_print(void) ...@@ -3530,10 +3530,11 @@ buf_print(void)
(ulong) buf_pool->n_flush[BUF_FLUSH_LRU], (ulong) buf_pool->n_flush[BUF_FLUSH_LRU],
(ulong) buf_pool->n_flush[BUF_FLUSH_LIST], (ulong) buf_pool->n_flush[BUF_FLUSH_LIST],
(ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE], (ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE],
(ulong) buf_pool->n_pages_made_young, (ulong) buf_pool->stat.n_pages_made_young,
(ulong) buf_pool->n_pages_not_made_young, (ulong) buf_pool->stat.n_pages_not_made_young,
(ulong) buf_pool->n_pages_read, buf_pool->n_pages_created, (ulong) buf_pool->stat.n_pages_read,
(ulong) buf_pool->n_pages_written); (ulong) buf_pool->stat.n_pages_created,
(ulong) buf_pool->stat.n_pages_written);
/* Count the number of blocks belonging to each index in the buffer */ /* Count the number of blocks belonging to each index in the buffer */
...@@ -3767,61 +3768,66 @@ buf_print_io( ...@@ -3767,61 +3768,66 @@ buf_print_io(
current_time = time(NULL); current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time, time_elapsed = 0.001 + difftime(current_time,
buf_pool->last_printout_time); buf_pool->last_printout_time);
buf_pool->last_printout_time = current_time;
fprintf(file, fprintf(file,
"Pages made young %lu, not young %lu\n" "Pages made young %lu, not young %lu\n"
"%.2f youngs/s, %.2f non-youngs/s\n" "%.2f youngs/s, %.2f non-youngs/s\n"
"Pages read %lu, created %lu, written %lu\n" "Pages read %lu, created %lu, written %lu\n"
"%.2f reads/s, %.2f creates/s, %.2f writes/s\n", "%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
(ulong) buf_pool->n_pages_made_young, (ulong) buf_pool->stat.n_pages_made_young,
(ulong) buf_pool->n_pages_not_made_young, (ulong) buf_pool->stat.n_pages_not_made_young,
(buf_pool->n_pages_made_young (buf_pool->stat.n_pages_made_young
- buf_pool->n_pages_made_young_old) - buf_pool->old_stat.n_pages_made_young)
/ time_elapsed, / time_elapsed,
(buf_pool->n_pages_not_made_young (buf_pool->stat.n_pages_not_made_young
- buf_pool->n_pages_not_made_young_old) - buf_pool->old_stat.n_pages_not_made_young)
/ time_elapsed, / time_elapsed,
(ulong) buf_pool->n_pages_read, (ulong) buf_pool->stat.n_pages_read,
(ulong) buf_pool->n_pages_created, (ulong) buf_pool->stat.n_pages_created,
(ulong) buf_pool->n_pages_written, (ulong) buf_pool->stat.n_pages_written,
(buf_pool->n_pages_read - buf_pool->n_pages_read_old) (buf_pool->stat.n_pages_read
- buf_pool->old_stat.n_pages_read)
/ time_elapsed, / time_elapsed,
(buf_pool->n_pages_created - buf_pool->n_pages_created_old) (buf_pool->stat.n_pages_created
- buf_pool->old_stat.n_pages_created)
/ time_elapsed, / time_elapsed,
(buf_pool->n_pages_written - buf_pool->n_pages_written_old) (buf_pool->stat.n_pages_written
- buf_pool->old_stat.n_pages_written)
/ time_elapsed); / time_elapsed);
n_gets_diff = buf_pool->n_page_gets - buf_pool->n_page_gets_old; n_gets_diff = buf_pool->stat.n_page_gets - buf_pool->old_stat.n_page_gets;
if (n_gets_diff) { if (n_gets_diff) {
fprintf(file, fprintf(file,
"Buffer pool hit rate %lu / 1000," "Buffer pool hit rate %lu / 1000,"
" young-making rate %lu / 1000 not %lu / 1000\n", " young-making rate %lu / 1000 not %lu / 1000\n",
(ulong) (ulong)
(1000 - ((1000 * (buf_pool->n_pages_read (1000 - ((1000 * (buf_pool->stat.n_pages_read
- buf_pool->n_pages_read_old)) - buf_pool->old_stat.n_pages_read))
/ n_gets_diff)), / (buf_pool->stat.n_page_gets
- buf_pool->old_stat.n_page_gets))),
(ulong) (ulong)
(1000 * (buf_pool->n_pages_made_young (1000 * (buf_pool->stat.n_pages_made_young
- buf_pool->n_pages_made_young_old) - buf_pool->old_stat.n_pages_made_young)
/ n_gets_diff), / n_gets_diff),
(ulong) (ulong)
(1000 * (buf_pool->n_pages_not_made_young (1000 * (buf_pool->stat.n_pages_not_made_young
- buf_pool->n_pages_not_made_young_old) - buf_pool->old_stat.n_pages_not_made_young)
/ n_gets_diff)); / n_gets_diff));
} else { } else {
fputs("No buffer pool page gets since the last printout\n", fputs("No buffer pool page gets since the last printout\n",
file); file);
} }
buf_pool->n_page_gets_old = buf_pool->n_page_gets; /* Statistics about read ahead algorithm */
buf_pool->n_pages_made_young_old = buf_pool->n_pages_made_young; fprintf(file, "Pages read ahead %.2f/s,"
buf_pool->n_pages_not_made_young_old " evicted without access %.2f/s\n",
= buf_pool->n_pages_not_made_young; (buf_pool->stat.n_ra_pages_read
buf_pool->n_pages_read_old = buf_pool->n_pages_read; - buf_pool->old_stat.n_ra_pages_read)
buf_pool->n_pages_created_old = buf_pool->n_pages_created; / time_elapsed,
buf_pool->n_pages_written_old = buf_pool->n_pages_written; (buf_pool->stat.n_ra_pages_evicted
- buf_pool->old_stat.n_ra_pages_evicted)
/ time_elapsed);
/* Print some values to help us with visualizing what is /* Print some values to help us with visualizing what is
happening with LRU eviction. */ happening with LRU eviction. */
...@@ -3833,6 +3839,7 @@ buf_print_io( ...@@ -3833,6 +3839,7 @@ buf_print_io(
buf_LRU_stat_sum.io, buf_LRU_stat_cur.io, buf_LRU_stat_sum.io, buf_LRU_stat_cur.io,
buf_LRU_stat_sum.unzip, buf_LRU_stat_cur.unzip); buf_LRU_stat_sum.unzip, buf_LRU_stat_cur.unzip);
buf_refresh_io_stats();
buf_pool_mutex_exit(); buf_pool_mutex_exit();
} }
...@@ -3844,10 +3851,7 @@ buf_refresh_io_stats(void) ...@@ -3844,10 +3851,7 @@ buf_refresh_io_stats(void)
/*======================*/ /*======================*/
{ {
buf_pool->last_printout_time = time(NULL); buf_pool->last_printout_time = time(NULL);
buf_pool->n_page_gets_old = buf_pool->n_page_gets; buf_pool->old_stat = buf_pool->stat;
buf_pool->n_pages_read_old = buf_pool->n_pages_read;
buf_pool->n_pages_created_old = buf_pool->n_pages_created;
buf_pool->n_pages_written_old = buf_pool->n_pages_written;
} }
/*********************************************************************//** /*********************************************************************//**
......
...@@ -576,6 +576,7 @@ buf_LRU_free_from_common_LRU_list( ...@@ -576,6 +576,7 @@ buf_LRU_free_from_common_LRU_list(
bpage = UT_LIST_GET_PREV(LRU, bpage), distance--) { bpage = UT_LIST_GET_PREV(LRU, bpage), distance--) {
enum buf_lru_free_block_status freed; enum buf_lru_free_block_status freed;
unsigned accessed;
mutex_t* block_mutex mutex_t* block_mutex
= buf_page_get_mutex(bpage); = buf_page_get_mutex(bpage);
...@@ -583,11 +584,18 @@ buf_LRU_free_from_common_LRU_list( ...@@ -583,11 +584,18 @@ buf_LRU_free_from_common_LRU_list(
ut_ad(bpage->in_LRU_list); ut_ad(bpage->in_LRU_list);
mutex_enter(block_mutex); mutex_enter(block_mutex);
accessed = buf_page_is_accessed(bpage);
freed = buf_LRU_free_block(bpage, TRUE, NULL); freed = buf_LRU_free_block(bpage, TRUE, NULL);
mutex_exit(block_mutex); mutex_exit(block_mutex);
switch (freed) { switch (freed) {
case BUF_LRU_FREED: case BUF_LRU_FREED:
/* Keep track of pages that are evicted without
ever being accessed. This gives us a measure of
the effectiveness of readahead */
if (!accessed) {
++buf_pool->stat.n_ra_pages_evicted;
}
return(TRUE); return(TRUE);
case BUF_LRU_NOT_FREED: case BUF_LRU_NOT_FREED:
...@@ -1270,7 +1278,7 @@ buf_LRU_make_block_young( ...@@ -1270,7 +1278,7 @@ buf_LRU_make_block_young(
buf_page_t* bpage) /*!< in: control block */ buf_page_t* bpage) /*!< in: control block */
{ {
ut_ad(buf_pool_mutex_own()); ut_ad(buf_pool_mutex_own());
buf_pool->n_pages_made_young++; buf_pool->stat.n_pages_made_young++;
buf_LRU_remove_block(bpage); buf_LRU_remove_block(bpage);
buf_LRU_add_block_low(bpage, FALSE); buf_LRU_add_block_low(bpage, FALSE);
......
...@@ -489,7 +489,7 @@ buf_read_ahead_linear( ...@@ -489,7 +489,7 @@ buf_read_ahead_linear(
LRU policy decision. */ LRU policy decision. */
buf_LRU_stat_inc_io(); buf_LRU_stat_inc_io();
++srv_read_ahead_seq; buf_pool->stat.n_ra_pages_read += count;
return(count); return(count);
} }
......
...@@ -500,10 +500,10 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -500,10 +500,10 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
{"buffer_pool_pages_total", {"buffer_pool_pages_total",
(char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
{"buffer_pool_read_ahead_rnd", {"buffer_pool_read_ahead",
(char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_read_ahead, SHOW_LONG},
{"buffer_pool_read_ahead_seq", {"buffer_pool_read_ahead_evicted",
(char*) &export_vars.innodb_buffer_pool_read_ahead_seq, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_read_ahead_evicted, SHOW_LONG},
{"buffer_pool_read_requests", {"buffer_pool_read_requests",
(char*) &export_vars.innodb_buffer_pool_read_requests, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_read_requests, SHOW_LONG},
{"buffer_pool_reads", {"buffer_pool_reads",
......
...@@ -1284,6 +1284,31 @@ Compute the hash fold value for blocks in buf_pool->zip_hash. */ ...@@ -1284,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)) #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. /** @brief The buffer pool structure.
NOTE! The definition appears here only for other modules of this NOTE! The definition appears here only for other modules of this
...@@ -1311,44 +1336,13 @@ struct buf_pool_struct{ ...@@ -1311,44 +1336,13 @@ struct buf_pool_struct{
time_t last_printout_time; time_t last_printout_time;
/*!< when buf_print_io was last time /*!< when buf_print_io was last time
called */ called */
ulint n_pages_made_young; buf_pool_stat_t stat; /*!< current statistics */
/*!< number of pages made young, in buf_pool_stat_t old_stat; /*!< old statistics */
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() */
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_io was
called last time: used to calculate
hit rate */
ulint n_pages_made_young_old;
/*!< n_pages_made_young when
buf_print_io was called last time */
ulint n_pages_not_made_young_old;
/*!< n_pages_not_made_young when
buf_print_io was called last time */
ulint n_pages_read_old;
/*!< n_pages_read when buf_print_io
was called last time */
ulint n_pages_written_old;
/*!< n_pages_written when buf_print_io
was called last time */
ulint n_pages_created_old;
/*!< n_pages_created when buf_print_io
was called last time */
/* @} */ /* @} */
/** @name Page flushing algorithm fields */ /** @name Page flushing algorithm fields */
/* @{ */ /* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) flush_list; UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
......
...@@ -80,7 +80,7 @@ buf_page_peek_if_too_old( ...@@ -80,7 +80,7 @@ buf_page_peek_if_too_old(
return(TRUE); return(TRUE);
} }
buf_pool->n_pages_not_made_young++; buf_pool->stat.n_pages_not_made_young++;
return(FALSE); return(FALSE);
} else { } else {
/* FIXME: bpage->freed_page_clock is 31 bits */ /* FIXME: bpage->freed_page_clock is 31 bits */
......
...@@ -34,6 +34,8 @@ typedef struct buf_block_struct buf_block_t; ...@@ -34,6 +34,8 @@ typedef struct buf_block_struct buf_block_t;
typedef struct buf_chunk_struct buf_chunk_t; typedef struct buf_chunk_struct buf_chunk_t;
/** Buffer pool comprising buf_chunk_t */ /** Buffer pool comprising buf_chunk_t */
typedef struct buf_pool_struct buf_pool_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 */ /** A buffer frame. @see page_t */
typedef byte buf_frame_t; typedef byte buf_frame_t;
......
...@@ -315,10 +315,6 @@ extern ulint srv_buf_pool_flushed; ...@@ -315,10 +315,6 @@ extern ulint srv_buf_pool_flushed;
/** Number of buffer pool reads that led to the /** Number of buffer pool reads that led to the
reading of a disk page */ reading of a disk page */
extern ulint srv_buf_pool_reads; 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 */ /** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc; typedef struct export_var_struct export_struc;
...@@ -605,13 +601,13 @@ struct export_var_struct{ ...@@ -605,13 +601,13 @@ struct export_var_struct{
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */ ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */ #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_reads; /*!< srv_buf_pool_reads */
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */ 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_pages_flushed; /*!< srv_buf_pool_flushed */
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */ 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; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */ ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */ ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */ ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */ ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
...@@ -623,9 +619,9 @@ struct export_var_struct{ ...@@ -623,9 +619,9 @@ struct export_var_struct{
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */ ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */ ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */
ulint innodb_page_size; /*!< UNIV_PAGE_SIZE */ ulint innodb_page_size; /*!< UNIV_PAGE_SIZE */
ulint innodb_pages_created; /*!< buf_pool->n_pages_created */ ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
ulint innodb_pages_read; /*!< buf_pool->n_pages_read */ ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
ulint innodb_pages_written; /*!< buf_pool->n_pages_written */ ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */ ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_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 ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
......
...@@ -292,12 +292,6 @@ UNIV_INTERN ulint srv_buf_pool_flushed = 0; ...@@ -292,12 +292,6 @@ UNIV_INTERN ulint srv_buf_pool_flushed = 0;
reading of a disk page */ reading of a disk page */
UNIV_INTERN ulint srv_buf_pool_reads = 0; UNIV_INTERN ulint srv_buf_pool_reads = 0;
/** Number of sequential read-aheads */
UNIV_INTERN ulint srv_read_ahead_seq = 0;
/** Number of random read-aheads */
UNIV_INTERN ulint srv_read_ahead_rnd = 0;
/* structure to pass status variables to MySQL */ /* structure to pass status variables to MySQL */
UNIV_INTERN export_struc export_vars; UNIV_INTERN export_struc export_vars;
...@@ -464,8 +458,6 @@ static ulint srv_main_background_loops = 0; ...@@ -464,8 +458,6 @@ static ulint srv_main_background_loops = 0;
static ulint srv_main_flush_loops = 0; static ulint srv_main_flush_loops = 0;
/* Log writes involving flush. */ /* Log writes involving flush. */
static ulint srv_log_writes_and_flush = 0; static ulint srv_log_writes_and_flush = 0;
/* Log writes not including flush. */
static ulint srv_log_buffer_writes = 0;
/* This is only ever touched by the master thread. It records the /* This is only ever touched by the master thread. It records the
time when the last flush of log file has happened. The master time when the last flush of log file has happened. The master
...@@ -714,9 +706,8 @@ srv_print_master_thread_info( ...@@ -714,9 +706,8 @@ srv_print_master_thread_info(
srv_main_1_second_loops, srv_main_sleeps, srv_main_1_second_loops, srv_main_sleeps,
srv_main_10_second_loops, srv_main_background_loops, srv_main_10_second_loops, srv_main_background_loops,
srv_main_flush_loops); srv_main_flush_loops);
fprintf(file, "srv_master_thread log flush and writes: %lu " fprintf(file, "srv_master_thread log flush and writes: %lu\n",
" log writes only: %lu\n", srv_log_writes_and_flush);
srv_log_writes_and_flush, srv_log_buffer_writes);
} }
/*********************************************************************//** /*********************************************************************//**
...@@ -1877,14 +1868,16 @@ srv_export_innodb_status(void) ...@@ -1877,14 +1868,16 @@ srv_export_innodb_status(void)
export_vars.innodb_data_reads = os_n_file_reads; export_vars.innodb_data_reads = os_n_file_reads;
export_vars.innodb_data_writes = os_n_file_writes; export_vars.innodb_data_writes = os_n_file_writes;
export_vars.innodb_data_written = srv_data_written; export_vars.innodb_data_written = srv_data_written;
export_vars.innodb_buffer_pool_read_requests = buf_pool->n_page_gets; export_vars.innodb_buffer_pool_read_requests = buf_pool->stat.n_page_gets;
export_vars.innodb_buffer_pool_write_requests export_vars.innodb_buffer_pool_write_requests
= srv_buf_pool_write_requests; = srv_buf_pool_write_requests;
export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free; export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed; export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads; export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads;
export_vars.innodb_buffer_pool_read_ahead_rnd = srv_read_ahead_rnd; export_vars.innodb_buffer_pool_read_ahead
export_vars.innodb_buffer_pool_read_ahead_seq = srv_read_ahead_seq; = buf_pool->stat.n_ra_pages_read;
export_vars.innodb_buffer_pool_read_ahead_evicted
= buf_pool->stat.n_ra_pages_evicted;
export_vars.innodb_buffer_pool_pages_data export_vars.innodb_buffer_pool_pages_data
= UT_LIST_GET_LEN(buf_pool->LRU); = UT_LIST_GET_LEN(buf_pool->LRU);
export_vars.innodb_buffer_pool_pages_dirty export_vars.innodb_buffer_pool_pages_dirty
...@@ -1915,9 +1908,9 @@ srv_export_innodb_status(void) ...@@ -1915,9 +1908,9 @@ srv_export_innodb_status(void)
export_vars.innodb_log_writes = srv_log_writes; export_vars.innodb_log_writes = srv_log_writes;
export_vars.innodb_dblwr_pages_written = srv_dblwr_pages_written; export_vars.innodb_dblwr_pages_written = srv_dblwr_pages_written;
export_vars.innodb_dblwr_writes = srv_dblwr_writes; export_vars.innodb_dblwr_writes = srv_dblwr_writes;
export_vars.innodb_pages_created = buf_pool->n_pages_created; export_vars.innodb_pages_created = buf_pool->stat.n_pages_created;
export_vars.innodb_pages_read = buf_pool->n_pages_read; export_vars.innodb_pages_read = buf_pool->stat.n_pages_read;
export_vars.innodb_pages_written = buf_pool->n_pages_written; export_vars.innodb_pages_written = buf_pool->stat.n_pages_written;
export_vars.innodb_row_lock_waits = srv_n_lock_wait_count; export_vars.innodb_row_lock_waits = srv_n_lock_wait_count;
export_vars.innodb_row_lock_current_waits export_vars.innodb_row_lock_current_waits
= srv_n_lock_wait_current_count; = srv_n_lock_wait_current_count;
...@@ -2284,12 +2277,6 @@ srv_sync_log_buffer_in_background(void) ...@@ -2284,12 +2277,6 @@ srv_sync_log_buffer_in_background(void)
log_buffer_sync_in_background(TRUE); log_buffer_sync_in_background(TRUE);
srv_last_log_flush_time = current_time; srv_last_log_flush_time = current_time;
srv_log_writes_and_flush++; srv_log_writes_and_flush++;
} else {
/* Actually we don't need to write logs here.
We are just being extra safe here by forcing
the log buffer to log file. */
log_buffer_sync_in_background(FALSE);
srv_log_buffer_writes++;
} }
} }
...@@ -2340,8 +2327,8 @@ loop: ...@@ -2340,8 +2327,8 @@ loop:
srv_main_thread_op_info = "reserving kernel mutex"; srv_main_thread_op_info = "reserving kernel mutex";
n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read n_ios_very_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ buf_pool->n_pages_written; + buf_pool->stat.n_pages_written;
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
/* Store the user activity counter at the start of this loop */ /* Store the user activity counter at the start of this loop */
...@@ -2361,8 +2348,8 @@ loop: ...@@ -2361,8 +2348,8 @@ loop:
skip_sleep = FALSE; skip_sleep = FALSE;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read n_ios_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ buf_pool->n_pages_written; + buf_pool->stat.n_pages_written;
srv_main_thread_op_info = "sleeping"; srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++; srv_main_1_second_loops++;
...@@ -2401,8 +2388,8 @@ loop: ...@@ -2401,8 +2388,8 @@ loop:
n_pend_ios = buf_get_n_pending_ios() n_pend_ios = buf_get_n_pending_ios()
+ log_sys->n_pending_writes; + log_sys->n_pending_writes;
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read n_ios = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ buf_pool->n_pages_written; + buf_pool->stat.n_pages_written;
if (n_pend_ios < SRV_PEND_IO_THRESHOLD if (n_pend_ios < SRV_PEND_IO_THRESHOLD
&& (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) { && (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
srv_main_thread_op_info = "doing insert buffer merge"; srv_main_thread_op_info = "doing insert buffer merge";
...@@ -2418,6 +2405,8 @@ loop: ...@@ -2418,6 +2405,8 @@ loop:
/* Try to keep the number of modified pages in the /* Try to keep the number of modified pages in the
buffer pool under the limit wished by the user */ buffer pool under the limit wished by the user */
srv_main_thread_op_info =
"flushing buffer pool pages";
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
PCT_IO(100), PCT_IO(100),
IB_ULONGLONG_MAX); IB_ULONGLONG_MAX);
...@@ -2436,6 +2425,8 @@ loop: ...@@ -2436,6 +2425,8 @@ loop:
ulint n_flush = buf_flush_get_desired_flush_rate(); ulint n_flush = buf_flush_get_desired_flush_rate();
if (n_flush) { if (n_flush) {
srv_main_thread_op_info =
"flushing buffer pool pages";
n_flush = ut_min(PCT_IO(100), n_flush); n_flush = ut_min(PCT_IO(100), n_flush);
n_pages_flushed = n_pages_flushed =
buf_flush_batch( buf_flush_batch(
...@@ -2473,8 +2464,8 @@ loop: ...@@ -2473,8 +2464,8 @@ loop:
are not required, and may be disabled. */ are not required, and may be disabled. */
n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes; n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes;
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read n_ios = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ buf_pool->n_pages_written; + buf_pool->stat.n_pages_written;
srv_main_10_second_loops++; srv_main_10_second_loops++;
if (n_pend_ios < SRV_PEND_IO_THRESHOLD if (n_pend_ios < SRV_PEND_IO_THRESHOLD
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment