From 397179e39480d2275dea29d002f4c06d2d3296d4 Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Fri, 5 Jan 2024 13:17:18 +0100 Subject: [PATCH] Changed approxBytesPerEntry after upgrading to golang 1.21 Signed-off-by: Marco Pracucci --- tsdb/hashcache/series_hash_cache.go | 2 +- tsdb/hashcache/series_hash_cache_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsdb/hashcache/series_hash_cache.go b/tsdb/hashcache/series_hash_cache.go index 964b057301..6680251a6c 100644 --- a/tsdb/hashcache/series_hash_cache.go +++ b/tsdb/hashcache/series_hash_cache.go @@ -13,7 +13,7 @@ const ( // approxBytesPerEntry is the estimated memory footprint (in bytes) of 1 cache // entry, measured with TestSeriesHashCache_MeasureApproximateSizePerEntry(). - approxBytesPerEntry = 28 + approxBytesPerEntry = 50 ) // SeriesHashCache is a bounded cache mapping the per-block series ID with diff --git a/tsdb/hashcache/series_hash_cache_test.go b/tsdb/hashcache/series_hash_cache_test.go index 375c8054d7..7c7d7c0758 100644 --- a/tsdb/hashcache/series_hash_cache_test.go +++ b/tsdb/hashcache/series_hash_cache_test.go @@ -66,7 +66,7 @@ func TestSeriesHashCache_MeasureApproximateSizePerEntry(t *testing.T) { runtime.ReadMemStats(&after) t.Logf("approximate size per entry: %d bytes", (after.TotalAlloc-before.TotalAlloc)/numEntries) - require.Equal(t, uint64(approxBytesPerEntry), (after.TotalAlloc-before.TotalAlloc)/numEntries, "approxBytesPerEntry constant is out date") + require.Equal(t, approxBytesPerEntry, int((after.TotalAlloc-before.TotalAlloc)/numEntries), "approxBytesPerEntry constant is out date") } func TestSeriesHashCache_Concurrency(t *testing.T) {