-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrent sandbox support with begin concurrent #99
Comments
I wonder what the drawback is for using |
A concurrent transaction can fail to commit as a whole, so I think outside of concurrent tests, it should certainly be opt-in behavior. |
I think
In the stock version it fails during parsing: sqlite> BEGIN CONCURRENT;
Parse error: near "CONCURRENT": syntax error
BEGIN CONCURRENT;
^--- error here |
It's a shame that |
However, it seems like that custom build + sandbox work :) |
Given this project ships with sqlite3, maybe we can ship with the begin concurrent version? |
Personally, I'd prefer running the official releases. Also
Is there maybe another way to enable concurrent tests? Like starting and migrating
|
This is generally my feelings as well. I haven't followed this feature too closely and don't know if it is going to be mainlined.
I believe we'd need to change a few things in order to take that amalgamation work. It would need to be automated here and the following would cause tests to break:
|
If the I like the idea of testing against an in-memory database, and I think I explored that approach at one point. However, it has some friction with how the existing Sandbox adapter works and ends up feeling hacky. To expand, the current adapter has normal connections, but proxies those connections and does the necessary transaction wrapping statements on checkout/checkin. This allows e.g., Ecto migrations to run as expected, as this proxying is only enabled once the If we follow a similar mechanism, what we want need to do in our custom Sandbox adapter is to, on checkout when |
Why not use the in-memory databases from the start? It seems like I didn't encounter any problems with the sandbox using that approach. |
I would love to use It's currently being discussed here elixir-sqlite/exqlite#192 |
Even if so, on re-open, By idle here, what do you mean? (I think the issue link is wrong) |
There will be people who use a structure.sql as well and don't build from scratch completely. I know this because I am one of them 😞.
I don't remember the details, but I was running into issues where the connection pool had 1 connection during a test and the in memory database just disappeared. I chalked that up to the connection going "idle" and closing the database. I threw some debugging in and saw that |
Is begin concurrent an extension? If so, could this be used to install it? https://observablehq.com/@asg017/making-sqlite-extensions-npm-installable-and-deno |
It doesn't seem to be an extension, but rather a fork. |
Hi everyone,
SQLite3 does not currently support async tests in the sandbox. At first, it makes sense because it is single writer, but then I realized that we never commit transactions anyway so we should never be writing. That's when I found SQLite3 supports a feature called "BEGIN CONCURRENT", which allows concurrent transactions, and serializes only the commit operation, which we never do!
Therefore, would it be worth giving a try to support this? Perhaps there could be a config on this project that chooses the transaction type (concurrent or not) and we set it to concurrent with the sandbox.
WDYT?
The text was updated successfully, but these errors were encountered: