Merge pull request #33117 from luxas/fix_arm_atomics

Automatic merge from submit-queue

Move HighWaterMark to the top of the struct in order to fix arm

I haven't tested this yet, but let's see how e2e tests react.
It should be no difference at all except for that it will fix arm.

etcd has had to do this some times (and I think there are some fixes like this that are needed for etcd as well)

For reference see: https://golang.org/pkg/sync/atomic/

This should be a cherrypick-candidate for v1.4.1 (as I understand it, v1.4.0 has clearly left the cherrypickable state)

@lavalamp @pwittrock @xiang90 @smarterclayton
This commit is contained in:
Kubernetes Submit Queue 2016-09-20 15:50:43 -07:00 committed by GitHub
commit c5837baf0e

View File

@ -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
}