Skip to content

fix(files): chunk filecache IN queries to respect Oracle's 1000-element limit#60958

Draft
miaulalala wants to merge 2 commits into
masterfrom
perf/noid/chunk-filecache-in-queries
Draft

fix(files): chunk filecache IN queries to respect Oracle's 1000-element limit#60958
miaulalala wants to merge 2 commits into
masterfrom
perf/noid/chunk-filecache-in-queries

Conversation

@miaulalala
Copy link
Copy Markdown
Contributor

@miaulalala miaulalala commented Jun 3, 2026

  • Resolves: #

Summary

Oracle raises ORA-01795 when an IN list exceeds 1000 elements. getByFileIds and getByFileIdsInStorage in FileAccess passed the full input array directly into a single IN clause with no upper bound.

files_sharing/Updater::move() collects all of a user's share node IDs across user, group, and room share types — without capping the count — before calling getByFileIdsInStorage. This is a realistic failure path for power users on Oracle.

Both methods are now chunked at 1000 elements per query with results merged, and an early return for empty input avoids issuing a vacuous IN query. Method signatures and return types are unchanged.

As a follow-up, the manual array_chunk loop in SetupManager::setupForPath that pre-chunked before calling getByFileIds is removed — it is now redundant since the method handles chunking itself.

TODO

  • Verify Oracle CI passes

Checklist

AI (if applicable)

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

Assisted-by: ClaudeCode:claude-sonnet-4-6

…nt limit

Oracle raises ORA-01795 when an IN list exceeds 1000 elements. Both
getByFileIds and getByFileIdsInStorage passed the full input array
directly into an IN clause with no upper bound, so any caller
supplying more than 1000 file IDs would get a hard DB error on Oracle.
files_sharing/Updater collects all of a user's share node IDs without
limiting the count before calling getByFileIdsInStorage, making this
a realistic failure path for power users.

Chunk both methods at 1000 and merge results, keeping the method
signatures and return types identical. Add an early return for empty
input to avoid issuing a vacuous IN query.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: Anna Larch <anna@nextcloud.com>
getByFileIds now chunks internally, so the array_chunk loop in
SetupManager::setupForPath was doing a double chunk. Replace with a
direct call.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala self-assigned this Jun 3, 2026
@miaulalala miaulalala added this to the Nextcloud 35 milestone Jun 3, 2026
@miaulalala miaulalala added ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) performance 🚀 labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress enhancement feature: files performance 🚀 ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant