Skip to content

Conversation

@dave42w
Copy link
Contributor

@dave42w dave42w commented Dec 27, 2025

Description

This adds a ConnectionPool instance to the rust binding Database. The default is for it to not be enabled, so same behaviour as default.

Motivation and context

The goal is to save execution time with a transparent ConnectionPool

Description of AI Usage

No AI used

@dave42w dave42w requested a review from penberg as a code owner December 27, 2025 00:01
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @jussisaurio

@dave42w dave42w marked this pull request as draft December 27, 2025 00:05
@dave42w
Copy link
Contributor Author

dave42w commented Dec 27, 2025

If the ConnectionPool is turned on then one test fails:

failures:

---- tests::test_database_persistence_many_frames stdout ----

thread 'tests::test_database_persistence_many_frames' panicked at bindings/rust/src/lib.rs:525:22:
Query succeeded after WAL deletion and DB reopen, but was expected to fail because the table definition should have been in the WAL.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    tests::test_database_persistence_many_frames

test result: FAILED. 11 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s

I think the issue is with the way Connection drop "recycles" Connections into the ConenctionPool. As drop cannot (yet) be async, we can't call self.maybe_handle_dangling_tx().await?;

I'd love some feedback on how to resolve this (maybe something better than cloning the inner Connection in drop?)

pool size by an order of magnitude if it is full. That would mean that
available_connections would not be considered dead code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant