server icon indicating copy to clipboard operation
server copied to clipboard

feat: remove orphaned entries from filecache_extended

Open kesselb opened this issue 1 year ago • 2 comments

  • Resolves: #

Summary

Test scenario:

  • Run sql: select * from oc_filecache_extended left join oc_filecache on oc_filecache_extended.fileid = oc_filecache.fileid where oc_filecache.fileid is null;
  • Mount an external storage (e.g. local)
  • Upload some files to the external storage
  • Delete external storage
  • Run sql: select * from oc_filecache_extended left join oc_filecache on oc_filecache_extended.fileid = oc_filecache.fileid where oc_filecache.fileid is null;
  • See files without a matching record in filecache

https://github.com/nextcloud/server/blob/e69c7c4d26731acd91cc683fbe118da1e423c460/lib/private/Files/Cache/Storage.php#L222

Best would be to clear filecache_extended when deleting the storage.

TODO

  • [ ] OCI
  • [x] CI

Checklist

kesselb avatar Jun 21 '23 14:06 kesselb

Moving to 29

kesselb avatar Nov 14 '23 19:11 kesselb

Howdy :wave:

Thank you for taking care, I almost forgot about it :see_no_evil:

I don't remember if I tested it with OCI back then. The chunking (for the OCI in clauses limit) is there.

kesselb avatar Feb 17 '24 16:02 kesselb

1) OCA\Files\Tests\Command\DeleteOrphanedFilesTest::testClearFiles
Expectation failed for method name is "writeln" when invoked 2 time(s)
Parameter 0 for invocation #1 Symfony\Component\Console\Output\OutputInterface::writeln('0 orphaned file cache extende...eleted', 0) does not match expected value.
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1 orphaned mount entries deleted'
+'0 orphaned file cache extended entries deleted'

skjnldsv avatar Feb 24 '24 18:02 skjnldsv

Moving to 30

kesselb avatar Mar 28 '24 15:03 kesselb