Skip to content

Use routers to fetch routing tables#280

Merged
madchicken merged 6 commits into
mainfrom
use-routers
Jan 14, 2026
Merged

Use routers to fetch routing tables#280
madchicken merged 6 commits into
mainfrom
use-routers

Conversation

@madchicken
Copy link
Copy Markdown
Collaborator

This PR aims to use the list of router servers the cluster provides to fetch the routing table for a specific DB.
With these modifications we also fix the fact that when asking for the default DB the driver was not using any connection pool, but it was creating a direct connection to the main cluster URL using the provided configuration (causing the whole TLS handshacking to happen every time).

The main changes introduce the concept of a "router" server pool, update the interfaces and implementations to propagate this information, and add round-robin selection for routers. The changes also update tests and documentation accordingly.

Routing and Connection Management Enhancements:

  • Added support for passing and selecting a "router" (ConnectionPool) throughout the routing and connection registry APIs, including in servers, fetch_routing_table, and get_default_db methods. This allows more efficient and flexible routing table fetching and server selection. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  • The RoutingTableProvider trait and its ClusterRoutingTableProvider implementation now accept an optional router connection pool, using it to obtain connections for routing table queries. [1] [2] [3] [4]

Load Balancing Improvements:

  • Extended the LoadBalancingStrategy trait and RoundRobinStrategy to support router selection, including a new router_index for round-robin router selection. Added the select_router method and logic to filter and sort routers for consistent selection. [1] [2] [3] [4]

Documentation and API Quality:

  • Improved documentation for session creation and default database retrieval in the Graph implementation, clarifying caching and session behavior.

Test Updates:

  • Updated tests to pass the new router parameter where required and to reflect the updated APIs, ensuring continued coverage and correctness. [1] [2] [3] [4] [5] [6]

@madchicken madchicken self-assigned this Dec 17, 2025
@madchicken madchicken marked this pull request as ready for review December 18, 2025 13:58
@madchicken
Copy link
Copy Markdown
Collaborator Author

@knutwalker this is now ready to be reviewed, we tested it against a real cluster

@madchicken
Copy link
Copy Markdown
Collaborator Author

@knutwalker any chance to have this PR merged?

@knutwalker
Copy link
Copy Markdown
Contributor

@madchicken i'll look at it next week

Copy link
Copy Markdown
Contributor

@knutwalker knutwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
There's a small typo in a doc comment, I'll leave it to you to merge

Comment thread lib/src/graph.rs Outdated
@knutwalker
Copy link
Copy Markdown
Contributor

Sorry, just merged #275 and it introduced a conflict with your changes. Once rebased, you should also be getting the now updated CI builds for the status checks

@madchicken madchicken merged commit 62a167a into main Jan 14, 2026
10 checks passed
@madchicken madchicken deleted the use-routers branch January 14, 2026 14:46
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