From daa7896b84756a7a92a402e492953031a99cb9bb Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Mon, 19 Dec 2022 16:48:12 +0530 Subject: [PATCH 1/7] change vtgate advertised mysql version to 8.0.31 Signed-off-by: Harshit Gangal --- go/vt/servenv/buildinfo.go | 2 +- go/vt/servenv/buildinfo_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index d00b4f063ff..180cfee1fc4 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -94,7 +94,7 @@ func (v *versionInfo) MySQLVersion() string { if mySQLServerVersion != "" { return mySQLServerVersion } - return "5.7.9-vitess-" + v.version + return "8.0.31-vitess-" + v.version } func init() { diff --git a/go/vt/servenv/buildinfo_test.go b/go/vt/servenv/buildinfo_test.go index b8262562d09..b366daff77a 100644 --- a/go/vt/servenv/buildinfo_test.go +++ b/go/vt/servenv/buildinfo_test.go @@ -45,5 +45,5 @@ func TestVersionString(t *testing.T) { assert.Equal(t, "Version: v1.2.3-SNAPSHOT (Jenkins build 422) (Git revision d54b87ca0be09b678bb4490060e8f23f890ddb92 branch 'gitBranch') built on time is now by user@host using 1.19.3 amiga/amd64", v.String()) - assert.Equal(t, "5.7.9-vitess-v1.2.3-SNAPSHOT", v.MySQLVersion()) + assert.Equal(t, "8.0.31-vitess-v1.2.3-SNAPSHOT", v.MySQLVersion()) } From 189722007d776009003d438035a0375db1cd78f8 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Mon, 19 Dec 2022 19:01:08 +0530 Subject: [PATCH 2/7] refactor keeping mysql advertised version Signed-off-by: Harshit Gangal --- go/mysql/collations/local.go | 9 +-------- go/vt/servenv/buildinfo.go | 5 +---- go/vt/servenv/buildinfo_test.go | 2 +- go/vt/servenv/mysql.go | 2 +- go/vt/sqlparser/parser.go | 12 +++++------- go/vt/vtexplain/vtexplain_vttablet.go | 4 ++++ go/vt/vtgate/plugin_mysql_server.go | 4 +--- go/vt/vttest/vtprocess.go | 5 +---- 8 files changed, 15 insertions(+), 28 deletions(-) diff --git a/go/mysql/collations/local.go b/go/mysql/collations/local.go index 988de156973..c0d3c10da09 100644 --- a/go/mysql/collations/local.go +++ b/go/mysql/collations/local.go @@ -35,14 +35,7 @@ func Local() *Environment { if !flag.Parsed() { panic("collations.Local() called too early") } - if mySQLVersion := servenv.MySQLServerVersion(); mySQLVersion == "" { - // The default server version used by vtgate is 5.7.9 - // NOTE: this should be changed along with the effective default - // for the vtgate mysql_server_version flag. - defaultEnv = fetchCacheEnvironment(collverMySQL57) - } else { - defaultEnv = NewEnvironment(mySQLVersion) - } + defaultEnv = NewEnvironment(servenv.MySQLServerVersion()) }) return defaultEnv } diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index 180cfee1fc4..15e34217dae 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -91,10 +91,7 @@ func (v *versionInfo) String() string { } func (v *versionInfo) MySQLVersion() string { - if mySQLServerVersion != "" { - return mySQLServerVersion - } - return "8.0.31-vitess-" + v.version + return mySQLServerVersion } func init() { diff --git a/go/vt/servenv/buildinfo_test.go b/go/vt/servenv/buildinfo_test.go index b366daff77a..5ad208f0fb0 100644 --- a/go/vt/servenv/buildinfo_test.go +++ b/go/vt/servenv/buildinfo_test.go @@ -45,5 +45,5 @@ func TestVersionString(t *testing.T) { assert.Equal(t, "Version: v1.2.3-SNAPSHOT (Jenkins build 422) (Git revision d54b87ca0be09b678bb4490060e8f23f890ddb92 branch 'gitBranch') built on time is now by user@host using 1.19.3 amiga/amd64", v.String()) - assert.Equal(t, "8.0.31-vitess-v1.2.3-SNAPSHOT", v.MySQLVersion()) + assert.Equal(t, "8.0.31-Vitess", v.MySQLVersion()) } diff --git a/go/vt/servenv/mysql.go b/go/vt/servenv/mysql.go index e5d37bd5391..c3f62718124 100644 --- a/go/vt/servenv/mysql.go +++ b/go/vt/servenv/mysql.go @@ -23,7 +23,7 @@ import ( // mySQLServerVersion is what Vitess will present as it's version during the connection handshake, // and as the value to the @@version system variable. If nothing is provided, Vitess will report itself as // a specific MySQL version with the vitess version appended to it -var mySQLServerVersion string +var mySQLServerVersion = "8.0.31-Vitess" // RegisterMySQLServerFlags installs the flags needed to specify or expose a // particular MySQL server version from Vitess. diff --git a/go/vt/sqlparser/parser.go b/go/vt/sqlparser/parser.go index a1033ef7c58..73c806bbd56 100644 --- a/go/vt/sqlparser/parser.go +++ b/go/vt/sqlparser/parser.go @@ -108,13 +108,11 @@ func Parse2(sql string) (Statement, BindVars, error) { func checkParserVersionFlag() { if flag.Parsed() { versionFlagSync.Do(func() { - if mySQLVersion := servenv.MySQLServerVersion(); mySQLVersion != "" { - convVersion, err := convertMySQLVersionToCommentVersion(mySQLVersion) - if err != nil { - log.Error(err) - } else { - MySQLVersion = convVersion - } + convVersion, err := convertMySQLVersionToCommentVersion(servenv.MySQLServerVersion()) + if err != nil { + log.Errorf("unable to parse mysql version: %v", err) + } else { + MySQLVersion = convVersion } }) } diff --git a/go/vt/vtexplain/vtexplain_vttablet.go b/go/vt/vtexplain/vtexplain_vttablet.go index ee94946e5c1..cac8c366c1c 100644 --- a/go/vt/vtexplain/vtexplain_vttablet.go +++ b/go/vt/vtexplain/vtexplain_vttablet.go @@ -412,6 +412,10 @@ func newTabletEnvironment(ddls []sqlparser.DDLStatement, opts *Options) (*tablet Fields: mysql.BaseShowTablesFields, Rows: showTableRows, }) + tEnv.addResult(mysql.TablesWithSize80, &sqltypes.Result{ + Fields: mysql.BaseShowTablesFields, + Rows: showTableRows, + }) indexRows := make([][]sqltypes.Value, 0, 4) for _, ddl := range ddls { diff --git a/go/vt/vtgate/plugin_mysql_server.go b/go/vt/vtgate/plugin_mysql_server.go index 077022cb173..0c1b13924fb 100644 --- a/go/vt/vtgate/plugin_mysql_server.go +++ b/go/vt/vtgate/plugin_mysql_server.go @@ -465,9 +465,7 @@ func initMySQLProtocol() { if err != nil { log.Exitf("mysql.NewListener failed: %v", err) } - if mySQLVersion := servenv.MySQLServerVersion(); mySQLVersion != "" { - mysqlListener.ServerVersion = mySQLVersion - } + mysqlListener.ServerVersion = servenv.MySQLServerVersion() if mysqlSslCert != "" && mysqlSslKey != "" { tlsVersion, err := vttls.TLSVersionToNumber(mysqlTLSMinVersion) if err != nil { diff --git a/go/vt/vttest/vtprocess.go b/go/vt/vttest/vtprocess.go index 6c5f73b322c..948cf9c7d92 100644 --- a/go/vt/vttest/vtprocess.go +++ b/go/vt/vttest/vtprocess.go @@ -252,10 +252,7 @@ func VtcomboProcess(environment Environment, args *Config, mysql MySQLManager) ( if args.VSchemaDDLAuthorizedUsers != "" { vt.ExtraArgs = append(vt.ExtraArgs, []string{"--vschema_ddl_authorized_users", args.VSchemaDDLAuthorizedUsers}...) } - if mySQLVersion := servenv.MySQLServerVersion(); mySQLVersion != "" { - vt.ExtraArgs = append(vt.ExtraArgs, "--mysql_server_version", mySQLVersion) - } - + vt.ExtraArgs = append(vt.ExtraArgs, "--mysql_server_version", servenv.MySQLServerVersion()) if socket != "" { vt.ExtraArgs = append(vt.ExtraArgs, []string{ "--db_socket", socket, From 7d227abcd6511cce0516905e9904c20ec7d9daee Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Mon, 19 Dec 2022 19:29:36 +0530 Subject: [PATCH 3/7] refactor sqlparser mysql version to use the mysql_server_version default Signed-off-by: Harshit Gangal --- go/vt/sqlparser/parse_test.go | 6 ++--- go/vt/sqlparser/parser.go | 34 ++++++++++++++++++---------- go/vt/sqlparser/token.go | 2 +- go/vt/sqlparser/token_test.go | 2 +- go/vt/vtgate/engine/set_test.go | 6 ++--- go/vt/vtgate/executor_select_test.go | 8 +++---- go/vt/vtgate/executor_set_test.go | 12 +++++----- 7 files changed, 40 insertions(+), 30 deletions(-) diff --git a/go/vt/sqlparser/parse_test.go b/go/vt/sqlparser/parse_test.go index 8fe9a925b10..40c703f1785 100644 --- a/go/vt/sqlparser/parse_test.go +++ b/go/vt/sqlparser/parse_test.go @@ -5657,9 +5657,9 @@ partition by range (id) for _, testcase := range testcases { t.Run(testcase.input+":"+testcase.mysqlVersion, func(t *testing.T) { - oldMySQLVersion := MySQLVersion - defer func() { MySQLVersion = oldMySQLVersion }() - MySQLVersion = testcase.mysqlVersion + oldMySQLVersion := mySQLParserVersion + defer func() { mySQLParserVersion = oldMySQLVersion }() + mySQLParserVersion = testcase.mysqlVersion tree, err := Parse(testcase.input) require.NoError(t, err, testcase.input) out := String(tree) diff --git a/go/vt/sqlparser/parser.go b/go/vt/sqlparser/parser.go index 73c806bbd56..2b474aabec0 100644 --- a/go/vt/sqlparser/parser.go +++ b/go/vt/sqlparser/parser.go @@ -43,8 +43,8 @@ var parserPool = sync.Pool{ // zeroParser is a zero-initialized parser to help reinitialize the parser for pooling. var zeroParser yyParserImpl -// MySQLVersion is the version of MySQL that the parser would emulate -var MySQLVersion = "50709" // default version if nothing else is stated +// mySQLParserVersion is the version of MySQL that the parser would emulate +var mySQLParserVersion string // yyParsePooled is a wrapper around yyParse that pools the parser objects. There isn't a // particularly good reason to use yyParse directly, since it immediately discards its parser. @@ -106,16 +106,26 @@ func Parse2(sql string) (Statement, BindVars, error) { } func checkParserVersionFlag() { - if flag.Parsed() { - versionFlagSync.Do(func() { - convVersion, err := convertMySQLVersionToCommentVersion(servenv.MySQLServerVersion()) - if err != nil { - log.Errorf("unable to parse mysql version: %v", err) - } else { - MySQLVersion = convVersion - } - }) + if !flag.Parsed() { + panic("checkParserVersionFlag called too soon") } + versionFlagSync.Do(func() { + convVersion, err := convertMySQLVersionToCommentVersion(servenv.MySQLServerVersion()) + if err != nil { + log.Fatalf("unable to parse mysql version: %v", err) + } + mySQLParserVersion = convVersion + }) +} + +// SetParserVersion sets the mysql parser version +func SetParserVersion(version string) { + mySQLParserVersion = version +} + +// GetParserVersion returns the version of the mysql parser +func GetParserVersion() string { + return mySQLParserVersion } // convertMySQLVersionToCommentVersion converts the MySQL version into comment version format. @@ -305,5 +315,5 @@ loop: } func IsMySQL80AndAbove() bool { - return MySQLVersion >= "80000" + return mySQLParserVersion >= "80000" } diff --git a/go/vt/sqlparser/token.go b/go/vt/sqlparser/token.go index 7a4c95adec7..16cda39dd46 100644 --- a/go/vt/sqlparser/token.go +++ b/go/vt/sqlparser/token.go @@ -674,7 +674,7 @@ func (tkn *Tokenizer) scanMySQLSpecificComment() (int, string) { commentVersion, sql := ExtractMysqlComment(tkn.buf[start:tkn.Pos]) - if MySQLVersion >= commentVersion { + if mySQLParserVersion >= commentVersion { // Only add the special comment to the tokenizer if the version of MySQL is higher or equal to the comment version tkn.specialComment = NewStringTokenizer(sql) } diff --git a/go/vt/sqlparser/token_test.go b/go/vt/sqlparser/token_test.go index 36229c55e7b..0fd43b8f86c 100644 --- a/go/vt/sqlparser/token_test.go +++ b/go/vt/sqlparser/token_test.go @@ -237,7 +237,7 @@ func TestVersion(t *testing.T) { for _, tcase := range testcases { t.Run(tcase.version+"_"+tcase.in, func(t *testing.T) { - MySQLVersion = tcase.version + mySQLParserVersion = tcase.version tok := NewStringTokenizer(tcase.in) for _, expectedID := range tcase.id { id, _ := tok.Scan() diff --git a/go/vt/vtgate/engine/set_test.go b/go/vt/vtgate/engine/set_test.go index 877aadf6502..0f7e0fd1641 100644 --- a/go/vt/vtgate/engine/set_test.go +++ b/go/vt/vtgate/engine/set_test.go @@ -563,10 +563,10 @@ func TestSetTable(t *testing.T) { tc.input = &SingleRow{} } - oldMySQLVersion := sqlparser.MySQLVersion - defer func() { sqlparser.MySQLVersion = oldMySQLVersion }() + oldMySQLVersion := sqlparser.GetParserVersion() + defer func() { sqlparser.SetParserVersion(oldMySQLVersion) }() if tc.mysqlVersion != "" { - sqlparser.MySQLVersion = tc.mysqlVersion + sqlparser.SetParserVersion(tc.mysqlVersion) } set := &Set{ diff --git a/go/vt/vtgate/executor_select_test.go b/go/vt/vtgate/executor_select_test.go index 1c0885db16d..997b9ac4c83 100644 --- a/go/vt/vtgate/executor_select_test.go +++ b/go/vt/vtgate/executor_select_test.go @@ -161,7 +161,7 @@ func TestSystemVariablesMySQLBelow80(t *testing.T) { executor, sbc1, _, _ := createExecutorEnv() executor.normalize = true - sqlparser.MySQLVersion = "57000" + sqlparser.SetParserVersion("57000") setVarEnabled = true session := NewAutocommitSession(&vtgatepb.Session{EnableSystemSettings: true, TargetString: "TestExecutor"}) @@ -197,7 +197,7 @@ func TestSystemVariablesWithSetVarDisabled(t *testing.T) { executor, sbc1, _, _ := createExecutorEnv() executor.normalize = true - sqlparser.MySQLVersion = "80000" + sqlparser.SetParserVersion("80000") setVarEnabled = false defer func() { setVarEnabled = true @@ -235,7 +235,7 @@ func TestSetSystemVariablesTx(t *testing.T) { executor, sbc1, _, _ := createExecutorEnv() executor.normalize = true - sqlparser.MySQLVersion = "80001" + sqlparser.SetParserVersion("80001") session := NewAutocommitSession(&vtgatepb.Session{EnableSystemSettings: true, TargetString: "TestExecutor"}) @@ -283,7 +283,7 @@ func TestSetSystemVariables(t *testing.T) { executor, _, _, lookup := createExecutorEnv() executor.normalize = true - sqlparser.MySQLVersion = "80001" + sqlparser.SetParserVersion("80001") session := NewAutocommitSession(&vtgatepb.Session{EnableSystemSettings: true, TargetString: KsTestUnsharded, SystemVariables: map[string]string{}}) diff --git a/go/vt/vtgate/executor_set_test.go b/go/vt/vtgate/executor_set_test.go index ef23c158427..e7acfef3e62 100644 --- a/go/vt/vtgate/executor_set_test.go +++ b/go/vt/vtgate/executor_set_test.go @@ -536,10 +536,10 @@ func TestSetVar(t *testing.T) { executor, _, _, sbc := createExecutorEnv() executor.normalize = true - oldVersion := sqlparser.MySQLVersion - sqlparser.MySQLVersion = "80000" + oldVersion := sqlparser.GetParserVersion() + sqlparser.SetParserVersion("80000") defer func() { - sqlparser.MySQLVersion = oldVersion + sqlparser.SetParserVersion(oldVersion) }() session := NewAutocommitSession(&vtgatepb.Session{EnableSystemSettings: true, TargetString: KsTestUnsharded}) @@ -580,10 +580,10 @@ func TestSetVarShowVariables(t *testing.T) { executor, _, _, sbc := createExecutorEnv() executor.normalize = true - oldVersion := sqlparser.MySQLVersion - sqlparser.MySQLVersion = "80000" + oldVersion := sqlparser.GetParserVersion() + sqlparser.SetParserVersion("80000") defer func() { - sqlparser.MySQLVersion = oldVersion + sqlparser.SetParserVersion(oldVersion) }() session := NewAutocommitSession(&vtgatepb.Session{EnableSystemSettings: true, TargetString: KsTestUnsharded}) From d23951c94abf4bea8bd7bf5d10c14bf7eef1cc66 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Mon, 19 Dec 2022 20:06:03 +0530 Subject: [PATCH 4/7] test: update test setup Signed-off-by: Harshit Gangal --- go/vt/vttablet/tabletmanager/tm_init_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vttablet/tabletmanager/tm_init_test.go b/go/vt/vttablet/tabletmanager/tm_init_test.go index 933a9501a55..e3736493404 100644 --- a/go/vt/vttablet/tabletmanager/tm_init_test.go +++ b/go/vt/vttablet/tabletmanager/tm_init_test.go @@ -45,7 +45,7 @@ import ( ) var ( - dbServerVersion = "5.7.0" + dbServerVersion = "8.0.0" charsetName = "utf8mb4" dbsvCollID = collations.NewEnvironment(dbServerVersion).DefaultCollationForCharset(charsetName).ID() ) From f4ce3376537e1740d2856dddec3c5eb6513c4360 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Mon, 19 Dec 2022 20:27:04 +0530 Subject: [PATCH 5/7] test: updated test help output Signed-off-by: Harshit Gangal --- go/flags/endtoend/mysqlctl.txt | 2 +- go/flags/endtoend/mysqlctld.txt | 2 +- go/flags/endtoend/vtbackup.txt | 2 +- go/flags/endtoend/vtctldclient.txt | 2 +- go/flags/endtoend/vtexplain.txt | 2 +- go/flags/endtoend/vtgate.txt | 2 +- go/flags/endtoend/vttablet.txt | 2 +- go/flags/endtoend/vttestserver.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go/flags/endtoend/mysqlctl.txt b/go/flags/endtoend/mysqlctl.txt index 4fd044196d9..9ba09cf2a5a 100644 --- a/go/flags/endtoend/mysqlctl.txt +++ b/go/flags/endtoend/mysqlctl.txt @@ -63,7 +63,7 @@ Global flags: --logtostderr log to standard error instead of files --max-stack-size int configure the maximum stack size in bytes (default 67108864) --mysql_port int MySQL port (default 3306) - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --mysql_socket string Path to the mysqld socket file --mysqlctl_client_protocol string the protocol to use to talk to the mysqlctl server (default "grpc") --mysqlctl_mycnf_template string template file to use for generating the my.cnf file during server init diff --git a/go/flags/endtoend/mysqlctld.txt b/go/flags/endtoend/mysqlctld.txt index e00ac7fac09..92152e508e0 100644 --- a/go/flags/endtoend/mysqlctld.txt +++ b/go/flags/endtoend/mysqlctld.txt @@ -68,7 +68,7 @@ Usage of mysqlctld: --logtostderr log to standard error instead of files --max-stack-size int configure the maximum stack size in bytes (default 67108864) --mysql_port int MySQL port (default 3306) - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --mysql_socket string Path to the mysqld socket file --mysqlctl_mycnf_template string template file to use for generating the my.cnf file during server init --mysqlctl_socket string socket file to use for remote mysqlctl actions (empty for local actions) diff --git a/go/flags/endtoend/vtbackup.txt b/go/flags/endtoend/vtbackup.txt index 84b4b25a367..bbfd3668d53 100644 --- a/go/flags/endtoend/vtbackup.txt +++ b/go/flags/endtoend/vtbackup.txt @@ -114,7 +114,7 @@ Usage of vtbackup: --mycnf_socket_file string mysql socket file --mycnf_tmp_dir string mysql tmp directory --mysql_port int mysql port (default 3306) - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --mysql_socket string path to the mysql socket --mysql_timeout duration how long to wait for mysqld startup (default 5m0s) --port int port for the server diff --git a/go/flags/endtoend/vtctldclient.txt b/go/flags/endtoend/vtctldclient.txt index 2afca2ea1b6..02d3f8590b2 100644 --- a/go/flags/endtoend/vtctldclient.txt +++ b/go/flags/endtoend/vtctldclient.txt @@ -108,7 +108,7 @@ Flags: --log_dir string If non-empty, write log files in this directory --log_rotate_max_size uint size in bytes at which logs are rotated (glog.MaxSize) (default 1887436800) --logtostderr log to standard error instead of files - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --purge_logs_interval duration how often try to remove old logs (default 1h0m0s) --security_policy string the name of a registered security policy to use for controlling access to URLs - empty means allow all for anyone (built-in policies: deny-all, read-only) --server string server to use for connection (required) diff --git a/go/flags/endtoend/vtexplain.txt b/go/flags/endtoend/vtexplain.txt index 904c47df1bd..bb0b358f20e 100644 --- a/go/flags/endtoend/vtexplain.txt +++ b/go/flags/endtoend/vtexplain.txt @@ -14,7 +14,7 @@ Usage of vtexplain: --log_err_stacks log stack traces for errors --log_rotate_max_size uint size in bytes at which logs are rotated (glog.MaxSize) (default 1887436800) --logtostderr log to standard error instead of files - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --normalize Whether to enable vtgate normalization --output-mode string Output in human-friendly text or json (default "text") --planner-version string Sets the query planner version to use when generating the explain output. Valid values are V3 and Gen4 diff --git a/go/flags/endtoend/vtgate.txt b/go/flags/endtoend/vtgate.txt index 339a70d1515..8aa511369e4 100644 --- a/go/flags/endtoend/vtgate.txt +++ b/go/flags/endtoend/vtgate.txt @@ -114,7 +114,7 @@ Usage of vtgate: --mysql_server_ssl_key string Path to ssl key for mysql server plugin SSL --mysql_server_ssl_server_ca string path to server CA in PEM format, which will be combine with server cert, return full certificate chain to clients --mysql_server_tls_min_version string Configures the minimal TLS version negotiated when SSL is enabled. Defaults to TLSv1.2. Options: TLSv1.0, TLSv1.1, TLSv1.2, TLSv1.3. - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --mysql_server_write_timeout duration connection write timeout --mysql_slow_connect_warn_threshold duration Warn if it takes more than the given threshold for a mysql connection to establish --mysql_tcp_version string Select tcp, tcp4, or tcp6 to control the socket type. (default "tcp") diff --git a/go/flags/endtoend/vttablet.txt b/go/flags/endtoend/vttablet.txt index ea529bd0bd2..baac1dfc6e5 100644 --- a/go/flags/endtoend/vttablet.txt +++ b/go/flags/endtoend/vttablet.txt @@ -190,7 +190,7 @@ Usage of vttablet: --mycnf_slow_log_path string mysql slow query log path --mycnf_socket_file string mysql socket file --mycnf_tmp_dir string mysql tmp directory - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --mysqlctl_mycnf_template string template file to use for generating the my.cnf file during server init --mysqlctl_socket string socket file to use for remote mysqlctl actions (empty for local actions) --onclose_timeout duration wait no more than this for OnClose handlers before stopping (default 10s) diff --git a/go/flags/endtoend/vttestserver.txt b/go/flags/endtoend/vttestserver.txt index df27f46bcb8..e080ee781dd 100644 --- a/go/flags/endtoend/vttestserver.txt +++ b/go/flags/endtoend/vttestserver.txt @@ -71,7 +71,7 @@ Usage of vttestserver: --min_table_shard_size int The minimum number of initial rows in a table shard. Ignored if--initialize_with_random_data is false. The actual number is chosen randomly. (default 1000) --mysql_bind_host string which host to bind vtgate mysql listener to (default "localhost") --mysql_only If this flag is set only mysql is initialized. The rest of the vitess components are not started. Also, the output specifies the mysql unix socket instead of the vtgate port. - --mysql_server_version string MySQL server version to advertise. + --mysql_server_version string MySQL server version to advertise. (default "8.0.31-Vitess") --mysqlctl_mycnf_template string template file to use for generating the my.cnf file during server init --mysqlctl_socket string socket file to use for remote mysqlctl actions (empty for local actions) --null_probability float The probability to initialize a field with 'NULL' if --initialize_with_random_data is true. Only applies to fields that can contain NULL values. (default 0.1) From 3962c2f62e8ad0dc61105e9708a7df2e0238efa8 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Fri, 6 Jan 2023 19:03:13 +0530 Subject: [PATCH 6/7] added release notes Signed-off-by: Harshit Gangal --- doc/releasenotes/16_0_0_summary.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releasenotes/16_0_0_summary.md b/doc/releasenotes/16_0_0_summary.md index bca1e18c5bd..96de4117bbd 100644 --- a/doc/releasenotes/16_0_0_summary.md +++ b/doc/releasenotes/16_0_0_summary.md @@ -35,6 +35,11 @@ In [PR #11097](https://github.com/vitessio/vitess/pull/11097) we introduced nati ### Breaking Changes +#### VTGate Advertised MySQL Version + +VTGate now advertises MySQL version 8.0.31. This is a breaking change for clients that rely on the VTGate advertised MySQL version and still use MySQL 5.7. +The users can set the `mysql_server_version` flag to advertise the correct version. + #### Orchestrator Integration Deletion Orchestrator integration in `vttablet` was deprecated in the previous release and is deleted in this release. From 9fde4ad519cbb2a21526b42724905fe1f3da831f Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Fri, 3 Feb 2023 01:38:28 +0530 Subject: [PATCH 7/7] feat: remove panic since it is getting triggered from the sidecardb Signed-off-by: Manan Gupta --- go/vt/sqlparser/parser.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/go/vt/sqlparser/parser.go b/go/vt/sqlparser/parser.go index 2b474aabec0..ae630ce3dea 100644 --- a/go/vt/sqlparser/parser.go +++ b/go/vt/sqlparser/parser.go @@ -106,16 +106,15 @@ func Parse2(sql string) (Statement, BindVars, error) { } func checkParserVersionFlag() { - if !flag.Parsed() { - panic("checkParserVersionFlag called too soon") + if flag.Parsed() { + versionFlagSync.Do(func() { + convVersion, err := convertMySQLVersionToCommentVersion(servenv.MySQLServerVersion()) + if err != nil { + log.Fatalf("unable to parse mysql version: %v", err) + } + mySQLParserVersion = convVersion + }) } - versionFlagSync.Do(func() { - convVersion, err := convertMySQLVersionToCommentVersion(servenv.MySQLServerVersion()) - if err != nil { - log.Fatalf("unable to parse mysql version: %v", err) - } - mySQLParserVersion = convVersion - }) } // SetParserVersion sets the mysql parser version