-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
mysql: Ensure we set up the initial collation correctly #15115
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
"vitess.io/vitess/go/vt/log" | ||
querypb "vitess.io/vitess/go/vt/proto/query" | ||
"vitess.io/vitess/go/vt/proto/vtrpc" | ||
"vitess.io/vitess/go/vt/sqlparser" | ||
"vitess.io/vitess/go/vt/vtenv" | ||
"vitess.io/vitess/go/vt/vterrors" | ||
) | ||
|
||
|
@@ -133,7 +133,7 @@ | |
|
||
ComResetConnection(c *Conn) | ||
|
||
SQLParser() *sqlparser.Parser | ||
Env() *vtenv.Environment | ||
} | ||
|
||
// UnimplementedHandler implemnts all of the optional callbacks so as to satisy | ||
|
@@ -233,9 +233,6 @@ | |
connBufferPooling bool, | ||
keepAlivePeriod time.Duration, | ||
flushDelay time.Duration, | ||
mysqlServerVersion string, | ||
truncateErrLen int, | ||
|
||
) (*Listener, error) { | ||
cfg := ListenerConfig{ | ||
Listener: l, | ||
|
@@ -247,8 +244,6 @@ | |
ConnBufferPooling: connBufferPooling, | ||
ConnKeepAlivePeriod: keepAlivePeriod, | ||
FlushDelay: flushDelay, | ||
MySQLServerVersion: mysqlServerVersion, | ||
TruncateErrLen: truncateErrLen, | ||
} | ||
return NewListenerWithConfig(cfg) | ||
} | ||
|
@@ -264,19 +259,17 @@ | |
connBufferPooling bool, | ||
keepAlivePeriod time.Duration, | ||
flushDelay time.Duration, | ||
mysqlServerVersion string, | ||
truncateErrLen int, | ||
) (*Listener, error) { | ||
listener, err := net.Listen(protocol, address) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if proxyProtocol { | ||
proxyListener := &proxyproto.Listener{Listener: listener} | ||
return NewFromListener(proxyListener, authServer, handler, connReadTimeout, connWriteTimeout, connBufferPooling, keepAlivePeriod, flushDelay, mysqlServerVersion, truncateErrLen) | ||
return NewFromListener(proxyListener, authServer, handler, connReadTimeout, connWriteTimeout, connBufferPooling, keepAlivePeriod, flushDelay) | ||
} | ||
|
||
return NewFromListener(listener, authServer, handler, connReadTimeout, connWriteTimeout, connBufferPooling, keepAlivePeriod, flushDelay, mysqlServerVersion, truncateErrLen) | ||
return NewFromListener(listener, authServer, handler, connReadTimeout, connWriteTimeout, connBufferPooling, keepAlivePeriod, flushDelay) | ||
} | ||
|
||
// ListenerConfig should be used with NewListenerWithConfig to specify listener parameters. | ||
|
@@ -293,8 +286,6 @@ | |
ConnBufferPooling bool | ||
ConnKeepAlivePeriod time.Duration | ||
FlushDelay time.Duration | ||
MySQLServerVersion string | ||
TruncateErrLen int | ||
} | ||
|
||
// NewListenerWithConfig creates new listener using provided config. There are | ||
|
@@ -315,15 +306,16 @@ | |
authServer: cfg.AuthServer, | ||
handler: cfg.Handler, | ||
listener: l, | ||
ServerVersion: cfg.MySQLServerVersion, | ||
ServerVersion: cfg.Handler.Env().MySQLVersion(), | ||
connectionID: 1, | ||
connReadTimeout: cfg.ConnReadTimeout, | ||
connWriteTimeout: cfg.ConnWriteTimeout, | ||
connReadBufferSize: cfg.ConnReadBufferSize, | ||
connBufferPooling: cfg.ConnBufferPooling, | ||
connKeepAlivePeriod: cfg.ConnKeepAlivePeriod, | ||
flushDelay: cfg.FlushDelay, | ||
truncateErrLen: cfg.TruncateErrLen, | ||
truncateErrLen: cfg.Handler.Env().TruncateErrLen(), | ||
charset: cfg.Handler.Env().CollationEnv().DefaultConnectionCharset(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
}, nil | ||
} | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 Handler and/or Env() be nil here? IMO it's worth a safety check here that returns an error or even an explicit panic with a message if it really shouldn't happen and we can't proceed. Same for the
cfg.Handler
chains below.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 should never ever be nil under any circumstance. That it panics in that case is good. I don't think we should guard this, as it means many guards all over the place then (the env is used in many other places too).