feat(pg_pool): PostgreSQL Connection Pool Health Probe with Adaptive Sizing - #166
Merged
JamesEjembi merged 4 commits intoAug 23, 2026
Conversation
…sizing (VeriNode-Labs#134) What was changed: - Added src/pg_pool/mod.rs: new pure-Rust module implementing the full PostgreSQL connection-pool health probe with adaptive sizing as required by issue VeriNode-Labs#134. Provides: * ConnectionPoolState - point-in-time snapshot (utilisation, P99 latency, pending requests, idle/active connection counts). * PoolHealthProbe - stateless probe classifying pools as Healthy / Warning / Degraded / Unavailable using saturation threshold (90%), P99 latency target (100 ms), and consecutive-unhealthy probe counter. * PoolAdaptiveSizer - stateful sizer tracking resize history and consecutive unhealthy probes; enforces cooldown window (30 s), min/max pool-size bounds (2..128), and canary release gate. * PoolCanaryAnalysis - blue-green / canary gate (99.99% success rate, 100 ms P99, security review required). * ConnectionPoolRegistry - multi-service registry with upsert, probe_all, dashboard_snapshot, and 512-pool capacity limit. * System-wide PoolMetricsSnapshot for dashboards and alerting pipelines. * Comprehensive unit tests (39 cases) co-located in the module. * All operational constants derived from issue VeriNode-Labs#134 technical bounds: P99 < 100 ms, 99.99% availability target. - Added tests/pg_pool_health_probe_test.rs: standalone integration-test suite (39 additional cases) covering every public type and all edge cases: utilisation arithmetic, health-state transitions, resize decisions, cooldown enforcement, canary gate boundary conditions, registry upsert / probe-all / capacity limits, and technical-invariant assertions. - Modified src/lib.rs: registered pub mod pg_pool with doc-comment matching the style of every other module in the file. - Modified Cargo.toml: added [[test]] entry for pg_pool_health_probe_test so cargo test discovers and runs the integration tests.
- fix(consensus): replace non-existent u64::saturating_shl with checked_shl in timeout_leader.rs (E0599 compile error on stable) - fix(fmt): apply rustfmt to bls_aggregator.rs, view_change/mod.rs, view_change/resolver.rs, db/mod.rs, db/slashing-store.rs, slashing/accumulator.rs, slashing/condition-engine.rs, slashing/mod.rs, slashing/types.rs, tests/consensus/view_change_partition_test.rs
…y_fragmentation_test - pub mod mem added to lib.rs so sorosusu_contracts::mem::buddy_allocator is reachable from integration tests (E0433: cannot find mem) - pool/mod.rs: declare shard_allocator, shard_defragmenter, tenant_registry sub-modules and re-export all symbols the test imports: ShardAllocator, ShardDefragmenter, TenantRegistry, ShardAllocResult, PoolFragmentationGauge, DefragEvent, bulk_allocate, bulk_free, SHARD_SIZE_BYTES, FRAGMENTATION_ALARM_RATIO, COALESCING_WINDOW_MS (E0432: unresolved imports)
- consensus_engine.rs: move DEADLOCK_VIEW_THRESHOLD import into #[cfg(test)] block (unused-imports in production compilation unit) - consensus_engine.rs: box EquivocationProof in EquivocationDetected variant to fix large-enum-variant (384 vs 40 bytes) - bls_aggregator.rs: replace chunks_exact(4) with as_chunks::<4>().0 to satisfy chunks-exact-to-as-chunks lint - slashing-store.rs: remove redundant & refs in slice comparison (op_ref lint: use bytes[0..8] != SLASHING_STORE_MAGIC directly)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgreSQL Connection Pool Health Probe with Adaptive Sizing
Closes #134
Summary of changes
Implements issue #134: a deterministic, dependency-free PostgreSQL connection-pool health probe with adaptive sizing, following the same architecture and conventions as the existing kafka_consumer (#131) and pool (#139) modules.
New files
Modified files
Key types
Technical bounds (issue #134)
Testing / validation performed
Risks / follow-up notes