Client tweaks

This commit is contained in:
Erik Grinaker
2025-07-03 14:54:23 +02:00
parent 14214eb853
commit 6f8650782f
2 changed files with 8 additions and 6 deletions

2
Cargo.lock generated
View File

@@ -1358,6 +1358,7 @@ dependencies = [
"metrics",
"neon-shmem",
"nix 0.30.1",
"pageserver_api",
"pageserver_client_grpc",
"pageserver_page_api",
"prometheus",
@@ -4605,6 +4606,7 @@ dependencies = [
"async-trait",
"bytes",
"chrono",
"compute_api",
"dashmap 5.5.0",
"futures",
"http 1.1.0",

View File

@@ -2,25 +2,25 @@ use std::collections::HashMap;
use std::sync::Arc;
use anyhow::anyhow;
use tokio::time::Instant;
use tracing::{error, info, instrument, warn};
use crate::pool::{ChannelPool, ClientGuard, ClientPool, StreamGuard, StreamPool};
use compute_api::spec::PageserverProtocol;
use pageserver_api::key::{Key, rel_block_to_key};
use pageserver_api::shard::{ShardStripeSize, key_to_shard_number};
use pageserver_page_api as page_api;
use tokio::time::Instant;
use tracing::{error, info, instrument, warn};
use utils::backoff::exponential_backoff_duration;
use utils::id::{TenantId, TimelineId};
use utils::shard::{ShardCount, ShardIndex, ShardNumber};
use crate::pool::{ChannelPool, ClientGuard, ClientPool, StreamGuard, StreamPool};
/// A rich Pageserver gRPC client for a single tenant timeline. This client is more capable than the
/// basic `page_api::Client` gRPC client, and supports:
///
/// * Sharded tenants across multiple Pageservers.
/// * Pooling of connections, clients, and streams for efficient resource use.
/// * Concurrent use by many callers.
/// * Internal handling of GetPage bidirectional streams.
/// * Internal handling of GetPage bidirectional streams, with pipelining and error handling.
/// * Automatic retries.
/// * Observability.
///
@@ -337,7 +337,7 @@ impl Shards {
///
/// TODO: consider separate pools for normal and bulk traffic, with different settings.
struct Shard {
/// Dedicated channel pool for this shard. Used by all clients/streams in this shard.
/// Dedicated channel pool for this shard. Shared by all clients/streams in this shard.
_channel_pool: Arc<ChannelPool>,
/// Unary gRPC client pool for this shard. Uses the shared channel pool.
client_pool: Arc<ClientPool>,