Bug 339565 - Deleting several thousand mails at once only deletes them in the local store
Summary: Deleting several thousand mails at once only deletes them in the local store
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Mollekopf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-01 09:56 UTC by Andreas Schneider
Modified: 2014-10-03 09:15 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.14.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2014-10-01 09:56:53 UTC
Deleting several thousand mails at once only deletes them in the local store and not on the IMAP server.

If I try to delete 30000 mails at once they are only deleted locally but not on the IMAP server. It works with less then 100 just fine.

The IMAP server is dovecot-2.2.

In the log you see:

S: A000016 BAD Error in IMAP command UID STORE: Too long argument.

Reproducible: Always

Steps to Reproduce:
1. Setup dovecot
2. Create a mailbox with several thousend mails
3. Try to delete those mails at once
Comment 1 Daniel Vrátil 2014-10-03 09:15:26 UTC
Git commit 6b8101c42bf96c54499da7aea61f1b70904fc450 by Dan Vrátil.
Committed on 03/10/2014 at 09:08.
Pushed by dvratil into branch 'KDE/4.14'.

[IMAP Resource] Remove RemoveItemsTask and use ChangeItemsFlagsTask instead

Removing emails means appending the \Deleted flag, so RemoteItemsTask is
just a simpler version of ChangeItemsFlagsTask with hardocded flag to append.
To avoid code duplication and make use of flags-related fixes in ChangeItemsFlagsTask,
we can just use that instead of RemoveItemsTask.

REVIEW: 120447

M  +0    -1    resources/imap/CMakeLists.txt
M  +2    -2    resources/imap/imapresourcebase.cpp
D  +0    -106  resources/imap/removeitemstask.cpp
D  +0    -46   resources/imap/removeitemstask.h
M  +0    -1    resources/imap/tests/CMakeLists.txt
D  +0    -105  resources/imap/tests/testremoveitemstask.cpp

http://commits.kde.org/kdepim-runtime/6b8101c42bf96c54499da7aea61f1b70904fc450
Comment 2 Daniel Vrátil 2014-10-03 09:15:27 UTC
Git commit 6cc5af5b150628a250e67b12ee1ee195a0d8859c by Dan Vrátil.
Committed on 03/10/2014 at 09:13.
Pushed by dvratil into branch 'KDE/4.14'.

[IMAP Resource] Split large UID STORE commands to multiple smaller ones

Although not specified in RFC, IMAP servers usually have some limit on maximal
length of a command send by clients. This is best visible in case of ChangeItemsFlagsTask,
which would create an insanely long STORE command when user marked as read
thousands of emails at once.

To prevent servers from rejecting our requests, we split large STORE requests
to multiple smaller ones, each of 2000 UIDs at most. 2000 sounds like a good
compromise between not hitting it too often (i.e. users usually mark as read
few emails at once, hundreds at best) and not hitting the server-side limits
(every server out there should handle 2000 UIDs in a request). This number
can be tuned later of course if we find out it's too much/not enough.

REVIEW: 120446
FIXED-IN: 4.14.2

M  +23   -9    resources/imap/changeitemsflagstask.cpp
M  +3    -0    resources/imap/changeitemsflagstask.h

http://commits.kde.org/kdepim-runtime/6cc5af5b150628a250e67b12ee1ee195a0d8859c