Skip to content

Commit 031650a

Browse files
committed
delete queryable
Signed-off-by: SungJin1212 <[email protected]>
1 parent 9c6d985 commit 031650a

File tree

3 files changed

+56
-56
lines changed

3 files changed

+56
-56
lines changed

pkg/querier/parquet_queryable_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func TestParquetQueryable_Limits(t *testing.T) {
402402
StoreGatewayQueryStatsEnabled: false,
403403
StoreGatewayConsistencyCheckMaxAttempts: 3,
404404
ParquetShardCache: parquetutil.CacheConfig{
405-
ParquetQueryableShardCacheSize: 100,
405+
ParquetShardCacheSize: 100,
406406
},
407407
ParquetQueryableDefaultBlockStore: "parquet",
408408
}

pkg/util/parquetutil/cache.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ type cacheMetrics struct {
2929
func newCacheMetrics(reg prometheus.Registerer) *cacheMetrics {
3030
return &cacheMetrics{
3131
hits: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
32-
Name: "cortex_parquet_queryable_cache_hits_total",
32+
Name: "cortex_parquet_cache_hits_total",
3333
Help: "Total number of parquet cache hits",
3434
}, []string{"name"}),
3535
misses: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
36-
Name: "cortex_parquet_queryable_cache_misses_total",
36+
Name: "cortex_parquet_cache_misses_total",
3737
Help: "Total number of parquet cache misses",
3838
}, []string{"name"}),
3939
evictions: promauto.With(reg).NewCounterVec(prometheus.CounterOpts{
40-
Name: "cortex_parquet_queryable_cache_evictions_total",
40+
Name: "cortex_parquet_cache_evictions_total",
4141
Help: "Total number of parquet cache evictions",
4242
}, []string{"name"}),
4343
size: promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{
44-
Name: "cortex_parquet_queryable_cache_item_count",
44+
Name: "cortex_parquet_cache_item_count",
4545
Help: "Current number of cached parquet items",
4646
}, []string{"name"}),
4747
}
@@ -61,23 +61,23 @@ type Cache[T any] struct {
6161
}
6262

6363
type CacheConfig struct {
64-
ParquetQueryableShardCacheSize int `yaml:"parquet_queryable_shard_cache_size"`
65-
ParquetQueryableShardCacheTTL time.Duration `yaml:"parquet_queryable_shard_cache_ttl"`
66-
MaintenanceInterval time.Duration `yaml:"-"`
64+
ParquetShardCacheSize int `yaml:"parquet_shard_cache_size"`
65+
ParquetShardCacheTTL time.Duration `yaml:"parquet_shard_cache_ttl"`
66+
MaintenanceInterval time.Duration `yaml:"-"`
6767
}
6868

6969
func (cfg *CacheConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
70-
f.IntVar(&cfg.ParquetQueryableShardCacheSize, prefix+"parquet-queryable-shard-cache-size", 512, "[Experimental] Maximum size of the Parquet queryable shard cache. 0 to disable.")
71-
f.DurationVar(&cfg.ParquetQueryableShardCacheTTL, prefix+"parquet-queryable-shard-cache-ttl", 24*time.Hour, "[Experimental] TTL of the Parquet queryable shard cache. 0 to no TTL.")
70+
f.IntVar(&cfg.ParquetShardCacheSize, prefix+"parquet-shard-cache-size", 512, "[Experimental] Maximum size of the Parquet shard cache. 0 to disable.")
71+
f.DurationVar(&cfg.ParquetShardCacheTTL, prefix+"parquet-shard-cache-ttl", 24*time.Hour, "[Experimental] TTL of the Parquet shard cache. 0 to no TTL.")
7272
cfg.MaintenanceInterval = defaultMaintenanceInterval
7373
}
7474

