Skip to content

Commit

Permalink
change again
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <benye@amazon.com>
  • Loading branch information
yeya24 committed Jun 15, 2023
1 parent bb33cd4 commit fff0f6d
Showing 1 changed file with 49 additions and 49 deletions.
98 changes: 49 additions & 49 deletions integration/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
assert.Equal(t, expectedVector3, result.(model.Vector))

// Check the in-memory index cache metrics (in the store-gateway).
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(12), "thanos_store_index_cache_requests_total"))
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(5+5+2), "thanos_store_index_cache_requests_total"))
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(0), "thanos_store_index_cache_hits_total")) // no cache hit cause the cache was empty

if testCfg.indexCacheBackend == tsdb.IndexCacheBackendInMemory {
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(2*3), "thanos_store_index_cache_items")) // 2 series both for expanded postings, postings and series cache
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(2*3), "thanos_store_index_cache_items_added_total")) // 2 series both for expanded postings, postings and series cache
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(9), "thanos_store_index_cache_items"))
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(9), "thanos_store_index_cache_items_added_total"))
} else if testCfg.indexCacheBackend == tsdb.IndexCacheBackendMemcached {
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(16), "thanos_memcached_operations_total")) // 12 gets + 4 sets
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(21), "thanos_memcached_operations_total")) // 14 gets + 7 sets
}

// Query back again the 1st series from storage. This time it should use the index cache.
Expand All @@ -257,14 +257,14 @@ func TestQuerierWithBlocksStorageRunningInMicroservicesMode(t *testing.T) {
require.Equal(t, model.ValVector, result.Type())
assert.Equal(t, expectedVector1, result.(model.Vector))

require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(7+2), "thanos_store_index_cache_requests_total"))
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(12+2), "thanos_store_index_cache_requests_total"))
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(2), "thanos_store_index_cache_hits_total")) // this time has used the index cache

if testCfg.indexCacheBackend == tsdb.IndexCacheBackendInMemory {
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(2*3), "thanos_store_index_cache_items")) // as before
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(2*3), "thanos_store_index_cache_items_added_total")) // as before
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(9), "thanos_store_index_cache_items")) // as before
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(9), "thanos_store_index_cache_items_added_total")) // as before
} else if testCfg.indexCacheBackend == tsdb.IndexCacheBackendMemcached {
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(16+2), "thanos_memcached_operations_total")) // as before + 2 gets
require.NoError(t, storeGateways.WaitSumMetrics(e2e.Equals(23), "thanos_memcached_operations_total")) // as before + 2 gets
}

// Query metadata.
Expand Down Expand Up @@ -298,38 +298,38 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
ingesterStreamingEnabled: true,
indexCacheBackend: tsdb.IndexCacheBackendInMemory,
},
"blocks sharding disabled, ingester gRPC streaming disabled, memcached index cache": {
blocksShardingEnabled: false,
ingesterStreamingEnabled: false,
indexCacheBackend: tsdb.IndexCacheBackendMemcached,
},
"blocks sharding enabled, ingester gRPC streaming enabled, memcached index cache": {
blocksShardingEnabled: true,
ingesterStreamingEnabled: true,
indexCacheBackend: tsdb.IndexCacheBackendMemcached,
},
"blocks sharding enabled, ingester gRPC streaming enabled, memcached index cache, bucket index enabled": {
blocksShardingEnabled: true,
ingesterStreamingEnabled: true,
indexCacheBackend: tsdb.IndexCacheBackendMemcached,
bucketIndexEnabled: true,
},
"blocks sharding disabled, ingester gRPC streaming disabled, redis index cache": {
blocksShardingEnabled: false,
ingesterStreamingEnabled: false,
indexCacheBackend: tsdb.IndexCacheBackendRedis,
},
"blocks sharding enabled, ingester gRPC streaming enabled, redis index cache": {
blocksShardingEnabled: true,
ingesterStreamingEnabled: true,
indexCacheBackend: tsdb.IndexCacheBackendRedis,
},
"blocks sharding enabled, ingester gRPC streaming enabled, redis index cache, bucket index enabled": {
blocksShardingEnabled: true,
ingesterStreamingEnabled: true,
indexCacheBackend: tsdb.IndexCacheBackendRedis,
bucketIndexEnabled: true,
},
//"blocks sharding disabled, ingester gRPC streaming disabled, memcached index cache": {
// blocksShardingEnabled: false,
// ingesterStreamingEnabled: false,
// indexCacheBackend: tsdb.IndexCacheBackendMemcached,
//},
//"blocks sharding enabled, ingester gRPC streaming enabled, memcached index cache": {
// blocksShardingEnabled: true,
// ingesterStreamingEnabled: true,
// indexCacheBackend: tsdb.IndexCacheBackendMemcached,
//},
//"blocks sharding enabled, ingester gRPC streaming enabled, memcached index cache, bucket index enabled": {
// blocksShardingEnabled: true,
// ingesterStreamingEnabled: true,
// indexCacheBackend: tsdb.IndexCacheBackendMemcached,
// bucketIndexEnabled: true,
//},
//"blocks sharding disabled, ingester gRPC streaming disabled, redis index cache": {
// blocksShardingEnabled: false,
// ingesterStreamingEnabled: false,
// indexCacheBackend: tsdb.IndexCacheBackendRedis,
//},
//"blocks sharding enabled, ingester gRPC streaming enabled, redis index cache": {
// blocksShardingEnabled: true,
// ingesterStreamingEnabled: true,
// indexCacheBackend: tsdb.IndexCacheBackendRedis,
//},
//"blocks sharding enabled, ingester gRPC streaming enabled, redis index cache, bucket index enabled": {
// blocksShardingEnabled: true,
// ingesterStreamingEnabled: true,
// indexCacheBackend: tsdb.IndexCacheBackendRedis,
// bucketIndexEnabled: true,
//},
}

