-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Reduce sql queries for groupname tests. #1902
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
Conversation
|
👍 |
1 similar comment
|
👍 |
cms/djangoapps/auth/authz.py
Outdated
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 quite understand the structure here: Will this function end up removing the user from more than one group? If so, do we want a .save() for each group? Would it work to move the .save() to after the for loop?
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 was mechanically editing and not thinking as clearly as you :-) I've made the change on the branch I'm progressing for the other fixes.
Conflicts: cms/djangoapps/auth/authz.py
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 think you could just do user.groups.remove(*user.groups.filter(name__in=groupnames)), which should cut it down to a single remove query (although from the previous comments, there might only be one anyway)
|
👍 |
|
Please review this next chunk of changes: @cpennington @chrisndodge Refactored loc mapper to use SON for subdocument queries and thus the default '_id' index. (I meant to put these on a different branch building on this one, mea culpa). As far as I can tell, this reduces the mongo time by about a factor of 2. I still need to implement memoization to get rid of most of the calls (I'll do that on a branch of this one this time). Need to have @e0d add 2 more indexes to location_map on all mongo dbs: |
STUD-1039
|
@dmitchell looking. I see test failed, but it's a locked database error. Spurious error?!? |
|
Just a clarification: as a high level summary, this just makes sure the queries are hitting the indicies (thus the perf increase). This doesn't reduce # of round trips. Right? |
|
Yes, the error looked unrelated to me too. Yes, this just ensures that every query uses the indices. I'm going to impl memoization to ensure the queries don't repeat which will curtail the round trips. |
|
re: memoization, we have in the code base a "request_cache", which is a cache which has a lifetime during the span of a request. I guess it should have been named "request_scoped_cache" :-) That might be helpful for you to do this. |
|
Can we ding the branch again to get a clean test pass? +1 but you should get @cpennington to go over it as well |
|
@dmitchell , that first commit ( 01e66ec) is already in release. #1906 |
|
👍 |
|
Changed to PR against master https://github.com/edx/edx-platform/pull/1954 |
|
@dmitchell we still want this against release because we're hotfixing off of this PR |
* Fix bug 'self'. openedx#1904 * Add validation of email subject and body. openedx#1904 * Mod to get first record, if duplicate. openedx#1903 * Fix margin. openedx#1905 * Fix scrollbar and skip bok-choy. openedx#1906
STUD-1039
@adampalay @cpennington please review