Skip to content
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

Document stats_mysql_global.max_connect_timeouts #4739

Open
cswingler opened this issue Nov 4, 2024 · 1 comment
Open

Document stats_mysql_global.max_connect_timeouts #4739

cswingler opened this issue Nov 4, 2024 · 1 comment

Comments

@cswingler
Copy link
Contributor

The statistic for max_connect_timeouts in the stats_mysql_global table is marked as "ToDo"

After reviewing the code, this documentation should read:

Number of times that a MySQL connection has exceed the mysql-connect_timeout_server_max global variable.

@cswingler
Copy link
Contributor Author

Supporting notes:

mysql-connect_timeout_server_max is mapped to max_connect_time:

proxysql/lib/MySQL_Session.cpp

Lines 3403 to 3407 in 065ee92

if (mysql_thread___connect_timeout_server_max) {
if (mybe->server_myds->max_connect_time==0) {
mybe->server_myds->max_connect_time=thread->curtime+mysql_thread___connect_timeout_server_max*1000;
}
}

And st_var_max_connect_timeout_err maps to p_th_counter::max_connect_timeouts:

{ st_var_max_connect_timeout_err, p_th_counter::max_connect_timeouts, (char *)"max_connect_timeouts" },

Which is iterated if a timeout is exceeded:

proxysql/lib/MySQL_Session.cpp

Lines 3205 to 3220 in 065ee92

if (thread->curtime >= mybe->server_myds->max_connect_time) {
if (mirror) {
PROXY_TRACE();
}
string errmsg {};
const string session_info { session_fast_forward ? "for 'fast_forward' session " : "" };
const uint64_t query_time = (thread->curtime - CurrentQuery.start_time)/1000;
string_format(
"Max connect timeout reached while reaching hostgroup %d %safter %llums",
errmsg, current_hostgroup, session_info.c_str(), query_time
);
if (thread) {
thread->status_variables.stvar[st_var_max_connect_timeout_err]++;

so that gets iterated if we exceed mysql-connect_timeout_server_max.

https://proxysql.com/documentation/global-variables/mysql-variables/#mysql-connect_timeout_server_max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant