-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ccl/sqlproxyccl: developer provided proxy handler #58203
base: master
Are you sure you want to change the base?
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.
Should we call this Handler
rather than Interceptor
? I think Handler
is the usual Go term for what this is doing.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andy-kimball and @darinpp)
pkg/ccl/sqlproxyccl/proxy.go, line 223 at r1 (raw file):
} go func() {
Why are we introducing another goroutine here? I'd like to find a design that doesn't require an extra goroutine for every connection.
f38d532
to
1688058
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @darinpp)
pkg/ccl/sqlproxyccl/proxy.go, line 83 at r2 (raw file):
// is accepted. It can optionally negotiate SSL, provide admittance control or // other types of frontend connection filtering. FrontendAdmitter func(incoming net.Conn) (net.Conn, *pgproto3.StartupMessage, error)
Let's get rid of FrontendAdmitter
and BackendDialer
, since they're obsolete with the new proxy pattern.
pkg/ccl/sqlproxyccl/proxy.go, line 96 at r2 (raw file):
// information to the end user in case of a problem. func (s *Server) SendErrToClient(conn net.Conn, code ErrorCode, msg string) { if s.opts.OnSendErrToClient != nil {
Let's get rid of OnSendErrToClient
, since now the caller can do that on their own if they need it.
pkg/ccl/sqlproxyccl/proxy.go, line 233 at r2 (raw file):
} func (s *Server) updateMetricsForError(err error) {
How come this is not exported? Wouldn't hosts need to use it?
1688058
to
e6ef69b
Compare
e6ef69b
to
09df366
Compare
cff406c
to
22f52fb
Compare
This PR changes the sqlproxyccl's Proxy implementation. Previously, it was expected that the developer will populate an options struct that will customize how the provided proxy will operate. With this PR, it is expected that the developer will provide a proxy handler instead that will do everything needed to proxy an SQL connection from a frontend to a backend. To help with the implementation, the code has been split into number of helper methods that can be combined and that make easy bulding a custom proxy. The existing implementation is now moved into the test file and is just one example of how a complicated proxy can be constructed. Release note: none Release justification:
22f52fb
to
aca8360
Compare
This PR changes the sqlproxyccl's Proxy implementation. Previously, it
was expected that the developer will populate an options struct that
will customize how the provided proxy will operate. With this PR, it is
expected that the developer will provide a proxy handler instead that
will do everything needed to proxy an SQL connection from a frontend to
a backend. To help with the implementation, the code has been split into
number of helper methods that can be combined and that make easy bulding
a custom proxy. The existing implementation is now moved into the test
file and is just one example of how a complicated proxy can be
constructed.
Release note: none