7575
func NewCache[T any](cfg *CacheConfig, name string, reg prometheus.Registerer) (CacheInterface[T], error) {
76-
if cfg.ParquetQueryableShardCacheSize <= 0 {
76+
if cfg.ParquetShardCacheSize <= 0 {
7777
return &noopCache[T]{}, nil
7878
}
7979
metrics := newCacheMetrics(reg)
80-
cache, err := lru.NewWithEvict(cfg.ParquetQueryableShardCacheSize, func(key string, value *cacheEntry[T]) {
80+
cache, err := lru.NewWithEvict(cfg.ParquetShardCacheSize, func(key string, value *cacheEntry[T]) {
8181
metrics.evictions.WithLabelValues(name).Inc()
8282
metrics.size.WithLabelValues(name).Dec()
8383
})
@@ -89,11 +89,11 @@ func NewCache[T any](cfg *CacheConfig, name string, reg prometheus.Registerer) (
8989
cache: cache,
9090
name: name,
9191
metrics: metrics,
92-
ttl: cfg.ParquetQueryableShardCacheTTL,
92+
ttl: cfg.ParquetShardCacheTTL,
9393
stopCh: make(chan struct{}),
9494
}
9595

96-
if cfg.ParquetQueryableShardCacheTTL > 0 {
96+
if cfg.ParquetShardCacheTTL > 0 {
9797
go c.maintenanceLoop(cfg.MaintenanceInterval)
9898
}
9999

pkg/util/parquetutil/cache_test.go

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
func Test_Cache_LRUEviction(t *testing.T) {
1414
reg := prometheus.NewRegistry()
1515
cfg := &CacheConfig{
16-
ParquetQueryableShardCacheSize: 2,
17-
ParquetQueryableShardCacheTTL: 0,
18-
MaintenanceInterval: time.Minute,
16+
ParquetShardCacheSize: 2,
17+
ParquetShardCacheTTL: 0,
18+
MaintenanceInterval: time.Minute,
1919
}
2020
cache, err := NewCache[string](cfg, "test", reg)
2121
require.NoError(t, err)
@@ -36,27 +36,27 @@ func Test_Cache_LRUEviction(t *testing.T) {
3636
require.Equal(t, "", val2)
3737

3838
require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(`
39-
# HELP cortex_parquet_queryable_cache_evictions_total Total number of parquet cache evictions
40-
# TYPE cortex_parquet_queryable_cache_evictions_total counter
41-
cortex_parquet_queryable_cache_evictions_total{name="test"} 1
42-
# HELP cortex_parquet_queryable_cache_hits_total Total number of parquet cache hits
43-
# TYPE cortex_parquet_queryable_cache_hits_total counter
44-
cortex_parquet_queryable_cache_hits_total{name="test"} 3
45-
# HELP cortex_parquet_queryable_cache_item_count Current number of cached parquet items
46-
# TYPE cortex_parquet_queryable_cache_item_count gauge
47-
cortex_parquet_queryable_cache_item_count{name="test"} 2
48-
# HELP cortex_parquet_queryable_cache_misses_total Total number of parquet cache misses
49-
# TYPE cortex_parquet_queryable_cache_misses_total counter
50-
cortex_parquet_queryable_cache_misses_total{name="test"} 1
39+
# HELP cortex_parquet_cache_evictions_total Total number of parquet cache evictions
40+
# TYPE cortex_parquet_cache_evictions_total counter
41+
cortex_parquet_cache_evictions_total{name="test"} 1
42+
# HELP cortex_parquet_cache_hits_total Total number of parquet cache hits
43+
# TYPE cortex_parquet_cache_hits_total counter
44+
cortex_parquet_cache_hits_total{name="test"} 3
45+
# HELP cortex_parquet_cache_item_count Current number of cached parquet items
46+
# TYPE cortex_parquet_cache_item_count gauge
47+
cortex_parquet_cache_item_count{name="test"} 2
48+
# HELP cortex_parquet_cache_misses_total Total number of parquet cache misses
49+
# TYPE cortex_parquet_cache_misses_total counter
50+
cortex_parquet_cache_misses_total{name="test"} 1
5151
`)))
5252
}
5353

5454
func Test_Cache_TTLEvictionByGet(t *testing.T) {
5555
reg := prometheus.NewRegistry()
5656
cfg := &CacheConfig{
57-
ParquetQueryableShardCacheSize: 10,
58-
ParquetQueryableShardCacheTTL: 100 * time.Millisecond,
59-
MaintenanceInterval: time.Minute,
57+
ParquetShardCacheSize: 10,
58+
ParquetShardCacheTTL: 100 * time.Millisecond,
59+
MaintenanceInterval: time.Minute,
6060
}
6161

6262
cache, err := NewCache[string](cfg, "test", reg)
@@ -75,27 +75,27 @@ func Test_Cache_TTLEvictionByGet(t *testing.T) {
7575
require.Equal(t, "", val)
7676

7777
require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(`
78-
# HELP cortex_parquet_queryable_cache_evictions_total Total number of parquet cache evictions
79-
# TYPE cortex_parquet_queryable_cache_evictions_total counter
80-
cortex_parquet_queryable_cache_evictions_total{name="test"} 1
81-
# HELP cortex_parquet_queryable_cache_hits_total Total number of parquet cache hits
82-
# TYPE cortex_parquet_queryable_cache_hits_total counter
83-
cortex_parquet_queryable_cache_hits_total{name="test"} 1
84-
# HELP cortex_parquet_queryable_cache_item_count Current number of cached parquet items
85-
# TYPE cortex_parquet_queryable_cache_item_count gauge
86-
cortex_parquet_queryable_cache_item_count{name="test"} 0
87-
# HELP cortex_parquet_queryable_cache_misses_total Total number of parquet cache misses
88-
# TYPE cortex_parquet_queryable_cache_misses_total counter
89-
cortex_parquet_queryable_cache_misses_total{name="test"} 1
78+
# HELP cortex_parquet_cache_evictions_total Total number of parquet cache evictions
79+
# TYPE cortex_parquet_cache_evictions_total counter
80+
cortex_parquet_cache_evictions_total{name="test"} 1
81+
# HELP cortex_parquet_cache_hits_total Total number of parquet cache hits
82+
# TYPE cortex_parquet_cache_hits_total counter
83+
cortex_parquet_cache_hits_total{name="test"} 1
84+
# HELP cortex_parquet_cache_item_count Current number of cached parquet items
85+
# TYPE cortex_parquet_cache_item_count gauge
86+
cortex_parquet_cache_item_count{name="test"} 0
87+
# HELP cortex_parquet_cache_misses_total Total number of parquet cache misses
88+
# TYPE cortex_parquet_cache_misses_total counter
89+
cortex_parquet_cache_misses_total{name="test"} 1
9090
`)))
9191
}
9292

9393
func Test_Cache_TTLEvictionByLoop(t *testing.T) {
9494
reg := prometheus.NewRegistry()
9595
cfg := &CacheConfig{
96-
ParquetQueryableShardCacheSize: 10,
97-
ParquetQueryableShardCacheTTL: 100 * time.Millisecond,
98-
MaintenanceInterval: 100 * time.Millisecond,
96+
ParquetShardCacheSize: 10,
97+
ParquetShardCacheTTL: 100 * time.Millisecond,
98+
MaintenanceInterval: 100 * time.Millisecond,
9999
}
100100

101101
cache, err := NewCache[string](cfg, "test", reg)
@@ -117,14 +117,14 @@ func Test_Cache_TTLEvictionByLoop(t *testing.T) {
117117
}
118118

119119
require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(`
120-
# HELP cortex_parquet_queryable_cache_evictions_total Total number of parquet cache evictions
121-
# TYPE cortex_parquet_queryable_cache_evictions_total counter
122-
cortex_parquet_queryable_cache_evictions_total{name="test"} 1
123-
# HELP cortex_parquet_queryable_cache_hits_total Total number of parquet cache hits
124-
# TYPE cortex_parquet_queryable_cache_hits_total counter
125-
cortex_parquet_queryable_cache_hits_total{name="test"} 1
126-
# HELP cortex_parquet_queryable_cache_item_count Current number of cached parquet items
127-
# TYPE cortex_parquet_queryable_cache_item_count gauge
128-
cortex_parquet_queryable_cache_item_count{name="test"} 0
120+
# HELP cortex_parquet_cache_evictions_total Total number of parquet cache evictions
121+
# TYPE cortex_parquet_cache_evictions_total counter
122+
cortex_parquet_cache_evictions_total{name="test"} 1
123+
# HELP cortex_parquet_cache_hits_total Total number of parquet cache hits
124+
# TYPE cortex_parquet_cache_hits_total counter
125+
cortex_parquet_cache_hits_total{name="test"} 1
126+
# HELP cortex_parquet_cache_item_count Current number of cached parquet items
127+
# TYPE cortex_parquet_cache_item_count gauge
128+
cortex_parquet_cache_item_count{name="test"} 0
129129
`)))
130130
}

0 commit comments

Comments
 (0)