From 06d8cbc93592fbdce2d0dbc12d94ae1115dc98bd Mon Sep 17 00:00:00 2001 From: Edward Welch Date: Mon, 1 Mar 2021 20:17:41 -0500 Subject: [PATCH 1/2] fix alignment of atomic 64 bit to work with 32 bit OS --- pkg/ingester/replay_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ingester/replay_controller.go b/pkg/ingester/replay_controller.go index 72fe9d513acf..856574bcc17f 100644 --- a/pkg/ingester/replay_controller.go +++ b/pkg/ingester/replay_controller.go @@ -40,9 +40,9 @@ type Flusher interface { // replayController handles coordinating backpressure between WAL replays and chunk flushing. type replayController struct { + currentBytes atomic.Int64 cfg WALConfig metrics *ingesterMetrics - currentBytes atomic.Int64 cond *sync.Cond isFlushing atomic.Bool flusher Flusher From c86871239080afff4163d931400bacf39bc2670c Mon Sep 17 00:00:00 2001 From: Edward Welch Date: Mon, 1 Mar 2021 20:29:40 -0500 Subject: [PATCH 2/2] add comment --- pkg/ingester/replay_controller.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/ingester/replay_controller.go b/pkg/ingester/replay_controller.go index 856574bcc17f..74217d8afd3e 100644 --- a/pkg/ingester/replay_controller.go +++ b/pkg/ingester/replay_controller.go @@ -40,6 +40,12 @@ type Flusher interface { // replayController handles coordinating backpressure between WAL replays and chunk flushing. type replayController struct { + // Note, this has to be defined first to make sure it is aligned properly for 32bit ARM OS + // From https://golang.org/pkg/sync/atomic/#pkg-note-BUG: + // > On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to arrange for + // > 64-bit alignment of 64-bit words accessed atomically. The first word in a + // > variable or in an allocated struct, array, or slice can be relied upon to + // > be 64-bit aligned. currentBytes atomic.Int64 cfg WALConfig metrics *ingesterMetrics