Skip to content

Commit a54504f

Browse files
committed
integration: Enable the parquet row ranges cache in the single-binary querier
Assert that the cache misses on the first query and hits when querying the same stored series again. Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com>
1 parent 51522cf commit a54504f

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

integration/querier_test.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
3636
blocksShardingEnabled bool
3737
indexCacheBackend string
3838
parquetLabelsCache string
39+
parquetRowRangesCache string
3940
}{
4041
// tsdb bucket storage
4142
"[TSDB] blocks sharding enabled, memcached index cache, bucket index enabled": {
@@ -49,15 +50,17 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
4950
indexCacheBackend: tsdb.IndexCacheBackendRedis,
5051
},
5152
// parquet bucket storage
52-
"[Parquet] blocks sharding enabled, memcached parquet labels cache, bucket index enabled": {
53+
"[Parquet] blocks sharding enabled, memcached parquet cache, bucket index enabled": {
5354
bucketStorageType: "parquet",
5455
blocksShardingEnabled: true,
5556
parquetLabelsCache: tsdb.CacheBackendMemcached,
57+
parquetRowRangesCache: tsdb.CacheBackendMemcached,
5658
},
57-
"[Parquet] blocks sharding enabled, redis parquet labels cache, bucket index enabled": {
59+
"[Parquet] blocks sharding enabled, redis parquet cache, bucket index enabled": {
5860
bucketStorageType: "parquet",
5961
blocksShardingEnabled: true,
6062
parquetLabelsCache: tsdb.CacheBackendRedis,
63+
parquetRowRangesCache: tsdb.CacheBackendMemcached,
6164
},
6265
}
6366

@@ -131,6 +134,7 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
131134
flags["-parquet-converter.conversion-interval"] = "1s"
132135
flags["-parquet-converter.ring.consul.hostname"] = consul.NetworkHTTPEndpoint()
133136
flags["-blocks-storage.bucket-store.parquet-labels-cache.backend"] = testCfg.parquetLabelsCache
137+
flags["-blocks-storage.bucket-store.parquet-row-ranges-cache.backend"] = testCfg.parquetRowRangesCache
134138
flags["-compactor.block-ranges"] = "1ms,12h"
135139
}
136140

@@ -150,6 +154,14 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
150154
flags["-blocks-storage.bucket-store.parquet-labels-cache.redis.addresses"] = redis.NetworkEndpoint(e2ecache.RedisPort)
151155
}
152156

157+
// Add the parquet row ranges cache address
158+
if strings.Contains(testCfg.parquetRowRangesCache, tsdb.CacheBackendMemcached) {
159+
flags["-blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.addresses"] = "dns+" + memcached.NetworkEndpoint(e2ecache.MemcachedPort)
160+
}
161+
if strings.Contains(testCfg.parquetRowRangesCache, tsdb.CacheBackendRedis) {
162+
flags["-blocks-storage.bucket-store.parquet-row-ranges-cache.redis.addresses"] = redis.NetworkEndpoint(e2ecache.RedisPort)
163+
}
164+
153165
// Start Cortex replicas.
154166
cortex1 := e2ecortex.NewSingleBinary("cortex-1", flags, "")
155167
cortex2 := e2ecortex.NewSingleBinary("cortex-2", flags, "")
@@ -253,6 +265,10 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
253265
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(0), "thanos_store_index_cache_hits_total")) // no cache hit cause the cache was empty
254266
}
255267

268+
if testCfg.bucketStorageType == "parquet" {
269+
require.NoError(t, cluster.WaitSumMetricsWithOptions(e2e.Greater(0), []string{"cortex_parquet_row_ranges_cache_misses_total"}, e2e.WaitMissingMetrics))
270+
}
271+
256272
if testCfg.indexCacheBackend == tsdb.IndexCacheBackendMemcached {
257273
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(21*seriesReplicationFactor)), "thanos_memcached_operations_total")) // 14 gets + 7 sets
258274
}
@@ -268,6 +284,7 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
268284
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64((12+2)*seriesReplicationFactor)), "thanos_store_index_cache_requests_total"))
269285
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(2*seriesReplicationFactor)), "thanos_store_index_cache_hits_total")) // this time has used the index cache
270286
case "parquet":
287+
require.NoError(t, cluster.WaitSumMetricsWithOptions(e2e.Greater(0), []string{"cortex_parquet_row_ranges_cache_hits_total"}, e2e.WaitMissingMetrics))
271288
switch testCfg.parquetLabelsCache {
272289
case tsdb.CacheBackendInMemory:
273290
require.NoError(t, cluster.WaitSumMetrics(e2e.Greater(float64(0)), "thanos_cache_inmemory_requests_total"))

0 commit comments

Comments
 (0)