-
Notifications
You must be signed in to change notification settings - Fork 3.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
sql: use follower reads for internal authentication-related queries #58497
Comments
cc @aaron-crl regarding the implications of the semantics of only lazily realizing password changes. |
Yeah that would be my main concern. At best, it seems like a pretty confusing user experience, and at worst a big security hole. |
Another option that I think I prefer is to using a leasing protocol similar to how we do with |
This has come up before. |
Checking auth against anything other than the current state of the database introduces the potential for authentication race conditions in certain circumstances. We should avoid performing any auth checks against data or permissions that are or may be out of date. |
In principle we could get authn down to 0 RTTs without too much lift. I'm inclined to close this issue to instead open an enhancement about caching hashes and using leasing rather than anything to do with follower reads. |
Closing in favor of #58869. |
Is your feature request related to a problem? Please describe.
When authenticating a non-root user, CockroachDB must query the system.users and system.role_options tables. See
cockroach/pkg/sql/user.go
Line 93 in ea4c2fa
In a multi-region cluster, the leaseholder for these system ranges may live in a different region than the node that is being connected to. This causes multiple cross-region network hops, thereby increasing the time it takes to establish the connection. Some applications configure aggressive connection timeouts, so in the worst case, this could prevent an application from connecting.
Describe the solution you'd like
Use follower reads for the above queries, and any other queries that are performed during authentication.
Describe alternatives you've considered
A cache could be added to avoid the cross-region hop. This could become hard to manage, since we'd need to make sure to invalidate stale data correctly.
Additional context
Customers have reported concerns about connection latency being too high for non-root users in multi-region clusters. See https://github.com/cockroachlabs/support/issues/742 and https://github.com/cockroachlabs/support/issues/736
The text was updated successfully, but these errors were encountered: