-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Reduce number of queries to read shares in a folder #34918
Conversation
I have been able to fix failing unit tests in 23d06ee, but I am not satisfied with this approach. 😞 I am afraid that I do not understand the approach to the unit tests well enough to do it better. Any suggestions are welcome. On the other hand the failing integration tests seem to point to a real issue with my update. I will look into it. |
I have managed to repeat locally the first failing scenario of the integration tests. At the moment I do not know how to fix the code. 😞 The problem is that:
A couple of questions:
Please advise. Update When I looked at the code in |
It seems that the quick-and-dirty change in d0c52e5 fixed the failing integration tests. 😮 Do you think this approach is correct? If yes, I will clean it up and make updates for the other review comments. |
I have committed small changes already requested by reviewers in c51e756 After removing the uid check for reshares mode in DefaultShareProvider::getSharesInFolder, the failing tests run OK. In the last run there is a failure in acceptance-app-files-sharing, but this one was OK just before clean-up, so I assume that this is a random error that I have seen already in the previous PR (#34471). I do not plan any more changes unless there are additional suggestions from review. |
How is the removal of uid check affecting the performance benchmark shown in your first post? |
Same results as previously - within error margin. The timings vary between 260 and 290 ms. Even the query count is not always the same, I see a slightly varying number of Average results from a few runs are:
This is a very good question. I have removed the uid check to fix the following integration tests:
This also fixed the issue that I have noticed at the beginning: original code handling this API call also returned information about incoming group shares. After removal of the uid check the new code behaves the same. I suspect that there are some other scenarios when |
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Seems like the tests pass now... |
Hi @nickvergessen and @icewind1991, I see a new PR #42638 touching the same area as this one - i.e. the Could we use this as an opportunity to get back to this PR? This is pending for a long time and is quite important to improve performance of the Android app. I will be glad to provide additional explanation and make further changes when suggested. At the moment I think that I had already responded to all questions/concerns and I have no idea what else I could do, to move this one forward. |
I will bring it to the performance group and check for feedback the first week of february |
0d09169
to
ba32ac1
Compare
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Code clean-up Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
This reverts commit 1367fc1. Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
ba32ac1
to
c7f5d11
Compare
@AndyScherzinger @icewind1991 - Is there anything I should/could do regarding this PR? I see that one of the failing tests is 'block unconventional commits'. I can squash all the commits into one if this is going to help. |
While working on nextcloud/android#10783 I have found that the API call to retrieve shares for files in a folder (/ocs/v2.php/apps/files_sharing/api/v1/shares?path=xyz&reshares=true&subfiles=true) executes 6 database queries for each file.
I have modified implementation of the ShareAPIController::getSharesInDir to use OC\Share20\Manager::getSharesInDir rather than retrieving shares separately for each file in the folder.
This significantly reduces the number of database queries and improves performance. In my tests (331 files in a folder) I got the following results (most of the time is now spent in the initialization code):
After implementing this change, I have noticed some changes in data returned from the API.
Original code handling this API call also returned information about incoming group shares. I do not know if this was an intended behaviour or an error in the original implementation.Update - after removing the uid check for re-shares mode in d0c52e5, the new code returns the same information in this case as the original one.