triedb/pathdb: sort the locations by read order

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-05-27 14:32:28 +08:00
parent a616748ec5
commit 3ebf3d048f
2 changed files with 9 additions and 9 deletions

View file

@ -91,7 +91,7 @@ func (dl *diffLayer) node(owner common.Hash, path []byte, depth int) ([]byte, co
dirtyNodeHitMeter.Mark(1)
dirtyNodeHitDepthHist.Update(int64(depth))
dirtyNodeReadMeter.Mark(int64(len(n.Blob)))
return n.Blob, n.Hash, &nodeLoc{loc: locDiffLayer, depth: depth}, nil
return n.Blob, n.Hash, &nodeLoc{loc: locDiffCache, depth: depth}, nil
}
// Trie node unknown to this layer, resolve from parent
return dl.parent.node(owner, path, depth+1)

View file

@ -29,10 +29,10 @@ import (
// The types of locations where the node is found.
const (
locDirtyCache = "dirty" // dirty cache
locCleanCache = "clean" // clean cache
locDiskLayer = "disk" // persistent state
locDiffLayer = "diff" // diff layers
locDiffCache = "diff" // in-memory cache for nodes from the diff layer
locDirtyCache = "dirty" // not yet persisted write buffer for modified nodes
locCleanCache = "clean" // fastcache for clean nodes from the disk layer
locDiskLayer = "disk" // on-disk persistent state
)
// nodeLoc is a helpful structure that contains the location where the node
@ -67,12 +67,12 @@ func (r *reader) Node(owner common.Hash, path []byte, hash common.Hash) ([]byte,
// Location is always available even if the node
// is not found.
switch loc.loc {
case locCleanCache:
nodeCleanFalseMeter.Mark(1)
case locDiffCache:
nodeDiffFalseMeter.Mark(1)
case locDirtyCache:
nodeDirtyFalseMeter.Mark(1)
case locDiffLayer:
nodeDiffFalseMeter.Mark(1)
case locCleanCache:
nodeCleanFalseMeter.Mark(1)
case locDiskLayer:
nodeDiskFalseMeter.Mark(1)
}