-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
SQL errors while trying to move / delete messages #6355
Comments
The code is here, and does, as you guessed, try to delete all the SQL entries with a query like If performance didn't matter, we could just delete the entries in a loop. Somehow we need to get the data into SQL, and I don't see how a temporary table helps here, because for this we would still need to somehow insert all the IDs into the table via params. Fixing this problemThis problem should be fixable by deleting only up to 900 rows at once in the SQL statement, and doing this in a loop until all rows are deleted. This should maybe not only be done for this specific SQL statement, but for all the 14 usages of Not sure if that's the best fix, maybe someone comes up with a better one. Reproducing this problemThis problem looks to be reproducable by receiving over 999 messages in one go (this is SQL's maximum) and then setting "Delete Messages from Server" to "At once"; sounds easy enough to write a python test for that, but of course we can't merge it because it will take ages to complete. This way, we could find out whether this is a new problem in 1.50 or if it was just coincidence that it appeared now. |
I think we should get rid of |
It seems that a transaction isn't really necessary here, |
Single transaction should make it faster because every time transaction is closed there is an fsync call waiting for the changes to be written to the disk. |
Fix is in #6358. |
And a follow-up issue to cleanup remaining statements: #6359 |
I noticed Delta Chat was a bit sluggish since the 1.50 update, taking a while to show me new messages, also displaying “updating” constantly on both desktop and mobile.
I started to dig a little bit and noticed that messages were not being deleted on the server (despite having set a deletion timer), the DeltaChat IMAP folder containing around 100000 messages now.
I also noticed that disappearing messages in some groups were in fact not disappearing at all, everything was kept. An example of such is a group where deleted messages were setup on the 7th of september, but everything since then is still there and readable.
Opening the log reveals quite a lot of error messages related to deleting messages, very similar errors on both Android and Desktop clients.
(I had to elide the huge row of question marks in the queries because there were too many to post the issue on github)
On desktop:
On Android:
Seems like something is generating enormous SQLite queries…
I haven’t looked at the code, but maybe creating a temp table with all the IDs and using an
IN
statement in theWHERE
clause would make more sense. Generating SQL queries seems like a big footgun.The text was updated successfully, but these errors were encountered: