Bug 406447 - UIDNEXT not updated in database
Summary: UIDNEXT not updated in database
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-11 20:45 UTC by Thiago Macieira
Modified: 2019-04-12 00:51 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2019-04-11 20:45:09 UTC
Akonadi keeps downloading the same emails over and over again for all folders, since it does not update the UIDNEXT entries in the collectionattributetable table.

STEPS TO REPRODUCE
1. Add an IMAP account, on a server with UIDNEXT support
2. Synchronise
3. Receiver more emails
4. Synchronise
5. Synchronise again

OBSERVED RESULT
Step 5 downloads the emails that Step 4 had already downloaded. The UIDNEXT entry in the database remains as it was, no update.

EXPECTED RESULT
Emails that have been downloaded are not downloaded again.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
From the logs:

akonadi_imap_resource[27122]: org.kde.pim.imapresource.trace: starting:  RetrieveItemsTask
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Starting retrieval for  "INBOX"
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Starting message retrieval. Elapsed(ms):  235
akonadi_imap_resource[27122]: org.kde.pim.imapresource: UidValidity:  1231428926 Local UidValidity:  1231428926
akonadi_imap_resource[27122]: org.kde.pim.imapresource: MessageCount:  1131 Local message count:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: UidNext:  21432 Local UidNext:  21428
akonadi_imap_resource[27122]: org.kde.pim.imapresource: HighestModSeq:  3639 Local HighestModSeq:  3623
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching new messages: UidNext:  21432  Old UidNext:  21428
akonadi_imap_resource[27122]: org.kde.pim.akonadiagentbase: 1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: 1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching  2  intervals
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  2 In total:  2  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  1 In total:  3  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Listing flags  1 21427
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Starting flag retrieval. Elapsed(ms):  670
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching  211  intervals
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  525 In total:  528  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  475 In total:  1003  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching  24  intervals
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  102 In total:  1105  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  26 In total:  1131  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Applying collection changes
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Retrieval complete. Elapsed(ms):  2562
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: ItemSync of collection 15 finished
akonadi_imap_resource[27122]: org.kde.pim.imapresource.trace: RetrieveCollectionMetadataTask
akonadi_imap_resource[27122]: org.kde.pim.imapresource.trace: starting:  RetrieveCollectionMetadataTask
akonadi_imap_resource[27122]: org.kde.pim.imapresource: ".INBOX"
akonadi_imap_resource[27122]: org.kde.pim.akonadiagentbase: 15 "Inbox"
akonadi_imap_resource[27122]: org.kde.pim.imapresource.trace: RetrieveItemsTask
akonadi_imap_resource[27122]: org.kde.pim.imapresource.trace: starting:  RetrieveItemsTask
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Starting retrieval for  "INBOX"
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Starting message retrieval. Elapsed(ms):  149
akonadi_imap_resource[27122]: org.kde.pim.imapresource: UidValidity:  1231428926 Local UidValidity:  1231428926
akonadi_imap_resource[27122]: org.kde.pim.imapresource: MessageCount:  1131 Local message count:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: UidNext:  21432 Local UidNext:  21428
akonadi_imap_resource[27122]: org.kde.pim.imapresource: HighestModSeq:  3639 Local HighestModSeq:  3623
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching new messages: UidNext:  21432  Old UidNext:  21428
akonadi_imap_resource[27122]: org.kde.pim.akonadiagentbase: 1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: 1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching  2  intervals
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  2 In total:  2  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  1 In total:  3  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Listing flags  1 21427
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Starting flag retrieval. Elapsed(ms):  367
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching  211  intervals
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  525 In total:  528  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  475 In total:  1003  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Fetching  24  intervals
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  102 In total:  1105  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: Received:  26 In total:  1131  Wanted:  1131
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Applying collection changes
akonadi_imap_resource[27122]: org.kde.pim.imapresource: Retrieval complete. Elapsed(ms):  2275
akonadi_imap_resource[27122]: org.kde.pim.akonadicore: ItemSync of collection 15 finished

As can be seen, akonadi downloaded the same emails twice. Note how the reported local UidNext in the second run is still the same as it was in the first run.

I enabled query logging in MySQL and did not see any UPDATE statements affecting the CollectionAttributeTable. It does show:
                  363 Execute   SELECT CollectionAttributeTable.id, CollectionAttributeTable.collectionId, CollectionAttributeTable.type, CollectionAttributeTable.value FROM CollectionAttributeTable WHERE ( collectionId = 15 AND type = 'uidnext' )
Comment 1 Thiago Macieira 2019-04-11 22:14:25 UTC
Possibly solved by https://mail.kde.org/pipermail/distributions/2019-April/000314.html. Attempting to test.
Comment 2 Thiago Macieira 2019-04-12 00:51:31 UTC
Confirmed, those patches fix the issue.