Skip to content

Commit

Permalink
proxy: move the connection pools to separate file (#9398)
Browse files Browse the repository at this point in the history
First PR for #9284
Start unification of the client and connection pool interfaces:
- Exclude the 'global_connections_count' out from the get_conn_entry()
- Move remote connection pools to the conn_pool_lib as a reference
- Unify clients among all the conn pools
  • Loading branch information
awarus authored Oct 17, 2024
1 parent db68e82 commit 22d8834
Show file tree
Hide file tree
Showing 7 changed files with 704 additions and 635 deletions.
13 changes: 7 additions & 6 deletions proxy/src/serverless/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use tokio::net::{lookup_host, TcpStream};
use tracing::field::display;
use tracing::{debug, info};

use super::conn_pool::{poll_client, Client, ConnInfo, GlobalConnPool};
use super::http_conn_pool::{self, poll_http2_client};
use super::conn_pool::poll_client;
use super::conn_pool_lib::{Client, ConnInfo, GlobalConnPool};
use super::http_conn_pool::{self, poll_http2_client, Send};
use super::local_conn_pool::{self, LocalClient, LocalConnPool};
use crate::auth::backend::local::StaticAuthRules;
use crate::auth::backend::{ComputeCredentials, ComputeUserInfo};
Expand All @@ -31,7 +32,7 @@ use crate::rate_limiter::EndpointRateLimiter;
use crate::{compute, EndpointId, Host};

pub(crate) struct PoolingBackend {
pub(crate) http_conn_pool: Arc<super::http_conn_pool::GlobalConnPool>,
pub(crate) http_conn_pool: Arc<super::http_conn_pool::GlobalConnPool<Send>>,
pub(crate) local_pool: Arc<LocalConnPool<tokio_postgres::Client>>,
pub(crate) pool: Arc<GlobalConnPool<tokio_postgres::Client>>,
pub(crate) config: &'static ProxyConfig,
Expand Down Expand Up @@ -199,7 +200,7 @@ impl PoolingBackend {
&self,
ctx: &RequestMonitoring,
conn_info: ConnInfo,
) -> Result<http_conn_pool::Client, HttpConnError> {
) -> Result<http_conn_pool::Client<Send>, HttpConnError> {
info!("pool: looking for an existing connection");
if let Some(client) = self.http_conn_pool.get(ctx, &conn_info) {
return Ok(client);
Expand Down Expand Up @@ -481,7 +482,7 @@ impl ConnectMechanism for TokioMechanism {
}

struct HyperMechanism {
pool: Arc<http_conn_pool::GlobalConnPool>,
pool: Arc<http_conn_pool::GlobalConnPool<Send>>,
conn_info: ConnInfo,
conn_id: uuid::Uuid,

Expand All @@ -491,7 +492,7 @@ struct HyperMechanism {

#[async_trait]
impl ConnectMechanism for HyperMechanism {
type Connection = http_conn_pool::Client;
type Connection = http_conn_pool::Client<Send>;
type ConnectError = HttpConnError;
type Error = HttpConnError;

Expand Down
Loading

1 comment on commit 22d8834

@github-actions
Copy link

Choose a reason for hiding this comment

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

5202 tests run: 4992 passed, 3 failed, 207 skipped (full report)


Failures on Postgres 16

Failures on Postgres 14

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_layer_download_timeouted[release-pg14] or test_logging_event_count[release-pg16-info] or test_slow_secondary_downloads[release-pg16-False]"
Flaky tests (7)

Postgres 17

Postgres 16

Postgres 15

Postgres 14

Test coverage report is not available

The comment gets automatically updated with the latest test results
22d8834 at 2024-10-17T11:35:11.588Z :recycle:

Please sign in to comment.