Repository navigation
sql: switch from sqlx to rusqlite - #2380
Conversation
09c52e0 to
970d249
Compare
4507917 to
6cb9f9f
Compare
| ], | ||
| ) | ||
| .await | ||
| .ok(); |
There was a problem hiding this comment.
Why we ignore the error here?
219de80 to
3c4171c
Compare
ca44b7b to
a3a06ab
Compare
| async fn test_get_html_empty() { | ||
| let t = TestContext::new().await; | ||
| let msg_id = MsgId::new_unset(); | ||
| let msg_id = MsgId::new(100); |
There was a problem hiding this comment.
This test is actually wrong, it tries to load HTML for nonexistent message, which is an error. Message ID 100 at least does not throw an error due to using special ID (rusqlite converters have protection against storing special IDs into database), but the test could be better anyway.
a3a06ab to
51c04f6
Compare
51c04f6 to
3b8926f
Compare
|
@link2xt great you could create this pr 🙏 also, thanks for this scientific view on the two libraries, that bring the different weaknesses of both libraries to light. all in all, for UIs, worse read speed seems to be a bigger flaw. that, and the other issues of #2378 in mind it still advisable to switch back to rusqlite, at least for now. at some point, sqlx may be a better choice, but that seems not to be today. for reviewing this pr: most of the lines are pulled on from before #2089, right? so they cannot be that wrong? :) |
I count regressions in performance as flaws. If previous release does some operation in 500ms and now it does the same in 600ms, that's a regression. The way to avoid it is to cover all common operations with benchmarks and only switch when some benchmarks improve and other don't degrade significantly. For now sqlx does not satisfy these conditions. But if we were using sqlx today, we should not change to rusqlite for the same reason.
I reviewed the PR line-by-line once. The most important part to review is |
There was a problem hiding this comment.
i walked through all recent commits as suggested, checking that no line is missing, that lgtm (did a tiny pr, #2381, not sure how useful that is)
also, i am running the pr already on my iphone.
i will have a look at receive_imf etc. tomorrow, but i'd say, if that pr blocks other things, we can already merge that in.
so that we do not forget about that test and the issues we had with that :)
| r2d2_sqlite = "0.17.0" | ||
| rand = "0.7.0" | ||
| regex = "1.1.6" | ||
| rusqlite = { version = "0.24", features = ["bundled"] } |
There was a problem hiding this comment.
Is there a way to turn the bundled feature off for a distribution package? I guess we'll have to patch Cargo.toml?
There was a problem hiding this comment.
deltachat-core-rust is a Rust package too and has its own features. We can change the [features] section in Cargo.toml to:
default = ["bundled-sqlite"]
internals = []
repl = ["internals", "rustyline", "log", "pretty_env_logger", "ansi_term", "dirs"]
vendored = ["async-native-tls/vendored", "async-smtp/native-tls-vendored"]
nightly = ["pgp/nightly"]
bundled-sqlite = ["rusqlite/bundled"]
And then you can build with --no-default-features if you don't want bundled SQLite. I don't mind hardcoding --no-default-features to CMakeLists.txt in this case.
There was a problem hiding this comment.
That would be nice! Hardcoding --no-default-features in CMakeLists.txt is up to you, I can also change that in Nixpkgs.
There was a problem hiding this comment.
I am going to do this with rusqlite update then.
Since you are packaging tagged release anyway, for now you can just patch Cargo.toml.



Closes #2378