We should fix how we interact with this field or completely remove it.
At least, we have the following problem due to a possible race between BucketSet and RouteMapClean. After setting it to zero (rs.bucketCount.Store(0)) in one goroutine we can subtract 1 from it (oldReplicaset.bucketCount.Add(-1)) in another goroutine, so we end up by getting bucketCount == -1, which is an incorrect value.
We should fix how we interact with this field or completely remove it.
At least, we have the following problem due to a possible race between
BucketSet
andRouteMapClean
. After setting it to zero (rs.bucketCount.Store(0)
) in one goroutine we can subtract 1 from it (oldReplicaset.bucketCount.Add(-1)
) in another goroutine, so we end up by getting bucketCount == -1, which is an incorrect value.