Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Jul 23, 2024
1 parent 138528c commit 654d6a6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
6 changes: 0 additions & 6 deletions edb/server/conn_pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,5 @@ potential sources for a connection for the acquire. Sources for a connection may
be a currently-connecting connection, a reconnecting connection, a connection
that is actively held by someone else or a connection that is sitting idle.

If an acquire operation is queued for a connection, and a block's last
connection becomes invalid due to an error, and the operation is next in line,
that operation will fail, returning the error as the failure reason. The
remainder of the connections that are queued will continue to await a connection
and, if the error is persistent, will eventually return errors as well.

The pool does not currently retry, and retry logic should be included in the
connect operation.
9 changes: 2 additions & 7 deletions edb/server/conn_pool/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,6 @@ impl<C: Connector> Conns<C> {
self.conns.borrow().len()
}

#[inline]
pub fn is_empty(&self) -> bool {
self.conns.borrow().is_empty()
}

#[inline]
pub fn youngest(&self) -> Duration {
self.youngest.get().elapsed()
Expand Down Expand Up @@ -479,7 +474,7 @@ impl<C: Connector> Conns<C> {
let range: &mut dyn Iterator<Item = usize> = if mru {
&mut (0..lock.len()).rev()
} else {
&mut (0..lock.len()).into_iter()
&mut (0..lock.len())
};
for pos in range {
return match lock[pos].variant() {
Expand All @@ -492,7 +487,7 @@ impl<C: Connector> Conns<C> {
MetricVariant::Failed => {
trace!("Got an error");
let conn = lock.swap_remove(pos);
conn.untrack(&metrics);
conn.untrack(metrics);

// We know that a removed connection cannot have a handle active, so the
// `Rc` unwrap will always succeed.
Expand Down
13 changes: 0 additions & 13 deletions edb/server/conn_pool/src/waitqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@ impl WaitQueue {
}
}

pub fn trigger_all(&self) {
trace!("Trigginging all waiters");
while let Some(front) = self.waiters.borrow_mut().pop_front() {
if front.gc.get() {
trace!("Tossing away a GC'd entry");
continue;
}
trace!("Triggered a waiter");
front.woke.set(true);
front.waker.wake_by_ref();
}
}

pub async fn queue(&self) {
trace!("Queueing");
let waker = poll_fn(|cx| Poll::Ready(cx.waker().clone())).await;
Expand Down

0 comments on commit 654d6a6

Please sign in to comment.