smtc0097 / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
0 stars 0 forks source link

pages_read is being overwritten by Innodb_buffer_pool_reads and Innodb_pages_read #106

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In ss_get_mysql_stats.php the pages_read variable is getting overwritten by
to different SHOW STATUS variables, Innodb_buffer_pool_reads and
Innodb_pages_read. Code snippet:

# Override values from InnoDB parsing with values from SHOW STATUS,
# because InnoDB status might not have everything and the SHOW STATUS is
# to be preferred where possible.
$overrides = array(
   'Innodb_buffer_pool_pages_data'  => 'database_pages',
   'Innodb_buffer_pool_pages_dirty' => 'modified_pages',
   'Innodb_buffer_pool_pages_free'  => 'free_pages',
   'Innodb_buffer_pool_pages_total' => 'pool_size',
   'Innodb_buffer_pool_reads'       => 'pages_read',
   'Innodb_data_fsyncs'             => 'file_fsyncs',
   'Innodb_data_pending_reads'      => 'pending_normal_aio_reads',
   'Innodb_data_pending_writes'     => 'pending_normal_aio_writes',
   'Innodb_os_log_pending_fsyncs'   => 'pending_log_flushes',
   'Innodb_pages_created'           => 'pages_created',
   'Innodb_pages_read'              => 'pages_read',
   'Innodb_pages_written'           => 'pages_written',
   'Innodb_rows_deleted'            => 'rows_deleted',
   'Innodb_rows_inserted'           => 'rows_inserted',
   'Innodb_rows_read'               => 'rows_read',
   'Innodb_rows_updated'            => 'rows_updated',
);

Original issue reported on code.google.com by joegrasse on 17 Dec 2009 at 1:59

GoogleCodeExporter commented 8 years ago
The mapping between the MySQL status variables and the output of SHOW INNODB 
STATUS
is not one-to-one.  Some of the variables in one have a related value in the 
other
that isn't quite the same thing.  Looking at the source investigation I did for
innotop, I think pages_read has no exact equivalent in SHOW STATUS.  I'll 
remove this
from the list of overrides.

Original comment by baron.schwartz on 25 Dec 2009 at 7:09

GoogleCodeExporter commented 8 years ago
Actually I'm looking again just to be sure...

Innodb_buffer_pool_reads comes from export_vars.innodb_buffer_pool_reads, which 
comes
from srv_buf_pool_reads.  I don't think this is used for anything else, so 
there is
nothing in SHOW INNODB STATUS to parse this from.

Innodb_pages_read comes from export_vars.innodb_pages_read, which comes from
buf_pool->n_pages_read, which is printed here:

2156    fprintf(stderr,
2157       "buf_pool size %lu\n"
2158       "database pages %lu\n"
2159       "free pages %lu\n"
2160       "modified database pages %lu\n"
2161       "n pending reads %lu\n"
2162       "n pending flush LRU %lu list %lu single page %lu\n"
2163       "pages read %lu, created %lu, written %lu\n",
2164       (ulong) size,
2165       (ulong) UT_LIST_GET_LEN(buf_pool->LRU),
2166       (ulong) UT_LIST_GET_LEN(buf_pool->free),
2167       (ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
2168       (ulong) buf_pool->n_pend_reads,
2169       (ulong) buf_pool->n_flush[BUF_FLUSH_LRU],
2170       (ulong) buf_pool->n_flush[BUF_FLUSH_LIST],
2171       (ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE],
2172       (ulong) buf_pool->n_pages_read, buf_pool->n_pages_created,
2173       (ulong) buf_pool->n_pages_written);

So this is right:

    'Innodb_pages_read'              => 'pages_read',

I'll delete the other line.  Someday I'll document the mapping between these
variables and SHOW INNODB STATUS.

Original comment by baron.schwartz on 25 Dec 2009 at 7:21

GoogleCodeExporter commented 8 years ago
Fortunately these overrides were processed in order so there was confusion but 
no
actual error.

Original comment by baron.schwartz on 25 Dec 2009 at 7:23

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r367.

Original comment by baron.schwartz on 25 Dec 2009 at 7:26