Skip to content

driver_config: report connection.node-preference #1002

Description

@nikagra

Problem

Schema v1 has two node-preference slots, both $ref-ing #/$defs/node-location-preference:

  • query.load-balancing.node-preference — "Defines part of the cluster queries will be scheduled on"
  • connection.node-preference — "Defines part of the cluster driver holds connections to"

DRIVER_CONFIG phase 2 (#997) emits only the first (cassandra/driver_config.py:1004). The
connection group (_connection_report, :1243) carries no node-preference at all, so an
operator reading the report cannot tell which nodes the driver actually holds pools to.

The two are not the same value. Pool membership is decided by ProfileManager.distance()
(cassandra/cluster.py:479), which is the union across every execution profile:

distances = set(p.load_balancing_policy.distance(host) for p in self.profiles.values())

and DCAwareRoundRobinPolicy.distance (cassandra/policies.py:278) returns IGNORED for a
remote-DC host while used_hosts_per_remote_dc == 0. So with the default of 0 no pool opens
outside the local DC, while a profile pinned to another DC widens the pool set without
changing what the default profile's query.load-balancing.node-preference says.

Every other ScyllaDB/Cassandra driver reports this: java-driver 4.x from
toDatacenterPreference(), csharp across profiles, gocql from the HostFilter.

What to decide

  • Divergent profiles. A single node-location-preference object cannot express "dc1 for
    profile A, dc2 for profile B". Omitting the key when profiles disagree is probably right —
    the schema makes it optional — but it needs stating and testing.
  • Which policy in a chain. _survey_policy_chain (:832) already walks _child_policy
    and hands back the location-aware link; the connection-level answer has to do that per
    profile, not once.
  • pools_allowed. ProfileManager.distance short-circuits to IGNORED when it is false,
    i.e. the driver holds no pools at all. The schema has no way to say that.

Reusable pieces

  • _node_location_preference_report(policy) (cassandra/driver_config.py:872) already builds
    the value from a policy and needs no change.
  • _survey_policy_chain(policy) (:832) finds the location-aware link in a chain.
  • tests/resources/driver-config-schema-v1.json already defines the key, so this is a
    reporting gap, not a schema change.

Why it is not in #997

Raised there as a review question and deliberately deferred: it is a new key with the
profile-aggregation question above to settle, and #997 is already +6348/-73.

Refs: #997 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions