mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
fix: miss metrics
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
dc9562592d
commit
7b7f2b3a3e
1 changed files with 6 additions and 0 deletions
|
|
@ -202,12 +202,14 @@ func newIndexWriter(db ethdb.KeyValueReader, state stateIdent, cacher *historyCa
|
||||||
key := state.CacheKey()
|
key := state.CacheKey()
|
||||||
if cacher != nil && cacher.index.Contains(key) {
|
if cacher != nil && cacher.index.Contains(key) {
|
||||||
blob, _ = cacher.index.Get(key)
|
blob, _ = cacher.index.Get(key)
|
||||||
|
historyIndexCacheHitMeter.Mark(1)
|
||||||
} else {
|
} else {
|
||||||
if state.account {
|
if state.account {
|
||||||
blob = rawdb.ReadAccountHistoryIndex(db, state.addressHash)
|
blob = rawdb.ReadAccountHistoryIndex(db, state.addressHash)
|
||||||
} else {
|
} else {
|
||||||
blob = rawdb.ReadStorageHistoryIndex(db, state.addressHash, state.storageHash)
|
blob = rawdb.ReadStorageHistoryIndex(db, state.addressHash, state.storageHash)
|
||||||
}
|
}
|
||||||
|
historyIndexCacheMissMeter.Mark(1)
|
||||||
if cacher != nil {
|
if cacher != nil {
|
||||||
cacher.index.Add(key, blob)
|
cacher.index.Add(key, blob)
|
||||||
}
|
}
|
||||||
|
|
@ -361,12 +363,14 @@ func newIndexDeleter(db ethdb.KeyValueReader, state stateIdent, cacher *historyC
|
||||||
key := state.CacheKey()
|
key := state.CacheKey()
|
||||||
if cacher != nil && cacher.index.Contains(key) {
|
if cacher != nil && cacher.index.Contains(key) {
|
||||||
blob, _ = cacher.index.Get(key)
|
blob, _ = cacher.index.Get(key)
|
||||||
|
historyIndexCacheHitMeter.Mark(1)
|
||||||
} else {
|
} else {
|
||||||
if state.account {
|
if state.account {
|
||||||
blob = rawdb.ReadAccountHistoryIndex(db, state.addressHash)
|
blob = rawdb.ReadAccountHistoryIndex(db, state.addressHash)
|
||||||
} else {
|
} else {
|
||||||
blob = rawdb.ReadStorageHistoryIndex(db, state.addressHash, state.storageHash)
|
blob = rawdb.ReadStorageHistoryIndex(db, state.addressHash, state.storageHash)
|
||||||
}
|
}
|
||||||
|
historyIndexCacheMissMeter.Mark(1)
|
||||||
if cacher != nil {
|
if cacher != nil {
|
||||||
cacher.index.Add(key, blob)
|
cacher.index.Add(key, blob)
|
||||||
}
|
}
|
||||||
|
|
@ -395,12 +399,14 @@ func newIndexDeleter(db ethdb.KeyValueReader, state stateIdent, cacher *historyC
|
||||||
key = fmt.Sprintf("%s:%d", state.CacheKey(), lastDesc.id)
|
key = fmt.Sprintf("%s:%d", state.CacheKey(), lastDesc.id)
|
||||||
if cacher != nil && cacher.block.Contains(key) {
|
if cacher != nil && cacher.block.Contains(key) {
|
||||||
indexBlock, _ = cacher.block.Get(key)
|
indexBlock, _ = cacher.block.Get(key)
|
||||||
|
historyBlockCacheHitMeter.Mark(1)
|
||||||
} else {
|
} else {
|
||||||
if state.account {
|
if state.account {
|
||||||
indexBlock = rawdb.ReadAccountHistoryIndexBlock(db, state.addressHash, lastDesc.id)
|
indexBlock = rawdb.ReadAccountHistoryIndexBlock(db, state.addressHash, lastDesc.id)
|
||||||
} else {
|
} else {
|
||||||
indexBlock = rawdb.ReadStorageHistoryIndexBlock(db, state.addressHash, state.storageHash, lastDesc.id)
|
indexBlock = rawdb.ReadStorageHistoryIndexBlock(db, state.addressHash, state.storageHash, lastDesc.id)
|
||||||
}
|
}
|
||||||
|
historyBlockCacheMissMeter.Mark(1)
|
||||||
if cacher != nil {
|
if cacher != nil {
|
||||||
cacher.block.Add(key, indexBlock)
|
cacher.block.Add(key, indexBlock)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue