Skip to content

Dk/remove random ids#2

Draft
dkropachev wants to merge 10 commits intodkropachev:masterfrom
scylladb:dk/remove_random_ids
Draft

Dk/remove random ids#2
dkropachev wants to merge 10 commits intodkropachev:masterfrom
scylladb:dk/remove_random_ids

Conversation

@dkropachev
Copy link
Copy Markdown
Owner

No description provided.

sylwiaszunejko and others added 10 commits January 9, 2026 14:45
… starting point

The `test_profile_lb_swap` test logic assumed that `populate`
was called before control connection (cc) was created, meaning
only the contact points from the cluster configuration were
known (a single host). Due to that the starting point was not random.

This commit updates the test to reflect the new behavior, where `populate`
is called on the load-balancing policy after the control connection is
created. This allows the policy to be updated with all known hosts and
ensures the starting point is properly randomized.
Previously, the driver relied on the load-balancing policy (LBP) to determine
the order of hosts to connect to. Since the default LBP is Round Robin, each
reconnection would start from a different host.

After removing fake hosts with random IDs at startup, this behavior changed.
When the LBP is not yet initialized, the driver now uses the endpoints provided
by the control connection (CC), so there is no guarantee that different hosts
will be selected on reconnection.

This change updates the test logic to first establish a connection and
initialize the LBP, and only then verify that two subsequent reconnections
land on different hosts in a healthy cluster.
Only compare hosts endpoints not whole Host instances as we
don't know hosts ids.
In DC aware lbp when local_dc is not provided we set it in
on_add and it needs to be initialized for distance to give
proper results.
Previously, we used endpoints provided to the cluster to create Host
instances with random host_ids in order to populate the LBP before the
ControlConnection was established. This logic led to creating many
connections that were opened and then quickly closed, because once we
learned the correct host_ids from system.peers, we removed the old Hosts
with random IDs and created new ones with the proper host_ids.

This commit introduces a new approach. To establish the ControlConnection,
we now use only the resolved contact points from the cluster configuration.
Only after a successful connection do we populate Host information in the
LBP. If the LBP is already initialized during ControlConnection
reconnection, we reuse the existing values.
@dkropachev dkropachev force-pushed the dk/remove_random_ids branch from 6707b0b to 37ee428 Compare January 9, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants