File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,6 @@ func SetEnabledDetailedMetrics(enableMetrics bool) {
4646 EnableDetailedMetrics = enableMetrics
4747}
4848
49- func UpdateMaxCost (maxCost int64 ) {
50- }
51-
5249// Cleanup waits until the closer has finished processing.
5350func Cleanup () {
5451 closer .SignalAndWait ()
Original file line number Diff line number Diff line change @@ -405,6 +405,13 @@ func (ml *MemoryLayer) del(key []byte) {
405405 ml .cache .del (key )
406406}
407407
408+ func (ml * MemoryLayer ) UpdateMaxCost (maxCost int64 ) {
409+ if ml .cache == nil || ml .cache .data == nil {
410+ return
411+ }
412+ ml .cache .data .UpdateMaxCost (maxCost )
413+ }
414+
408415type IterateDiskArgs struct {
409416 Prefix []byte
410417 Prefetch bool
Original file line number Diff line number Diff line change @@ -150,7 +150,9 @@ func UpdateCacheMb(memoryMB int64) error {
150150 blockCacheSize := (cachePercent [1 ] * (memoryMB << 20 )) / 100
151151 indexCacheSize := (cachePercent [2 ] * (memoryMB << 20 )) / 100
152152
153- posting .UpdateMaxCost (plCacheSize )
153+ if posting .MemLayerInstance != nil {
154+ posting .MemLayerInstance .UpdateMaxCost (plCacheSize )
155+ }
154156 if _ , err := pstore .CacheMaxCost (badger .BlockCache , blockCacheSize ); err != nil {
155157 return errors .Wrapf (err , "cannot update block cache size" )
156158 }
You can’t perform that action at this time.
0 commit comments