Fix stats_global substring collision and reload failure tracking

1. stats_global strstr match: add exclusion guards for stats_mysql_global
   and stats_pgsql_global to prevent spurious stats___global() calls and
   unnecessary ssl_mutex contention on every MySQL/PgSQL global stats query.

2. TLS reload failure tracking: set tls_last_load_ok=false and update
   tls_load_count/tls_last_load_timestamp on non-bootstrap reload failures.
   Previously, a failed PROXYSQL RELOAD TLS would leave stale SUCCESS status
   in stats_global.
copilot/add-ssl-tls-certificate-stats-table
René Cannaò 2 weeks ago
parent 730f77e64e
commit 9850d9daeb

@ -1450,7 +1450,7 @@ bool ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign
{ stats_pgsql_client_host_cache_reset = true; refresh = true; }
if (strstr(query_no_space,"stats_tls_certificates"))
{ stats_tls_certificates=true; refresh=true; }
if (strstr(query_no_space,"stats_global"))
if (strstr(query_no_space,"stats_global") && !strstr(query_no_space,"stats_mysql_global") && !strstr(query_no_space,"stats_pgsql_global"))
{ stats_global=true; refresh=true; }
if (strstr(query_no_space,"stats_proxysql_servers_checksums"))
{ stats_proxysql_servers_checksums = true; refresh = true; }

@ -485,6 +485,12 @@ int ProxySQL_create_or_load_TLS(bool bootstrap, std::string& msg) {
// Completely disable session tickets and session-cache. See comment above.
SSL_CTX_set_options(GloVars.global.ssl_ctx, SSL_OP_NO_TICKET);
SSL_CTX_set_session_cache_mode(GloVars.global.ssl_ctx, SSL_SESS_CACHE_OFF);
} else if (!bootstrap) {
// Record reload failure in TLS tracking stats
std::lock_guard<std::mutex> lock(GloVars.global.ssl_mutex);
GloVars.global.tls_load_count++;
GloVars.global.tls_last_load_timestamp = time(NULL);
GloVars.global.tls_last_load_ok = false;
}
X509_free(x509);
EVP_PKEY_free(pkey);

Loading…
Cancel
Save