Sitelet https://github.com/init4tech/storage/commit/ecdeb0201d1dbbe3939f221430eb8a751d070953
Skip to content

Commit ecdeb02

Browse files
prestwichclaude
andauthored
fix(cold-sql): pool starvation and query inefficiencies (#45)
* fix(cold-sql): pool starvation and query inefficiencies (#45) - Add per-backend pool defaults and SqlConnector builder - Add safety checks to integer conversions - Replace get_logs COUNT+SELECT with single LIMIT query - Consolidate get_receipt and batch drain_above - Bump workspace version to 0.7.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove docs files and add docs/ to gitignore Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor(cold-sql): replace PoolOverrides with sqlx PoolOptions Remove the custom `PoolOverrides` struct and accept `sqlx::pool::PoolOptions<Any>` directly, giving callers the full sqlx pool configuration surface. Only force `max_connections = 1` for in-memory SQLite URLs where per-connection state isolation requires it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(cold-sql): mirror PoolOptions builder methods on SqlConnector Add convenience builder methods on SqlConnector for the most common pool settings: max_connections, min_connections, acquire_timeout, max_lifetime, and idle_timeout. The full PoolOptions can still be set via with_pool_options. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(cold-sql): correctness and cleanup in drain_above and get_receipt - Use from_i64 for prior_cumulative_gas (was bypassing debug assertion) - Use actual tx_index from DB row instead of enumerate index in drain_above - Read first_log_index from DB instead of recomputing in drain_above - Add debug_assert on gas_used subtraction for corruption detection - Import BTreeMap at file top instead of inline fully-qualified paths - Remove dead r_tx_index column from combined get_receipt query - Extract shared delete_above_in_tx helper from truncate/drain_above Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test(cold): add regression coverage for drain_above receipt fields Enhance conformance tests to verify receipt properties that were previously only checked as counts: - test_drain_above: assert transaction_index, first_log_index (via log_index), gas_used, tx_hash, from, block_hash, block_timestamp on all drained receipts across multiple blocks - test_cold_receipt_metadata: verify all fields on get_receipts_in_block results (was only checking gas_used) - test_confirmation_metadata: add tx_hash and from assertions on receipt lookups Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(cold-sql): use explicit column lists in batch receipt queries Replace `r.*` with explicit column lists in `drain_above` and `get_receipts_in_block` to avoid potential column name collisions from the JOIN with the transactions table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 97c46ef commit ecdeb02

7 files changed

Lines changed: 433 additions & 119 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
Cargo.lock
44
.idea/
55
.claude/*
6-
!.claude/skills/
6+
!.claude/skills/
7+
docs/

‎Cargo.toml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.6.9"
6+
version = "0.7.0"
77
edition = "2024"
88
rust-version = "1.92"
99
authors = ["init4"]
@@ -35,13 +35,13 @@ incremental = false
3535

3636
[workspace.dependencies]
3737
# internal
38-
signet-hot = { version = "0.6.9", path = "./crates/hot" }
39-
signet-hot-mdbx = { version = "0.6.9", path = "./crates/hot-mdbx" }
40-
signet-cold = { version = "0.6.9", path = "./crates/cold" }
41-
signet-cold-mdbx = { version = "0.6.9", path = "./crates/cold-mdbx" }
42-
signet-cold-sql = { version = "0.6.9", path = "./crates/cold-sql" }
43-
signet-storage = { version = "0.6.9", path = "./crates/storage" }
44-
signet-storage-types = { version = "0.6.9", path = "./crates/types" }
38+
signet-hot = { version = "0.7.0", path = "./crates/hot" }
39+
signet-hot-mdbx = { version = "0.7.0", path = "./crates/hot-mdbx" }
40+
signet-cold = { version = "0.7.0", path = "./crates/cold" }
41+
signet-cold-mdbx = { version = "0.7.0", path = "./crates/cold-mdbx" }
42+
signet-cold-sql = { version = "0.7.0", path = "./crates/cold-sql" }
43+
signet-storage = { version = "0.7.0", path = "./crates/storage" }
44+
signet-storage-types = { version = "0.7.0", path = "./crates/types" }
4545

4646
# External, in-house
4747
signet-libmdbx = { version = "0.8.0" }

0 commit comments

Comments
 (0)