Parent epic: #921
Problem
Several topology paths still use endpoint/address as a way to find or identify an existing host. That conflicts with the target model where host_id is the only stable host identity and endpoint is connectivity metadata.
Known risky areas include:
- control connection refresh logic that searches by endpoint before falling back to
host_id;
Cluster.add_host() behavior that short-circuits on endpoint mappings;
- metadata secondary indexes such as
_host_id_by_endpoint being treated as identity rather than lookup state;
- session pools, load-balancing policies, token maps, and route state that may rely on
Host equality/hash semantics.
Desired behavior
Scope
- Audit host lookup/update callsites in
cassandra/cluster.py, cassandra/metadata.py, cassandra/pool.py, cassandra/policies.py, client routes, and tests.
- Remove endpoint-first host identity decisions when
host_id is available.
- Keep
_host_id_by_endpoint as an index, but make its ownership and update points explicit.
- Update tests that currently expect endpoint-based
Host equality or set/dict behavior.
Acceptance criteria
- Existing host lookup during topology refresh is host-id-first.
- No internal session/pool/policy path depends on endpoint-based
Host equality for identity.
- Endpoint lookup remains available for address-based lookup APIs and event translation.
- Tests cover same endpoint/different
host_id and same host_id/different endpoint detection.
Part of #921. Related to #867 and #382.
Parent epic: #921
Problem
Several topology paths still use endpoint/address as a way to find or identify an existing host. That conflicts with the target model where
host_idis the only stable host identity and endpoint is connectivity metadata.Known risky areas include:
host_id;Cluster.add_host()behavior that short-circuits on endpoint mappings;_host_id_by_endpointbeing treated as identity rather than lookup state;Hostequality/hash semantics.Desired behavior
host_idis known, topology updates resolve hosts byhost_idonly.host_idis treated as a replacement/rebirth, not the same host.host_idwith a different endpoint is passed to the explicit endpoint replacement flow tracked by Introduce explicit endpoint replacement flow for existing host_id #923.Host.__eq__andHost.__hash__no longer depend on endpoint; see Host equality/hash depend on mutable endpoint #867.Scope
cassandra/cluster.py,cassandra/metadata.py,cassandra/pool.py,cassandra/policies.py, client routes, and tests.host_idis available._host_id_by_endpointas an index, but make its ownership and update points explicit.Hostequality or set/dict behavior.Acceptance criteria
Hostequality for identity.host_idand samehost_id/different endpoint detection.Part of #921. Related to #867 and #382.