From 06917531b301d6fa00f7505918f46c67a531d2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Fri, 23 Sep 2016 20:58:28 +0300 Subject: [PATCH] Move HighWaterMark to the top of the struct in order to fix arm, second time --- pkg/controller/controller_utils.go | 2 ++ pkg/genericapiserver/tunneler.go | 7 +++++-- pkg/storage/cacher.go | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pkg/controller/controller_utils.go b/pkg/controller/controller_utils.go index f8925195628..d7fbd09a33c 100644 --- a/pkg/controller/controller_utils.go +++ b/pkg/controller/controller_utils.go @@ -219,6 +219,8 @@ type Expectations interface { // ControlleeExpectations track controllee creates/deletes. type ControlleeExpectations struct { + // Important: Since these two int64 fields are using sync/atomic, they have 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 add int64 del int64 key string diff --git a/pkg/genericapiserver/tunneler.go b/pkg/genericapiserver/tunneler.go index ea3dfc6e294..6eaae287fb8 100644 --- a/pkg/genericapiserver/tunneler.go +++ b/pkg/genericapiserver/tunneler.go @@ -46,14 +46,17 @@ type Tunneler interface { } type SSHTunneler struct { + // Important: Since these two int64 fields are using sync/atomic, they have 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 + lastSync int64 // Seconds since Epoch + lastSSHKeySync int64 // Seconds since Epoch + SSHUser string SSHKeyfile string InstallSSHKey InstallSSHKey HealthCheckURL *url.URL tunnels *ssh.SSHTunnelList - lastSync int64 // Seconds since Epoch - lastSSHKeySync int64 // Seconds since Epoch lastSyncMetric prometheus.GaugeFunc clock clock.Clock diff --git a/pkg/storage/cacher.go b/pkg/storage/cacher.go index b29ebdb0bf5..7e851037bc2 100644 --- a/pkg/storage/cacher.go +++ b/pkg/storage/cacher.go @@ -130,6 +130,13 @@ func (i *indexedWatchers) terminateAll(objectType reflect.Type) { // Cacher implements storage.Interface (although most of the calls are just // delegated to the underlying storage). type Cacher 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 HighWaterMark + // Incoming events that should be dispatched to watchers. + incoming chan watchCacheEvent + sync.RWMutex // Before accessing the cacher's cache, wait for the ready to be ok. @@ -164,10 +171,6 @@ type Cacher struct { watcherIdx int watchers indexedWatchers - // Incoming events that should be dispatched to watchers. - incoming chan watchCacheEvent - incomingHWM HighWaterMark - // Handling graceful termination. stopLock sync.RWMutex stopped bool