Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions posting/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ func SetEnabledDetailedMetrics(enableMetrics bool) {
EnableDetailedMetrics = enableMetrics
}

func UpdateMaxCost(maxCost int64) {
}

// Cleanup waits until the closer has finished processing.
func Cleanup() {
closer.SignalAndWait()
Expand Down
7 changes: 7 additions & 0 deletions posting/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ func (ml *MemoryLayer) del(key []byte) {
ml.cache.del(key)
}

func (ml *MemoryLayer) UpdateMaxCost(maxCost int64) {
if ml.cache == nil || ml.cache.data == nil {
return
}
ml.cache.data.UpdateMaxCost(maxCost)
}

type IterateDiskArgs struct {
Prefix []byte
Prefetch bool
Expand Down
4 changes: 3 additions & 1 deletion worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ func UpdateCacheMb(memoryMB int64) error {
blockCacheSize := (cachePercent[1] * (memoryMB << 20)) / 100
indexCacheSize := (cachePercent[2] * (memoryMB << 20)) / 100

posting.UpdateMaxCost(plCacheSize)
if posting.MemLayerInstance != nil {
posting.MemLayerInstance.UpdateMaxCost(plCacheSize)
}
if _, err := pstore.CacheMaxCost(badger.BlockCache, blockCacheSize); err != nil {
return errors.Wrapf(err, "cannot update block cache size")
}
Expand Down
Loading