Skip to content

Freeze Host identity and topology fields after endpoint replacement path is in place #924

Description

@dkropachev

Parent epic: #921

Problem

Host currently exposes identity/topology fields that can be mutated after construction, especially endpoint and host_id. That makes it easy for internal dictionaries, sets, policies, and pools to observe broken identity semantics.

Freezing these fields too early would only hide existing mutation sites. The endpoint replacement flow must exist first, then Host can become immutable for identity/topology from normal driver code.

Desired behavior

  • Host.host_id is assigned once and is the stable identity.
  • Host.endpoint is not mutated directly by general driver code.
  • Host.__eq__ and Host.__hash__ are stable and do not depend on mutable endpoint state.
  • Runtime health fields remain mutable: up/down state, conviction policy, reconnection handler, and related connection health state.
  • Any remaining topology changes happen through explicit metadata/topology APIs rather than ad hoc field assignment.

Scope

  • Remove or guard direct mutation of Host.host_id and Host.endpoint.
  • Update code paths that previously changed host topology fields directly.
  • Revisit Host.__lt__ so ordering is compatible with host-id identity.
  • Decide compatibility behavior for legacy Host == address comparisons.
  • Update generated C artifacts if required by Python/Cython source changes.

Acceptance criteria

  • Driver code cannot casually mutate Host.host_id or Host.endpoint.
  • hash(host) remains stable for the lifetime of the Host object.
  • Equality and hash semantics are internally consistent.
  • Existing health state mutation continues to work.
  • Unit tests cover immutability/guard behavior and compatibility decisions.

Part of #921. Depends on #922 and #923. Related to #867.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions