From 2d2aba4e8dde96d8a6e94d02042b9b3bf122f5c6 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Wed, 11 Aug 2021 16:11:49 +0200 Subject: [PATCH] tsdb: align atomically accessed int64 (#9192) This prevents a panic in 32-bit archs: https://pkg.go.dev/sync/atomic#pkg-note-BUG Fixed #9190 Signed-off-by: Julien Pivotto --- tsdb/head.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tsdb/head.go b/tsdb/head.go index ae549d253..b0124922e 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -117,6 +117,10 @@ type Head struct { // HeadOptions are parameters for the Head block. type HeadOptions struct { + // Runtime reloadable option. At the top of the struct for 32 bit OS: + // https://pkg.go.dev/sync/atomic#pkg-note-BUG + MaxExemplars atomic.Int64 + ChunkRange int64 // ChunkDirRoot is the parent directory of the chunks directory. ChunkDirRoot string @@ -128,9 +132,6 @@ type HeadOptions struct { StripeSize int SeriesCallback SeriesLifecycleCallback EnableExemplarStorage bool - - // Runtime reloadable options. - MaxExemplars atomic.Int64 } func DefaultHeadOptions() *HeadOptions {