Bug #35030 maria_pagecache_read* status variables updated at wrong moment
Submitted: 4 Mar 2008 10:23 Modified: 16 Mar 2008 16:08
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S3 (Non-critical)
Version:5.1-maria OS:Any
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[4 Mar 2008 10:23] Guilhem Bichot
Description:
First, here's what the manual says:

  Key_read_requests:
  The number of requests to read a key block from the cache.
  Key_reads:
  The number of physical reads of a key block from disk. If Key_reads is
  large, then your key_buffer_size value is probably too small. The
  cache miss rate can be calculated as Key_reads/Key_read_requests.

So, Key_reads is about physical reads.

In key cache, it is incremented at places where we do a pread(), that
looks logical.
In page cache, it's incremented in find_block(), when taking a block
from the LRU. That is strange: pagecache_unlock(), pagecache_unpin(),
pagecache_write_part() all call find_block(). There is no reason that
a pagecache_write_part() should increase global_cache_read.
And also, find_block() increments the counter even for secondary read
requests, which is not normal: secondary read requests don't read
block from disk, only primary ones do.
I think it should be updated only close to pagecache_fread() calls.

global_cache_write seems ok: it is updated close to
pagecache_fwrite() calls.

How to repeat:
code review
[5 Mar 2008 10:10] Guilhem Bichot
BUG#34911 is not a duplicate but still interesting to know about
[12 Mar 2008 0:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43780

ChangeSet@1.2616, 2008-03-11 18:12:08+02:00, bell@desktop.sanja.is.com.ua +1 -0
  Fixed statistic calculation.
  (BUG#35030 maria_pagecache_read* status
  variables updated at wrong moment)