Commit ecdeb02
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
- crates
- cold-sql/src
- cold/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
0 commit comments