mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-26 10:26:30 +00:00
Random instance selection (#136)
* wip * revert some' * revert more * poor-man's integration test * remove test * fmt * --workspace * fix build * fix integration test * another stab * log * run after integration * cargo test after integration * revert * revert more * Refactor + clean up * more clean up
This commit is contained in:
committed by
GitHub
parent
5948fef6cf
commit
5f5b5e2543
@@ -499,7 +499,6 @@ where
|
||||
// The query router determines where the query is going to go,
|
||||
// e.g. primary, replica, which shard.
|
||||
let mut query_router = QueryRouter::new();
|
||||
let mut round_robin = rand::random();
|
||||
|
||||
// Our custom protocol loop.
|
||||
// We expect the client to either start a transaction with regular queries
|
||||
@@ -631,12 +630,7 @@ where
|
||||
|
||||
// Grab a server from the pool.
|
||||
let connection = match pool
|
||||
.get(
|
||||
query_router.shard(),
|
||||
query_router.role(),
|
||||
self.process_id,
|
||||
round_robin,
|
||||
)
|
||||
.get(query_router.shard(), query_router.role(), self.process_id)
|
||||
.await
|
||||
{
|
||||
Ok(conn) => {
|
||||
@@ -655,8 +649,6 @@ where
|
||||
let address = connection.1;
|
||||
let server = &mut *reference;
|
||||
|
||||
round_robin += 1;
|
||||
|
||||
// Server is assigned to the client in case the client wants to
|
||||
// cancel a query later.
|
||||
server.claim(self.process_id, self.secret_key);
|
||||
|
||||
Reference in New Issue
Block a user