Skip to content

Commit

Permalink
Merge pull request #1431 from sh0rez/remove-diskcache
Browse files Browse the repository at this point in the history
BREAKING fix(chunk/cache): Remove diskcache
  • Loading branch information
tomwilkie authored Jun 3, 2019
2 parents d548ff6 + 9e34955 commit 15de516
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 258 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ require (
go.etcd.io/bbolt v1.3.2 // indirect
go.uber.org/atomic v1.3.2 // indirect
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138
google.golang.org/api v0.4.0
Expand Down
14 changes: 0 additions & 14 deletions pkg/chunk/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ type Cache interface {

// Config for building Caches.
type Config struct {
EnableDiskcache bool `yaml:"enable_diskcache,omitempty"`
EnableFifoCache bool `yaml:"enable_fifocache,omitempty"`

DefaultValidity time.Duration `yaml:"defaul_validity,omitempty"`

Background BackgroundConfig `yaml:"background,omitempty"`
Memcache MemcachedConfig `yaml:"memcached,omitempty"`
MemcacheClient MemcachedClientConfig `yaml:"memcached_client,omitempty"`
Diskcache DiskcacheConfig `yaml:"diskcache,omitempty"`
Fifocache FifoCacheConfig `yaml:"fifocache,omitempty"`

// This is to name the cache metrics properly.
Expand All @@ -38,10 +36,8 @@ func (cfg *Config) RegisterFlagsWithPrefix(prefix string, description string, f
cfg.Background.RegisterFlagsWithPrefix(prefix, description, f)
cfg.Memcache.RegisterFlagsWithPrefix(prefix, description, f)
cfg.MemcacheClient.RegisterFlagsWithPrefix(prefix, description, f)
cfg.Diskcache.RegisterFlagsWithPrefix(prefix, description, f)
cfg.Fifocache.RegisterFlagsWithPrefix(prefix, description, f)

f.BoolVar(&cfg.EnableDiskcache, prefix+"cache.enable-diskcache", false, description+"Enable on-disk cache.")
f.BoolVar(&cfg.EnableFifoCache, prefix+"cache.enable-fifocache", false, description+"Enable in-memory cache.")
f.DurationVar(&cfg.DefaultValidity, prefix+"default-validity", 0, description+"The default validity of entries for caches unless overridden.")

Expand All @@ -65,16 +61,6 @@ func New(cfg Config) (Cache, error) {
caches = append(caches, Instrument(cfg.Prefix+"fifocache", cache))
}

if cfg.EnableDiskcache {
cache, err := NewDiskcache(cfg.Diskcache)
if err != nil {
return nil, err
}

cacheName := cfg.Prefix + "diskcache"
caches = append(caches, NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache)))
}

if cfg.MemcacheClient.Host != "" {
if cfg.Memcache.Expiration == 0 && cfg.DefaultValidity != 0 {
cfg.Memcache.Expiration = cfg.DefaultValidity
Expand Down
15 changes: 0 additions & 15 deletions pkg/chunk/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package cache_test
import (
"context"
"math/rand"
"os"
"path"
"sort"
"strconv"
"testing"
Expand Down Expand Up @@ -156,19 +154,6 @@ func TestMemcache(t *testing.T) {
})
}

func TestDiskcache(t *testing.T) {
dirname := os.TempDir()
filename := path.Join(dirname, "diskcache")
defer os.RemoveAll(filename)

cache, err := cache.NewDiskcache(cache.DiskcacheConfig{
Path: filename,
Size: 100 * 1024 * 1024,
})
require.NoError(t, err)
testCache(t, cache)
}

func TestFifoCache(t *testing.T) {
cache := cache.NewFifoCache("test", cache.FifoCacheConfig{Size: 1e3, Validity: 1 * time.Hour})
testCache(t, cache)
Expand Down
227 changes: 0 additions & 227 deletions pkg/chunk/cache/diskcache.go

This file was deleted.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ github.com/prometheus/prometheus/discovery/refresh
github.com/prometheus/prometheus/pkg/logging
github.com/prometheus/prometheus/util/treecache
# github.com/prometheus/tsdb v0.7.2-0.20190506134726-2ae028114c89
github.com/prometheus/tsdb/fileutil
github.com/prometheus/tsdb/chunkenc
github.com/prometheus/tsdb/labels
github.com/prometheus/tsdb
github.com/prometheus/tsdb/fileutil
github.com/prometheus/tsdb/wal
github.com/prometheus/tsdb/chunks
github.com/prometheus/tsdb/encoding
Expand Down

0 comments on commit 15de516

Please sign in to comment.