Skip to content

Commit a0e249c

Browse files
hawkingreiti-chi-bot
authored andcommitted
This is an automated cherry-pick of #58013
Signed-off-by: ti-chi-bot <[email protected]>
1 parent b79a70b commit a0e249c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/statistics/handle/cache/internal/lfu/lfu_cache.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ func NewLFU(totalMemCost int64) (*LFU, error) {
8686
return result, err
8787
}
8888

89+
<<<<<<< HEAD
90+
=======
91+
// adjustMemCost adjusts the memory cost according to the total memory cost.
92+
// When the total memory cost is 0, the memory cost is set to 20% of the total memory.
93+
func adjustMemCost(totalMemCost int64) (result int64, err error) {
94+
if totalMemCost == 0 {
95+
memTotal, err := memory.MemTotal()
96+
if err != nil {
97+
return 0, err
98+
}
99+
return int64(memTotal * 20 / 100), nil
100+
}
101+
return totalMemCost, nil
102+
}
103+
104+
>>>>>>> 9d0fb303ede (statistics: stats cache set default quota as 20% (#58013))
89105
// Get implements statsCacheInner
90106
func (s *LFU) Get(tid int64) (*statistics.Table, bool) {
91107
result, ok := s.cache.Get(tid)

0 commit comments

Comments
 (0)