-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Reduce number of queries to read shares in a folder #34918
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
Changes from all commits
10bc136
1d3070b
641968d
7d57fbf
0aca9f1
093e47e
6054d48
c7f5d11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -674,13 +674,6 @@ public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = t | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($reshares === false) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $qb->andWhere( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $qb->expr()->orX( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $qb->expr()->eq('uid_owner', $qb->createNamedParameter($userId)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
-677
to
-683
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this means we don't filter by
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am also concerned about this change. I have reverted it to check once again and I see that three integration tests fail consistently - in exactly the same way as when I started the PR. Please see my comments above - esp. this one and this one. I would welcome any suggestion how to fix this in a better way.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @icewind1991, I have looked once again into this issue. I think I have a better understanding now. One of the failing tests describes the following scenario: server/build/integration/sharing_features/sharing-v1-part2.feature Lines 306 to 318 in 96f0118
This scenario expects two shares to be returned for user1: user1 -> user2 and user2 -> user3. Obviously in the second share user1 is neither owner nor initiator - but the share should be returned anyway. I have recreated data for this scenario in my test environment and tried to repeat the issue from the UI. I have not been able to repeat this in the UI, but I have noticed a discrepancy between the following two API calls:
In the first case the shares are retrieved by DefaultShareProvider::getSharesBy that contains the following fragment to handle the reshares mode: server/lib/private/Share20/DefaultShareProvider.php Lines 760 to 771 in 96f0118
Here the userId parameter is ignored in reshares mode when the node parameter is specified. Before my changes the second API call was handled by invoking getSharesBy individually for each item in the folder. In this PR I want to reuse better handling already available in DefaultShareProvider::getSharesInFolder. So, to achieve consistency with previous behaviour - I think that the userId check should be removed from the getSharesInFolder method. The folder node must be provided, the code always adds an additional filter to retrieve only shares relevant to files/subfolders inside the provided folder. server/lib/private/Share20/DefaultShareProvider.php Lines 696 to 718 in 96f0118
Is my understanding correct? Or have I overlooked something?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @icewind1991, Trying once again to move this PR forward. I rebased the changes yesterday and once again removed the This is the last major item still open on the list of performance issues in the Android app that I started over a year ago. Would be great to get this merged. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // todo? maybe get these from the oc_mounts table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.