server
server copied to clipboard
feat: remove orphaned entries from filecache_extended
- 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
- Code is properly formatted
- Sign-off message is added to all commits
- [ ] Tests (unit, integration, api and/or acceptance) are included
- [ ] Screenshots before/after for front-end changes
- [ ] Documentation (manuals or wiki) has been updated or is not required
- [ ] Backports requested where applicable (ex: critical bugfixes)
Moving to 29
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.
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'
Moving to 30