fix(files_metadata): chunk file id list in getMetadataFromFileIds - #64608
Open
shawon9324 wants to merge 6 commits into
Open
shawon9324 wants to merge 6 commits into
shawon9324 wants to merge 6 commits into
Conversation
getMetadataFromFileIds() passed the full file id array into a single IN() expression. QueryBuilder rejects lists above MAX_IN_PARAMETERS, so PROPFIND on directories with more than 1000 files failed with a query exception. Query the ids in chunks, matching dropMetadataForFiles(). Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: shawon9324 <shawon9324@gmail.com>
shawon9324
requested review from
Altahrim,
come-nc,
leftybournes and
salmart-dev
and removed request for
a team
September 21, 2026 06:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getMetadataFromFileIds()currently passes the complete list of file IDs into a singleIN()clause. When the list exceedsIQueryBuilder::MAX_IN_PARAMETERS, QueryBuilder logs an error for the oversized parameter list but still proceeds with the query. This can cause repeated error logging during operations such as PROPFIND on directories containing more than 1000 files, and can escalate to an actual query failure when backend-specific parameter limits are reached.The issue originates before normal database execution because the complete array is passed to
createNamedParameter()asPARAM_INT_ARRAY. QueryBuilder detects arrays larger thanIQueryBuilder::MAX_IN_PARAMETERSand logs the condition, while PostgreSQL can genuinely fail at sufficiently large parameter counts due to its protocol parameter-count limit, and Oracle has a database-level limit of 1000 expressions in anIN()list.This change splits the file ID list into chunks of
IQueryBuilder::MAX_IN_PARAMETERS, executes one query per chunk, and merges the resulting metadata into the same return array. This follows the existing chunking pattern already used bydropMetadataForFiles()and avoids introducing a separate query strategy or architectural change. Tests were added to verify both parameter chunking and that results from multiple chunks are merged correctly.The issue report mentions both
getMetadataFromFileIds()anddropMetadataForFiles(). I verified thatdropMetadataForFiles()is already chunking its input correctly and already has coverage throughtestDropMetadataForFilesChunking(). Therefore, onlygetMetadataFromFileIds()still required a fix.Checklist
3. to review, feature component)stable32)AI (if applicable)