Fix compile warnings, minor cleanup.

This commit is contained in:
Elizabeth Murray
2025-05-26 06:30:48 -07:00
parent 014823b305
commit 7c9bd542a6
4 changed files with 6 additions and 31 deletions

View File

@@ -12,7 +12,7 @@ tonic.workspace = true
tracing.workspace = true
tokio = { version = "1.43.1", features = ["full", "macros", "net", "io-util", "rt", "rt-multi-thread"] }
uuid = { version = "1", features = ["v4"] }
tower = { version = "0.4", features = ["timeout"] }
tower = { version = "0.4", features = ["timeout", "util"] }
rand = "0.8"
tokio-util = { version = "0.7", features = ["compat"] }
hyper-util = "0.1.9"

View File

@@ -1,8 +1,7 @@
use std::{
collections::{BinaryHeap, HashMap},
collections::{HashMap},
sync::{
Arc,
atomic::{AtomicUsize, Ordering},
},
time::{Duration, Instant},
io::{self, Error, ErrorKind},
@@ -11,7 +10,7 @@ use std::{
use priority_queue::PriorityQueue;
use tokio::{
sync::{Mutex, mpsc, watch, Semaphore, OwnedSemaphorePermit},
sync::{Mutex, Semaphore, OwnedSemaphorePermit},
time::sleep,
net::TcpStream,
io::{AsyncRead, AsyncWrite, ReadBuf},
@@ -32,31 +31,10 @@ use rand::{
SeedableRng
};
use tower::service_fn;
use http::Uri;
use hyper_util::rt::TokioIo;
use bytes::BytesMut;
use futures::future;
use http::Uri;
use hyper_util::rt::TokioIo;
use rand::{Rng, SeedableRng, rngs::StdRng};
use std::io::{self, Error, ErrorKind};
use std::{
pin::Pin,
task::{Context, Poll},
};
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio::net::TcpStream;
use tower::service_fn;
use uuid;
use metrics::{
{Encoder, TextEncoder},
proto::MetricFamily,
};
// use info
use tracing::info;
use tokio_util::sync::CancellationToken;
@@ -240,7 +218,6 @@ pub struct PooledClient {
pool: Arc<ConnectionPool>,
id: uuid::Uuid,
permit: OwnedSemaphorePermit,
is_ok: bool,
}
impl ConnectionPool {
@@ -356,7 +333,7 @@ impl ConnectionPool {
// Pop the highest-active-consumers connection. There are no connections
// in the heap that have more than max_consumers active consumers.
if let Some((id, cons)) = inner.pq.pop() {
if let Some((id, _cons)) = inner.pq.pop() {
let entry = inner.entries.get_mut(&id)
.expect("pq and entries got out of sync");
@@ -369,7 +346,6 @@ impl ConnectionPool {
pool: Arc::clone(&self),
id,
permit: permit,
is_ok: true,
};
// reinsert with updated priority
@@ -437,7 +413,6 @@ impl ConnectionPool {
let mut inner = self_clone.inner.lock().await;
inner.waiters += 1;
if inner.waiters >= (inner.in_progress * self_clone.max_consumers) {
semaphore = Arc::clone(&self_clone.channel_semaphore);
let self_clone_spawn = Arc::clone(&self_clone);
tokio::task::spawn(async move {
self_clone_spawn.create_connection().await;

View File

@@ -22,7 +22,7 @@ use utils::shard::ShardIndex;
use std::fmt::Debug;
mod client_cache;
use metrics::{IntCounter, IntCounterVec, core::Collector};
use metrics::{IntCounterVec, core::Collector};
#[derive(Error, Debug)]
pub enum PageserverClientError {

View File

@@ -171,7 +171,7 @@ pub(crate) fn main(args: Args) -> anyhow::Result<()> {
})
}
async fn get_metrics(State(state): State<Arc<pageserver_client_grpc::PageserverClientAggregateMetrics>>) -> Response {
use metrics::core::Collector;
let metrics = state.collect();
info!("metrics: {metrics:?}");