Skip to content

fix(acl): make preloadRulesForFolder actually warm the rule cache#4737

Open
solracsf wants to merge 1 commit into
masterfrom
fix/warm-rule-cache
Open

fix(acl): make preloadRulesForFolder actually warm the rule cache#4737
solracsf wants to merge 1 commit into
masterfrom
fix/warm-rule-cache

Conversation

@solracsf
Copy link
Copy Markdown
Member

@solracsf solracsf commented Jun 3, 2026

Summary

ACLManager::preloadRulesForFolder() was a no-op: it ran a query that scans every child of a folder and then threw the result away, caching nothing. This fixes it to populate the rule cache as intended, and speeds up the underlying query.

preloadRulesForFolder() called RuleManager::getRulesForFilesByParent() but ignored the returned array:

public function preloadRulesForFolder(int $storageId, int $parentId): void {
    $this->ruleManager->getRulesForFilesByParent($this->user, $storageId, $parentId);
}

getRulesForFilesByParent() has no caching side effect: it just builds and returns rules. So on every trash listing (TrashBackend::listTrashFolder() and getTrashForFolders()), this query scanned every child of the folder (~20k filecache rows on a large folder) and cached nothing. The intent was clearly to warm ACLManager::$ruleCache so the subsequent per-child getACLPermissionsForPath() calls would be cache hits.

Measured ~3.6x faster for the preload query on a 15k-ACL / 20k-child folder (MariaDB 10.11), plus the per-child lookups for children that have rules are now served from cache instead of issuing a query per path.

@solracsf solracsf added 3. to review Items that need to be reviewed performance πŸš€ bug labels Jun 3, 2026
@solracsf solracsf self-assigned this Jun 3, 2026
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf solracsf force-pushed the fix/warm-rule-cache branch from bd26a07 to 9221146 Compare June 3, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Items that need to be reviewed bug performance πŸš€

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant