From 8b851ea8ae77529b5d7a07c9f23260e1245dd7be Mon Sep 17 00:00:00 2001 From: Burak Sezer Date: Sat, 1 May 2021 20:38:52 +0300 Subject: [PATCH] fix: 64-bit alignment of 64-bit words accessed atomically --- client/stream.go | 2 +- internal/cluster/routingtable/routingtable.go | 44 +++++++++---------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/client/stream.go b/client/stream.go index 2e73d06c..4610994e 100644 --- a/client/stream.go +++ b/client/stream.go @@ -57,10 +57,10 @@ func newListener() *listener { type stream struct { mu sync.RWMutex + pongReceivedAt int64 listeners map[uint64]*listener read chan protocol.EncodeDecoder write chan protocol.EncodeDecoder - pongReceivedAt int64 errCh chan error ctx context.Context cancel context.CancelFunc diff --git a/internal/cluster/routingtable/routingtable.go b/internal/cluster/routingtable/routingtable.go index 710f4412..258d0cd7 100644 --- a/internal/cluster/routingtable/routingtable.go +++ b/internal/cluster/routingtable/routingtable.go @@ -45,36 +45,32 @@ type route struct { type RoutingTable struct { sync.RWMutex // routingMtx - // These values is useful to control operation status. - bootstrapped int32 - - updateRoutingMtx sync.Mutex - - table map[uint64]*route - - // consistent hash ring implementation. - consistent *consistent.Consistent - // numMembers is used to check cluster quorum. numMembers int32 // Currently owned partition count. Approximate LRU implementation // uses that. ownedPartitionCount uint64 signature uint64 - this discovery.Member - members *Members - config *config.Config - log *flog.Logger - primary *partitions.Partitions - backup *partitions.Partitions - client *transport.Client - discovery *discovery.Discovery - callbacks []func() - callbackMtx sync.Mutex - updatePeriod time.Duration - ctx context.Context - cancel context.CancelFunc - wg sync.WaitGroup + // These values is useful to control operation status. + bootstrapped int32 + + updateRoutingMtx sync.Mutex + table map[uint64]*route + consistent *consistent.Consistent + this discovery.Member + members *Members + config *config.Config + log *flog.Logger + primary *partitions.Partitions + backup *partitions.Partitions + client *transport.Client + discovery *discovery.Discovery + callbacks []func() + callbackMtx sync.Mutex + updatePeriod time.Duration + ctx context.Context + cancel context.CancelFunc + wg sync.WaitGroup } func New(e *environment.Environment) *RoutingTable {