fix(universaldb): stop postgres commits from starving the connection pool - #5685
Conversation
…for the periodic tick
…d of stalling until expiry
|
Stack for rivet-dev/actors
Get stack: change knwntqqs |
|
Review Correction to my previous review on this PR: I previously wrote that "committing the read tx and Critical: the core fix is not actually applied ( let _ = tx.commit().await;
// NEGCONTROL drop(conn);
let result =
commit::submit(&self.shared, read_version, operations, conflict_ranges)
.await;The comment directly above this ("end it and hand the pooled connection back before awaiting the leader...") describes dropping This same file also has several Why this does not fail the new tests: the separate Fix: uncomment Other observations
Bottom line Do not merge as-is: the headline fix for postgres commits starving the connection pool is currently a no-op due to the commented-out 🤖 Generated with Claude Code |
aa77ba6 to
e0e0344
Compare
| // occupy every slot in the pool the leader drain loop draws from, so the commits | ||
| // they are waiting on can never be applied. | ||
| let _ = tx.commit().await; | ||
| // NEGCONTROL drop(conn); |
There was a problem hiding this comment.
🔴 High · Release the follower connection before submitting
tx.commit() ends the read-only transaction, but conn remains owned by this task until after commit::submit(...).await returns. Every writer can therefore still occupy a follower-pool slot while waiting for the drain loop, reproducing the exact circular wait this change describes; pool_starvation_single_node will time out with its four-slot configuration.
Drop conn immediately after committing the snapshot and before awaiting submission.
| let batch_len = jobs.len(); | ||
|
|
||
| let pool_wait_start = Instant::now(); | ||
| let mut conn = shared |
There was a problem hiding this comment.
🔴 High · Run leader work on the reserved pool
The new leader_pool is constructed and stored, but all resolver operations still use shared.pool, including this drain checkout and lease acquire/renew/release. Saturating follower connections therefore still blocks drain and lease renewal; the new reserved-pool test will observe an expired lease rather than its asserted renewal.
Use shared.leader_pool consistently for the resolver's lease and drain operations.
| .with_env_filter("warn") | ||
| .with_test_writer() | ||
| .try_init(); | ||
|
|
There was a problem hiding this comment.
🟠 Medium · Exclude the manual reproduction harness from normal tests
This test reads REPRO_PG_PORT and REPRO_NATS_PORT before it creates any test resources, and env_port panics when they are unset. Since it is an ordinary #[tokio::test], every standard cargo test -p universaldb run now fails on a clean CI/developer environment.
Mark this manual reproduction test #[ignore] (with a run instruction), or provision its dependencies through the normal test container helpers.
No description provided.