Repository navigation
Closed
Description
Expected Behavior
oc_filecache entries to be removed
Actual Behavior
oc_filecache entries remain forever
Steps
Mount an external storage for a user (such as SMB Mount).
View oc_storages table and you will see the storage mount
View oc_filecache table and you will see the files in the storage mount
Remove the external storage mount for that user
View oc_storages table and the storage mount still exists:
mysql> select * from oc_storages;
+-----------------------------------+------------+
| id | numeric_id |
+-----------------------------------+------------+
| home::oc605 | 1 |
| local::/var/www/owncloud605/data/ | 2 |
| smb::[email protected]//TedB// | 3 |
+-----------------------------------+------------+
3 rows in set (0.00 sec)
View the oc_filecache table and files still exist:
mysql> select * from oc_filecache;
+--------+---------+----------------------------------------------+----------------------------------+--------+----------------------------------------------+----------+----------+--------+------------+---------------+-----------+------------------+---------------+
| fileid | storage | path | path_hash | parent | name | mimetype | mimepart | size | mtime | storage_mtime | encrypted | unencrypted_size | etag |
+--------+---------+----------------------------------------------+----------------------------------+--------+----------------------------------------------+----------+----------+--------+------------+---------------+-----------+------------------+---------------+
| 1 | 1 | | d41d8cd98f00b204e9800998ecf8427e | -1 | | 2 | 1 | 0 | 1409663947 | 1409663813 | 0 | 0 | 5405c3cbe3a31 |
| 2 | 1 | files | 45b963397aa40d4a0063e0d85e4fe7a1 | 1 | files | 2 | 1 | 0 | 1409663947 | 1409663813 | 0 | 0 | 5405c3cbe46b3 |
| 3 | 3 | | d41d8cd98f00b204e9800998ecf8427e | -1 | | 2 | 1 | 590202 | 1409663947 | 1409067126 | 0 | 0 | 5405c3cbe4e05 |
| 4 | 3 | alicia.JPG | 31afff473d8d00aae670b37f2162a5da | 3 | alicia.JPG | 4 | 3 | 112256 | 1385482319 | 1385482319 | 0 | 0 | 5405c3cbc771f |
| 5 | 3 | alicia4.JPG | 2dec69c2a9f1203f659104d4961fd5e0 | 3 | alicia4.JPG | 4 | 3 | 209832 | 1385482265 | 1385482265 | 0 | 0 | 5405c3cbc81ee |
| 6 | 3 | alicia6.JPG | 2233842fec744e55647a60bd1bae3e6d | 3 | alicia6.JPG | 4 | 3 | 100821 | 1385482298 | 1385482298 | 0 | 0 | 5405c3cbcb085 |
| 7 | 3 | Box Notes.docx | 216f5281726f0f0d66b960f621e00076 | 3 | Box Notes.docx | 6 | 5 | 0 | 1385482306 | 1385482306 | 0 | 0 | 5405c3cbcb868 |
| 8 | 3 | External Storage Mounts.docx | c2969fa1623d340700d21c4db6c0e6cf | 3 | External Storage Mounts.docx | 6 | 5 | 140773 | 1385136711 | 1385136711 | 0 | 0 | 5405c3cbcc172 |
| 9 | 3 | github.txt | 2a0024bd2b78a4d7b77aaa5e199de80d | 3 | github.txt | 8 | 7 | 32 | 1387204974 | 1387204974 | 0 | 0 | 5405c3cbcc74f |
| 10 | 3 | Lets go Mets | 8c2f8d095d335b1047dbff80c3bcf814 | 3 | Lets go Mets | 9 | 5 | 0 | 1385482323 | 1385482323 | 0 | 0 | 5405c3cbccb2b |
| 11 | 3 | logo-wide.svg | 62c8e3d96b576ea824e4f270c3c21fdf | 3 | logo-wide.svg | 10 | 3 | 5256 | 1385136809 | 1385136809 | 0 | 0 | 5405c3cbcd510 |
| 12 | 3 | New Test 99.txt | 9b8f96dc113453c9b3d78746c041a7c9 | 3 | New Test 99.txt | 8 | 7 | 45 | 1387476529 | 1387476529 | 0 | 0 | 5405c3cbcd8a0 |
| 13 | 3 | nov19 | 4bbe18414a9518c27ffeee7d954de720 | 3 | nov19 | 9 | 5 | 0 | 1385482336 | 1385482336 | 0 | 0 | 5405c3cbcdbe0 |
| 14 | 3 | owncloud.log | 9703bd00121351aafcb85ff51784acc5 | 3 | owncloud.log | 9 | 5 | 12188 | 1385482302 | 1385482302 | 0 | 0 | 5405c3cbcdf25 |
| 15 | 3 | Steve Test 1 | 80785b4fb129e1667588caf8825da5ce | 3 | Steve Test 1 | 9 | 5 | 0 | 1385482326 | 1385482326 | 0 | 0 | 5405c3cbce25e |
| 16 | 3 | Test 1 | 206a9b642b3e16c89a61696ab28f3d5c | 3 | Test 1 | 2 | 1 | 0 | 1384869247 | 1384869247 | 0 | 0 | 5405c3cbce583 |
| 17 | 3 | Test 15 | 6cc8a646b56fcf2a60c7f7c231ff469c | 3 | Test 15 | 9 | 5 | 0 | 1385047837 | 1385047837 | 0 | 0 | 5405c3cbce8ba |
| 18 | 3 | Test 5.txt | d789d4d3cbc81ac8a4d23eda8310c5db | 3 | Test 5.txt | 8 | 7 | 55 | 1390405395 | 1390405395 | 0 | 0 | 5405c3cbcebf2 |
| 19 | 3 | Test 77662 one | d72f01d2a9b593cdb2ed3de41fab45d3 | 3 | Test 77662 one | 9 | 5 | 4 | 1385482296 | 1385482296 | 0 | 0 | 5405c3cbcef2e |
| 20 | 3 | Test Plan ownCloud OC6_BETA4 - WINDOWS.docx | 3672a694104d909bb5d68fb76cdd9680 | 3 | Test Plan ownCloud OC6_BETA4 - WINDOWS.docx | 6 | 5 | 8846 | 1387476933 | 1387476933 | 0 | 0 | 5405c3cbcf289 |
| 21 | 3 | Test SMB | 2f692411fb26ece11c366db14f18e7d7 | 3 | Test SMB | 9 | 5 | 0 | 1385482345 | 1385482345 | 0 | 0 | 5405c3cbcf5c7 |
| 22 | 3 | test SSbB | 30d83845a422a6fc494dae9d0160b689 | 3 | test SSbB | 9 | 5 | 0 | 1370535883 | 1370535883 | 0 | 0 | 5405c3cbcf8f3 |
| 23 | 3 | test.txt | dd18bf3a8e0a2a3e53e2661c7fb53534 | 3 | test.txt | 8 | 7 | 24 | 1387476621 | 1387476621 | 0 | 0 | 5405c3cbcfc61 |
| 24 | 3 | test.txt (2).txt | 7e6dbbbd064b285985d7bc003f4110d5 | 3 | test.txt (2).txt | 8 | 7 | 0 | 1389973693 | 1389973693 | 0 | 0 | 5405c3cbcff96 |
| 25 | 3 | test.txt.txt | c299535170b7a5da8913d47733614354 | 3 | test.txt.txt | 8 | 7 | 26 | 1389973730 | 1389973730 | 0 | 0 | 5405c3cbd02ce |
| 26 | 3 | Test123 | 68eacb97d86f0c4621fa2b0e17cabd8c | 3 | Test123 | 9 | 5 | 0 | 1409066505 | 1409066505 | 0 | 0 | 5405c3cbd0606 |
| 27 | 3 | test123.txt | 6da18d765028223ac5827ecf9c932e9f | 3 | test123.txt | 8 | 7 | 0 | 1409067126 | 1409067126 | 0 | 0 | 5405c3cbd0945 |
| 28 | 3 | test1234 | 16d7a4fca7442dda3ad93c9a726597e4 | 3 | test1234 | 9 | 5 | 0 | 1385482351 | 1385482351 | 0 | 0 | 5405c3cbd0c8a |
| 29 | 3 | test4 | 86985e105f79b95d6bc918fb45ec7727 | 3 | test4 | 9 | 5 | 0 | 1385482331 | 1385482331 | 0 | 0 | 5405c3cbd0fbe |
| 30 | 3 | testme.txt | 36796fb60874df776c413dca9183d4a3 | 3 | testme.txt | 8 | 7 | 0 | 1385482310 | 1385482310 | 0 | 0 | 5405c3cbd12f6 |
| 31 | 3 | TestSync.txt | b4957fc6be01213e399490c5ee93f166 | 3 | TestSync.txt | 8 | 7 | 40 | 1385482261 | 1385482261 | 0 | 0 | 5405c3cbd1658 |
| 32 | 3 | Valerio | 08f6b1e002a4fbd734c9323d9bc3c348 | 3 | Valerio | 9 | 5 | 4 | 1385482258 | 1385482258 | 0 | 0 | 5405c3cbd198c |
+--------+---------+----------------------------------------------+----------------------------------+--------+----------------------------------------------+----------+----------+--------+------------+---------------+-----------+------------------+---------------+
32 rows in set (0.00 sec)
Run files:scan utility and check oc_filecache and files still exist.
There is no way to remove the files from the oc_filecache table.
00001186
Activity
karlitschek commentedon Sep 2, 2014
@icewind1991 any idea?
PVince81 commentedon Sep 3, 2014
Also happens on OC 7.
Storages are not deleted.
There was a fix on OC 7 when renaming mount points: #9495
But it doesn't seem to handle storage deletion.
icewind1991 commentedon Sep 3, 2014
This has been brought op in the past but we've never had a conclusion about when we should clear out the filecache due to the data that is lost in removing and rescaning the cache.
If an admin removes a storage and re-adds it, should the shares still exists, etc...
PVince81 commentedon Sep 5, 2014
I also remember hearing such discussions in the past but can't find them any more in Github.
One issue would be that clicking on the "X" can happen by mistake.
So I suggest to add the "Undo" notification like for users and only delete after leaving the page.
And then actually delete the "oc_storage" entry, the "oc_filecache" entries and the matching "oc_share" entries. I think there's a single function for that.
What do you think ?
PVince81 commentedon Sep 5, 2014
@craigpg @MTRichards I've set this to next sprint. Please confirm.
MTRichards commentedon Sep 5, 2014
It is a sev 2, so that works. Thanks @PVince81
MTRichards commentedon Sep 17, 2014
@ser72 Need a little more background. There is a use case for where this is how it should work. For example, if you accidentally delete it and want to re-add it, this should not cause a complete re-sync. Also, if the external storage is not available, we don't want to clean the database.
Best bet is probably to make it time based, and have the database cleaned after something like 3 days, using a cron - but that is then an enhancement.
Comments @ser72 ?
ser72 commentedon Sep 17, 2014
@MTRichards
I would think time based is ok. The use case here is that if an external storage mount exists, for testing purposes lets say, with hundreds or thousands of files, each has an entry in oc_filecache.
Then if the admin desires to unmount the external storage. the oc_filecache table never gets cleaned up. Thus there are invalid/unnecessary entries in the table which, even a files:scan won't remove. In the case of thousands of files, that's thousands of lines of useless data in the database taking up space.
ser72 commentedon Sep 17, 2014
@MTRichards As for accidentally deleting the files, how about the "undo" as @PVince81 suggested above?
46 remaining items
DeepDiver1975 commentedon Oct 6, 2015
@PVince81 any fix at hand? What can we do here? THX
PVince81 commentedon Oct 6, 2015
No current fix at hand, need to start from scratch.
DeepDiver1975 commentedon Oct 6, 2015
@cmonteroluque @karlitschek 9.0 or fix during 8.2rc1 phase? THX
PVince81 commentedon Oct 6, 2015
also the fix would be limited to storages that don't use the "$user" variable, which itself makes it impossible to identify the associated storages.
PVince81 commentedon Oct 6, 2015
also I believe that we wanted to have the "undo" feature at the same time in case an admin deletes the wrong storage, so we wouldn't directly delete all cache entries for it right away.
PVince81 commentedon Oct 6, 2015
Fix is here for the removal: #19610
Does not work with
$uservariables, these are ignored at deletion time. Also does not contain an undo feature.MorrisJobke commentedon Oct 6, 2015
@michaelstingl @cdamken Can you communicate this? Be aware of the restrictions of the solution: #19610 (comment)
cdamken commentedon Oct 8, 2015
Thanks @MorrisJobke I communicated the info too.
lock commentedon Aug 7, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.