Skip to content
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

[Bug]: Optimize Deletion of Objects for Calendar Subscriptions #51120

Open
kesselb opened this issue Feb 27, 2025 · 0 comments
Open

[Bug]: Optimize Deletion of Objects for Calendar Subscriptions #51120

kesselb opened this issue Feb 27, 2025 · 0 comments
Labels
1. to develop Accepted and waiting to be taken care of 30-feedback bug feature: caldav Related to CalDAV internals

Comments

@kesselb
Copy link
Contributor

kesselb commented Feb 27, 2025

Description:

The RefreshWebcalService is responsible for updating calendar subscriptions. Since Nextcloud 30, the updated source is diffed against the local state, and only changes are written back.

Recently, we investigated a system with an unusually large oc_calendarobjects table and recurring deadlocks when removing calendar objects that no longer exist in the source.

Findings:

It turned out that the user had subscribed to a calendar from a Redmine instance. This subscription changed the UID on every request and contained a rather large set of events.

As a result, every time the subscription was refreshed, around 15,000 objects needed to be removed. This process affects the following tables:

  • oc_calendarobjects_props
  • oc_calendarobjects
  • oc_calendarchanges (twice)

Currently, these deletions are handled within a single transaction, significantly increasing the risk of deadlocks.

Suggested Improvement:

To reduce the likelihood of deadlocks, we should consider optimizing how deletions are handled—potentially by breaking them into smaller transactions or batching the deletions more efficiently.

Additional information

Script to simulate such a calendar feed: https://github.com/kesselb/weird-calendars/blob/main/calendar_subscription_with_unstable_uid.php

@kesselb kesselb added 1. to develop Accepted and waiting to be taken care of 30-feedback bug feature: caldav Related to CalDAV internals labels Feb 27, 2025
@kesselb kesselb moved this to 📄 To do in 💌 📅 👥 Groupware team Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of 30-feedback bug feature: caldav Related to CalDAV internals
Projects
Status: 📄 To do
Development

No branches or pull requests

1 participant