KaymeKaydex / go-vshard-router

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

Delete a replicaset from bucket map when this replicaset is removed from the cluster #59

Open nurzhan-saktaganov opened 2 months ago

nurzhan-saktaganov commented 2 months ago

In RemoveReplicaset we remove replicaset from idToReplicaset map and close its connection pool. But in routeMap we may still have pointers to this replicaset. This looks like a buggy behavior.

The straightforward solution with replacing to nil all elements of routeMap, that hold this pointer, doesn't work. Because there might be a discovering goroutine that holds an old value of idToReplicaset that is still in progress. Therefore, we need a bit more smart solution.