The occ files:scan takes a long time

I ran the files:scan command for the first time in three months. And this run was the first run since I changed to NC 19.0.1 and PHP 7.4.

Accounts with more than 100MB of data will require a significant amount of time to complete. An account of about 50MB takes only a few seconds. For a 150MB account, it took 10 minutes to complete. The 6GB user took 5 hours.

There were also problems with these. If I didn’t disable File Locking, I got an error that locked the file.

'Exception during scan: "..." is locked, existing lock on file: exclusive'

The following errors occurred regardless of the amount of data.

Exception during scan: An exception occurred while executing 'SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `name`,`mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum`, `metadata_etag`, `creation_time`, `upload_time` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` WHERE (`storage` = ?) AND (`path_hash` =?)' with params [164, "8d13c215674ee0d64d93feaaa2f6b1c9"]:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

It never used to take this long before. Do I have a problem?


CentOS 7.7, NC19.0.1, PHP 7.4.8, MariaDB 10.2.32, Nginx 1.16.1

The problem has been solved. The cause was external storage.
I was able to scan normally by giving the “–home-only” option.