nextcloud / nextcloud/server

Faster update by speeding up repair step "Remove activity entries of private events"

Open
#49,520 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 29-feedback bug feature: activity and notification feature: caldav feature: install and update performance 🚀
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.
When running an update of our Nextcloud Instance (or occ maintenance:repair) I face a very intense slowdown (>30 min) on the repair step Remove activity entries of private events. oc_activity contains 312.577 entries and this does not seam to be very very much because I already searched a bit in the Nextcloud Forum.
It would be great if this step could be more fast.

Describe the solution you'd like
I tired to understand what happens on this step and it seams to me that https://github.com/nextcloud/server/blob/01b2ae4e4e47a58e3036184bbd52d8fdd76ee412/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php#L48 for every calendar entry of every user is trying to delete lines in oc_activity that in column affecteduser have something different than the user that is the owner of the calendar entry.
I asked myself if it wouldn't be possible to simply delete every entry of this type without having to do this in a while loop one by one? I may be wrong (very probably 😉) but couldn't we delete every entry in oc_activity that has an other value in affecteduser than in owner?

Say:

		$delete->delete('activity')
			->where($delete->expr()->neq('affecteduser', $delete->createParameter('owner')))
                        ->andWhere($delete->expr()->eq('owner', $delete->createParameter('owner')))
			->andWhere($delete->expr()->eq('object_type', $delete->createParameter('type')))
			->andWhere($delete->expr()->eq('object_id', $delete->createParameter('calendar_id')));

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/dav/lib/Migration/RemoveClassifiedEventActivity.php at the linked repair step, then run occ maintenance:repair against the described activity data to understand the current behavior. Compare a set-based deletion with the existing per-calendar processing, and consider the work done when private-event activity entries are removed correctly without the reported slowdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.