Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Jul 23, 2024
1 parent 26ec907 commit 396abc4
Show file tree
Hide file tree
Showing 8 changed files with 710 additions and 263 deletions.
12 changes: 12 additions & 0 deletions edb/server/conn_pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,15 @@ more connections are waiting on this block, we return the connection to the
block to be re-used immediately. If no connections are waiting but the block is
hungry, we return it. If the block is satisfied or overfull and we have hungry
blocks waiting, we transfer it to a hungry block that has waiters.

## Error Handling

The pool will attempt to provide a connection where possible, but connection
operations may not always be reliable. The error for a connection failure will
be routed through the acquire operation if the pool detects there are no other
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.

The pool does not currently retry, and retry logic should be included in the
connect operation.
14 changes: 14 additions & 0 deletions edb/server/conn_pool/src/algo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,20 @@ impl PoolConstraints {
);
}

/// Plan a shutdown.
pub fn plan_shutdown(&self, it: &impl VisitPoolAlgoData) -> Vec<RebalanceOp> {
let mut ops = vec![];
it.with_all(|name, block| {
let idle = block.count(MetricVariant::Idle);
let failed = block.count(MetricVariant::Failed);

for _ in 0..(idle + failed) {
ops.push(RebalanceOp::Close(name.clone()));
}
});
ops
}

/// Plan a rebalance to better match the target quotas of the blocks in the
/// pool.
pub fn plan_rebalance(&self, it: &impl VisitPoolAlgoData) -> Vec<RebalanceOp> {
Expand Down
Loading

0 comments on commit 396abc4

Please sign in to comment.