Hi Alik,
Alexander Nozdrin wrote:
[..]
> diff -Nrup a/mysql-test/t/connect.test b/mysql-test/t/connect.test
> --- a/mysql-test/t/connect.test 2006-10-04 18:33:24 +04:00
> +++ b/mysql-test/t/connect.test 2008-03-05 16:56:03 +03:00
> @@ -102,4 +102,120 @@ disconnect con7;
> connection default;
> drop table t1;
>
> -# End of 4.1 tests
> +--disconnect con1
> +--disconnect con2
> +--disconnect con3
> +--disconnect con4
> +--disconnect con5
> +--disconnect con6
> +--disconnect con10
> +
> +--echo # ------------------------------------------------------------------
> +--echo # -- End of 4.1 tests
> +--echo # ------------------------------------------------------------------
> +
> +--echo
> +--echo # -- Bug#33507: Event scheduler creates more threads than max_connections
> +--echo # -- which results in user lockout.
> +--echo
> +
> +GRANT USAGE ON *.* TO mysqltest_u1@localhost;
> +
> +--echo
> +
> +SET GLOBAL max_connections = 3;
Please save and restore the value of max_connections.
> +SET GLOBAL event_scheduler = ON;
> +
> +--echo
> +--echo # -- Waiting for old connections to close...
> +let $wait_condition =
> + SELECT COUNT(*) = 1
> + FROM information_schema.processlist
> + WHERE db = 'test';
> +--source include/wait_condition.inc
> +
> +--echo
> +let $wait_condition =
> + SELECT COUNT(*) = 1
> + FROM information_schema.processlist
> + WHERE user = 'event_scheduler';
> +--source include/wait_condition.inc
> +--echo
> +
> +--echo # -- Disconnecting default connection...
> +--disconnect default
You don't reconnect the default one in the end of the test.
> +--echo
> +--echo # -- Check that we allow exactly three user connections, no matter how
> +--echo # -- many threads are running.
> +--echo
I've seen some spurious connections break up a few test, do you think
the test is reliable? Would be better to drop all accounts and only
accept connections from the account you created?
> +--echo
> +
> +--echo # ------------------------------------------------------------------
> +--echo # -- End of 5.1 tests
> +--echo # ------------------------------------------------------------------
> diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h
> --- a/sql/mysql_priv.h 2008-02-26 19:26:40 +03:00
> +++ b/sql/mysql_priv.h 2008-03-05 16:56:03 +03:00
> @@ -974,8 +974,6 @@ void time_out_user_resource_limits(THD *
> void decrease_user_connections(USER_CONN *uc);
> void thd_init_client_charset(THD *thd, uint cs_number);
> bool setup_connection_thread_globals(THD *thd);
> -bool login_connection(THD *thd);
> -void end_connection(THD *thd);
[..]
> @@ -4700,6 +4713,11 @@ void create_thread_to_handle_connection(
> thread_count--;
> thd->killed= THD::KILL_CONNECTION; // Safety
> (void) pthread_mutex_unlock(&LOCK_thread_count);
> +
> + pthread_mutex_lock(&LOCK_connection_count);
> + --connection_count;
> + pthread_mutex_unlock(&LOCK_connection_count);
Where is the counter part which increments connection_count?
--
Davi Arnaut, Software Engineer
MySQL Inc, www.mysql.com
Are you MySQL certified? www.mysql.com/certification