Support multiple routing tables (one per database) #244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for multi-database connections, so each database has its own routing table saved (and refreshed) on the driver side. It introduces significant enhancements to the connection management and routing logic in the codebase.
It also updates to TLS configuration handling (only load certificates if needed).
Database-specific routing and connection management:
lib/src/graph.rs
: Updated methods to include an optionaldb
parameter for database-specific connection retrieval. This ensures operations can target specific databases when required. [1] [2] [3] [4]lib/src/routing/routed_connection_manager.rs
: EnhancedRoutedConnectionManager
to support database-specific routing tables and connections. Added logic to refresh routing tables dynamically when empty and introduced a maximum wait time for routing table updates. [1] [2] [3] [4]Load-balancing strategy improvements:
lib/src/routing/load_balancing/round_robin_strategy.rs
: RefactoredRoundRobinStrategy
to utilize aConnectionRegistry
for tracking all servers. Improved the selection logic to handle scenarios where servers are unavailable or have been used. Updated tests to validate the new behavior. [1] [2] [3] [4]TLS configuration updates:
lib/src/connection.rs
: Simplified TLS configuration logic by removing redundant warnings and restructuring theClientConfig
initialization process. [1] [2]Routing table provider updates:
lib/src/routing/routing_table_provider.rs
: Extended theRoutingTableProvider
trait and its implementation to support database-specific routing table retrieval. This aligns with the changes in connection management. [1] [2] [3]Logging and diagnostics improvements:
lib/src/pool.rs
: Enhanced logging to include the node URI when creating connection pools, providing better visibility into pool initialization.