Move HighWaterMark to the top of the struct in order to fix 32-bit platforms

This commit is contained in:
Lucas Käldström 2016-09-20 22:44:56 +03:00
parent 46197a5d13
commit 519379138d

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
}