-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Optimizing pointer CLP query decoration done by DatabaseController#addPointerPermissions #6747
Optimizing pointer CLP query decoration done by DatabaseController#addPointerPermissions #6747
Conversation
}; | ||
const ors = permFields.map((key) => { | ||
const fieldDescriptor = schema.getExpectedType(className, key); | ||
const fieldType = fieldDescriptor.type; |
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.
The CI tests failed because I can get null/undefined/string in fieldDescriptor
. Basically I assumed that I could only get a descriptor with a type
of Array
or Pointer
, but it seems this is not the case. I will investigate this issue further and revisit this code. If anyone can point me in the right direction as to why I can get null/undefined or a string as the pointer CLP I will appreciate it.
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 I realized that the CI build failed because of the flow type checker and I know why. I am still getting used to flow since I haven't used it before.
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.
Fixed it.
I just added some tests... |
Codecov Report
@@ Coverage Diff @@
## master #6747 +/- ##
==========================================
- Coverage 93.90% 93.83% -0.08%
==========================================
Files 169 169
Lines 12197 12267 +70
==========================================
+ Hits 11454 11511 +57
- Misses 743 756 +13
Continue to review full report at Codecov.
|
I am going to ignore the code coverage errors for now. It was not failing until my last push to the branch, which added tests to cover areas that weren't previously covered. It did not failed when I originally created the PR. |
@mtrezza I apologize in advance for tagging you. I do have one question to ask and I didn't know where to ask. What actions do I need to take to get this work reviewed? Asking since this PR has been up for a while and I do not know if I need to take some additional actions so that my work starts to get reviewed. If I just need to wait for a maintainer to review my work, then I do not mind the wait :) Thanks in advance! |
@mess-lelouch Thanks for your contribution and apologies for the wait. I remember the analysis of this issue this PR intends to fix. Let me look into this again in some more detail. In the mean time, can you please make sure (if you haven't already) that we have a test case for every possible scenario:
Also, can you please make sure there are no (lint) changes in the PR of unrelated code, so we can focus on the actual change. |
No need to apologize. On the contrary, thank you for dedicating your time to maintaining this piece of software that I use. I added test cases for everything you mentioned except for the literal object case. And the reason I didn't is because I assumed it was not supported since the dashboard does not let me set a field of type That said, I could easily add it if you think it is necessary (i.e. due to backwards compatibility reasons). |
Exactly because of that - IIRC I made an assumption as to why literal pointer objects are supported, but there was no definitive conclusion, so to be safe I suggest we add this for backwards compatibility and add a code comment for future contributors, so we may remove that code at some point in the future. Unless you want to do some more research regarding this to remove this on more solid ground. |
Makes sense... I think I will save myself some time and add it. |
@mtrezza ok, I think that with my latest changes I now handle the Object case properly. I updated the tests as well. |
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.
LGTM! @BufferUnderflower Can you look this over?
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.
It looks good to me.
Travis didn't rerun, I'll close and reopen. |
This change implements what was suggested in the following issue: #6708 (comment)
Basically, the code added looks for the type of the CLP pointers and decorates the query accordingly if the field is of type
Pointer
orArray
. Also, it only introduces an$or
query if there are multiple CLP pointer entries.Below is the
explain
output of a simple find query when only a pointer CLP entryuser
is presentBelow is the
explain
output of a simple find query when only an array CLP entryusers
is presentBelow is the
explain
output of a simple find query when pointer/array CLP entriesuser
/users
are presentPlease feel free to share any questions, concerns or observations that would help me improve this PR.