nextcloud / nextcloud/server

[perf] MIME type repair step takes hours on large instances

Open
#48,698 1 comment 6 reactions 1 assignee View on GitHub

@leftybournes is already working on this.

Since Sep 16, 2026.

🌍 scaling 1. to develop enhancement feature: database feature: filesystem performance 🚀
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Running the MIME type repair step can take up to multiple hours on large instances, as the filecache table is pretty huge.

A possible solution would be to do this not within the repair steps but only start a background job from the repair step that then will do the repair in chunks.
E.g.

  1. Get the current largest fileid
  2. start a background job A with (start=0, end=fileid)
  3. Update the mime types in that background job but only in the chunk [start, min(start+5000, end)]
  4. start the background job again from that background job with (start = start + 5000, end=fileid) if needed

(5000 is just taken as an example as this should not lock the table on mysql and thus should not block the production instance too heavily).

cc @juliushaertl

https://github.com/nextcloud/server/blob/8dc64d794c133c7ed58e51f94a901c189cea2591/lib/private/Repair/RepairMimeTypes.php

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.