summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-05-13 21:34:16 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-05-14 09:25:39 +0200
commitfda846b4af2fdb78a9c347650a51931ce499f351 (patch)
tree953ca3aa6fd11e7de5c1d67f595eaa9c7ae48ab1 /sql/mysqld.cc
parent41779561ec543787b073a1506a2291f6f89cff48 (diff)
downloadmariadb-git-fda846b4af2fdb78a9c347650a51931ce499f351.tar.gz
MDEV-19277: Add status variable that gets incremented if connection is aborted prior to authenticationbb-10.4-MDEV-19282
MDEV-19282: Log more specific warning with log_warnings=2 if connection is aborted prior to authentication
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index dbe6055d387..dec23535551 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -492,7 +492,7 @@ ulonglong query_cache_size=0;
ulong query_cache_limit=0;
ulong executed_events=0;
query_id_t global_query_id;
-ulong aborted_threads, aborted_connects;
+ulong aborted_threads, aborted_connects, aborted_connects_preauth;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
ulong delayed_insert_errors,flush_time;
@@ -2560,13 +2560,19 @@ static void network_init(void)
void close_connection(THD *thd, uint sql_errno)
{
+ int lvl= (thd->main_security_ctx.user ? 3 : 1);
DBUG_ENTER("close_connection");
if (sql_errno)
+ {
net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL);
-
- thd->print_aborted_warning(3, sql_errno ? ER_DEFAULT(sql_errno)
- : "CLOSE_CONNECTION");
+ thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno));
+ }
+ else
+ thd->print_aborted_warning(lvl, (thd->main_security_ctx.user ?
+ "This connection closed normally" :
+ "This connection closed normally without"
+ " authentication"));
thd->disconnect();
@@ -7615,6 +7621,7 @@ int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
SHOW_VAR status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
+ {"Aborted_connects_preauth", (char*) &aborted_connects_preauth, SHOW_LONG},
{"Acl", (char*) acl_statistics, SHOW_ARRAY},
{"Access_denied_errors", (char*) offsetof(STATUS_VAR, access_denied_errors), SHOW_LONG_STATUS},
{"Binlog_bytes_written", (char*) offsetof(STATUS_VAR, binlog_bytes_written), SHOW_LONGLONG_STATUS},
@@ -8026,7 +8033,7 @@ static int mysql_init_variables(void)
opt_using_transactions= 0;
abort_loop= select_thread_in_use= signal_thread_in_use= 0;
grant_option= 0;
- aborted_threads= aborted_connects= 0;
+ aborted_threads= aborted_connects= aborted_connects_preauth= 0;
subquery_cache_miss= subquery_cache_hit= 0;
delayed_insert_threads= delayed_insert_writes= delayed_rows_in_use= 0;
delayed_insert_errors= thread_created= 0;