提交 29465b0b 编写于 作者: D Davies Liu

change metrics of cache miss to match with hits

上级 9281087d
......@@ -140,6 +140,9 @@ func (c *rChunk) ReadAt(ctx context.Context, page *Page, off int) (n int, err er
}
}
cacheMiss.Add(1)
cacheMissBytes.Add(float64(len(p)))
if c.store.seekable && boff > 0 && len(p) <= blockSize/4 {
// partial read
st := time.Now()
......@@ -152,8 +155,6 @@ func (c *rChunk) ReadAt(ctx context.Context, page *Page, off int) (n int, err er
c.store.fetcher.fetch(key)
if err == nil {
defer in.Close()
cacheMiss.Add(1)
cacheMissBytes.Add(float64(len(p)))
return io.ReadFull(in, p)
}
}
......@@ -637,8 +638,6 @@ func (store *cachedStore) load(key string, page *Page, cache bool) (err error) {
return fmt.Errorf("read %s fully: %s (%d < %d) after %s (tried %d)", key, err, n, len(page.Data),
time.Since(start), tried)
}
cacheMiss.Add(1)
cacheMissBytes.Add(float64(len(page.Data)))
if cache {
store.bcache.cache(key, page)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册