From 519379138d773bf23fe36cb5b7752c2919ff2878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Tue, 20 Sep 2016 22:44:56 +0300 Subject: [PATCH] Move HighWaterMark to the top of the struct in order to fix 32-bit platforms --- pkg/storage/etcd/etcd_watcher.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/storage/etcd/etcd_watcher.go b/pkg/storage/etcd/etcd_watcher.go index e7bb9adb905..f9b9b391c71 100644 --- a/pkg/storage/etcd/etcd_watcher.go +++ b/pkg/storage/etcd/etcd_watcher.go @@ -61,6 +61,12 @@ func exceptKey(except string) includeFunc { // etcdWatcher converts a native etcd watch to a watch.Interface. type etcdWatcher struct { + // HighWaterMarks for performance debugging. + // Important: Since HighWaterMark is using sync/atomic, it has to be at the top of the struct due to a bug on 32-bit platforms + // See: https://golang.org/pkg/sync/atomic/ for more information + incomingHWM storage.HighWaterMark + outgoingHWM storage.HighWaterMark + encoding runtime.Codec // Note that versioner is required for etcdWatcher to work correctly. // There is no public constructor of it, so be careful when manipulating @@ -90,10 +96,6 @@ type etcdWatcher struct { // Injectable for testing. Send the event down the outgoing channel. emit func(watch.Event) - // HighWaterMarks for performance debugging. - incomingHWM storage.HighWaterMark - outgoingHWM storage.HighWaterMark - cache etcdCache }