Repository navigation
Improve sql interface - #2089
Conversation
|
Note that |
df4d2bc to
2fda933
Compare
402b3d3 to
67fdcbd
Compare
67fdcbd to
7ce5ceb
Compare
This comment has been minimized.
This comment has been minimized.
Hocuri
left a comment
There was a problem hiding this comment.
Only reviewed, like, a third (deltachat-ffi, examples, accounts.rs, blob.rs and chat.rs until line 2700) and only superficially
| } | ||
|
|
||
| async fn set_block_contact(context: &Context, contact_id: u32, new_blocking: bool) { | ||
| dbg!(contact_id); |
There was a problem hiding this comment.
Accidentally committed dbg statements
There was a problem hiding this comment.
Maybe not accidentally, they are everywhere :)
This is a workaround for transact-rs/sqlx#1147 Draining statement results is no longer needed.
|
@link2xt thanks for your first explanation, but I still have some questions:
What is the advantage of sqlx against current rusqlite? Do we have a technical requirement? Are we having technical or performance problems with rusqlite? At last, I read to split database into several files somewhere above? Is that a misunderstanding from my side or is that really planned?
Is that important for development? I never saw some problems or performance issues with database (rusqlite). |
No, the database stays as one file.
Resultification is important for reliability. If errors are not processed correctly, but simply ignored, it's possible to end up with a database in inconsistent state. We had similar problems with multiple rows for the same peerstate etc. As for the difference between @dignifiedquire and @r10s can probably provide more background on why this change was made in the first place. I think @dignifiedquire uses sqlx in some other projects already. @csb0730 If your concern is that merging this PR in will make maintaining your soft fork harder, we will merge this as a single commit. After that, rebasing on top of it should be fairly straightforward, most merge conflicts should be about the changes to SQL statement syntax ( |
|
@link2xt thanks a lot again. Regarding this Executor, I'm not skilled enough in the moment to understand these details. I think it's ok when you know what you're doing ;-) Regarding files: When db file stays the same then all is ok for me :-) When splitting sql.rs, ok when this makes sense, so what 👍 Anyway, I will update my fork later that year, but then based on the future software base. In the moment I'm still very very happy with it :-) |
…at existing NULL as "empty string".
No need to abort the connection if all connections are stalled for 10 seconds. This did not happen, just to make sure each timeout is a result of an actual deadlock.
|
If someone merges this, please squash all commits manually and write some meaningful commit message. |
maybe leave final merging up to @dignifiedquire :) |
r10s
left a comment
There was a problem hiding this comment.
beside various codechecks, i am already using this or a 3gig database in "production" on my iphone, up to now, i did not find any more problems! pretty sure, they will arise, however :)
this is one of the biggest pr, and i hope it is worth the overall effort :) (i think so :) thanks everyone for making that possible!
|
Two more |
|
Oh, in #2313, which is rebased on this PR here except for the last two commits (which just remove unwraps), configure failed in one of the tests with "Sqlx: PoolTimedOut: pool timed out while waiting for an open connection". So, apparently these errors are not completely gone, just a lot less often. Rare enough that we might merge this PR fix this later, I think, though. Test output |
|
I experienced another timeout, this time when setting a config, in #2297:
Test output |
|
to these timeouts: not sure where they come from, but that seems to happen independently of sqlx, also on current master with rusqlite here and there, eg. https://app.circleci.com/pipelines/github/deltachat/deltachat-core-rust/8069/workflows/ba2a9949-b4ad-4ceb-a930-073bba05e2db/jobs/30965 - frequency might have changed, though. Test output |
|
The timeout at https://app.circleci.com/pipelines/github/deltachat/deltachat-core-rust/8069/workflows/ba2a9949-b4ad-4ceb-a930-073bba05e2db/jobs/30965 is a problem in the python test utils that will be fixed by #2316. Under some circumstances, a "normal" test failure led to a timeout here, without printing a decent error message. But this had nothing to do with sql |
| @@ -349,11 +351,6 @@ PRAGMA query_only=1; -- Protect against writes even in read-write mode | |||
|
|
|||
| let mut rows = pool.fetch(sqlx::query(&q)); | |||
| if let Some(first_row) = rows.next().await { | |||
There was a problem hiding this comment.
should probably use fetch_one instead
dbg!everywhere)sql::test_db_reopen. Reproducible in repl: create a database,exit, restart repl,set addr [email protected].get addrreturnsOk(None). There seems to be a general issue with re-opening, that seems to be close to other open issues.TestOnlineAccount::test_saved_mime_on_received_message(pr)NULLtomime_headerscolumn nor expect it from there. existing NULL should be treated as "empty string"