-
Notifications
You must be signed in to change notification settings - Fork 1.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
Support disconnect_expired_cert for database access #6857
Conversation
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.
@smallinsky Also, please cover this scenario (disconnecting expired cert and, if possible, idle timeout) with unit tests. See test files in srv/db
package for examples, most of the machinery for spinning up dbs should already be there. We also have integration tests in integration/db_integration_test.go
.
2925cca
to
f30b821
Compare
f30b821
to
09de9f3
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.
Implementation looks good to me now, just a few suggestions/nits here and there.
d19c438
to
a3fcbf2
Compare
8296673
to
5983c99
Compare
5983c99
to
101ed5b
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.
@smallinsky I've just realized something - the way it's currently implemented, with the connection being monitored on the proxy only, won't cover the trusted cluster scenario.
With trusted clusters, connection goes from the root cluster proxy to leaf cluster database service. So we need to have the same connection monitor on the "database service" side as well (lib/srv/db/server.go
).
lib/srv/monitor.go
Outdated
sync.RWMutex | ||
net.Conn |
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.
Can we unexport sync.RWMutex
and net.Conn
? You can also just remove net.Conn
completely probably and just use it from cfg
.
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.
yes, the mtx can be unexpected but net.Conn
uses struct embedding in order to implement all unnecessary net.Conn methods and unexported net.Conn will require explicitly implementation of net.Conn methods like RemoteAddr
SetWriteDeadline
by theTrackingReadConn
struct.
hm, I'm wondering if monitoring Right now in trusted cluster scenario we have following setup:
As far I know the Am I missing something ? |
@r0mant |
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.
Code looks good to me
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.
Mostly lgtm, just one question about integration tests.
This reverts commit eb7bb01.
Issue #5476
Purpose:
Add support for the
client_idle_timeout
anddisconnect_expired_cert
user role flags in the client db proxy connection.Implementation:
Use Monitor object to track connection activity.