KaymeKaydex / go-vshard-router

go vshard-router implementation for tarantool
MIT License
21 stars 3 forks source link

An inconsistent value of field `bucketCount` of struct `Replicaset` #44

Closed nurzhan-saktaganov closed 2 months ago

nurzhan-saktaganov commented 3 months ago

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.