-
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
Improve efficiency and accuracy of mysqld.GetVersionString #15096
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Matt Lord <[email protected]>
8d9f576
to
5e45865
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15096 +/- ##
==========================================
+ Coverage 47.70% 47.79% +0.09%
==========================================
Files 1155 1155
Lines 240222 240319 +97
==========================================
+ Hits 114596 114865 +269
+ Misses 117021 116882 -139
+ Partials 8605 8572 -33 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Matt Lord <[email protected]>
d3f04ae
to
ddef1ac
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.
I know this is a draft right now, but the changes look good to me! Thank-you for fixing this.
@@ -87,15 +93,15 @@ var ( | |||
|
|||
replicationConnectRetry = 10 * time.Second | |||
|
|||
versionRegex = regexp.MustCompile(`Ver ([0-9]+)\.([0-9]+)\.([0-9]+)`) | |||
versionRegex = regexp.MustCompile(fmt.Sprintf(`%s([0-9]+)\.([0-9]+)\.([0-9]+)`, versionStringPrefix)) |
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.
I'm sure there's a good reason you changed this, but it doesn't feel necessary.
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.
Just so that we're using the same const in the regex and where we build the string to match it when querying mysqld.
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
80833d2
to
4cd461a
Compare
Signed-off-by: Matt Lord <[email protected]>
…ring (#15096) (#15111) Signed-off-by: Matt Lord <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Description
The following vitess binaries call the tabletmanager
FullStatus
RPC:vtorc
: It runs it viarefreshAllTablets()
every 15 seconds by defaultvtadmin
: It runs it on the tablet view pages (I believe with a regular auto refresh)vtctldclient
: Any time theGetFullStatus
command is usedIn the
vtorc
(for sure) andvtadmin
(I think) cases, it's run automatically and periodically. So over time, this RPC can be called many thousands of times on a tablet. And this RPC is merely one thing that ends up calling theVtMySQLRoot()
function. This function was blindly prepending/usr/sbin:
to thePATH
and updating the environment variable every time it was called whenVT_MYSQL_ROOT
was not set:vitess/go/vt/env/env.go
Lines 69 to 79 in 3147240
In the case of the
FullStatus
RPC, it ends up there via:vitess/go/vt/vttablet/tabletmanager/rpc_replication.go
Lines 95 to 96 in 3147240
vitess/go/vt/mysqlctl/mysqld.go
Line 1188 in 3147240
vitess/go/vt/mysqlctl/mysqld.go
Lines 192 to 195 in 3147240
This ends up making a sys exec call to execute
mysqld --version
:vitess/go/vt/mysqlctl/mysqld.go
Line 203 in 3147240
And every time we do this the
PATH
env var grows by 11 bytes as/usr/sbin:
is prepended to it and saved in the env every time. When we exec themysqld
command it inherits a copy-on-write copy of the vttablet's env (with the ever growingPATH
value) — because we setcmd.Env
to nil. Eventually this will cause theexecve
call to fail withE2BIG (Argument list too long)
as the the arguments and env size count against theARG_MAX
OS limit.If you want to try and repeat it yourself, you can do so using this manual test: #15095 (comment)
I think that we should at least backport this to v18 since we expect everyone to be using
vtorc
,vtadmin
, andvtctldclient
.Related Issue(s)
Checklist