You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* `ConnectionPools` which is a map from addresses to connection pools
* `RoutingTable` which contains addresses for routers, writers, and readers
For a routing driver, once an address is removed from the current `RoutingTable`, the address is no longer accessable. a.k.a. no new connection will be created in the corresponding connection pool.
When updating routing table, we also need to signal the addresses in `ConnectionPools` to be active if they are newly added into the current routing table or passive if they have already been removed from the routing table. For the pools connected to addresses that have been removed, when a connection is free, the connection should be terminated rather than reused. When there is no connection in the pool, the pool could be safely removed from `ConnectionPools`.
So the logic that need to be changed:
* When a new `RoutingTable` is available, compute
`added_addr = distinct_addr_in(new_routingTable) - distinct_addr_in(pre_routingTable)`
`removed_addr = distinct_addr_in(pre_routingTable) - distinct_addr_in(new_routingTable)`
* Mark all addresses in set `added_addr` in `ConnectionPools` to be `active` connection pools
* Mark all addresses in set `removed_addr` in `ConnectionPools` to be `passive` connection pools
* Remove `passive` connection pools if no connection is `inUse` (all connections are idle)
* When returning a connection to a `passive` connection pool, terminate the connection directly, [and remove the connection pool if no connections is `InUse`]
0 commit comments