-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: add pruning for orphaned chat file_ids entries #23910
Copy link
Copy link
Open
Description
Context
PR #23537 adds a file_ids uuid[] column to chats. File IDs are appended when messages reference uploaded files, but no code path ever removes entries from this array.
Problem
- Editing a message to replace file A with file B leaves A in
file_ids(phantom reference). - Soft-deleted messages' file references persist in the array.
- Over time, chats accumulate stale entries (capped at 20 by
MaxChatFileIDs). - No
dbpurgejob exists to clean up orphanedchat_filesrows.
Suggested approach
- Add a
dbpurgejob that periodically scans forchat_filesrows not referenced by any chat'sfile_idsarray. - Optionally, add a
RemoveChatFileIDsquery to scrub stale entries when messages are soft-deleted.
The current cap of 20 limits the practical impact, but this should be addressed before the feature leaves experimental.
Ref: #23537 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels