Skip to content

Commit de9398b

Browse files
d_lru: remove mutex (#19543)
PR #16922 introduced mutex to D_LRU - but i think it's not needed for Parallel exec anymore (because parallel exec doesn't do parallel reads from same `rotx` - current D_LRU is per-rotx)
1 parent 84fe7e5 commit de9398b

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

db/state/cache.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type u128 struct{ hi, lo uint64 } //nolint
1919
type u192 struct{ hi, lo, ext uint64 } //nolint
2020

2121
type DomainGetFromFileCache struct {
22-
sync.RWMutex
2322
*freelru.LRU[uint64, domainGetFromFileCacheItem]
2423
enabled, trace bool
2524
limit uint32
@@ -45,25 +44,11 @@ func NewDomainGetFromFileCache(limit uint32) *DomainGetFromFileCache {
4544
return &DomainGetFromFileCache{LRU: c, enabled: domainGetFromFileCacheEnabled, trace: domainGetFromFileCacheTrace, limit: limit}
4645
}
4746

48-
func (c *DomainGetFromFileCache) Add(key uint64, value domainGetFromFileCacheItem) (evicted bool) {
49-
c.Lock()
50-
defer c.Unlock()
51-
return c.LRU.Add(key, value)
52-
}
53-
54-
func (c *DomainGetFromFileCache) Get(key uint64) (value domainGetFromFileCacheItem, ok bool) {
55-
c.Lock() // get upates cache vars
56-
defer c.Unlock()
57-
return c.LRU.Get(key)
58-
}
59-
6047
func (c *DomainGetFromFileCache) SetTrace(v bool) { c.trace = v }
6148
func (c *DomainGetFromFileCache) LogStats(dt kv.Domain) {
6249
if c == nil {
6350
return
6451
}
65-
c.RLock()
66-
defer c.RUnlock()
6752
if !c.enabled || !c.trace {
6853
return
6954
}

0 commit comments

Comments
 (0)