From 8c3048e9da7473fea1d2ca4276245724d6197673 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Nov 2007 16:12:46 -0500 Subject: [PATCH] Bug#28785 thread-handling not displayed properly in SHOW VARIABLES mysql-test/r/no-threads.result: Test that we are in the 'no-threads' thread_handling mode. mysql-test/t/no-threads.test: Test that we are in the 'no-threads' thread_handling mode. sql/mysqld.cc: Changes to make global_system_variables.thread_handling be zero based, instead of 1 based. sql/scheduler.h: Changed the enum to start at 0, to match the array elements in thread_handling_names in mysqld.cc --- mysql-test/r/no-threads.result | 3 +++ mysql-test/t/no-threads.test | 1 + sql/mysqld.cc | 5 +++-- sql/scheduler.h | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/no-threads.result b/mysql-test/r/no-threads.result index 50e52138be8..aefecd0f7bc 100644 --- a/mysql-test/r/no-threads.result +++ b/mysql-test/r/no-threads.result @@ -4,3 +4,6 @@ select 1+1; select 1+2; 1+2 3 +SHOW GLOBAL VARIABLES LIKE 'thread_handling'; +Variable_name Value +thread_handling no-threads diff --git a/mysql-test/t/no-threads.test b/mysql-test/t/no-threads.test index 806cf24e961..31ea6406ee9 100644 --- a/mysql-test/t/no-threads.test +++ b/mysql-test/t/no-threads.test @@ -3,3 +3,4 @@ # select 1+1; select 1+2; +SHOW GLOBAL VARIABLES LIKE 'thread_handling'; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4cf6e05751f..f65fee872ed 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7745,12 +7745,13 @@ mysqld_get_one_option(int optid, break; } case OPT_ONE_THREAD: - global_system_variables.thread_handling= 2; + global_system_variables.thread_handling= + SCHEDULER_ONE_THREAD_PER_CONNECTION; break; case OPT_THREAD_HANDLING: { global_system_variables.thread_handling= - find_type_or_exit(argument, &thread_handling_typelib, opt->name); + find_type_or_exit(argument, &thread_handling_typelib, opt->name)-1; break; } case OPT_FT_BOOLEAN_SYNTAX: diff --git a/sql/scheduler.h b/sql/scheduler.h index 8351cefda4c..46bbd300cbb 100644 --- a/sql/scheduler.h +++ b/sql/scheduler.h @@ -40,7 +40,7 @@ public: enum scheduler_types { - SCHEDULER_ONE_THREAD_PER_CONNECTION=1, + SCHEDULER_ONE_THREAD_PER_CONNECTION=0, SCHEDULER_NO_THREADS, SCHEDULER_POOL_OF_THREADS };