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
(improvement)Optimize DCAwareRoundRobinPolicy by removing redundant state
Refactor `DCAwareRoundRobinPolicy` to simplify distance calculations and memory usage.
Key changes:
- Remove `_hosts_by_distance` and the complex caching of LOCAL hosts.
- `distance()` now checks `host.datacenter` directly for LOCAL calculation, which is correct and static.
- Only cache `_remote_hosts` to efficiently handle `used_hosts_per_remote_dc`.
- Optimize control plane operations (`on_up`, `on_down`) to only rebuild the remote cache when necessary (when remote hosts change or local DC changes).
- This removes the overhead of maintaining a redundant LOCAL cache and ensures correct behavior even if a local host is marked down.
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
0 commit comments