Skip to content

Commit 8b1acc3

Browse files
committed
Merge Fix alignment bug on 32-bit platforms in new rackAwareRR code (#1666)
2 parents fe55d80 + 6d279ed commit 8b1acc3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

policies.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,14 @@ func (d *dcAwareRR) Pick(q ExecutableQuery) NextHost {
904904
// a different rack, before hosts in all other datercentres
905905

906906
type rackAwareRR struct {
907+
// lastUsedHostIdx keeps the index of the last used host.
908+
// It is accessed atomically and needs to be aligned to 64 bits, so we
909+
// keep it first in the struct. Do not move it or add new struct members
910+
// before it.
911+
lastUsedHostIdx uint64
907912
localDC string
908913
localRack string
909914
hosts []cowHostList
910-
lastUsedHostIdx uint64
911915
}
912916

913917
func RackAwareRoundRobinPolicy(localDC string, localRack string) HostSelectionPolicy {

0 commit comments

Comments
 (0)