for testName, testCfg := range tests {
Expand Down Expand Up @@ -475,14 +475,14 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
assert.Equal(t, expectedVector3, result.(model.Vector))

// Check the in-memory index cache metrics (in the store-gateway).
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(12*seriesReplicationFactor)), "thanos_store_index_cache_requests_total"))
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(0), "thanos_store_index_cache_hits_total")) // no cache hit cause the cache was empty
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64((5+5+2)*seriesReplicationFactor)), "thanos_store_index_cache_requests_total")) // 5 for expanded postings and postings, 2 for series
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(0), "thanos_store_index_cache_hits_total")) // no cache hit cause the cache was empty

if testCfg.indexCacheBackend == tsdb.IndexCacheBackendInMemory {
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(2*3*seriesReplicationFactor)), "thanos_store_index_cache_items")) // 2 series both for expanded postings, postings and series cache
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(2*3*seriesReplicationFactor)), "thanos_store_index_cache_items_added_total")) // 2 series both for expanded postings, postings and series cache
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(9*seriesReplicationFactor)), "thanos_store_index_cache_items"))
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(9*seriesReplicationFactor)), "thanos_store_index_cache_items_added_total"))
} else if testCfg.indexCacheBackend == tsdb.IndexCacheBackendMemcached {
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(16*seriesReplicationFactor)), "thanos_memcached_operations_total")) // 12 gets + 4 sets
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(21*seriesReplicationFactor)), "thanos_memcached_operations_total")) // 14 gets + 7 sets
}

// Query back again the 1st series from storage. This time it should use the index cache.
Expand All @@ -491,14 +491,14 @@ func TestQuerierWithBlocksStorageRunningInSingleBinaryMode(t *testing.T) {
require.Equal(t, model.ValVector, result.Type())
assert.Equal(t, expectedVector1, result.(model.Vector))

require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64((7+1)*seriesReplicationFactor)), "thanos_store_index_cache_requests_total"))
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64((12+2)*seriesReplicationFactor)), "thanos_store_index_cache_requests_total"))
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(2*seriesReplicationFactor)), "thanos_store_index_cache_hits_total")) // this time has used the index cache

if testCfg.indexCacheBackend == tsdb.IndexCacheBackendInMemory {
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(2*3*seriesReplicationFactor)), "thanos_store_index_cache_items")) // as before
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(2*3*seriesReplicationFactor)), "thanos_store_index_cache_items_added_total")) // as before
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(9*seriesReplicationFactor)), "thanos_store_index_cache_items")) // as before
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64(9*seriesReplicationFactor)), "thanos_store_index_cache_items_added_total")) // as before
} else if testCfg.indexCacheBackend == tsdb.IndexCacheBackendMemcached {
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64((16+2)*seriesReplicationFactor)), "thanos_memcached_operations_total")) // as before + 2 gets
require.NoError(t, cluster.WaitSumMetrics(e2e.Equals(float64((21+2)*seriesReplicationFactor)), "thanos_memcached_operations_total")) // as before + 2 gets
}

// Query metadata.
Expand Down

0 comments on commit fff0f6d

Please sign in to comment.