Skip to content

fix(files): clean up filecache companion rows of removed storages - #64208

Merged
susnux merged 1 commit into
fix/63969-filecache-removal-eventsfrom
fix/filecache-companion-cleanup
Sep 17, 2026
Merged

susnux merged 1 commit into
fix/63969-filecache-removal-eventsfrom
fix/filecache-companion-cleanup

Conversation

@solracsf

@solracsf solracsf commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Deleting an external storage removed its filecache rows through Storage::cleanByMountId() but left their filecache_extended, files_metadata and files_metadata_index rows behind. They now go through the same batched helper as Cache::clear().

occ files:cleanup now also removes rows in those three tables whose file id is no longer in the filecache, so instances that already have orphans can clean them up. This is a full walk of each table (1000 file ids per batch, across all shards) instead of only looking at deleted storages, so it takes longer on large instances. --skip-filecache-extended still skips the filecache_extended pass, and the command prints two extra lines for the metadata tables.

The new tests fail without the change and pass with it on MariaDB 11.8 and PostgreSQL 16 (local and S3 primary storage) and on a 4-shard MariaDB setup.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

cleanByMountId() deleted the filecache rows of an unmounted storage but
left their filecache_extended and file metadata rows behind. It now goes
through Storage::removeFileCacheEntries(), the same path clear() uses.

files:cleanup also removes filecache_extended, files_metadata and
files_metadata_index rows whose file is no longer in the filecache, so
rows orphaned before this fix are cleaned up too.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf
solracsf requested a review from a team as a code owner September 11, 2026 10:30
@solracsf solracsf added this to the Nextcloud 36 milestone Sep 11, 2026
@susnux
susnux merged commit 08b856f into fix/63969-filecache-removal-events Sep 17, 2026
158 checks passed
@susnux
susnux deleted the fix/filecache-companion-cleanup branch September 17, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants