nextcloud / nextcloud/server

Scanning newly created folders is doing too much work

Open
#33,611 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement feature: filesystem performance 🚀
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Image

Line Method
3rdparty/doctrine/dbal/src/Connection.php 1149 OC\DB\BacktraceDebugStack->startQuery
lib/private/DB/Connection.php 294 Doctrine\DBAL\Connection->executeStatement
3rdparty/doctrine/dbal/src/Query/QueryBuilder.php 354 OC\DB\Connection->executeStatement
lib/private/DB/QueryBuilder/QueryBuilder.php 281 Doctrine\DBAL\Query\QueryBuilder->execute
lib/private/Files/Cache/Cache.php 382 OC\DB\QueryBuilder\QueryBuilder->execute
lib/private/Files/Cache/Scanner.php 401 OC\Files\Cache\Cache->update
lib/private/Files/Cache/Scanner.php 342 OC\Files\Cache\Scanner->scanChildren
lib/private/Files/Cache/LocalRootScanner.php 39 OC\Files\Cache\Scanner->scan
lib/private/Files/Cache/Updater.php 125 OC\Files\Cache\LocalRootScanner->scan
lib/private/Files/View.php 327 OC\Files\Cache\Updater->update
lib/private/Files/View.php 1191 OC\Files\View->writeUpdate
lib/private/Files/View.php 275 OC\Files\View->basicOperation
lib/private/Files/Node/Folder.php 163 OC\Files\View->mkdir
lib/private/Files/AppData/AppData.php 147 OC\Files\Node\Folder->newFolder
lib/private/Preview/Storage/Root.php 74 OC\Files\AppData\AppData->newFolder
lib/private/Preview/Generator.php 578 OC\Preview\Storage\Root->newFolder
lib/private/Preview/Generator.php 134 OC\Preview\Generator->getPreviewFolder
lib/private/Preview/Generator.php 111 OC\Preview\Generator->generatePreviews
lib/private/PreviewManager.php 212 OC\Preview\Generator->getPreview
core/Controller/PreviewController.php 133 OC\PreviewManager->getPreview
core/Controller/PreviewController.php 112 OC\Core\Controller\PreviewController->fetchPreview
lib/private/AppFramework/Http/Dispatcher.php 225 OC\Core\Controller\PreviewController->getPreviewByFileId
lib/private/AppFramework/Http/Dispatcher.php 133 OC\AppFramework\Http\Dispatcher->executeController
lib/private/AppFramework/App.php 172 OC\AppFramework\Http\Dispatcher->dispatch
lib/private/Route/Router.php 298 OC\AppFramework\App::main
lib/base.php 1033 OC\Route\Router->match
index.php 36 OC::handleRequest

partial fix: https://github.com/nextcloud/server/pull/33551

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 by reviewing lib/private/Files/Cache/Scanner.php, LocalRootScanner.php, and the Preview and View call paths shown in the stack trace. Read the partial fix in pull request 33551 first, then investigate the remaining excessive work when newly created folders are scanned; completion should address the reported database activity without regressing preview generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, database, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.