-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat: faster regional queries #1171
Conversation
Can you run the formatter fo rthe new year in another pr and then rebase? makes it easier to review |
e8f9fc7
to
eaa4cf9
Compare
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.
Nice, looking pretty good already 👍
d2e490a
to
b5b7c97
Compare
Queries went down from 9 to 2 already (and I have an idea about the last redundant one) for the common case of computed userset rewrite checks. |
4c39cf1
to
055f6ec
Compare
Can you create a PR in cloud that uses this patch and demonstrates it for our queries? |
done :) |
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.
As far as I can tell from our review, this looks good to me. Only a few minor things that should be addressed IMO.
I think it would be good to add some test:
- self-referencing OPL definitions (this is the -1 bugfix)
- think about potential edge cases for this new set up and write tests
- create a regression check list in the cloud PR and test it locally
3bf159d
to
4ab0113
Compare
27757f4
to
32484d4
Compare
32484d4
to
736c9bd
Compare
736c9bd
to
93c8ed6
Compare
93c8ed6
to
5dbe21e
Compare
5dbe21e
to
3d1cbbc
Compare
This PR accelerates the database queries when running on a globally-distributed Cockroach cluster.
Related issue(s)
Fixes #1167
Relates to https://github.com/ory-corp/cloud/issues/3668
Fixes https://github.com/ory-corp/cloud/issues/3680
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
security@ory.sh) from the maintainers to push
the changes.
works.
Further Comments
Further improvements
Query fusing in the check eninge
During one check, we currently execute a lot of queries in parallel that could be fused into one. For example, take query for a namespace with$n$ computed userset rewrites. These currently result in $2\cdot n$ queries (one for the direct access, and one for the subject set expansion, respectively).
Ideally, we want to combine the queries to have one of
In both cases, the queries should work on sets of starting tuples, so that multiple paths can be explored in parallel by the database. Of course, you always start with a single node (the query), but that might lead to multiple intermediate nodes that should be checked in parallel, so that each successive query expands the frontier of the traversed graph until either a tuple is found in the DB or the maximum depth is reached.
Traversal results
In order to be compatible with each other, all graph traversal queries are written such that they return the exact same columns and can be scanned into a common
TraversalResult
.Before/after the computed userset optimization: