-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(trashbin): Fix n+1 issue in propfind in trash root #54317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| use OCA\DAV\CalDAV\DefaultCalendarValidator; | ||
| use OCA\DAV\Connector\Sabre\Directory; | ||
| use OCA\DAV\Connector\Sabre\FilesPlugin; | ||
| use OCA\Files_Trashbin\Sabre\TrashRoot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like depending on Files_Trashbin in the dav app, maybe worth creating a new interface that both TrashRoot and Directory inherit? Any name suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICachableCollection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMergedCollection? since it is about a dav collection that is created from merging multiple collections
|
This doesn't work with the group folder app as the content of the trash is stored in |
| use OCA\DAV\CalDAV\DefaultCalendarValidator; | ||
| use OCA\DAV\Connector\Sabre\Directory; | ||
| use OCA\DAV\Connector\Sabre\FilesPlugin; | ||
| use OCA\Files_Trashbin\Sabre\TrashRoot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICachableCollection?
So it breaks stuff with groupfolders? |
doesn't break it but also doesn't fix the similar issue there... I'm trying to rethink a bit how to do it so that it works for every trash backend |
e574092 to
9df9b4a
Compare
Found a solution, this adds a method to the ITrashBackend branch. I'm not sure it is allowed as it is an API break but then it's also in OCA and not OCP and we release the groupfolder app at the same time as server. Worst case, I can just add an interface :) |
9c07e5a to
0d37a55
Compare
| * @return Folder[] | ||
| * @since 32.0.0 | ||
| */ | ||
| public function getTrashRootsForUser(IUser $user): array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would encode further assumptions about how trash items are stored. If we ever want to expose "deleted but versioned" s3 objects or deleted items from filesystem snapshots this could be problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I wonder if there is a better way to do it. the list of Folder is really only used for pre-caching them and does not necessarily need to be exhaustive for this usecase
This comment was marked as off-topic.
This comment was marked as off-topic.
3938b32 to
684df76
Compare
684df76 to
9b3efb3
Compare
CustomPropertiesBackend is already able to cache the custom properties of a folder content. But the trash root is not a Directory but instead just a ICollection, so extend CacheEntry to also handle a TrashEntry. Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
That interface can be implemented by any ICollection that is based on one or multiple \OCP\Files\Folder to pre-fetch the custom properties. Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
Introduze a LazyMountPoint which is similar to LazyFile/LazyFolder and allow to avoid doing DB request when we just want the storage id and we already have it. Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
9b3efb3 to
a015a44
Compare
Summary
CustomPropertiesBackend is already able to cache the custom properties of a folder content. But the trash root is not a Directory but instead just a ICollection, so extend CacheEntry to also handle a TrashEntry.
DB queries before (with around 30 entries in trash, around half from a groupfolder):
DB queries after:
TODO
Checklist