Skip to content

fix retrieval of group members and cache group members - #11494

Merged
blizzz merged 5 commits into
masterfrom
fix-ldap-ingroup-for-9225-2
Oct 17, 2014
Merged

blizzz merged 5 commits into
masterfrom
fix-ldap-ingroup-for-9225-2

Conversation

@blizzz

@blizzz blizzz commented Oct 9, 2014

Copy link
Copy Markdown
Contributor

replaces #11161

This is the missing piece to fix #10513 for LDAP users.

Please review! Please mind, the performance is not very lovely on a big LDAP setup, but i brought it down from over 40 to less than 10s with a huge user base (OpenLDAP). Getting group memberships is the expensive part here. At least it works… Testing with AD is also yet necessary.

@blizzz blizzz changed the title [WIP] fix retrieval of group members and cache group members fix retrieval of group members and cache group members Oct 10, 2014
@blizzz

blizzz commented Oct 10, 2014

Copy link
Copy Markdown
Contributor Author

Please test/review @Xenopathic @PVince81 @craigpg @jnfrmarks

@craigpg

craigpg commented Oct 11, 2014

Copy link
Copy Markdown

I'm a bit confused on the specific use case we're trying to solve, but in my testing with and without this patch the drop-down autocomplete only has 15 names in it in either case. Additionally, the results with the patch are different. The results without the patch look more correct to me.

Without patch (looks correct, but there are more than 15 users that match the criteria):
image
With patch:
image
Tested against group that has 794 members, many of which (well more than 15) start with "a".

Separately, note the ordering of the results here (with patch):
image

None of the above is fatal, but it does require that you type enough of the name (i.e. get fewer results) such that the name you're looking for appears in the list of names.

@blizzz

blizzz commented Oct 13, 2014

Copy link
Copy Markdown
Contributor Author

@craigpg

Will you find caleb_homenick without the patch? No local users included?

With my test group (49 users) and without the patch the search for "oo" runs over 10 minutes and results in 0 entries (3 expected).

With the patch it returns the correct results in 4 seconds.

@craigpg

craigpg commented Oct 13, 2014

Copy link
Copy Markdown

I'm confused by what the correct results are supposed to look like. If the problem was not finding the user at all (given enough input text to narrow it down), then I think we're ok.

However, if the problem is that select menu created by partial text doesn't include the right number of users and/or if that list is not ordered correctly, then finding the user might be confusing.

The screenshots above are both valid in that they match the substring criteria (both were limited to 15 users, is that intentional?), but that patched menu (and its ordering) is matching the substring anywhere while the unpatched is matching the substring at the start of the string.

I've yet to see anything take 5+ minutes, so it's likely I'm not understanding the use case well enough to reproduce.

@craigpg

craigpg commented Oct 15, 2014

Copy link
Copy Markdown

Did some more testing and this looks good. +1

We should consider adding tests to verify we're hitting the cache (and not hitting ldap) as expected.

@blizzz

blizzz commented Oct 16, 2014

Copy link
Copy Markdown
Contributor Author

One more reviewer required, @PVince81 @Xenopathic @razyr or others

@blizzz

blizzz commented Oct 16, 2014

Copy link
Copy Markdown
Contributor Author

That's all Jenkins tells me:

Test report file /var/jenkins/workspace/pull-request-analyser-ng-simple/label/vm-slave-02/tests/autotest-results-sqlite.xml was length 0

Guess, this is OK in fact? @DeepDiver1975

@PVince81

Copy link
Copy Markdown
Contributor

I tried the following: have a group with about 1400 zombies inside. When sharing with that group, the share.php call takes:

  • on master: 53s, 54s, 59s, 59s => avg 56s
  • on this branch: 42s, 45s, 53s, 48s => avg 47s

The difference is not significant.

From what i heard from @butonic on IRC he seemed to have much more but also got similar results, without significant difference.

Since many hours have already gone into testing this, and @blizzz and @craigpg tested it and confirmed the improvement, and the code looks good, I suggest to merge 👍

@ghost

ghost commented Oct 16, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/520/

Build result: FAILURE

GitHub pull request #11494 of commit 2017d7e automatically merged.Building remotely on vm-slave-02 (SLAVE) in workspace /var/jenkins/workspace/pull-request-analyser-ng-simple@7 > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.git > git --version # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git rev-parse origin/pr/11494/merge^{commit} # timeout=10Checking out Revision 267b4b4039a48b1f7e643b9fcf137fd12a5aa6e5 (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 267b4b4039a48b1f7e643b9fcf137fd12a5aa6e5 > git rev-list fdd52d3e9a3cb630a802919fdc3d4da2e8f2069f # timeout=10 > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02Configuration pull-request-analyser-ng-simple » vm-slave-02 is still in the queue: Waiting for next available executor on vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 5 minutes
💣 Test FAILed. 💣

@craigpg

craigpg commented Oct 17, 2014

Copy link
Copy Markdown

@blizzz
We could reduce some server traffic by making some small adjustments to our use of autocomplete, for example:

