-
-
Notifications
You must be signed in to change notification settings - Fork 101
sql: switch from sqlx to rusqlite #2380
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
Conversation
09c52e0
to
970d249
Compare
4507917
to
6cb9f9f
Compare
], | ||
) | ||
.await | ||
.ok(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we ignore the error here?
219de80
to
3c4171c
Compare
ca44b7b
to
a3a06ab
Compare
@@ -426,7 +426,7 @@ test some special html-characters as < > and & but also " and &#x | |||
#[async_std::test] | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :)
rand = "0.7.0" | ||
regex = "1.1.6" | ||
rusqlite = { version = "0.24", features = ["bundled"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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