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

feat: Move mimetype repair to background jobs #39290

Closed
wants to merge 1 commit into from

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Jul 10, 2023

Summary

Move the heavy and slow mime type repair steps into background jobs that are split by storage id.

Some considerations:

  • The query is quite hard to optimize as we need to check for the file extension on all files

  • Running an upgrade without this is usually fine as just old files might not immediately show up with the newly introduced mimetypes then

  • Splitting by storage id seems to be the most reasonable thing to not have massive update transactions, but might not be enough yet

  • Check if this mass of background jobs can become an issue on large instances, maybe those should be only during off-peak hours but this might have the risk of taking forever then

  • Still have a way to manually run them, but we'd need to safeguard to not run the jobs then

Checklist

Signed-off-by: Julius Härtl <jus@bitgrid.net>
/**
* Fix mime types
*/
public function run(IOutput $out) {

Check failure

Code scanning / Psalm

ParamNameMismatch Error

Argument 1 of OC\Repair\AddRepairMimeTypeJob::run has wrong name $out, expecting $output as defined by OCP\Migration\IRepairStep::run
if (empty($this->folderMimeTypeId)) {
$query->setParameter('mimetype', 'httpd/unix-directory');
$result = $query->execute();
$this->folderMimeTypeId = (int)$result->fetchOne();

Check failure

Code scanning / Psalm

UndefinedThisPropertyAssignment Error

Instance property OC\Repair\RepairMimeTypeJob::$folderMimeTypeId is not defined
@joshtrichards
Copy link
Member

Perhaps incorporate a check (for Admin->Overview) if it's still "in progress" that reports at info-only level. Maybe with some indication of how far along it is so the user can decide whether they need to do something to push it along faster.

@solracsf solracsf added this to the Nextcloud 28 milestone Jul 13, 2023
@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
@blizzz blizzz mentioned this pull request Nov 14, 2023
@skjnldsv skjnldsv added the 2. developing Work in progress label Feb 21, 2024
This was referenced Mar 12, 2024
@Altahrim Altahrim mentioned this pull request Mar 20, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
@juliushaertl
Copy link
Member Author

Replaced by #45930

@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants