Skip to content
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

Awesome! #12

Closed
kevinlang opened this issue Feb 28, 2021 · 3 comments
Closed

Awesome! #12

kevinlang opened this issue Feb 28, 2021 · 3 comments

Comments

@kevinlang
Copy link
Member

kevinlang commented Feb 28, 2021

Was just looking into reviving my ill-fated attempt at this once before, xqlite3 that got nowhere due to the busy errors you mentioned in the README (and also because it was my first foray into Elixir programming, probably not the best thing to start with).

You may want to post about it on the Elixir Forum as things get somewhat stable, as a decent SQLite3 ecto3 driver has been wanted for some time. Here is a recent thread, for example:
https://elixirforum.com/t/help-with-debugging-sqlites-busy-error-with-ecto3/33613/9

(edit: just realized one of the contributors was the one who started that thread, 😅 )

It would be awesome to one day see the ecto driver upstreamed into the ecto repo itself once things get stable, as the other drivers have been (postgrex, myxql, etc).

Cheers,

@warmwaffles
Copy link
Member

Thanks @kevinlang, there are plenty of outstanding issues right now that I am about to start throwing into the issue tracker.

I still occasionally get the sqlite3 busy error, or sqlite database is locked when trying to migrate.

And I totally also cloned your library to see the work you put in to it.

@kevinlang
Copy link
Member Author

kevinlang commented Mar 1, 2021

Might also be worthwhile looking through the sqlite3 ruby gem and its associated ActiveRecord adapter/connector. I remember looking through those at the time of my initial attempt and it gave me some good insights.

I also find looking at the go-sqlite3 issues to give some insight into common errors around sqlite3 itself (since I'm certainly no expert). They also seem to get similar locked errors here and there. It seems that there are a couple of possible solutions:

  1. Use BEGIN IMMEDIATE for database migration transactions (or other scenarios that begin-read-write)
  2. Limit connection pool to one during migration time (not sure how easy that would be).

I also see an approach of looking at whether a statement is RW or not and doing some mutex around that to prevent it, though that seems ill advised.

Some interesting links/discussions around the locked error:
mattn/go-sqlite3#209 (comment)
mattn/go-sqlite3#827 (comment)

Best of luck :)

@warmwaffles
Copy link
Member

Probably a good call on the begin immediate. Right now transactions default to deferred since that is what is default in sqlite3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants