Duplicate calendar events



  • Hi,
    My Android Calendar database has duplicate events.

    Android 6.0.1 Nexus 5X
    DAVDroid 1.3-ose
    Server: OwnCloud 9.1.0

    • I have opened calendar.db in an sqlite browser, and I see two rows that are identical, except for a different _id. For example, I have two rows with _sync_id = "a6b497f6-d828-4c53-ae91-3ba3d2184fd1.ics". In total I have approx 10-20% of my entries duplicated.
    • I have looked on the server and in clients on other platforms and there is only one entry.
    • When I sync, the matching entries in the log file are (full URLs replaced with XXXXXX for privacy):
      2016-10-02 17:06:52 38 [syncadapter.SyncManager] Found local resource: a6b497f6-d828-4c53-ae91-3ba3d2184fd1.ics
      2016-10-02 17:06:52 38 [syncadapter.SyncManager] Found local resource: a6b497f6-d828-4c53-ae91-3ba3d2184fd1.ics
      <d:href>/XXXXXX/a6b497f6-d828-4c53-ae91-3ba3d2184fd1.ics</d:href>
      2016-10-02 17:06:53 38 [dav4android.DavResource] Received <response> for XXXXXX/a6b497f6-d828-4c53-ae91-3ba3d2184fd1.ics
      2016-10-02 17:06:53 38 [syncadapter.CalendarSyncManager] Found remote VEVENT: a6b497f6-d828-4c53-ae91-3ba3d2184fd1.ics
    • Net result of sync is that I still have two entries even though there is only one response in the log.
    • I don't have any knowledge of how the duplicate occurred in the first place, and I can't necessarily reproduce it. However I can sync as many times as I like and the duplicate entries remain. I guess that anyone else wanting to reproduce could hack their database.db to contain a duplicate.

    Next steps:

    • It would be great if DAVdroid could be fixed automatically remove duplicate entries. Duplicates are characterised by a) identical ID b) only 1 response from server although 2 local entries.
    • I suspect my problem will go away if I can force a drop of the local database and complete reload. However I don't want to accidentally destroy all events on the server in the process. Please can anyone advise how to safely force a full sync?

    Many thanks.



  • In the course of my testing I have accidentally discovered how to safely force a full sync.

    I opened the DAVdroid app and clicked on my account. I unselected the calendar that had the bug, and then clicked to synchronize. I reselected the calendar and synchronized again.

    This is a workaround rather than a proper fix. It would be great if DAVdroid could be fixed automatically remove duplicate entries.


  • developer

    @AdamPS Duplicate rows should never occur. It would be important to identity the circumstances which led to duplicate rows. I don't think handling duplicate rows is a good idea, because this would just hide other problems (which lead to duplication).

    If you can reproduce the duplication in any way, please let us know.



  • Thanks for the reply.

    OK I have some extra information for the duplicate events. My phone has two accounts set up with different names, but pointing to exactly the same account on the server. The reason for this set up is that it was the recommended way to connect to more than one CardDAV address book on the account.

    On the second account, I disabled all the CalDAV calendars. However I expect that there was briefly a time when both accounts had the calendars enabled.

    I have just tested enabling CalDAV on the second account also. I do see all the events twice in the database. The _sync_id is the same but the calendar ID is different. When I disable the CalDAV on the second account, the duplicates go away again. So this isn't a full explanation. However I suspect that the double account is a part of the cause of my duplicates.

    I will post again if I see duplicates in future.


  • developer

    @AdamPS said in Duplicate calendar events:

    I have just tested enabling CalDAV on the second account also. I do see all the events twice in the database. The _sync_id is the same but the calendar ID is different. When I disable the CalDAV on the second account, the duplicates go away again.

    When the calendar ID is different, there's no problem, because the events are not really duplicate, but the CalDAV collection is just synchronized two times into different local calendars. Problems only occur in case of really duplicate entries, i.e when everything except the _id is identical.


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.