Closed butonic closed 2 years ago
The only upsert on the filecache is https://github.com/owncloud/core/blob/cba1e6b01e13b265b6e5356d46c3def922bbb7c5/lib/private/Files/Cache/Cache.php#L307
I have 20k small files in my trash because I use Joplin to sync notes with owncloud ... and I seem to have an old upload bitrotting in my uploads folder ...
double checking cron
ok, there were a few hundred jobs that had piled up ... but even after getting them executed a simple PROPFIND produces:
mysql> select a.event_time, a.command_type, convert(a.argument using utf8) from mysql.general_log a WHERE user_host LIKE 'owncloud%' AND command_type='Execute' AND convert(a.argument using utf8) LIKE 'INSERT INTO oc_f%';
+----------------------------+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| event_time | command_type | convert(a.argument using utf8) |
+----------------------------+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 2022-03-01 21:35:33.740340 | Execute | INSERT INTO oc_filecache( storage, etag, mimetype, mimepart, permissions, name, parent, checksum, path_hash, path) VALUES(1,'5ced345f4ea649a39cf6e8f07cc272dd',(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),31,'',-1,'','d41d8cd98f00b204e9800998ecf8427e','') ON DUPLICATE KEY UPDATE etag='5ced345f4ea649a39cf6e8f07cc272dd',mimetype=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),mimepart=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),permissions=31,name='',parent=-1,checksum='' |
| 2022-03-01 21:35:33.747383 | Execute | INSERT INTO oc_filecache( storage, etag, mimetype, mimepart, permissions, name, parent, checksum, path_hash, path) VALUES(1,'0fde5fce68f7badfd1f334024fa76e9a',(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),31,'files',35335,'','45b963397aa40d4a0063e0d85e4fe7a1','files') ON DUPLICATE KEY UPDATE etag='0fde5fce68f7badfd1f334024fa76e9a',mimetype=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),mimepart=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),permissions=31,name='files',parent=35335,checksum='' |
| 2022-03-01 21:35:33.752871 | Execute | INSERT INTO oc_filecache( storage, path_hash, path, etag, mimetype, mimepart, permissions, name, parent, checksum) VALUES(1,'fb66dca5f27af6f15c1d1d81e6f8d28b','files_trashbin','ccda679debe251c117bbd68f956a669b',(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),31,'files_trashbin',35335,'') ON DUPLICATE KEY UPDATE etag='ccda679debe251c117bbd68f956a669b',mimetype=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),mimepart=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),permissions=31,name='files_trashbin',parent=35335,checksum='' |
| 2022-03-01 21:35:33.759794 | Execute | INSERT INTO oc_filecache( storage, name, parent, checksum, path_hash, path, etag, mimetype, mimepart, permissions) VALUES(1,'files',70174,'','3014a771cbe30761f2e9ff3272110dbf','files_trashbin/files','1a26c26709952aa566430b6bb84e30c1',(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),31) ON DUPLICATE KEY UPDATE name='files',parent=70174,checksum='',etag='1a26c26709952aa566430b6bb84e30c1',mimetype=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),mimepart=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),permissions=31 |
| 2022-03-01 21:35:33.765154 | Execute | INSERT INTO oc_filecache( storage, permissions, name, parent, checksum, path_hash, path, etag, mimetype, mimepart) VALUES(1,31,'versions',70174,'','c639d144d3f1014051e14a98beac5705','files_trashbin/versions','879ab489c5da522f2f0a6a53df105389',(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),(SELECT id FROM oc_mimetypes WHERE mimetype='httpd')) ON DUPLICATE KEY UPDATE permissions=31,name='versions',parent=70174,checksum='',etag='879ab489c5da522f2f0a6a53df105389',mimetype=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),mimepart=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd') |
| 2022-03-01 21:35:33.771952 | Execute | INSERT INTO oc_filecache( storage, etag, mimetype, mimepart, permissions, name, parent, checksum, path_hash, path) VALUES(1,'379036057b5e5e04eb5f2901898643ae',(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),31,'uploads',35335,'','5128f35c9b4be13788ba41bdb6d1fc1f','uploads') ON DUPLICATE KEY UPDATE etag='379036057b5e5e04eb5f2901898643ae',mimetype=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd/unix-directory'),mimepart=(SELECT id FROM oc_mimetypes WHERE mimetype='httpd'),permissions=31,name='uploads',parent=35335,checksum='' |
+----------------------------+--------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
6 rows in set, 2 warnings (0.01 sec)
so the list of folders that are being inserted into storage 1 (which is my personal home) is definitively:
''
or the root of my users files in the data dirfiles
or the root of the files that are visible when browsing my filesfiles_trashbin
files_trashbin/files
files_trashbin/versions
uploads
there are more folders in my data dir, but they don't seem to be recreated ...
Ok that is caused by my parallel deployment of ocis: https://github.com/cs3org/reva/blob/master/pkg/storage/fs/owncloudsql/owncloudsql.go#L665-L670
When looking at the database queries we recently saw an analysis that revealed
To be the query that creates most of the work, at least for oracle:
But also the mysql performance schema lists it as the second most written table which is weird ... are we inserting mimetypes all the time????:
🤔
now ... this is happening on my personal instance which might be suffering from various quirks ... I'll dig deeper to see if I can come up with the root cause of this ...
Unfortunately, these queries do not show up in the diagnostics app log ... for whatever reason ...