From 8ce93bbd64a38514de82e73fade36ba703ada5dd Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 16 Aug 2011 12:32:06 +0300 Subject: Fixed bug that MAX_USER_CONNECTIONS was not working properly in all situations (which could cause aborted connects) thd->user_connect is now handled in thd->clenup() which will ensure that it works in all context (including slaves). I added also some DBUG_ASSERT() to ensure that things are working correctly. sql/sql_acl.cc: Reset thd->user_connect on failed check_for_max_user_connections() to ensure we don't decrement value twice. Removed not needed call to decrease_user_connections() as thd->cleanup() will now do it. sql/sql_class.cc: Call decrease_user_connections() in thd->cleanup() sql/sql_connect.cc: Ensure we don't allocate thd->user_connect twice. Simplify check_for_max_user_connections(). sql/sql_parse.cc: Ensure that thd->user_connect is handled properly in for 'change_user' command. --- sql/sql_class.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0db3ea22c78..1ba6b7131d9 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1080,6 +1080,11 @@ void THD::cleanup(void) lock=locked_tables; locked_tables=0; close_thread_tables(this); } + if (user_connect) + { + decrease_user_connections(user_connect); + user_connect= 0; // Safety + } wt_thd_destroy(&transaction.wt); #if defined(ENABLED_DEBUG_SYNC) -- cgit v1.2.1