$('#shareWith').autocomplete({minLength: 2, delay: 750, ...)

This would prevent a ldap substring search on a single character (e.g. displayName=a) and would give the user a little time to correct their typos instead of sending a request as each character is entered.

@butonic, @PVince81
Separately, we should check the performance of your test ldap servers and make sure they are properly indexed. The ldap log will warn you about searches that are being resolved without indexes.

To test, you can use ldapsearch:

ldapsearch -x -LLL -H ldap:/// -b dc=owncloudqa,dc=com (&(|(memberOf=cn=aggregate-24x7-users,ou=groups,dc=owncloudqa,dc=com))(displayName=*aal*))"

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

@craigpg yes, agreed, i suggested it in another github issue, was waiting for a comment by @schiesbn. alas, i am don't know by heard in which issue it was.

@craigpg

craigpg commented Oct 17, 2014

Copy link
Copy Markdown

@blizzz, can we get the autocomplete change in before the merge? We can investigate the other performance issues separately.

@butonic

butonic commented Oct 17, 2014

Copy link
Copy Markdown
Contributor

Ok, after a lot of fiddeling with the LDAP setup (nothing new here) I can see the other members of my group (~300 users) after ~22sec. I have ~30k users in 100 groups, of which only members of 10 groups are enabled in OC.

on master the search hasnt finished after 5 min and timeouts. so 👍 from me

@butonic

butonic commented Oct 17, 2014

Copy link
Copy Markdown
Contributor

@owncloud-bot retest this please

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

ty @butonic

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

afterwards we merge

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

@blizzz, can we get the autocomplete change in before the merge? We can investigate the other performance issues separately.

Have seen this just now. I would like to have @schiesbn opinion and also @jancborchardt about the min required amount of characters to trigger search

@PVince81

Copy link
Copy Markdown
Contributor

I'd agree, but let's do it in a separate PR. This one lived long enough...

Also, @blizzz please rebase

@ghost

ghost commented Oct 17, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/663/

Build result: FAILURE

[...truncated 2 lines...] > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.git > git --version # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git rev-parse 2017d7e^{commit} # timeout=10Checking out Revision 2017d7e (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 2017d7e > git rev-list bf9127aa2c2a085d0e0157eff764684a2d7e3ed4 # timeout=10First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02Configuration pull-request-analyser-ng-simple » vm-slave-02 is still in the queue: Waiting for next available executor on vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 4 second
💣 Test FAILed. 💣

@schiessle

Copy link
Copy Markdown
Contributor

I have no objections against the suggestion regarding auto complete, I think it makes sense to have a delay here. I leave it to you if you want to add it to this PR or create a new PR for it.

Probably I doesn't make much sense to wait for Jenkins at the moment, my suggestion: rebase and merge it if the tests run on your local system.

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

Well, Jenkins sees 2 failing tests. I rebase and look after it.

@blizzz
blizzz force-pushed the fix-ldap-ingroup-for-9225-2 branch from 2017d7e to 7ff7a49 Compare October 17, 2014 18:53
@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

And those tests were failing, because they were not adjusted according to the changes in the group manager. Should be resolved now, at least locally.

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 7 new issues, 4 updated code elements

@ghost

ghost commented Oct 17, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/681/

Build result: FAILURE

GitHub pull request #11494 of commit 7ff7a49 automatically merged.Building remotely on vm-slave-02 (SLAVE) in workspace /var/jenkins/workspace/pull-request-analyser-ng-simple > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.git > git --version # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git rev-parse origin/pr/11494/merge^{commit} # timeout=10Checking out Revision 3d76a4ef88fe64a5b74147c5751d56b0e6beb74f (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 3d76a4ef88fe64a5b74147c5751d56b0e6beb74f > git rev-list 79bf2d27cc62cdaed8a9dfa63620af105eaa31b2 # timeout=10First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 3 second
💣 Test FAILed. 💣

@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

Now Jenkins is kidding me. It says it tested the latest commit, but the console output indicates it has an older code state (otherwise the fail messages really cannot happen). Tests succeed locally.

@LukasReschke

Copy link
Copy Markdown
Contributor

@owncloud-bot Retest this please.

@ghost

ghost commented Oct 17, 2014

Copy link
Copy Markdown

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/687/
🚀 Test PASSed. 🚀

blizzz added a commit that referenced this pull request Oct 17, 2014
fix retrieval of group members and cache group members
@blizzz
blizzz merged commit 2b6281f into master Oct 17, 2014
@blizzz
blizzz deleted the fix-ldap-ingroup-for-9225-2 branch October 17, 2014 21:57
@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

Since you confirmed a less severe PR to be backported, i assume i am allowed to do it here as well, @karlitschek

blizzz added a commit that referenced this pull request Oct 17, 2014
fix retrievel of group members and cache group members

fix changed variable name

with several backends, more than limit can be returned

make performance less bad. Still far from good, but at least it works

add one simple cache test

adjust group manager tests
@blizzz

blizzz commented Oct 17, 2014

Copy link
Copy Markdown
Contributor Author

backport to stable7: 86daab2
backport to stable6 waits for #11217 to be merged first

@karlitschek

Copy link
Copy Markdown
Contributor

Sure. Risk should be ok so please backport

blizzz added a commit that referenced this pull request Oct 20, 2014
fix retrievel of group members and cache group members

fix changed variable name

with several backends, more than limit can be returned

make performance less bad. Still far from good, but at least it works

add one simple cache test

adjust group manager tests

Conflicts:
	apps/user_ldap/group_ldap.php
	apps/user_ldap/lib/access.php
	apps/user_ldap/tests/group_ldap.php
@blizzz

blizzz commented Oct 20, 2014

Copy link
Copy Markdown
Contributor Author

and backport to stable6 is here: e46f87f

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot share with a user in a group of more than 15 members

8 participants