Merge lp:~sergei.glushchenko/percona-server/56-tp into lp:percona-server/5.6

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 312
Proposed branch: lp:~sergei.glushchenko/percona-server/56-tp
Merge into: lp:percona-server/5.6
Diff against target: 8145 lines (+6615/-380)
60 files modified
Percona-Server/include/my_sys.h (+2/-0)
Percona-Server/include/violite.h (+14/-0)
Percona-Server/mysql-test/include/have_pool_of_threads.inc (+4/-0)
Percona-Server/mysql-test/include/mysqld--help.inc (+2/-1)
Percona-Server/mysql-test/include/not_threadpool.inc (+1/-1)
Percona-Server/mysql-test/lib/My/ConfigFactory.pm (+14/-3)
Percona-Server/mysql-test/r/aborted_clients.result (+10/-0)
Percona-Server/mysql-test/r/have_pool_of_threads.require (+2/-0)
Percona-Server/mysql-test/r/mysqld--help-notwin.result (+8/-1)
Percona-Server/mysql-test/r/mysqld--help-win.result (+8/-1)
Percona-Server/mysql-test/r/pool_of_threads.result (+2169/-0)
Percona-Server/mysql-test/suite/perfschema/t/aggregate.test (+1/-0)
Percona-Server/mysql-test/suite/perfschema/t/pool_of_threads-master.opt (+1/-1)
Percona-Server/mysql-test/suite/perfschema/t/sizing_growth.test (+1/-0)
Percona-Server/mysql-test/suite/perfschema/t/thread_cache.test (+1/-0)
Percona-Server/mysql-test/suite/perfschema/t/threads_mysql.test (+1/-0)
Percona-Server/mysql-test/suite/sys_vars/r/extra_max_connections_basic.result (+43/-0)
Percona-Server/mysql-test/suite/sys_vars/r/extra_port_basic.result (+21/-0)
Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result (+47/-0)
Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result (+47/-0)
Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_min_threads_basic.result (+49/-0)
Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_oversubscribe_basic.result (+47/-0)
Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result (+41/-0)
Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result (+47/-0)
Percona-Server/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test (+42/-0)
Percona-Server/mysql-test/suite/sys_vars/t/extra_port_basic.test (+21/-0)
Percona-Server/mysql-test/suite/sys_vars/t/thread_cache_size_func.test (+1/-2)
Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test (+43/-0)
Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test (+42/-0)
Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test (+43/-0)
Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test (+43/-0)
Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test (+47/-0)
Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test (+43/-0)
Percona-Server/mysql-test/t/aborted_clients.test (+28/-0)
Percona-Server/mysql-test/t/pool_of_threads.cnf (+15/-0)
Percona-Server/mysql-test/t/pool_of_threads.test (+80/-0)
Percona-Server/mysys/thr_lock.c (+5/-1)
Percona-Server/sql/CMakeLists.txt (+8/-1)
Percona-Server/sql/mysqld.cc (+326/-259)
Percona-Server/sql/mysqld.h (+6/-1)
Percona-Server/sql/net_serv.cc (+4/-0)
Percona-Server/sql/scheduler.cc (+42/-49)
Percona-Server/sql/scheduler.h (+18/-4)
Percona-Server/sql/signal_handler.cc (+5/-4)
Percona-Server/sql/sql_class.cc (+30/-36)
Percona-Server/sql/sql_class.h (+10/-1)
Percona-Server/sql/sql_client.cc (+1/-0)
Percona-Server/sql/sql_connect.cc (+5/-4)
Percona-Server/sql/sql_parse.cc (+2/-1)
Percona-Server/sql/sys_vars.cc (+124/-3)
Percona-Server/sql/threadpool.h (+69/-0)
Percona-Server/sql/threadpool_common.cc (+364/-0)
Percona-Server/sql/threadpool_unix.cc (+1677/-0)
Percona-Server/sql/threadpool_win.cc (+763/-0)
Percona-Server/storage/innobase/buf/buf0rea.cc (+8/-2)
Percona-Server/storage/perfschema/pfs_visitor.cc (+8/-2)
Percona-Server/vio/vio.c (+24/-1)
Percona-Server/vio/vio_priv.h (+5/-0)
Percona-Server/vio/viopipe.c (+26/-1)
Percona-Server/vio/viosocket.c (+56/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-server/56-tp
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
Review via email: mp+146178@code.launchpad.net

Description of the change

- Most of code is ported from merge propost to Percona Server 5.5.
- Due to bug in bundled SSL library (SSL_pending blocks) it is
  impossible to run threadpool with SSL on my laptop. Workaround
  is to build MySQL with OpenSSL library (system or specified).
  The bug needs further investigation before it can be reported
  upstream.
- The most significant changes are related to performance schema
  improvements in MySQL 5.6.
- Sockets instrumentation
  * MYSQL_SOCKET has been introduced
  * all calls replaced with instrumented equivalents
    (mysql_socket_*)
  * it is also important to associate socket with proper thread
- Tracking socket states and thread states
  * it is important now to set IDLE/ACTIVE state for socket and
    signal IDLE thread event in proper places. Not only
    performance schema tables rely on this but also
    SHOW PROCESSLIST command output
  * couple of hooks in net layer do the trick for one thread
    connection model (before packet header and after packet
    header). This doesn't work for threadpool because in
    threadpool poll/kevent/epoll are used and thread doesn't
    actually sleep waiting for next packet to come. So these
    hooks have been replaced with threadpool-specific ones in
    case when threadpool comes to play.
- Thread owner and thread parent_id
  * threadpool introduces additional type of thread - background
    worker thread
  * client threads are also registered in performance schema as
    one_connection threads. They are act as foreground threads,
    but are really only *fake* threads, which however are very
    needed as they are represent client contexts (THD)
  * thread owner is assigned for thread upon login somewhere in
    ACL and it does work good for threadpool's *fake* threads.
  * mysql_thread_create does the most of thread instrumentation
    upon creation.
    * for example it assigns parent thread id for newly created
      thread (actually in pfs_spawn_thread). There is no way to
      assign this id somewere else without changing PSI. In the
      current implementation parent id for worker thread is set
      while parent id for client thread is left NULL.
    * it also assigns user and host for thread getting them from
      parent. Threadpool fixes this by setting them to NULL in
      worker_main.
- Some tests have been disabled for threadpool
  * perfschema.threads_mysql
    * parent thread id is not set for client threads with
      threadpool event scheduler (see above)
  * perfschema.sizing_growth
    * this test is sensitive to the way MySQL threads created.
      For example it has assumtion of mutex instances count.
      This is broken with threadpool.
  * perfschema.thread_cache
    * tests number of objects (threads, mutexes, etc.) created
      per user connection
    * this number is different for threadpool. For example it
      is impossible to predict reliably will new worker
      be created for new connection or not.
  * perfschema.aggregate
    * test is broken because of change in aggregation in 5.6.
      Now there is no way to prevent aggregating timed event
      (such as cond_wait). There are two table to manage
      aggregation such an events:
      * performance_schema.setup_instruments
      * performance_schema.setup_consumers
    * aggregation is performed in two stages
      1. start wait. We look into setup_instruments whether
         instrument aggregation is enabled and whether we
         should account the wait time
      2. end wait. We look at the setup_consumers to see
         if we should update appropriate tables
    * MySQL 5.5 had events_waits_summary_* in setup_consumers.
      After implementing WL#4816 PERFORMANCE SCHEMA SUMMARIES
      these consumers disappeared.
    * So if cond wait is already started and not yet finished,
      wait time will be aggregated even if we disable
      appropriate instrument
    * worker_cond and timer_cond of threadpool break
      aggregation consistency (sum of wait time for instrument
      instances <= wait time summary in summary table).
      These events may shot between lookups of first and second
      tables.
    * Test is broken not only for threadpool, but it is broken
      because of design change (WL#4816)

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

There is no way to specify custom arguments for mtr in our 5.6 param build

Jenkins run with default mtr arguments:
http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/28/

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Download full text (7.3 KiB)

I'm also happy with the results of tiny test I peformed on my laptop.
So much happy that I decided to share :)

Tiny sysbench oltp table

./sysbench --test=tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=1000 prepare --mysql-user=root --mysql-password='' --mysql-db=test

MySQL run with threadpool (max 10 threads)

bin/mysqld --basedir=. --datadir=`pwd`/data --thread-handling=pool-of-threads --thread_pool_max_threads=10

First sysbench run (60 seconds readonly oltp)

./sysbench --test=tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=1000 --mysql-user=root --mysql-password='' --mysql-db=test --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=80 run
sysbench 0.5: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 80
Random number generator seed is 0 and will be ignored

Threads started!

OLTP test statistics:
    queries performed:
        read: 126000
        write: 0
        other: 18000
        total: 144000
    transactions: 9000 (149.13 per sec.)
    deadlocks: 0 (0.00 per sec.)
    read/write requests: 126000 (2087.83 per sec.)
    other operations: 18000 (298.26 per sec.)

General statistics:
    total time: 60.3499s
    total number of events: 9000
    total time taken by event execution: 4814.1637s
    response time:
         min: 270.09ms
         avg: 534.91ms
         max: 1154.89ms
         approx. 95 percentile: 745.07ms

Threads fairness:
    events (avg/stddev): 112.5000/1.50
    execution time (avg/stddev): 60.1770/0.09

Second sysbench run (60 seconds readonly oltp)

./sysbench --test=tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=1000 --mysql-user=root --mysql-password='' --mysql-db=test --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=80 run
sysbench 0.5: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 80
Random number generator seed is 0 and will be ignored

Threads started!

OLTP test statistics:
    queries performed:
        read: 136150
        write: 0
        other: 19450
        total: 155600
    transactions: 9725 (161.27 per sec.)
    deadlocks: 0 (0.00 per sec.)
    read/write requests: 136150 (2257.76 per sec.)
    other operations: 19450 (322.54 per sec.)

General statistics:
    total time: 60.3032s
    total number of events: 9725
    total time taken by event execution: 4811.5574s
    response time:
         min: 232.06ms
         avg: 494.76ms
         max: ...

Read more...

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Oh, launchpad broke my pretty table :( This link gives the original message http://sprunge.us/GILY.

And please don't look into param build #28. #29 is the correct one.
http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/29/

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

This has caused bug 1133932.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/include/my_sys.h'
2--- Percona-Server/include/my_sys.h 2012-10-16 06:21:51 +0000
3+++ Percona-Server/include/my_sys.h 2013-02-01 18:07:28 +0000
4@@ -852,6 +852,8 @@
5 extern my_bool my_gethwaddr(uchar *to);
6 extern int my_getncpus();
7
8+#define my_microsecond_getsystime() (my_getsystime()/10)
9+
10 #ifdef HAVE_SYS_MMAN_H
11 #include <sys/mman.h>
12
13
14=== modified file 'Percona-Server/include/violite.h'
15--- Percona-Server/include/violite.h 2012-05-09 16:53:03 +0000
16+++ Percona-Server/include/violite.h 2013-02-01 18:07:28 +0000
17@@ -189,11 +189,23 @@
18 #define vio_should_retry(vio) (vio)->should_retry(vio)
19 #define vio_was_timeout(vio) (vio)->was_timeout(vio)
20 #define vio_close(vio) ((vio)->vioclose)(vio)
21+#define vio_shutdown(vio,how) ((vio)->shutdown)(vio,how)
22 #define vio_peer_addr(vio, buf, prt, buflen) (vio)->peer_addr(vio, buf, prt, buflen)
23 #define vio_io_wait(vio, event, timeout) (vio)->io_wait(vio, event, timeout)
24 #define vio_is_connected(vio) (vio)->is_connected(vio)
25 #endif /* !defined(DONT_MAP_VIO) */
26
27+#ifdef _WIN32
28+/*
29+ Set thread id for io cancellation (required on Windows XP only,
30+ and should to be removed if XP is no more supported)
31+*/
32+
33+#define vio_set_thread_id(vio, tid) if(vio) vio->thread_id= tid
34+#else
35+#define vio_set_thread_id(vio, tid)
36+#endif
37+
38 /* This enumerator is used in parser - should be always visible */
39 enum SSL_type
40 {
41@@ -240,10 +252,12 @@
42 my_bool (*was_timeout)(Vio*);
43 int (*vioclose)(Vio*);
44 my_bool (*is_connected)(Vio*);
45+ int (*shutdown)(Vio *, int);
46 my_bool (*has_data) (Vio*);
47 int (*io_wait)(Vio*, enum enum_vio_io_event, int);
48 my_bool (*connect)(Vio*, struct sockaddr *, socklen_t, int);
49 #ifdef _WIN32
50+ DWORD thread_id; /* Used on XP only by vio_shutdown() */
51 OVERLAPPED overlapped;
52 HANDLE hPipe;
53 #endif
54
55=== added file 'Percona-Server/mysql-test/include/have_pool_of_threads.inc'
56--- Percona-Server/mysql-test/include/have_pool_of_threads.inc 1970-01-01 00:00:00 +0000
57+++ Percona-Server/mysql-test/include/have_pool_of_threads.inc 2013-02-01 18:07:28 +0000
58@@ -0,0 +1,4 @@
59+-- require r/have_pool_of_threads.require
60+disable_query_log;
61+show variables like 'thread_handling';
62+enable_query_log;
63
64=== modified file 'Percona-Server/mysql-test/include/mysqld--help.inc'
65--- Percona-Server/mysql-test/include/mysqld--help.inc 2012-12-04 08:24:59 +0000
66+++ Percona-Server/mysql-test/include/mysqld--help.inc 2013-02-01 18:07:28 +0000
67@@ -23,7 +23,8 @@
68 # Plugins which may or may not be there:
69 @plugins=qw/innodb ndb ndbinfo archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file
70 thread-concurrency super-large-pages mutex-deadlock-detector null-audit
71- sha256-password-private-key-path sha256-password-public-key-path/;
72+ sha256-password-private-key-path sha256-password-public-key-path
73+ thread-pool/;
74
75 # And substitute the content some environment variables with their
76 # names:
77
78=== modified file 'Percona-Server/mysql-test/include/not_threadpool.inc'
79--- Percona-Server/mysql-test/include/not_threadpool.inc 2011-01-14 08:28:23 +0000
80+++ Percona-Server/mysql-test/include/not_threadpool.inc 2013-02-01 18:07:28 +0000
81@@ -1,5 +1,5 @@
82 if (`SELECT count(*) FROM information_schema.GLOBAL_VARIABLES WHERE
83 VARIABLE_NAME = 'THREAD_HANDLING' AND
84- VARIABLE_VALUE = 'loaded-dynamically'`){
85+ VARIABLE_VALUE = 'pool-of-threads'`){
86 skip Test requires: 'not_threadpool';
87 }
88
89=== modified file 'Percona-Server/mysql-test/lib/My/ConfigFactory.pm'
90--- Percona-Server/mysql-test/lib/My/ConfigFactory.pm 2012-08-22 01:40:20 +0000
91+++ Percona-Server/mysql-test/lib/My/ConfigFactory.pm 2013-02-01 18:07:28 +0000
92@@ -27,12 +27,22 @@
93
94 use File::Basename;
95
96-
97 #
98 # Rules to run first of all
99 #
100+
101+sub add_opt_values {
102+ my ($self, $config)= @_;
103+
104+ # add auto-options
105+ $config->insert('OPT', 'port' => fix_port($self, $config) );
106+ $config->insert('OPT', 'vardir' => sub { $self->{ARGS}->{vardir} });
107+ $config->insert('mysqld', "loose-skip-$_" => undef) for (@::optional_plugins);
108+}
109+
110 my @pre_rules=
111 (
112+ \&add_opt_values,
113 );
114
115
116@@ -89,8 +99,8 @@
117
118 sub fix_port {
119 my ($self, $config, $group_name, $group)= @_;
120- my $hostname= $group->value('#host');
121- return $self->{HOSTS}->{$hostname}++;
122+ my $port= $self->{PORT}++;
123+ return $port;
124 }
125
126 sub fix_host {
127@@ -658,6 +668,7 @@
128 my $self= bless {
129 CONFIG => $config,
130 ARGS => $args,
131+ PORT => $args->{baseport},
132 HOSTS => $hosts,
133 NEXT_HOST => 0,
134 SERVER_ID => 1,
135
136=== added file 'Percona-Server/mysql-test/r/aborted_clients.result'
137--- Percona-Server/mysql-test/r/aborted_clients.result 1970-01-01 00:00:00 +0000
138+++ Percona-Server/mysql-test/r/aborted_clients.result 2013-02-01 18:07:28 +0000
139@@ -0,0 +1,10 @@
140+FLUSH STATUS;
141+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
142+VARIABLE_VALUE
143+0
144+KILL CONNECTION_ID();
145+ERROR 70100: Query execution was interrupted
146+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
147+VARIABLE_VALUE
148+1
149+FLUSH STATUS;
150
151=== added file 'Percona-Server/mysql-test/r/have_pool_of_threads.require'
152--- Percona-Server/mysql-test/r/have_pool_of_threads.require 1970-01-01 00:00:00 +0000
153+++ Percona-Server/mysql-test/r/have_pool_of_threads.require 2013-02-01 18:07:28 +0000
154@@ -0,0 +1,2 @@
155+Variable_name Value
156+thread_handling pool-of-threads
157
158=== modified file 'Percona-Server/mysql-test/r/mysqld--help-notwin.result'
159--- Percona-Server/mysql-test/r/mysqld--help-notwin.result 2012-12-04 08:24:59 +0000
160+++ Percona-Server/mysql-test/r/mysqld--help-notwin.result 2013-02-01 18:07:28 +0000
161@@ -204,6 +204,11 @@
162 With this option enabled you can run myisamchk to test
163 (not repair) tables while the MySQL server is running.
164 Disable with --skip-external-locking.
165+ --extra-max-connections=#
166+ The number of connections on extra-port
167+ --extra-port=# Extra port number to use for tcp connections in a
168+ one-thread-per-connection manner. 0 means don't use
169+ another port
170 --flush Flush MyISAM tables to disk between SQL commands
171 --flush-time=# A dedicated thread is created to flush all tables at the
172 given interval
173@@ -930,7 +935,7 @@
174 How many threads we should keep in a cache for reuse
175 --thread-handling=name
176 Define threads usage for handling queries, one of
177- one-thread-per-connection, no-threads, loaded-dynamically
178+ one-thread-per-connection, no-threads, pool-of-threads
179 --thread-stack=# The stack size for each thread
180 --time-format=name The TIME format (ignored)
181 --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
182@@ -1026,6 +1031,8 @@
183 expire-logs-days 0
184 explicit-defaults-for-timestamp FALSE
185 external-locking FALSE
186+extra-max-connections 1
187+extra-port 0
188 flush FALSE
189 flush-time 0
190 ft-boolean-syntax + -><()~*:""&|
191
192=== modified file 'Percona-Server/mysql-test/r/mysqld--help-win.result'
193--- Percona-Server/mysql-test/r/mysqld--help-win.result 2012-12-04 08:24:59 +0000
194+++ Percona-Server/mysql-test/r/mysqld--help-win.result 2013-02-01 18:07:28 +0000
195@@ -204,6 +204,11 @@
196 With this option enabled you can run myisamchk to test
197 (not repair) tables while the MySQL server is running.
198 Disable with --skip-external-locking.
199+ --extra-max-connections=#
200+ The number of connections on extra-port
201+ --extra-port=# Extra port number to use for tcp connections in a
202+ one-thread-per-connection manner. 0 means don't use
203+ another port
204 --flush Flush MyISAM tables to disk between SQL commands
205 --flush-time=# A dedicated thread is created to flush all tables at the
206 given interval
207@@ -938,7 +943,7 @@
208 How many threads we should keep in a cache for reuse
209 --thread-handling=name
210 Define threads usage for handling queries, one of
211- one-thread-per-connection, no-threads, loaded-dynamically
212+ one-thread-per-connection, no-threads, pool-of-threads
213 --thread-stack=# The stack size for each thread
214 --time-format=name The TIME format (ignored)
215 --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
216@@ -1023,6 +1028,8 @@
217 expire-logs-days 0
218 explicit-defaults-for-timestamp FALSE
219 external-locking FALSE
220+extra-max-connections 1
221+extra-port 0
222 flush FALSE
223 flush-time 0
224 ft-boolean-syntax + -><()~*:""&|
225
226=== added file 'Percona-Server/mysql-test/r/pool_of_threads.result'
227--- Percona-Server/mysql-test/r/pool_of_threads.result 1970-01-01 00:00:00 +0000
228+++ Percona-Server/mysql-test/r/pool_of_threads.result 2013-02-01 18:07:28 +0000
229@@ -0,0 +1,2169 @@
230+drop table if exists t1,t2,t3,t4;
231+CREATE TABLE t1 (
232+Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
233+Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
234+);
235+INSERT INTO t1 VALUES (9410,9412);
236+select period from t1;
237+period
238+9410
239+select * from t1;
240+Period Varor_period
241+9410 9412
242+select t1.* from t1;
243+Period Varor_period
244+9410 9412
245+CREATE TABLE t2 (
246+auto int not null auto_increment,
247+fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
248+companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
249+fld3 char(30) DEFAULT '' NOT NULL,
250+fld4 char(35) DEFAULT '' NOT NULL,
251+fld5 char(35) DEFAULT '' NOT NULL,
252+fld6 char(4) DEFAULT '' NOT NULL,
253+UNIQUE fld1 (fld1),
254+KEY fld3 (fld3),
255+PRIMARY KEY (auto)
256+);
257+select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
258+fld3
259+imaginable
260+select fld3 from t2 where fld3 like "%cultivation" ;
261+fld3
262+cultivation
263+select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
264+fld3 companynr
265+concoct 58
266+druggists 58
267+engrossing 58
268+Eurydice 58
269+exclaimers 58
270+ferociousness 58
271+hopelessness 58
272+Huey 58
273+imaginable 58
274+judges 58
275+merging 58
276+ostrich 58
277+peering 58
278+Phelps 58
279+presumes 58
280+Ruth 58
281+sentences 58
282+Shylock 58
283+straggled 58
284+synergy 58
285+thanking 58
286+tying 58
287+unlocks 58
288+select fld3,companynr from t2 where companynr = 58 order by fld3;
289+fld3 companynr
290+concoct 58
291+druggists 58
292+engrossing 58
293+Eurydice 58
294+exclaimers 58
295+ferociousness 58
296+hopelessness 58
297+Huey 58
298+imaginable 58
299+judges 58
300+merging 58
301+ostrich 58
302+peering 58
303+Phelps 58
304+presumes 58
305+Ruth 58
306+sentences 58
307+Shylock 58
308+straggled 58
309+synergy 58
310+thanking 58
311+tying 58
312+unlocks 58
313+select fld3 from t2 order by fld3 desc limit 10;
314+fld3
315+youthfulness
316+yelped
317+Wotan
318+workers
319+Witt
320+witchcraft
321+Winsett
322+Willy
323+willed
324+wildcats
325+select fld3 from t2 order by fld3 desc limit 5;
326+fld3
327+youthfulness
328+yelped
329+Wotan
330+workers
331+Witt
332+select fld3 from t2 order by fld3 desc limit 5,5;
333+fld3
334+witchcraft
335+Winsett
336+Willy
337+willed
338+wildcats
339+select t2.fld3 from t2 where fld3 = 'honeysuckle';
340+fld3
341+honeysuckle
342+select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
343+fld3
344+honeysuckle
345+select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
346+fld3
347+honeysuckle
348+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
349+fld3
350+honeysuckle
351+select t2.fld3 from t2 where fld3 LIKE 'h%le';
352+fld3
353+honeysuckle
354+select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
355+fld3
356+select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
357+fld3
358+explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
359+id select_type table type possible_keys key key_len ref rows Extra
360+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
361+explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
362+id select_type table type possible_keys key key_len ref rows Extra
363+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
364+explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
365+id select_type table type possible_keys key key_len ref rows Extra
366+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
367+explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
368+id select_type table type possible_keys key key_len ref rows Extra
369+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
370+explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
371+id select_type table type possible_keys key key_len ref rows Extra
372+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
373+explain select fld3 from t2 ignore index (fld3,not_used);
374+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
375+explain select fld3 from t2 use index (not_used);
376+ERROR 42000: Key 'not_used' doesn't exist in table 't2'
377+select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
378+fld3
379+honeysuckle
380+honoring
381+explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
382+id select_type table type possible_keys key key_len ref rows Extra
383+1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index
384+select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
385+fld1 fld3
386+148504 Colombo
387+068305 Colombo
388+000000 nondecreasing
389+select fld1,fld3 from t2 where companynr = 37 and fld3 = 'appendixes';
390+fld1 fld3
391+232605 appendixes
392+1232605 appendixes
393+1232606 appendixes
394+1232607 appendixes
395+1232608 appendixes
396+1232609 appendixes
397+select fld1 from t2 where fld1=250501 or fld1="250502";
398+fld1
399+250501
400+250502
401+explain select fld1 from t2 where fld1=250501 or fld1="250502";
402+id select_type table type possible_keys key key_len ref rows Extra
403+1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index
404+select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
405+fld1
406+250501
407+250502
408+250505
409+250601
410+explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
411+id select_type table type possible_keys key key_len ref rows Extra
412+1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index
413+select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
414+fld1 fld3
415+012001 flanking
416+013602 foldout
417+013606 fingerings
418+018007 fanatic
419+018017 featherweight
420+018054 fetters
421+018103 flint
422+018104 flopping
423+036002 funereal
424+038017 fetched
425+038205 firearm
426+058004 Fenton
427+088303 feminine
428+186002 freakish
429+188007 flurried
430+188505 fitting
431+198006 furthermore
432+202301 Fitzpatrick
433+208101 fiftieth
434+208113 freest
435+218008 finishers
436+218022 feed
437+218401 faithful
438+226205 foothill
439+226209 furnishings
440+228306 forthcoming
441+228311 fated
442+231315 freezes
443+232102 forgivably
444+238007 filial
445+238008 fixedly
446+select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
447+fld3
448+select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
449+fld3
450+Chantilly
451+select fld1,fld3 from t2 where fld1 like "25050%";
452+fld1 fld3
453+250501 poisoning
454+250502 Iraqis
455+250503 heaving
456+250504 population
457+250505 bomb
458+select fld1,fld3 from t2 where fld1 like "25050_";
459+fld1 fld3
460+250501 poisoning
461+250502 Iraqis
462+250503 heaving
463+250504 population
464+250505 bomb
465+select distinct companynr from t2;
466+companynr
467+00
468+37
469+36
470+50
471+58
472+29
473+40
474+53
475+65
476+41
477+34
478+68
479+select distinct companynr from t2 order by companynr;
480+companynr
481+00
482+29
483+34
484+36
485+37
486+40
487+41
488+50
489+53
490+58
491+65
492+68
493+select distinct companynr from t2 order by companynr desc;
494+companynr
495+68
496+65
497+58
498+53
499+50
500+41
501+40
502+37
503+36
504+34
505+29
506+00
507+select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
508+fld3 period
509+obliterates 9410
510+offload 9410
511+opaquely 9410
512+organizer 9410
513+overestimating 9410
514+overlay 9410
515+select distinct fld3 from t2 where companynr = 34 order by fld3;
516+fld3
517+absentee
518+accessed
519+ahead
520+alphabetic
521+Asiaticizations
522+attitude
523+aye
524+bankruptcies
525+belays
526+Blythe
527+bomb
528+boulevard
529+bulldozes
530+cannot
531+caressing
532+charcoal
533+checksumming
534+chess
535+clubroom
536+colorful
537+cosy
538+creator
539+crying
540+Darius
541+diffusing
542+duality
543+Eiffel
544+Epiphany
545+Ernestine
546+explorers
547+exterminated
548+famine
549+forked
550+Gershwins
551+heaving
552+Hodges
553+Iraqis
554+Italianization
555+Lagos
556+landslide
557+libretto
558+Majorca
559+mastering
560+narrowed
561+occurred
562+offerers
563+Palestine
564+Peruvianizes
565+pharmaceutic
566+poisoning
567+population
568+Pygmalion
569+rats
570+realest
571+recording
572+regimented
573+retransmitting
574+reviver
575+rouses
576+scars
577+sicker
578+sleepwalk
579+stopped
580+sugars
581+translatable
582+uncles
583+unexpected
584+uprisings
585+versatility
586+vest
587+select distinct fld3 from t2 limit 10;
588+fld3
589+abates
590+abiding
591+Abraham
592+abrogating
593+absentee
594+abut
595+accessed
596+accruing
597+accumulating
598+accuracies
599+select distinct fld3 from t2 having fld3 like "A%" limit 10;
600+fld3
601+abates
602+abiding
603+Abraham
604+abrogating
605+absentee
606+abut
607+accessed
608+accruing
609+accumulating
610+accuracies
611+select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
612+substring(fld3,1,3)
613+aba
614+abi
615+Abr
616+abs
617+abu
618+acc
619+acq
620+acu
621+Ade
622+adj
623+Adl
624+adm
625+Ado
626+ads
627+adv
628+aer
629+aff
630+afi
631+afl
632+afo
633+agi
634+ahe
635+aim
636+air
637+Ald
638+alg
639+ali
640+all
641+alp
642+alr
643+ama
644+ame
645+amm
646+ana
647+and
648+ane
649+Ang
650+ani
651+Ann
652+Ant
653+api
654+app
655+aqu
656+Ara
657+arc
658+Arm
659+arr
660+Art
661+Asi
662+ask
663+asp
664+ass
665+ast
666+att
667+aud
668+Aug
669+aut
670+ave
671+avo
672+awe
673+aye
674+Azt
675+select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
676+a
677+aba
678+abi
679+Abr
680+abs
681+abu
682+acc
683+acq
684+acu
685+Ade
686+adj
687+select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
688+substring(fld3,1,3)
689+aba
690+abi
691+Abr
692+abs
693+abu
694+acc
695+acq
696+acu
697+Ade
698+adj
699+select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
700+a
701+aba
702+abi
703+Abr
704+abs
705+abu
706+acc
707+acq
708+acu
709+Ade
710+adj
711+create table t3 (
712+period int not null,
713+name char(32) not null,
714+companynr int not null,
715+price double(11,0),
716+price2 double(11,0),
717+key (period),
718+key (name)
719+);
720+create temporary table tmp engine = myisam select * from t3;
721+insert into t3 select * from tmp;
722+insert into tmp select * from t3;
723+insert into t3 select * from tmp;
724+insert into tmp select * from t3;
725+insert into t3 select * from tmp;
726+insert into tmp select * from t3;
727+insert into t3 select * from tmp;
728+insert into tmp select * from t3;
729+insert into t3 select * from tmp;
730+insert into tmp select * from t3;
731+insert into t3 select * from tmp;
732+insert into tmp select * from t3;
733+insert into t3 select * from tmp;
734+insert into tmp select * from t3;
735+insert into t3 select * from tmp;
736+insert into tmp select * from t3;
737+insert into t3 select * from tmp;
738+alter table t3 add t2nr int not null auto_increment primary key first;
739+drop table tmp;
740+SET BIG_TABLES=1;
741+select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
742+namn
743+Abraham Abraham
744+abrogating abrogating
745+admonishing admonishing
746+Adolph Adolph
747+afield afield
748+aging aging
749+ammonium ammonium
750+analyzable analyzable
751+animals animals
752+animized animized
753+SET BIG_TABLES=0;
754+select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
755+concat(fld3," ",fld3)
756+Abraham Abraham
757+abrogating abrogating
758+admonishing admonishing
759+Adolph Adolph
760+afield afield
761+aging aging
762+ammonium ammonium
763+analyzable analyzable
764+animals animals
765+animized animized
766+select distinct fld5 from t2 limit 10;
767+fld5
768+neat
769+Steinberg
770+jarring
771+tinily
772+balled
773+persist
774+attainments
775+fanatic
776+measures
777+rightfulness
778+select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
779+fld3 count(*)
780+affixed 1
781+and 1
782+annoyers 1
783+Anthony 1
784+assayed 1
785+assurers 1
786+attendants 1
787+bedlam 1
788+bedpost 1
789+boasted 1
790+SET BIG_TABLES=1;
791+select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
792+fld3 count(*)
793+affixed 1
794+and 1
795+annoyers 1
796+Anthony 1
797+assayed 1
798+assurers 1
799+attendants 1
800+bedlam 1
801+bedpost 1
802+boasted 1
803+SET BIG_TABLES=0;
804+select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
805+fld3 repeat("a",length(fld3)) count(*)
806+circus aaaaaa 1
807+cited aaaaa 1
808+Colombo aaaaaaa 1
809+congresswoman aaaaaaaaaaaaa 1
810+contrition aaaaaaaaaa 1
811+corny aaaaa 1
812+cultivation aaaaaaaaaaa 1
813+definiteness aaaaaaaaaaaa 1
814+demultiplex aaaaaaaaaaa 1
815+disappointing aaaaaaaaaaaaa 1
816+select distinct companynr,rtrim(space(512+companynr)) from t3 order by 1,2;
817+companynr rtrim(space(512+companynr))
818+37
819+78
820+101
821+154
822+311
823+447
824+512
825+select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
826+fld3
827+explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
828+id select_type table type possible_keys key key_len ref rows Extra
829+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
830+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
831+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
832+id select_type table type possible_keys key key_len ref rows Extra
833+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
834+1 SIMPLE t3 ref period period 4 test.t1.period 4181 NULL
835+explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
836+id select_type table type possible_keys key key_len ref rows Extra
837+1 SIMPLE t3 index period period 4 NULL 1 NULL
838+1 SIMPLE t1 ref period period 4 test.t3.period 4181 NULL
839+explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
840+id select_type table type possible_keys key key_len ref rows Extra
841+1 SIMPLE t1 index period period 4 NULL 1 NULL
842+1 SIMPLE t3 ref period period 4 test.t1.period 4181 NULL
843+select period from t1;
844+period
845+9410
846+select period from t1 where period=1900;
847+period
848+select fld3,period from t1,t2 where fld1 = 011401 order by period;
849+fld3 period
850+breaking 9410
851+select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
852+fld3 period
853+breaking 1001
854+explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
855+id select_type table type possible_keys key key_len ref rows Extra
856+1 SIMPLE t2 const fld1 fld1 4 const 1 NULL
857+1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 NULL
858+select fld3,period from t2,t1 where companynr*10 = 37*10;
859+fld3 period
860+breaking 9410
861+Romans 9410
862+intercepted 9410
863+bewilderingly 9410
864+astound 9410
865+admonishing 9410
866+sumac 9410
867+flanking 9410
868+combed 9410
869+subjective 9410
870+scatterbrain 9410
871+Eulerian 9410
872+Kane 9410
873+overlay 9410
874+perturb 9410
875+goblins 9410
876+annihilates 9410
877+Wotan 9410
878+snatching 9410
879+concludes 9410
880+laterally 9410
881+yelped 9410
882+grazing 9410
883+Baird 9410
884+celery 9410
885+misunderstander 9410
886+handgun 9410
887+foldout 9410
888+mystic 9410
889+succumbed 9410
890+Nabisco 9410
891+fingerings 9410
892+aging 9410
893+afield 9410
894+ammonium 9410
895+boat 9410
896+intelligibility 9410
897+Augustine 9410
898+teethe 9410
899+dreaded 9410
900+scholastics 9410
901+audiology 9410
902+wallet 9410
903+parters 9410
904+eschew 9410
905+quitter 9410
906+neat 9410
907+Steinberg 9410
908+jarring 9410
909+tinily 9410
910+balled 9410
911+persist 9410
912+attainments 9410
913+fanatic 9410
914+measures 9410
915+rightfulness 9410
916+capably 9410
917+impulsive 9410
918+starlet 9410
919+terminators 9410
920+untying 9410
921+announces 9410
922+featherweight 9410
923+pessimist 9410
924+daughter 9410
925+decliner 9410
926+lawgiver 9410
927+stated 9410
928+readable 9410
929+attrition 9410
930+cascade 9410
931+motors 9410
932+interrogate 9410
933+pests 9410
934+stairway 9410
935+dopers 9410
936+testicle 9410
937+Parsifal 9410
938+leavings 9410
939+postulation 9410
940+squeaking 9410
941+contrasted 9410
942+leftover 9410
943+whiteners 9410
944+erases 9410
945+Punjab 9410
946+Merritt 9410
947+Quixotism 9410
948+sweetish 9410
949+dogging 9410
950+scornfully 9410
951+bellow 9410
952+bills 9410
953+cupboard 9410
954+sureties 9410
955+puddings 9410
956+fetters 9410
957+bivalves 9410
958+incurring 9410
959+Adolph 9410
960+pithed 9410
961+Miles 9410
962+trimmings 9410
963+tragedies 9410
964+skulking 9410
965+flint 9410
966+flopping 9410
967+relaxing 9410
968+offload 9410
969+suites 9410
970+lists 9410
971+animized 9410
972+multilayer 9410
973+standardizes 9410
974+Judas 9410
975+vacuuming 9410
976+dentally 9410
977+humanness 9410
978+inch 9410
979+Weissmuller 9410
980+irresponsibly 9410
981+luckily 9410
982+culled 9410
983+medical 9410
984+bloodbath 9410
985+subschema 9410
986+animals 9410
987+Micronesia 9410
988+repetitions 9410
989+Antares 9410
990+ventilate 9410
991+pityingly 9410
992+interdependent 9410
993+Graves 9410
994+neonatal 9410
995+chafe 9410
996+honoring 9410
997+realtor 9410
998+elite 9410
999+funereal 9410
1000+abrogating 9410
1001+sorters 9410
1002+Conley 9410
1003+lectured 9410
1004+Abraham 9410
1005+Hawaii 9410
1006+cage 9410
1007+hushes 9410
1008+Simla 9410
1009+reporters 9410
1010+Dutchman 9410
1011+descendants 9410
1012+groupings 9410
1013+dissociate 9410
1014+coexist 9410
1015+Beebe 9410
1016+Taoism 9410
1017+Connally 9410
1018+fetched 9410
1019+checkpoints 9410
1020+rusting 9410
1021+galling 9410
1022+obliterates 9410
1023+traitor 9410
1024+resumes 9410
1025+analyzable 9410
1026+terminator 9410
1027+gritty 9410
1028+firearm 9410
1029+minima 9410
1030+Selfridge 9410
1031+disable 9410
1032+witchcraft 9410
1033+betroth 9410
1034+Manhattanize 9410
1035+imprint 9410
1036+peeked 9410
1037+swelling 9410
1038+interrelationships 9410
1039+riser 9410
1040+Gandhian 9410
1041+peacock 9410
1042+bee 9410
1043+kanji 9410
1044+dental 9410
1045+scarf 9410
1046+chasm 9410
1047+insolence 9410
1048+syndicate 9410
1049+alike 9410
1050+imperial 9410
1051+convulsion 9410
1052+railway 9410
1053+validate 9410
1054+normalizes 9410
1055+comprehensive 9410
1056+chewing 9410
1057+denizen 9410
1058+schemer 9410
1059+chronicle 9410
1060+Kline 9410
1061+Anatole 9410
1062+partridges 9410
1063+brunch 9410
1064+recruited 9410
1065+dimensions 9410
1066+Chicana 9410
1067+announced 9410
1068+praised 9410
1069+employing 9410
1070+linear 9410
1071+quagmire 9410
1072+western 9410
1073+relishing 9410
1074+serving 9410
1075+scheduling 9410
1076+lore 9410
1077+eventful 9410
1078+arteriole 9410
1079+disentangle 9410
1080+cured 9410
1081+Fenton 9410
1082+avoidable 9410
1083+drains 9410
1084+detectably 9410
1085+husky 9410
1086+impelling 9410
1087+undoes 9410
1088+evened 9410
1089+squeezes 9410
1090+destroyer 9410
1091+rudeness 9410
1092+beaner 9410
1093+boorish 9410
1094+Everhart 9410
1095+encompass 9410
1096+mushrooms 9410
1097+Alison 9410
1098+externally 9410
1099+pellagra 9410
1100+cult 9410
1101+creek 9410
1102+Huffman 9410
1103+Majorca 9410
1104+governing 9410
1105+gadfly 9410
1106+reassigned 9410
1107+intentness 9410
1108+craziness 9410
1109+psychic 9410
1110+squabbled 9410
1111+burlesque 9410
1112+capped 9410
1113+extracted 9410
1114+DiMaggio 9410
1115+exclamation 9410
1116+subdirectory 9410
1117+Gothicism 9410
1118+feminine 9410
1119+metaphysically 9410
1120+sanding 9410
1121+Miltonism 9410
1122+freakish 9410
1123+index 9410
1124+straight 9410
1125+flurried 9410
1126+denotative 9410
1127+coming 9410
1128+commencements 9410
1129+gentleman 9410
1130+gifted 9410
1131+Shanghais 9410
1132+sportswriting 9410
1133+sloping 9410
1134+navies 9410
1135+leaflet 9410
1136+shooter 9410
1137+Joplin 9410
1138+babies 9410
1139+assails 9410
1140+admiring 9410
1141+swaying 9410
1142+Goldstine 9410
1143+fitting 9410
1144+Norwalk 9410
1145+analogy 9410
1146+deludes 9410
1147+cokes 9410
1148+Clayton 9410
1149+exhausts 9410
1150+causality 9410
1151+sating 9410
1152+icon 9410
1153+throttles 9410
1154+communicants 9410
1155+dehydrate 9410
1156+priceless 9410
1157+publicly 9410
1158+incidentals 9410
1159+commonplace 9410
1160+mumbles 9410
1161+furthermore 9410
1162+cautioned 9410
1163+parametrized 9410
1164+registration 9410
1165+sadly 9410
1166+positioning 9410
1167+babysitting 9410
1168+eternal 9410
1169+hoarder 9410
1170+congregates 9410
1171+rains 9410
1172+workers 9410
1173+sags 9410
1174+unplug 9410
1175+garage 9410
1176+boulder 9410
1177+specifics 9410
1178+Teresa 9410
1179+Winsett 9410
1180+convenient 9410
1181+buckboards 9410
1182+amenities 9410
1183+resplendent 9410
1184+sews 9410
1185+participated 9410
1186+Simon 9410
1187+certificates 9410
1188+Fitzpatrick 9410
1189+Evanston 9410
1190+misted 9410
1191+textures 9410
1192+save 9410
1193+count 9410
1194+rightful 9410
1195+chaperone 9410
1196+Lizzy 9410
1197+clenched 9410
1198+effortlessly 9410
1199+accessed 9410
1200+beaters 9410
1201+Hornblower 9410
1202+vests 9410
1203+indulgences 9410
1204+infallibly 9410
1205+unwilling 9410
1206+excrete 9410
1207+spools 9410
1208+crunches 9410
1209+overestimating 9410
1210+ineffective 9410
1211+humiliation 9410
1212+sophomore 9410
1213+star 9410
1214+rifles 9410
1215+dialysis 9410
1216+arriving 9410
1217+indulge 9410
1218+clockers 9410
1219+languages 9410
1220+Antarctica 9410
1221+percentage 9410
1222+ceiling 9410
1223+specification 9410
1224+regimented 9410
1225+ciphers 9410
1226+pictures 9410
1227+serpents 9410
1228+allot 9410
1229+realized 9410
1230+mayoral 9410
1231+opaquely 9410
1232+hostess 9410
1233+fiftieth 9410
1234+incorrectly 9410
1235+decomposition 9410
1236+stranglings 9410
1237+mixture 9410
1238+electroencephalography 9410
1239+similarities 9410
1240+charges 9410
1241+freest 9410
1242+Greenberg 9410
1243+tinting 9410
1244+expelled 9410
1245+warm 9410
1246+smoothed 9410
1247+deductions 9410
1248+Romano 9410
1249+bitterroot 9410
1250+corset 9410
1251+securing 9410
1252+environing 9410
1253+cute 9410
1254+Crays 9410
1255+heiress 9410
1256+inform 9410
1257+avenge 9410
1258+universals 9410
1259+Kinsey 9410
1260+ravines 9410
1261+bestseller 9410
1262+equilibrium 9410
1263+extents 9410
1264+relatively 9410
1265+pressure 9410
1266+critiques 9410
1267+befouled 9410
1268+rightfully 9410
1269+mechanizing 9410
1270+Latinizes 9410
1271+timesharing 9410
1272+Aden 9410
1273+embassies 9410
1274+males 9410
1275+shapelessly 9410
1276+mastering 9410
1277+Newtonian 9410
1278+finishers 9410
1279+abates 9410
1280+teem 9410
1281+kiting 9410
1282+stodgy 9410
1283+feed 9410
1284+guitars 9410
1285+airships 9410
1286+store 9410
1287+denounces 9410
1288+Pyle 9410
1289+Saxony 9410
1290+serializations 9410
1291+Peruvian 9410
1292+taxonomically 9410
1293+kingdom 9410
1294+stint 9410
1295+Sault 9410
1296+faithful 9410
1297+Ganymede 9410
1298+tidiness 9410
1299+gainful 9410
1300+contrary 9410
1301+Tipperary 9410
1302+tropics 9410
1303+theorizers 9410
1304+renew 9410
1305+already 9410
1306+terminal 9410
1307+Hegelian 9410
1308+hypothesizer 9410
1309+warningly 9410
1310+journalizing 9410
1311+nested 9410
1312+Lars 9410
1313+saplings 9410
1314+foothill 9410
1315+labeled 9410
1316+imperiously 9410
1317+reporters 9410
1318+furnishings 9410
1319+precipitable 9410
1320+discounts 9410
1321+excises 9410
1322+Stalin 9410
1323+despot 9410
1324+ripeness 9410
1325+Arabia 9410
1326+unruly 9410
1327+mournfulness 9410
1328+boom 9410
1329+slaughter 9410
1330+Sabine 9410
1331+handy 9410
1332+rural 9410
1333+organizer 9410
1334+shipyard 9410
1335+civics 9410
1336+inaccuracy 9410
1337+rules 9410
1338+juveniles 9410
1339+comprised 9410
1340+investigations 9410
1341+stabilizes 9410
1342+seminaries 9410
1343+Hunter 9410
1344+sporty 9410
1345+test 9410
1346+weasels 9410
1347+CERN 9410
1348+tempering 9410
1349+afore 9410
1350+Galatean 9410
1351+techniques 9410
1352+error 9410
1353+veranda 9410
1354+severely 9410
1355+Cassites 9410
1356+forthcoming 9410
1357+guides 9410
1358+vanish 9410
1359+lied 9410
1360+sawtooth 9410
1361+fated 9410
1362+gradually 9410
1363+widens 9410
1364+preclude 9410
1365+evenhandedly 9410
1366+percentage 9410
1367+disobedience 9410
1368+humility 9410
1369+gleaning 9410
1370+petted 9410
1371+bloater 9410
1372+minion 9410
1373+marginal 9410
1374+apiary 9410
1375+measures 9410
1376+precaution 9410
1377+repelled 9410
1378+primary 9410
1379+coverings 9410
1380+Artemia 9410
1381+navigate 9410
1382+spatial 9410
1383+Gurkha 9410
1384+meanwhile 9410
1385+Melinda 9410
1386+Butterfield 9410
1387+Aldrich 9410
1388+previewing 9410
1389+glut 9410
1390+unaffected 9410
1391+inmate 9410
1392+mineral 9410
1393+impending 9410
1394+meditation 9410
1395+ideas 9410
1396+miniaturizes 9410
1397+lewdly 9410
1398+title 9410
1399+youthfulness 9410
1400+creak 9410
1401+Chippewa 9410
1402+clamored 9410
1403+freezes 9410
1404+forgivably 9410
1405+reduce 9410
1406+McGovern 9410
1407+Nazis 9410
1408+epistle 9410
1409+socializes 9410
1410+conceptions 9410
1411+Kevin 9410
1412+uncovering 9410
1413+chews 9410
1414+appendixes 9410
1415+appendixes 9410
1416+appendixes 9410
1417+appendixes 9410
1418+appendixes 9410
1419+appendixes 9410
1420+raining 9410
1421+infest 9410
1422+compartment 9410
1423+minting 9410
1424+ducks 9410
1425+roped 9410
1426+waltz 9410
1427+Lillian 9410
1428+repressions 9410
1429+chillingly 9410
1430+noncritical 9410
1431+lithograph 9410
1432+spongers 9410
1433+parenthood 9410
1434+posed 9410
1435+instruments 9410
1436+filial 9410
1437+fixedly 9410
1438+relives 9410
1439+Pandora 9410
1440+watering 9410
1441+ungrateful 9410
1442+secures 9410
1443+poison 9410
1444+dusted 9410
1445+encompasses 9410
1446+presentation 9410
1447+Kantian 9410
1448+select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price;
1449+fld3 period price price2
1450+admonishing 1002 28357832 8723648
1451+analyzable 1002 28357832 8723648
1452+annihilates 1001 5987435 234724
1453+Antares 1002 28357832 8723648
1454+astound 1001 5987435 234724
1455+audiology 1001 5987435 234724
1456+Augustine 1002 28357832 8723648
1457+Baird 1002 28357832 8723648
1458+bewilderingly 1001 5987435 234724
1459+breaking 1001 5987435 234724
1460+Conley 1001 5987435 234724
1461+dentally 1002 28357832 8723648
1462+dissociate 1002 28357832 8723648
1463+elite 1001 5987435 234724
1464+eschew 1001 5987435 234724
1465+Eulerian 1001 5987435 234724
1466+flanking 1001 5987435 234724
1467+foldout 1002 28357832 8723648
1468+funereal 1002 28357832 8723648
1469+galling 1002 28357832 8723648
1470+Graves 1001 5987435 234724
1471+grazing 1001 5987435 234724
1472+groupings 1001 5987435 234724
1473+handgun 1001 5987435 234724
1474+humility 1002 28357832 8723648
1475+impulsive 1002 28357832 8723648
1476+inch 1001 5987435 234724
1477+intelligibility 1001 5987435 234724
1478+jarring 1001 5987435 234724
1479+lawgiver 1001 5987435 234724
1480+lectured 1002 28357832 8723648
1481+Merritt 1002 28357832 8723648
1482+neonatal 1001 5987435 234724
1483+offload 1002 28357832 8723648
1484+parters 1002 28357832 8723648
1485+pityingly 1002 28357832 8723648
1486+puddings 1002 28357832 8723648
1487+Punjab 1001 5987435 234724
1488+quitter 1002 28357832 8723648
1489+realtor 1001 5987435 234724
1490+relaxing 1001 5987435 234724
1491+repetitions 1001 5987435 234724
1492+resumes 1001 5987435 234724
1493+Romans 1002 28357832 8723648
1494+rusting 1001 5987435 234724
1495+scholastics 1001 5987435 234724
1496+skulking 1002 28357832 8723648
1497+stated 1002 28357832 8723648
1498+suites 1002 28357832 8723648
1499+sureties 1001 5987435 234724
1500+testicle 1002 28357832 8723648
1501+tinily 1002 28357832 8723648
1502+tragedies 1001 5987435 234724
1503+trimmings 1001 5987435 234724
1504+vacuuming 1001 5987435 234724
1505+ventilate 1001 5987435 234724
1506+wallet 1001 5987435 234724
1507+Weissmuller 1002 28357832 8723648
1508+Wotan 1002 28357832 8723648
1509+select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37;
1510+fld1 fld3 period price price2
1511+018201 relaxing 1001 5987435 234724
1512+018601 vacuuming 1001 5987435 234724
1513+018801 inch 1001 5987435 234724
1514+018811 repetitions 1001 5987435 234724
1515+create table t4 (
1516+companynr tinyint(2) unsigned zerofill NOT NULL default '00',
1517+companyname char(30) NOT NULL default '',
1518+PRIMARY KEY (companynr),
1519+UNIQUE KEY companyname(companyname)
1520+) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
1521+select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
1522+companynr companyname
1523+00 Unknown
1524+29 company 1
1525+34 company 2
1526+36 company 3
1527+37 company 4
1528+40 company 5
1529+41 company 6
1530+50 company 11
1531+53 company 7
1532+58 company 8
1533+65 company 9
1534+68 company 10
1535+select SQL_SMALL_RESULT t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
1536+companynr companyname
1537+00 Unknown
1538+29 company 1
1539+34 company 2
1540+36 company 3
1541+37 company 4
1542+40 company 5
1543+41 company 6
1544+50 company 11
1545+53 company 7
1546+58 company 8
1547+65 company 9
1548+68 company 10
1549+select * from t1,t1 t12;
1550+Period Varor_period Period Varor_period
1551+9410 9412 9410 9412
1552+select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
1553+fld1 fld1
1554+250501 250501
1555+250502 250501
1556+250503 250501
1557+250504 250501
1558+250505 250501
1559+250501 250502
1560+250502 250502
1561+250503 250502
1562+250504 250502
1563+250505 250502
1564+250501 250503
1565+250502 250503
1566+250503 250503
1567+250504 250503
1568+250505 250503
1569+250501 250504
1570+250502 250504
1571+250503 250504
1572+250504 250504
1573+250505 250504
1574+250501 250505
1575+250502 250505
1576+250503 250505
1577+250504 250505
1578+250505 250505
1579+insert into t2 (fld1, companynr) values (999999,99);
1580+select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
1581+companynr companyname
1582+99 NULL
1583+select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
1584+count(*)
1585+1199
1586+explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
1587+id select_type table type possible_keys key key_len ref rows Extra
1588+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 NULL
1589+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
1590+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
1591+id select_type table type possible_keys key key_len ref rows Extra
1592+1 SIMPLE t4 ALL NULL NULL NULL NULL 12 NULL
1593+1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists; Using join buffer (Block Nested Loop)
1594+select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
1595+companynr companyname
1596+select count(*) from t2 left join t4 using (companynr) where companynr is not null;
1597+count(*)
1598+1200
1599+explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
1600+id select_type table type possible_keys key key_len ref rows Extra
1601+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
1602+explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null;
1603+id select_type table type possible_keys key key_len ref rows Extra
1604+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
1605+delete from t2 where fld1=999999;
1606+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
1607+id select_type table type possible_keys key key_len ref rows Extra
1608+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1609+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 NULL
1610+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
1611+id select_type table type possible_keys key key_len ref rows Extra
1612+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1613+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 NULL
1614+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
1615+id select_type table type possible_keys key key_len ref rows Extra
1616+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1617+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 NULL
1618+explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
1619+id select_type table type possible_keys key key_len ref rows Extra
1620+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
1621+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1622+explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
1623+id select_type table type possible_keys key key_len ref rows Extra
1624+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
1625+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1626+explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
1627+id select_type table type possible_keys key key_len ref rows Extra
1628+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
1629+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1630+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
1631+id select_type table type possible_keys key key_len ref rows Extra
1632+1 SIMPLE t4 ALL NULL NULL NULL NULL 12 NULL
1633+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1634+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
1635+id select_type table type possible_keys key key_len ref rows Extra
1636+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 NULL
1637+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1638+explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
1639+id select_type table type possible_keys key key_len ref rows Extra
1640+1 SIMPLE t4 ALL NULL NULL NULL NULL 12 NULL
1641+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1642+explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
1643+id select_type table type possible_keys key key_len ref rows Extra
1644+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
1645+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1646+explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
1647+id select_type table type possible_keys key key_len ref rows Extra
1648+1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
1649+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1650+explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
1651+id select_type table type possible_keys key key_len ref rows Extra
1652+1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
1653+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1654+select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
1655+companynr companynr
1656+37 36
1657+41 40
1658+explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
1659+id select_type table type possible_keys key key_len ref rows Extra
1660+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1661+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (Block Nested Loop)
1662+select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
1663+fld1 companynr fld3 period
1664+038008 37 reporters 1008
1665+038208 37 Selfridge 1008
1666+select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
1667+fld1 companynr fld3 period
1668+038008 37 reporters 1008
1669+038208 37 Selfridge 1008
1670+select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
1671+fld1 companynr fld3 period
1672+038008 37 reporters 1008
1673+038208 37 Selfridge 1008
1674+select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909);
1675+period
1676+9410
1677+select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6)));
1678+period
1679+9410
1680+select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1;
1681+fld1
1682+250501
1683+250502
1684+250503
1685+250505
1686+select fld1 from t2 where fld1 in (250502,98005,98006,250503,250605,250606) and fld1 >=250502 and fld1 not in (250605,250606);
1687+fld1
1688+250502
1689+250503
1690+select fld1 from t2 where fld1 between 250502 and 250504;
1691+fld1
1692+250502
1693+250503
1694+250504
1695+select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld3 like "L%" or fld3 like "G%")) and fld3 like "L%" ;
1696+fld3
1697+label
1698+labeled
1699+labeled
1700+landslide
1701+laterally
1702+leaflet
1703+lewdly
1704+Lillian
1705+luckily
1706+select count(*) from t1;
1707+count(*)
1708+1
1709+select companynr,count(*),sum(fld1) from t2 group by companynr;
1710+companynr count(*) sum(fld1)
1711+00 82 10355753
1712+29 95 14473298
1713+34 70 17788966
1714+36 215 22786296
1715+37 588 83602098
1716+40 37 6618386
1717+41 52 12816335
1718+50 11 1595438
1719+53 4 793210
1720+58 23 2254293
1721+65 10 2284055
1722+68 12 3097288
1723+select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
1724+companynr count(*)
1725+68 12
1726+65 10
1727+58 23
1728+53 4
1729+50 11
1730+select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
1731+count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
1732+70 absentee vest 17788966 254128.0857 3272.5939722090234 10709871.306938833
1733+explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
1734+id select_type table type possible_keys key key_len ref rows filtered Extra
1735+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
1736+Warnings:
1737+Note 1003 /* select#1 */ select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
1738+select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
1739+companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
1740+00 82 Anthony windmills 10355753 126289.6707 115550.97568479746 13352027981.708656
1741+29 95 abut wetness 14473298 152350.5053 8368.547956641249 70032594.90260443
1742+34 70 absentee vest 17788966 254128.0857 3272.5939722090234 10709871.306938833
1743+select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
1744+companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
1745+37 1 1 5987435 5987435 5987435 5987435.0000
1746+37 2 1 28357832 28357832 28357832 28357832.0000
1747+37 3 1 39654943 39654943 39654943 39654943.0000
1748+37 11 1 5987435 5987435 5987435 5987435.0000
1749+37 12 1 28357832 28357832 28357832 28357832.0000
1750+37 13 1 39654943 39654943 39654943 39654943.0000
1751+37 21 1 5987435 5987435 5987435 5987435.0000
1752+37 22 1 28357832 28357832 28357832 28357832.0000
1753+37 23 1 39654943 39654943 39654943 39654943.0000
1754+37 31 1 5987435 5987435 5987435 5987435.0000
1755+select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
1756+companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
1757+37 1 1 5987435 5987435 5987435 5987435.0000
1758+37 2 1 28357832 28357832 28357832 28357832.0000
1759+37 3 1 39654943 39654943 39654943 39654943.0000
1760+37 11 1 5987435 5987435 5987435 5987435.0000
1761+37 12 1 28357832 28357832 28357832 28357832.0000
1762+37 13 1 39654943 39654943 39654943 39654943.0000
1763+37 21 1 5987435 5987435 5987435 5987435.0000
1764+37 22 1 28357832 28357832 28357832 28357832.0000
1765+37 23 1 39654943 39654943 39654943 39654943.0000
1766+37 31 1 5987435 5987435 5987435 5987435.0000
1767+select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
1768+companynr count(price) sum(price) min(price) max(price) avg(price)
1769+37 12543 309394878010 5987435 39654943 24666736.6667
1770+78 8362 414611089292 726498 98439034 49582766.0000
1771+101 4181 3489454238 834598 834598 834598.0000
1772+154 4181 4112197254950 983543950 983543950 983543950.0000
1773+311 4181 979599938 234298 234298 234298.0000
1774+447 4181 9929180954 2374834 2374834 2374834.0000
1775+512 4181 3288532102 786542 786542 786542.0000
1776+select distinct mod(companynr,10) from t4 group by companynr;
1777+mod(companynr,10)
1778+0
1779+9
1780+4
1781+6
1782+7
1783+1
1784+3
1785+8
1786+5
1787+select distinct 1 from t4 group by companynr;
1788+1
1789+1
1790+select count(distinct fld1) from t2;
1791+count(distinct fld1)
1792+1199
1793+select companynr,count(distinct fld1) from t2 group by companynr;
1794+companynr count(distinct fld1)
1795+00 82
1796+29 95
1797+34 70
1798+36 215
1799+37 588
1800+40 37
1801+41 52
1802+50 11
1803+53 4
1804+58 23
1805+65 10
1806+68 12
1807+select companynr,count(*) from t2 group by companynr;
1808+companynr count(*)
1809+00 82
1810+29 95
1811+34 70
1812+36 215
1813+37 588
1814+40 37
1815+41 52
1816+50 11
1817+53 4
1818+58 23
1819+65 10
1820+68 12
1821+select companynr,count(distinct concat(fld1,repeat(65,1000))) from t2 group by companynr;
1822+companynr count(distinct concat(fld1,repeat(65,1000)))
1823+00 82
1824+29 95
1825+34 70
1826+36 215
1827+37 588
1828+40 37
1829+41 52
1830+50 11
1831+53 4
1832+58 23
1833+65 10
1834+68 12
1835+select companynr,count(distinct concat(fld1,repeat(65,200))) from t2 group by companynr;
1836+companynr count(distinct concat(fld1,repeat(65,200)))
1837+00 82
1838+29 95
1839+34 70
1840+36 215
1841+37 588
1842+40 37
1843+41 52
1844+50 11
1845+53 4
1846+58 23
1847+65 10
1848+68 12
1849+select companynr,count(distinct floor(fld1/100)) from t2 group by companynr;
1850+companynr count(distinct floor(fld1/100))
1851+00 47
1852+29 35
1853+34 14
1854+36 69
1855+37 108
1856+40 16
1857+41 11
1858+50 9
1859+53 1
1860+58 1
1861+65 1
1862+68 1
1863+select companynr,count(distinct concat(repeat(65,1000),floor(fld1/100))) from t2 group by companynr;
1864+companynr count(distinct concat(repeat(65,1000),floor(fld1/100)))
1865+00 47
1866+29 35
1867+34 14
1868+36 69
1869+37 108
1870+40 16
1871+41 11
1872+50 9
1873+53 1
1874+58 1
1875+65 1
1876+68 1
1877+select sum(fld1),fld3 from t2 where fld3="Romans" group by fld1 limit 10;
1878+sum(fld1) fld3
1879+11402 Romans
1880+select name,count(*) from t3 where name='cloakroom' group by name;
1881+name count(*)
1882+cloakroom 4181
1883+select name,count(*) from t3 where name='cloakroom' and price>10 group by name;
1884+name count(*)
1885+cloakroom 4181
1886+select count(*) from t3 where name='cloakroom' and price2=823742;
1887+count(*)
1888+4181
1889+select name,count(*) from t3 where name='cloakroom' and price2=823742 group by name;
1890+name count(*)
1891+cloakroom 4181
1892+select name,count(*) from t3 where name >= "extramarital" and price <= 39654943 group by name;
1893+name count(*)
1894+extramarital 4181
1895+gazer 4181
1896+gems 4181
1897+Iranizes 4181
1898+spates 4181
1899+tucked 4181
1900+violinist 4181
1901+select t2.fld3,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
1902+fld3 count(*)
1903+spates 4181
1904+select companynr|0,companyname from t4 group by 1;
1905+companynr|0 companyname
1906+0 Unknown
1907+29 company 1
1908+34 company 2
1909+36 company 3
1910+37 company 4
1911+40 company 5
1912+41 company 6
1913+50 company 11
1914+53 company 7
1915+58 company 8
1916+65 company 9
1917+68 company 10
1918+select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by t2.companynr order by companyname;
1919+companynr companyname count(*)
1920+29 company 1 95
1921+68 company 10 12
1922+50 company 11 11
1923+34 company 2 70
1924+36 company 3 215
1925+37 company 4 588
1926+40 company 5 37
1927+41 company 6 52
1928+53 company 7 4
1929+58 company 8 23
1930+65 company 9 10
1931+00 Unknown 82
1932+select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
1933+fld1 count(*)
1934+158402 4181
1935+select sum(Period)/count(*) from t1;
1936+sum(Period)/count(*)
1937+9410.0000
1938+select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
1939+companynr count sum diff func
1940+37 12543 309394878010 0.0000 464091
1941+78 8362 414611089292 0.0000 652236
1942+101 4181 3489454238 0.0000 422281
1943+154 4181 4112197254950 0.0000 643874
1944+311 4181 979599938 0.0000 1300291
1945+447 4181 9929180954 0.0000 1868907
1946+512 4181 3288532102 0.0000 2140672
1947+select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
1948+companynr avg
1949+154 983543950.0000
1950+select companynr,count(*) from t2 group by companynr order by 2 desc;
1951+companynr count(*)
1952+37 588
1953+36 215
1954+29 95
1955+00 82
1956+34 70
1957+41 52
1958+40 37
1959+58 23
1960+68 12
1961+50 11
1962+65 10
1963+53 4
1964+select companynr,count(*) from t2 where companynr > 40 group by companynr order by 2 desc;
1965+companynr count(*)
1966+41 52
1967+58 23
1968+68 12
1969+50 11
1970+65 10
1971+53 4
1972+select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;
1973+fld4 fld1 count(price) sum(price) min(price) max(price) avg(price)
1974+teethe 000001 1 5987435 5987435 5987435 5987435.0000
1975+dreaded 011401 1 5987435 5987435 5987435 5987435.0000
1976+scholastics 011402 1 28357832 28357832 28357832 28357832.0000
1977+audiology 011403 1 39654943 39654943 39654943 39654943.0000
1978+wallet 011501 1 5987435 5987435 5987435 5987435.0000
1979+parters 011701 1 5987435 5987435 5987435 5987435.0000
1980+eschew 011702 1 28357832 28357832 28357832 28357832.0000
1981+quitter 011703 1 39654943 39654943 39654943 39654943.0000
1982+neat 012001 1 5987435 5987435 5987435 5987435.0000
1983+Steinberg 012003 1 39654943 39654943 39654943 39654943.0000
1984+balled 012301 1 5987435 5987435 5987435 5987435.0000
1985+persist 012302 1 28357832 28357832 28357832 28357832.0000
1986+attainments 012303 1 39654943 39654943 39654943 39654943.0000
1987+capably 012501 1 5987435 5987435 5987435 5987435.0000
1988+impulsive 012602 1 28357832 28357832 28357832 28357832.0000
1989+starlet 012603 1 39654943 39654943 39654943 39654943.0000
1990+featherweight 012701 1 5987435 5987435 5987435 5987435.0000
1991+pessimist 012702 1 28357832 28357832 28357832 28357832.0000
1992+daughter 012703 1 39654943 39654943 39654943 39654943.0000
1993+lawgiver 013601 1 5987435 5987435 5987435 5987435.0000
1994+stated 013602 1 28357832 28357832 28357832 28357832.0000
1995+readable 013603 1 39654943 39654943 39654943 39654943.0000
1996+testicle 013801 1 5987435 5987435 5987435 5987435.0000
1997+Parsifal 013802 1 28357832 28357832 28357832 28357832.0000
1998+leavings 013803 1 39654943 39654943 39654943 39654943.0000
1999+squeaking 013901 1 5987435 5987435 5987435 5987435.0000
2000+contrasted 016001 1 5987435 5987435 5987435 5987435.0000
2001+leftover 016201 1 5987435 5987435 5987435 5987435.0000
2002+whiteners 016202 1 28357832 28357832 28357832 28357832.0000
2003+erases 016301 1 5987435 5987435 5987435 5987435.0000
2004+Punjab 016302 1 28357832 28357832 28357832 28357832.0000
2005+Merritt 016303 1 39654943 39654943 39654943 39654943.0000
2006+sweetish 018001 1 5987435 5987435 5987435 5987435.0000
2007+dogging 018002 1 28357832 28357832 28357832 28357832.0000
2008+scornfully 018003 1 39654943 39654943 39654943 39654943.0000
2009+fetters 018012 1 28357832 28357832 28357832 28357832.0000
2010+bivalves 018013 1 39654943 39654943 39654943 39654943.0000
2011+skulking 018021 1 5987435 5987435 5987435 5987435.0000
2012+flint 018022 1 28357832 28357832 28357832 28357832.0000
2013+flopping 018023 1 39654943 39654943 39654943 39654943.0000
2014+Judas 018032 1 28357832 28357832 28357832 28357832.0000
2015+vacuuming 018033 1 39654943 39654943 39654943 39654943.0000
2016+medical 018041 1 5987435 5987435 5987435 5987435.0000
2017+bloodbath 018042 1 28357832 28357832 28357832 28357832.0000
2018+subschema 018043 1 39654943 39654943 39654943 39654943.0000
2019+interdependent 018051 1 5987435 5987435 5987435 5987435.0000
2020+Graves 018052 1 28357832 28357832 28357832 28357832.0000
2021+neonatal 018053 1 39654943 39654943 39654943 39654943.0000
2022+sorters 018061 1 5987435 5987435 5987435 5987435.0000
2023+epistle 018062 1 28357832 28357832 28357832 28357832.0000
2024+Conley 018101 1 5987435 5987435 5987435 5987435.0000
2025+lectured 018102 1 28357832 28357832 28357832 28357832.0000
2026+Abraham 018103 1 39654943 39654943 39654943 39654943.0000
2027+cage 018201 1 5987435 5987435 5987435 5987435.0000
2028+hushes 018202 1 28357832 28357832 28357832 28357832.0000
2029+Simla 018402 1 28357832 28357832 28357832 28357832.0000
2030+reporters 018403 1 39654943 39654943 39654943 39654943.0000
2031+coexist 018601 1 5987435 5987435 5987435 5987435.0000
2032+Beebe 018602 1 28357832 28357832 28357832 28357832.0000
2033+Taoism 018603 1 39654943 39654943 39654943 39654943.0000
2034+Connally 018801 1 5987435 5987435 5987435 5987435.0000
2035+fetched 018802 1 28357832 28357832 28357832 28357832.0000
2036+checkpoints 018803 1 39654943 39654943 39654943 39654943.0000
2037+gritty 018811 1 5987435 5987435 5987435 5987435.0000
2038+firearm 018812 1 28357832 28357832 28357832 28357832.0000
2039+minima 019101 1 5987435 5987435 5987435 5987435.0000
2040+Selfridge 019102 1 28357832 28357832 28357832 28357832.0000
2041+disable 019103 1 39654943 39654943 39654943 39654943.0000
2042+witchcraft 019201 1 5987435 5987435 5987435 5987435.0000
2043+betroth 030501 1 5987435 5987435 5987435 5987435.0000
2044+Manhattanize 030502 1 28357832 28357832 28357832 28357832.0000
2045+imprint 030503 1 39654943 39654943 39654943 39654943.0000
2046+swelling 031901 1 5987435 5987435 5987435 5987435.0000
2047+interrelationships 036001 1 5987435 5987435 5987435 5987435.0000
2048+riser 036002 1 28357832 28357832 28357832 28357832.0000
2049+bee 038001 1 5987435 5987435 5987435 5987435.0000
2050+kanji 038002 1 28357832 28357832 28357832 28357832.0000
2051+dental 038003 1 39654943 39654943 39654943 39654943.0000
2052+railway 038011 1 5987435 5987435 5987435 5987435.0000
2053+validate 038012 1 28357832 28357832 28357832 28357832.0000
2054+normalizes 038013 1 39654943 39654943 39654943 39654943.0000
2055+Kline 038101 1 5987435 5987435 5987435 5987435.0000
2056+Anatole 038102 1 28357832 28357832 28357832 28357832.0000
2057+partridges 038103 1 39654943 39654943 39654943 39654943.0000
2058+recruited 038201 1 5987435 5987435 5987435 5987435.0000
2059+dimensions 038202 1 28357832 28357832 28357832 28357832.0000
2060+Chicana 038203 1 39654943 39654943 39654943 39654943.0000
2061+select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
2062+companynr fld3 sum(price)
2063+512 boat 786542
2064+512 capably 786542
2065+512 cupboard 786542
2066+512 decliner 786542
2067+512 descendants 786542
2068+512 dopers 786542
2069+512 erases 786542
2070+512 Micronesia 786542
2071+512 Miles 786542
2072+512 skies 786542
2073+select t2.companynr,count(*),min(fld3),max(fld3),sum(price),avg(price) from t2,t3 where t3.companynr >= 30 and t3.companynr <= 58 and t3.t2nr = t2.fld1 and 1+1=2 group by t2.companynr;
2074+companynr count(*) min(fld3) max(fld3) sum(price) avg(price)
2075+00 1 Omaha Omaha 5987435 5987435.0000
2076+36 1 dubbed dubbed 28357832 28357832.0000
2077+37 83 Abraham Wotan 1908978016 22999735.1325
2078+50 2 scribbled tapestry 68012775 34006387.5000
2079+select t3.companynr+0,t3.t2nr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 37 group by 1,t3.t2nr,fld3,fld3,fld3,fld3,fld3 order by fld1;
2080+t3.companynr+0 t2nr fld3 sum(price)
2081+37 1 Omaha 5987435
2082+37 11401 breaking 5987435
2083+37 11402 Romans 28357832
2084+37 11403 intercepted 39654943
2085+37 11501 bewilderingly 5987435
2086+37 11701 astound 5987435
2087+37 11702 admonishing 28357832
2088+37 11703 sumac 39654943
2089+37 12001 flanking 5987435
2090+37 12003 combed 39654943
2091+37 12301 Eulerian 5987435
2092+37 12302 dubbed 28357832
2093+37 12303 Kane 39654943
2094+37 12501 annihilates 5987435
2095+37 12602 Wotan 28357832
2096+37 12603 snatching 39654943
2097+37 12701 grazing 5987435
2098+37 12702 Baird 28357832
2099+37 12703 celery 39654943
2100+37 13601 handgun 5987435
2101+37 13602 foldout 28357832
2102+37 13603 mystic 39654943
2103+37 13801 intelligibility 5987435
2104+37 13802 Augustine 28357832
2105+37 13803 teethe 39654943
2106+37 13901 scholastics 5987435
2107+37 16001 audiology 5987435
2108+37 16201 wallet 5987435
2109+37 16202 parters 28357832
2110+37 16301 eschew 5987435
2111+37 16302 quitter 28357832
2112+37 16303 neat 39654943
2113+37 18001 jarring 5987435
2114+37 18002 tinily 28357832
2115+37 18003 balled 39654943
2116+37 18012 impulsive 28357832
2117+37 18013 starlet 39654943
2118+37 18021 lawgiver 5987435
2119+37 18022 stated 28357832
2120+37 18023 readable 39654943
2121+37 18032 testicle 28357832
2122+37 18033 Parsifal 39654943
2123+37 18041 Punjab 5987435
2124+37 18042 Merritt 28357832
2125+37 18043 Quixotism 39654943
2126+37 18051 sureties 5987435
2127+37 18052 puddings 28357832
2128+37 18053 tapestry 39654943
2129+37 18061 trimmings 5987435
2130+37 18062 humility 28357832
2131+37 18101 tragedies 5987435
2132+37 18102 skulking 28357832
2133+37 18103 flint 39654943
2134+37 18201 relaxing 5987435
2135+37 18202 offload 28357832
2136+37 18402 suites 28357832
2137+37 18403 lists 39654943
2138+37 18601 vacuuming 5987435
2139+37 18602 dentally 28357832
2140+37 18603 humanness 39654943
2141+37 18801 inch 5987435
2142+37 18802 Weissmuller 28357832
2143+37 18803 irresponsibly 39654943
2144+37 18811 repetitions 5987435
2145+37 18812 Antares 28357832
2146+37 19101 ventilate 5987435
2147+37 19102 pityingly 28357832
2148+37 19103 interdependent 39654943
2149+37 19201 Graves 5987435
2150+37 30501 neonatal 5987435
2151+37 30502 scribbled 28357832
2152+37 30503 chafe 39654943
2153+37 31901 realtor 5987435
2154+37 36001 elite 5987435
2155+37 36002 funereal 28357832
2156+37 38001 Conley 5987435
2157+37 38002 lectured 28357832
2158+37 38003 Abraham 39654943
2159+37 38011 groupings 5987435
2160+37 38012 dissociate 28357832
2161+37 38013 coexist 39654943
2162+37 38101 rusting 5987435
2163+37 38102 galling 28357832
2164+37 38103 obliterates 39654943
2165+37 38201 resumes 5987435
2166+37 38202 analyzable 28357832
2167+37 38203 terminator 39654943
2168+select sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1= t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008;
2169+sum(price)
2170+234298
2171+select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;
2172+fld1 sum(price)
2173+038008 234298
2174+explain select fld3 from t2 where 1>2 or 2>3;
2175+id select_type table type possible_keys key key_len ref rows Extra
2176+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2177+explain select fld3 from t2 where fld1=fld1;
2178+id select_type table type possible_keys key key_len ref rows Extra
2179+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 NULL
2180+select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
2181+companynr fld1
2182+34 250501
2183+34 250502
2184+select companynr,fld1 from t2 WHERE fld1>=250501 HAVING fld1<=250502;
2185+companynr fld1
2186+34 250501
2187+34 250502
2188+select companynr,count(*) as count,sum(fld1) as sum from t2 group by companynr having count > 40 and sum/count >= 120000;
2189+companynr count sum
2190+00 82 10355753
2191+29 95 14473298
2192+34 70 17788966
2193+37 588 83602098
2194+41 52 12816335
2195+select companynr from t2 group by companynr having count(*) > 40 and sum(fld1)/count(*) >= 120000 ;
2196+companynr
2197+00
2198+29
2199+34
2200+37
2201+41
2202+select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by companyname having t2.companynr >= 40;
2203+companynr companyname count(*)
2204+68 company 10 12
2205+50 company 11 11
2206+40 company 5 37
2207+41 company 6 52
2208+53 company 7 4
2209+58 company 8 23
2210+65 company 9 10
2211+select count(*) from t2;
2212+count(*)
2213+1199
2214+select count(*) from t2 where fld1 < 098024;
2215+count(*)
2216+387
2217+select min(fld1) from t2 where fld1>= 098024;
2218+min(fld1)
2219+98024
2220+select max(fld1) from t2 where fld1>= 098024;
2221+max(fld1)
2222+1232609
2223+select count(*) from t3 where price2=76234234;
2224+count(*)
2225+4181
2226+select count(*) from t3 where companynr=512 and price2=76234234;
2227+count(*)
2228+4181
2229+explain select min(fld1),max(fld1),count(*) from t2;
2230+id select_type table type possible_keys key key_len ref rows Extra
2231+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2232+select min(fld1),max(fld1),count(*) from t2;
2233+min(fld1) max(fld1) count(*)
2234+0 1232609 1199
2235+select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
2236+min(t2nr) max(t2nr)
2237+2115 2115
2238+select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
2239+count(*) min(t2nr) max(t2nr)
2240+4181 4 41804
2241+select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
2242+t2nr count(*)
2243+9 1
2244+19 1
2245+29 1
2246+39 1
2247+49 1
2248+59 1
2249+69 1
2250+79 1
2251+89 1
2252+99 1
2253+109 1
2254+119 1
2255+129 1
2256+139 1
2257+149 1
2258+159 1
2259+169 1
2260+179 1
2261+189 1
2262+199 1
2263+select max(t2nr) from t3 where price=983543950;
2264+max(t2nr)
2265+41807
2266+select t1.period from t3 = t1 limit 1;
2267+period
2268+1001
2269+select t1.period from t1 as t1 limit 1;
2270+period
2271+9410
2272+select t1.period as "Nuvarande period" from t1 as t1 limit 1;
2273+Nuvarande period
2274+9410
2275+select period as ok_period from t1 limit 1;
2276+ok_period
2277+9410
2278+select period as ok_period from t1 group by ok_period limit 1;
2279+ok_period
2280+9410
2281+select 1+1 as summa from t1 group by summa limit 1;
2282+summa
2283+2
2284+select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
2285+Nuvarande period
2286+9410
2287+show tables;
2288+Tables_in_test
2289+t1
2290+t2
2291+t3
2292+t4
2293+show tables from test like "s%";
2294+Tables_in_test (s%)
2295+show tables from test like "t?";
2296+Tables_in_test (t?)
2297+show full columns from t2;
2298+Field Type Collation Null Key Default Extra Privileges Comment
2299+auto int(11) NULL NO PRI NULL auto_increment #
2300+fld1 int(6) unsigned zerofill NULL NO UNI 000000 #
2301+companynr tinyint(2) unsigned zerofill NULL NO 00 #
2302+fld3 char(30) latin1_swedish_ci NO MUL #
2303+fld4 char(35) latin1_swedish_ci NO #
2304+fld5 char(35) latin1_swedish_ci NO #
2305+fld6 char(4) latin1_swedish_ci NO #
2306+show full columns from t2 from test like 'f%';
2307+Field Type Collation Null Key Default Extra Privileges Comment
2308+fld1 int(6) unsigned zerofill NULL NO UNI 000000 #
2309+fld3 char(30) latin1_swedish_ci NO MUL #
2310+fld4 char(35) latin1_swedish_ci NO #
2311+fld5 char(35) latin1_swedish_ci NO #
2312+fld6 char(4) latin1_swedish_ci NO #
2313+show full columns from t2 from test like 's%';
2314+Field Type Collation Null Key Default Extra Privileges Comment
2315+show keys from t2;
2316+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
2317+t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
2318+t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
2319+t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
2320+drop table t4, t3, t2, t1;
2321+CREATE TABLE t1 (
2322+cont_nr int(11) NOT NULL auto_increment,
2323+ver_nr int(11) NOT NULL default '0',
2324+aufnr int(11) NOT NULL default '0',
2325+username varchar(50) NOT NULL default '',
2326+hdl_nr int(11) NOT NULL default '0',
2327+eintrag date NOT NULL default '0000-00-00',
2328+st_klasse varchar(40) NOT NULL default '',
2329+st_wert varchar(40) NOT NULL default '',
2330+st_zusatz varchar(40) NOT NULL default '',
2331+st_bemerkung varchar(255) NOT NULL default '',
2332+kunden_art varchar(40) NOT NULL default '',
2333+mcbs_knr int(11) default NULL,
2334+mcbs_aufnr int(11) NOT NULL default '0',
2335+schufa_status char(1) default '?',
2336+bemerkung text,
2337+wirknetz text,
2338+wf_igz int(11) NOT NULL default '0',
2339+tarifcode varchar(80) default NULL,
2340+recycle char(1) default NULL,
2341+sim varchar(30) default NULL,
2342+mcbs_tpl varchar(30) default NULL,
2343+emp_nr int(11) NOT NULL default '0',
2344+laufzeit int(11) default NULL,
2345+hdl_name varchar(30) default NULL,
2346+prov_hdl_nr int(11) NOT NULL default '0',
2347+auto_wirknetz varchar(50) default NULL,
2348+auto_billing varchar(50) default NULL,
2349+touch timestamp NOT NULL,
2350+kategorie varchar(50) default NULL,
2351+kundentyp varchar(20) NOT NULL default '',
2352+sammel_rech_msisdn varchar(30) NOT NULL default '',
2353+p_nr varchar(9) NOT NULL default '',
2354+suffix char(3) NOT NULL default '',
2355+PRIMARY KEY (cont_nr),
2356+KEY idx_aufnr(aufnr),
2357+KEY idx_hdl_nr(hdl_nr),
2358+KEY idx_st_klasse(st_klasse),
2359+KEY ver_nr(ver_nr),
2360+KEY eintrag_idx(eintrag),
2361+KEY emp_nr_idx(emp_nr),
2362+KEY wf_igz(wf_igz),
2363+KEY touch(touch),
2364+KEY hdl_tag(eintrag,hdl_nr),
2365+KEY prov_hdl_nr(prov_hdl_nr),
2366+KEY mcbs_aufnr(mcbs_aufnr),
2367+KEY kundentyp(kundentyp),
2368+KEY p_nr(p_nr,suffix)
2369+) ENGINE=MyISAM;
2370+INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
2371+INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
2372+INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
2373+INSERT INTO t1 VALUES (3359359,468,3359359,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1507831,2143894,'+','','P',1909162,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
2374+INSERT INTO t1 VALUES (3359360,0,0,'Mustermann Musterfrau',29674907,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1900169997,2414578,'+',NULL,'N',1909148,'',NULL,NULL,'RV99066_2',20,NULL,'POS',29674907,NULL,NULL,20010202105916,'Mobilfunk','','','97317481','007');
2375+INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag storniert','','(7001-84):Storno, Kd. möchte nicht mehr','privat',NULL,0,'+','','P',1909150,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
2376+INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
2377+SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
2378+Kundentyp kategorie
2379+Privat (Private Nutzung) Mobilfunk
2380+Warnings:
2381+Warning 1052 Column 'kundentyp' in group statement is ambiguous
2382+drop table t1;
2383+SELECT sleep(50000);
2384+SELECT sleep(50000);
2385+# -- Success: more than --thread_pool_max_threads normal connections not possible
2386+SELECT 'Connection on extra port ok';
2387+Connection on extra port ok
2388+Connection on extra port ok
2389+KILL QUERY @id;
2390+KILL QUERY @id;
2391+SELECT 'Connection on extra port 2 ok';
2392+Connection on extra port 2 ok
2393+Connection on extra port 2 ok
2394+# -- Success: more than --extra-max-connections + 1 normal connections not possible
2395+sleep(50000)
2396+1
2397+sleep(50000)
2398+1
2399
2400=== modified file 'Percona-Server/mysql-test/suite/perfschema/t/aggregate.test'
2401--- Percona-Server/mysql-test/suite/perfschema/t/aggregate.test 2011-10-19 21:49:22 +0000
2402+++ Percona-Server/mysql-test/suite/perfschema/t/aggregate.test 2013-02-01 18:07:28 +0000
2403@@ -3,6 +3,7 @@
2404
2405 --source include/not_embedded.inc
2406 --source include/have_perfschema.inc
2407+--source include/not_threadpool.inc
2408
2409 --echo "General cleanup"
2410
2411
2412=== modified file 'Percona-Server/mysql-test/suite/perfschema/t/pool_of_threads-master.opt'
2413--- Percona-Server/mysql-test/suite/perfschema/t/pool_of_threads-master.opt 2010-01-12 01:47:27 +0000
2414+++ Percona-Server/mysql-test/suite/perfschema/t/pool_of_threads-master.opt 2013-02-01 18:07:28 +0000
2415@@ -1,1 +1,1 @@
2416---loose-pool-of-threads
2417+--loose-thread-handling=pool-of-threads
2418
2419=== modified file 'Percona-Server/mysql-test/suite/perfschema/t/sizing_growth.test'
2420--- Percona-Server/mysql-test/suite/perfschema/t/sizing_growth.test 2012-07-12 15:16:30 +0000
2421+++ Percona-Server/mysql-test/suite/perfschema/t/sizing_growth.test 2013-02-01 18:07:28 +0000
2422@@ -2,6 +2,7 @@
2423
2424 --source include/not_embedded.inc
2425 --source include/have_perfschema.inc
2426+--source include/not_threadpool.inc
2427
2428 #
2429 # Important note:
2430
2431=== modified file 'Percona-Server/mysql-test/suite/perfschema/t/thread_cache.test'
2432--- Percona-Server/mysql-test/suite/perfschema/t/thread_cache.test 2011-10-19 21:49:22 +0000
2433+++ Percona-Server/mysql-test/suite/perfschema/t/thread_cache.test 2013-02-01 18:07:28 +0000
2434@@ -2,6 +2,7 @@
2435
2436 --source include/not_embedded.inc
2437 --source include/have_perfschema.inc
2438+--source include/not_threadpool.inc
2439
2440 #
2441 # Important note:
2442
2443=== modified file 'Percona-Server/mysql-test/suite/perfschema/t/threads_mysql.test'
2444--- Percona-Server/mysql-test/suite/perfschema/t/threads_mysql.test 2011-10-19 21:49:22 +0000
2445+++ Percona-Server/mysql-test/suite/perfschema/t/threads_mysql.test 2013-02-01 18:07:28 +0000
2446@@ -6,6 +6,7 @@
2447 --source include/not_windows.inc
2448 --source include/not_embedded.inc
2449 --source include/have_perfschema.inc
2450+--source include/not_threadpool.inc
2451
2452 # Ensure that the event scheduler (started via threads_mysql-master.opt)
2453 # is really running.
2454
2455=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/extra_max_connections_basic.result'
2456--- Percona-Server/mysql-test/suite/sys_vars/r/extra_max_connections_basic.result 1970-01-01 00:00:00 +0000
2457+++ Percona-Server/mysql-test/suite/sys_vars/r/extra_max_connections_basic.result 2013-02-01 18:07:28 +0000
2458@@ -0,0 +1,43 @@
2459+SET @start_global_value = @@global.extra_max_connections;
2460+select @@global.extra_max_connections;
2461+@@global.extra_max_connections
2462+1
2463+select @@session.extra_max_connections;
2464+ERROR HY000: Variable 'extra_max_connections' is a GLOBAL variable
2465+show global variables like 'extra_max_connections';
2466+Variable_name Value
2467+extra_max_connections 1
2468+show session variables like 'extra_max_connections';
2469+Variable_name Value
2470+extra_max_connections 1
2471+select * from information_schema.global_variables where variable_name='extra_max_connections';
2472+VARIABLE_NAME VARIABLE_VALUE
2473+EXTRA_MAX_CONNECTIONS 1
2474+select * from information_schema.session_variables where variable_name='extra_max_connections';
2475+VARIABLE_NAME VARIABLE_VALUE
2476+EXTRA_MAX_CONNECTIONS 1
2477+set global extra_max_connections=1;
2478+select @@global.extra_max_connections;
2479+@@global.extra_max_connections
2480+1
2481+set session extra_max_connections=1;
2482+ERROR HY000: Variable 'extra_max_connections' is a GLOBAL variable and should be set with SET GLOBAL
2483+set global extra_max_connections=1.1;
2484+ERROR 42000: Incorrect argument type to variable 'extra_max_connections'
2485+set global extra_max_connections=1e1;
2486+ERROR 42000: Incorrect argument type to variable 'extra_max_connections'
2487+set global extra_max_connections="foo";
2488+ERROR 42000: Incorrect argument type to variable 'extra_max_connections'
2489+set global extra_max_connections=0;
2490+Warnings:
2491+Warning 1292 Truncated incorrect extra_max_connections value: '0'
2492+select @@global.extra_max_connections;
2493+@@global.extra_max_connections
2494+1
2495+set global extra_max_connections=cast(-1 as unsigned int);
2496+Warnings:
2497+Warning 1292 Truncated incorrect extra_max_connections value: '18446744073709551615'
2498+select @@global.extra_max_connections;
2499+@@global.extra_max_connections
2500+100000
2501+SET @@global.extra_max_connections = @start_global_value;
2502
2503=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/extra_port_basic.result'
2504--- Percona-Server/mysql-test/suite/sys_vars/r/extra_port_basic.result 1970-01-01 00:00:00 +0000
2505+++ Percona-Server/mysql-test/suite/sys_vars/r/extra_port_basic.result 2013-02-01 18:07:28 +0000
2506@@ -0,0 +1,21 @@
2507+select @@global.extra_port;
2508+@@global.extra_port
2509+0
2510+select @@session.extra_port;
2511+ERROR HY000: Variable 'extra_port' is a GLOBAL variable
2512+show global variables like 'extra_port';
2513+Variable_name Value
2514+extra_port 0
2515+show session variables like 'extra_port';
2516+Variable_name Value
2517+extra_port 0
2518+select * from information_schema.global_variables where variable_name='extra_port';
2519+VARIABLE_NAME VARIABLE_VALUE
2520+EXTRA_PORT 0
2521+select * from information_schema.session_variables where variable_name='extra_port';
2522+VARIABLE_NAME VARIABLE_VALUE
2523+EXTRA_PORT 0
2524+set global extra_port=1;
2525+ERROR HY000: Variable 'extra_port' is a read only variable
2526+set session extra_port=1;
2527+ERROR HY000: Variable 'extra_port' is a read only variable
2528
2529=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result'
2530--- Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result 1970-01-01 00:00:00 +0000
2531+++ Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result 2013-02-01 18:07:28 +0000
2532@@ -0,0 +1,47 @@
2533+SET @start_global_value = @@global.thread_pool_idle_timeout;
2534+select @@global.thread_pool_idle_timeout;
2535+@@global.thread_pool_idle_timeout
2536+60
2537+select @@session.thread_pool_idle_timeout;
2538+ERROR HY000: Variable 'thread_pool_idle_timeout' is a GLOBAL variable
2539+show global variables like 'thread_pool_idle_timeout';
2540+Variable_name Value
2541+thread_pool_idle_timeout 60
2542+show session variables like 'thread_pool_idle_timeout';
2543+Variable_name Value
2544+thread_pool_idle_timeout 60
2545+select * from information_schema.global_variables where variable_name='thread_pool_idle_timeout';
2546+VARIABLE_NAME VARIABLE_VALUE
2547+THREAD_POOL_IDLE_TIMEOUT 60
2548+select * from information_schema.session_variables where variable_name='thread_pool_idle_timeout';
2549+VARIABLE_NAME VARIABLE_VALUE
2550+THREAD_POOL_IDLE_TIMEOUT 60
2551+set global thread_pool_idle_timeout=60;
2552+select @@global.thread_pool_idle_timeout;
2553+@@global.thread_pool_idle_timeout
2554+60
2555+set global thread_pool_idle_timeout=4294967295;
2556+select @@global.thread_pool_idle_timeout;
2557+@@global.thread_pool_idle_timeout
2558+4294967295
2559+set session thread_pool_idle_timeout=1;
2560+ERROR HY000: Variable 'thread_pool_idle_timeout' is a GLOBAL variable and should be set with SET GLOBAL
2561+set global thread_pool_idle_timeout=1.1;
2562+ERROR 42000: Incorrect argument type to variable 'thread_pool_idle_timeout'
2563+set global thread_pool_idle_timeout=1e1;
2564+ERROR 42000: Incorrect argument type to variable 'thread_pool_idle_timeout'
2565+set global thread_pool_idle_timeout="foo";
2566+ERROR 42000: Incorrect argument type to variable 'thread_pool_idle_timeout'
2567+set global thread_pool_idle_timeout=-1;
2568+Warnings:
2569+Warning 1292 Truncated incorrect thread_pool_idle_timeout value: '-1'
2570+select @@global.thread_pool_idle_timeout;
2571+@@global.thread_pool_idle_timeout
2572+1
2573+set global thread_pool_idle_timeout=10000000000;
2574+Warnings:
2575+Warning 1292 Truncated incorrect thread_pool_idle_timeout value: '10000000000'
2576+select @@global.thread_pool_idle_timeout;
2577+@@global.thread_pool_idle_timeout
2578+4294967295
2579+SET @@global.thread_pool_idle_timeout = @start_global_value;
2580
2581=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result'
2582--- Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result 1970-01-01 00:00:00 +0000
2583+++ Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result 2013-02-01 18:07:28 +0000
2584@@ -0,0 +1,47 @@
2585+SET @start_global_value = @@global.thread_pool_max_threads;
2586+select @@global.thread_pool_max_threads;
2587+@@global.thread_pool_max_threads
2588+500
2589+select @@session.thread_pool_max_threads;
2590+ERROR HY000: Variable 'thread_pool_max_threads' is a GLOBAL variable
2591+show global variables like 'thread_pool_max_threads';
2592+Variable_name Value
2593+thread_pool_max_threads 500
2594+show session variables like 'thread_pool_max_threads';
2595+Variable_name Value
2596+thread_pool_max_threads 500
2597+select * from information_schema.global_variables where variable_name='thread_pool_max_threads';
2598+VARIABLE_NAME VARIABLE_VALUE
2599+THREAD_POOL_MAX_THREADS 500
2600+select * from information_schema.session_variables where variable_name='thread_pool_max_threads';
2601+VARIABLE_NAME VARIABLE_VALUE
2602+THREAD_POOL_MAX_THREADS 500
2603+set global thread_pool_max_threads=1;
2604+select @@global.thread_pool_max_threads;
2605+@@global.thread_pool_max_threads
2606+1
2607+set global thread_pool_max_threads=65536;
2608+select @@global.thread_pool_max_threads;
2609+@@global.thread_pool_max_threads
2610+65536
2611+set session thread_pool_max_threads=1;
2612+ERROR HY000: Variable 'thread_pool_max_threads' is a GLOBAL variable and should be set with SET GLOBAL
2613+set global thread_pool_max_threads=1.1;
2614+ERROR 42000: Incorrect argument type to variable 'thread_pool_max_threads'
2615+set global thread_pool_max_threads=1e1;
2616+ERROR 42000: Incorrect argument type to variable 'thread_pool_max_threads'
2617+set global thread_pool_max_threads="foo";
2618+ERROR 42000: Incorrect argument type to variable 'thread_pool_max_threads'
2619+set global thread_pool_max_threads=0;
2620+Warnings:
2621+Warning 1292 Truncated incorrect thread_pool_max_threads value: '0'
2622+select @@global.thread_pool_max_threads;
2623+@@global.thread_pool_max_threads
2624+1
2625+set global thread_pool_max_threads=10000000000;
2626+Warnings:
2627+Warning 1292 Truncated incorrect thread_pool_max_threads value: '10000000000'
2628+select @@global.thread_pool_max_threads;
2629+@@global.thread_pool_max_threads
2630+65536
2631+SET @@global.thread_pool_max_threads = @start_global_value;
2632
2633=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_min_threads_basic.result'
2634--- Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_min_threads_basic.result 1970-01-01 00:00:00 +0000
2635+++ Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_min_threads_basic.result 2013-02-01 18:07:28 +0000
2636@@ -0,0 +1,49 @@
2637+SET @start_global_value = @@global.thread_pool_min_threads;
2638+select @@global.thread_pool_min_threads;
2639+@@global.thread_pool_min_threads
2640+1
2641+select @@session.thread_pool_min_threads;
2642+ERROR HY000: Variable 'thread_pool_min_threads' is a GLOBAL variable
2643+show global variables like 'thread_pool_min_threads';
2644+Variable_name Value
2645+thread_pool_min_threads 1
2646+show session variables like 'thread_pool_min_threads';
2647+Variable_name Value
2648+thread_pool_min_threads 1
2649+select * from information_schema.global_variables where variable_name='thread_pool_min_threads';
2650+VARIABLE_NAME VARIABLE_VALUE
2651+THREAD_POOL_MIN_THREADS 1
2652+select * from information_schema.session_variables where variable_name='thread_pool_min_threads';
2653+VARIABLE_NAME VARIABLE_VALUE
2654+THREAD_POOL_MIN_THREADS 1
2655+set global thread_pool_min_threads=1;
2656+select @@global.thread_pool_min_threads;
2657+@@global.thread_pool_min_threads
2658+1
2659+set global thread_pool_min_threads=65536;
2660+Warnings:
2661+Warning 1292 Truncated incorrect thread_pool_min_threads value: '65536'
2662+select @@global.thread_pool_min_threads;
2663+@@global.thread_pool_min_threads
2664+256
2665+set session thread_pool_min_threads=1;
2666+ERROR HY000: Variable 'thread_pool_min_threads' is a GLOBAL variable and should be set with SET GLOBAL
2667+set global thread_pool_min_threads=1.1;
2668+ERROR 42000: Incorrect argument type to variable 'thread_pool_min_threads'
2669+set global thread_pool_min_threads=1e1;
2670+ERROR 42000: Incorrect argument type to variable 'thread_pool_min_threads'
2671+set global thread_pool_min_threads="foo";
2672+ERROR 42000: Incorrect argument type to variable 'thread_pool_min_threads'
2673+set global thread_pool_min_threads=0;
2674+Warnings:
2675+Warning 1292 Truncated incorrect thread_pool_min_threads value: '0'
2676+select @@global.thread_pool_min_threads;
2677+@@global.thread_pool_min_threads
2678+1
2679+set global thread_pool_min_threads=10000000000;
2680+Warnings:
2681+Warning 1292 Truncated incorrect thread_pool_min_threads value: '10000000000'
2682+select @@global.thread_pool_min_threads;
2683+@@global.thread_pool_min_threads
2684+256
2685+SET @@global.thread_pool_min_threads = @start_global_value;
2686
2687=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_oversubscribe_basic.result'
2688--- Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_oversubscribe_basic.result 1970-01-01 00:00:00 +0000
2689+++ Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_oversubscribe_basic.result 2013-02-01 18:07:28 +0000
2690@@ -0,0 +1,47 @@
2691+SET @start_global_value = @@global.thread_pool_oversubscribe;
2692+select @@global.thread_pool_oversubscribe;
2693+@@global.thread_pool_oversubscribe
2694+3
2695+select @@session.thread_pool_oversubscribe;
2696+ERROR HY000: Variable 'thread_pool_oversubscribe' is a GLOBAL variable
2697+show global variables like 'thread_pool_oversubscribe';
2698+Variable_name Value
2699+thread_pool_oversubscribe 3
2700+show session variables like 'thread_pool_oversubscribe';
2701+Variable_name Value
2702+thread_pool_oversubscribe 3
2703+select * from information_schema.global_variables where variable_name='thread_pool_oversubscribe';
2704+VARIABLE_NAME VARIABLE_VALUE
2705+THREAD_POOL_OVERSUBSCRIBE 3
2706+select * from information_schema.session_variables where variable_name='thread_pool_oversubscribe';
2707+VARIABLE_NAME VARIABLE_VALUE
2708+THREAD_POOL_OVERSUBSCRIBE 3
2709+set global thread_pool_oversubscribe=60;
2710+select @@global.thread_pool_oversubscribe;
2711+@@global.thread_pool_oversubscribe
2712+60
2713+set global thread_pool_oversubscribe=1000;
2714+select @@global.thread_pool_oversubscribe;
2715+@@global.thread_pool_oversubscribe
2716+1000
2717+set session thread_pool_oversubscribe=1;
2718+ERROR HY000: Variable 'thread_pool_oversubscribe' is a GLOBAL variable and should be set with SET GLOBAL
2719+set global thread_pool_oversubscribe=1.1;
2720+ERROR 42000: Incorrect argument type to variable 'thread_pool_oversubscribe'
2721+set global thread_pool_oversubscribe=1e1;
2722+ERROR 42000: Incorrect argument type to variable 'thread_pool_oversubscribe'
2723+set global thread_pool_oversubscribe="foo";
2724+ERROR 42000: Incorrect argument type to variable 'thread_pool_oversubscribe'
2725+set global thread_pool_oversubscribe=-1;
2726+Warnings:
2727+Warning 1292 Truncated incorrect thread_pool_oversubscribe value: '-1'
2728+select @@global.thread_pool_oversubscribe;
2729+@@global.thread_pool_oversubscribe
2730+1
2731+set global thread_pool_oversubscribe=10000000000;
2732+Warnings:
2733+Warning 1292 Truncated incorrect thread_pool_oversubscribe value: '10000000000'
2734+select @@global.thread_pool_oversubscribe;
2735+@@global.thread_pool_oversubscribe
2736+1000
2737+set @@global.thread_pool_oversubscribe = @start_global_value;
2738
2739=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result'
2740--- Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result 1970-01-01 00:00:00 +0000
2741+++ Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result 2013-02-01 18:07:28 +0000
2742@@ -0,0 +1,41 @@
2743+SET @start_global_value = @@global.thread_pool_size;
2744+select @@global.thread_pool_size;
2745+@@global.thread_pool_size
2746+#
2747+select @@session.thread_pool_size;
2748+ERROR HY000: Variable 'thread_pool_size' is a GLOBAL variable
2749+show global variables like 'thread_pool_size';
2750+Variable_name Value
2751+thread_pool_size #
2752+show session variables like 'thread_pool_size';
2753+Variable_name Value
2754+thread_pool_size #
2755+select * from information_schema.global_variables where variable_name='thread_pool_size';
2756+VARIABLE_NAME VARIABLE_VALUE
2757+THREAD_POOL_SIZE #
2758+select * from information_schema.session_variables where variable_name='thread_pool_size';
2759+VARIABLE_NAME VARIABLE_VALUE
2760+THREAD_POOL_SIZE #
2761+set global thread_pool_size=1;
2762+select @@global.thread_pool_size;
2763+@@global.thread_pool_size
2764+1
2765+set global thread_pool_size=128;
2766+select @@global.thread_pool_size;
2767+@@global.thread_pool_size
2768+128
2769+set session thread_pool_size=1;
2770+ERROR HY000: Variable 'thread_pool_size' is a GLOBAL variable and should be set with SET GLOBAL
2771+set global thread_pool_size=1.1;
2772+ERROR 42000: Incorrect argument type to variable 'thread_pool_size'
2773+set global thread_pool_size=1e1;
2774+ERROR 42000: Incorrect argument type to variable 'thread_pool_size'
2775+set global thread_pool_size="foo";
2776+ERROR 42000: Incorrect argument type to variable 'thread_pool_size'
2777+set global thread_pool_size=-1;
2778+Warnings:
2779+Warning 1292 Truncated incorrect thread_pool_size value: '-1'
2780+set global thread_pool_size=100000;
2781+Warnings:
2782+Warning 1292 Truncated incorrect thread_pool_size value: '100000'
2783+SET @@global.thread_pool_size = @start_global_value;
2784
2785=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result'
2786--- Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result 1970-01-01 00:00:00 +0000
2787+++ Percona-Server/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result 2013-02-01 18:07:28 +0000
2788@@ -0,0 +1,47 @@
2789+SET @start_global_value = @@global.thread_pool_stall_limit;
2790+select @@global.thread_pool_stall_limit;
2791+@@global.thread_pool_stall_limit
2792+500
2793+select @@session.thread_pool_stall_limit;
2794+ERROR HY000: Variable 'thread_pool_stall_limit' is a GLOBAL variable
2795+show global variables like 'thread_pool_stall_limit';
2796+Variable_name Value
2797+thread_pool_stall_limit 500
2798+show session variables like 'thread_pool_stall_limit';
2799+Variable_name Value
2800+thread_pool_stall_limit 500
2801+select * from information_schema.global_variables where variable_name='thread_pool_stall_limit';
2802+VARIABLE_NAME VARIABLE_VALUE
2803+THREAD_POOL_STALL_LIMIT 500
2804+select * from information_schema.session_variables where variable_name='thread_pool_stall_limit';
2805+VARIABLE_NAME VARIABLE_VALUE
2806+THREAD_POOL_STALL_LIMIT 500
2807+set global thread_pool_stall_limit=60;
2808+select @@global.thread_pool_stall_limit;
2809+@@global.thread_pool_stall_limit
2810+60
2811+set global thread_pool_stall_limit=4294967295;
2812+select @@global.thread_pool_stall_limit;
2813+@@global.thread_pool_stall_limit
2814+4294967295
2815+set session thread_pool_stall_limit=1;
2816+ERROR HY000: Variable 'thread_pool_stall_limit' is a GLOBAL variable and should be set with SET GLOBAL
2817+set global thread_pool_stall_limit=1.1;
2818+ERROR 42000: Incorrect argument type to variable 'thread_pool_stall_limit'
2819+set global thread_pool_stall_limit=1e1;
2820+ERROR 42000: Incorrect argument type to variable 'thread_pool_stall_limit'
2821+set global thread_pool_stall_limit="foo";
2822+ERROR 42000: Incorrect argument type to variable 'thread_pool_stall_limit'
2823+set global thread_pool_stall_limit=-1;
2824+Warnings:
2825+Warning 1292 Truncated incorrect thread_pool_stall_limit value: '-1'
2826+select @@global.thread_pool_stall_limit;
2827+@@global.thread_pool_stall_limit
2828+10
2829+set global thread_pool_stall_limit=10000000000;
2830+Warnings:
2831+Warning 1292 Truncated incorrect thread_pool_stall_limit value: '10000000000'
2832+select @@global.thread_pool_stall_limit;
2833+@@global.thread_pool_stall_limit
2834+4294967295
2835+set @@global.thread_pool_stall_limit = @start_global_value;
2836
2837=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test'
2838--- Percona-Server/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test 1970-01-01 00:00:00 +0000
2839+++ Percona-Server/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test 2013-02-01 18:07:28 +0000
2840@@ -0,0 +1,42 @@
2841+# ulong global
2842+
2843+SET @start_global_value = @@global.extra_max_connections;
2844+
2845+#
2846+# exists as global only
2847+#
2848+select @@global.extra_max_connections;
2849+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2850+select @@session.extra_max_connections;
2851+show global variables like 'extra_max_connections';
2852+show session variables like 'extra_max_connections';
2853+select * from information_schema.global_variables where variable_name='extra_max_connections';
2854+select * from information_schema.session_variables where variable_name='extra_max_connections';
2855+
2856+#
2857+# show that it's writable
2858+#
2859+set global extra_max_connections=1;
2860+select @@global.extra_max_connections;
2861+--error ER_GLOBAL_VARIABLE
2862+set session extra_max_connections=1;
2863+
2864+#
2865+# incorrect types
2866+#
2867+--error ER_WRONG_TYPE_FOR_VAR
2868+set global extra_max_connections=1.1;
2869+--error ER_WRONG_TYPE_FOR_VAR
2870+set global extra_max_connections=1e1;
2871+--error ER_WRONG_TYPE_FOR_VAR
2872+set global extra_max_connections="foo";
2873+
2874+#
2875+# min/max values
2876+#
2877+set global extra_max_connections=0;
2878+select @@global.extra_max_connections;
2879+set global extra_max_connections=cast(-1 as unsigned int);
2880+select @@global.extra_max_connections;
2881+
2882+SET @@global.extra_max_connections = @start_global_value;
2883
2884=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/extra_port_basic.test'
2885--- Percona-Server/mysql-test/suite/sys_vars/t/extra_port_basic.test 1970-01-01 00:00:00 +0000
2886+++ Percona-Server/mysql-test/suite/sys_vars/t/extra_port_basic.test 2013-02-01 18:07:28 +0000
2887@@ -0,0 +1,21 @@
2888+# ulong readonly
2889+
2890+#
2891+# show the global and session values;
2892+#
2893+select @@global.extra_port;
2894+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2895+select @@session.extra_port;
2896+show global variables like 'extra_port';
2897+show session variables like 'extra_port';
2898+select * from information_schema.global_variables where variable_name='extra_port';
2899+select * from information_schema.session_variables where variable_name='extra_port';
2900+
2901+#
2902+# show that it's read-only
2903+#
2904+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2905+set global extra_port=1;
2906+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2907+set session extra_port=1;
2908+
2909
2910=== modified file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_cache_size_func.test'
2911--- Percona-Server/mysql-test/suite/sys_vars/t/thread_cache_size_func.test 2011-01-14 08:28:23 +0000
2912+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_cache_size_func.test 2013-02-01 18:07:28 +0000
2913@@ -27,9 +27,8 @@
2914 # Setup
2915 #
2916
2917---source include/not_embedded.inc
2918---source include/not_threadpool.inc
2919
2920+--source include/one_thread_per_connection.inc
2921 SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
2922
2923 FLUSH STATUS;
2924
2925=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test'
2926--- Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test 1970-01-01 00:00:00 +0000
2927+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test 2013-02-01 18:07:28 +0000
2928@@ -0,0 +1,43 @@
2929+# uint global
2930+--source include/not_windows.inc
2931+--source include/not_embedded.inc
2932+SET @start_global_value = @@global.thread_pool_idle_timeout;
2933+
2934+#
2935+# exists as global only
2936+#
2937+select @@global.thread_pool_idle_timeout;
2938+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2939+select @@session.thread_pool_idle_timeout;
2940+show global variables like 'thread_pool_idle_timeout';
2941+show session variables like 'thread_pool_idle_timeout';
2942+select * from information_schema.global_variables where variable_name='thread_pool_idle_timeout';
2943+select * from information_schema.session_variables where variable_name='thread_pool_idle_timeout';
2944+
2945+#
2946+# show that it's writable
2947+#
2948+set global thread_pool_idle_timeout=60;
2949+select @@global.thread_pool_idle_timeout;
2950+set global thread_pool_idle_timeout=4294967295;
2951+select @@global.thread_pool_idle_timeout;
2952+--error ER_GLOBAL_VARIABLE
2953+set session thread_pool_idle_timeout=1;
2954+
2955+#
2956+# incorrect types
2957+#
2958+--error ER_WRONG_TYPE_FOR_VAR
2959+set global thread_pool_idle_timeout=1.1;
2960+--error ER_WRONG_TYPE_FOR_VAR
2961+set global thread_pool_idle_timeout=1e1;
2962+--error ER_WRONG_TYPE_FOR_VAR
2963+set global thread_pool_idle_timeout="foo";
2964+
2965+
2966+set global thread_pool_idle_timeout=-1;
2967+select @@global.thread_pool_idle_timeout;
2968+set global thread_pool_idle_timeout=10000000000;
2969+select @@global.thread_pool_idle_timeout;
2970+
2971+SET @@global.thread_pool_idle_timeout = @start_global_value;
2972
2973=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test'
2974--- Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test 1970-01-01 00:00:00 +0000
2975+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test 2013-02-01 18:07:28 +0000
2976@@ -0,0 +1,42 @@
2977+# uint global
2978+--source include/not_embedded.inc
2979+SET @start_global_value = @@global.thread_pool_max_threads;
2980+
2981+#
2982+# exists as global only
2983+#
2984+select @@global.thread_pool_max_threads;
2985+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
2986+select @@session.thread_pool_max_threads;
2987+show global variables like 'thread_pool_max_threads';
2988+show session variables like 'thread_pool_max_threads';
2989+select * from information_schema.global_variables where variable_name='thread_pool_max_threads';
2990+select * from information_schema.session_variables where variable_name='thread_pool_max_threads';
2991+
2992+#
2993+# show that it's writable
2994+#
2995+set global thread_pool_max_threads=1;
2996+select @@global.thread_pool_max_threads;
2997+set global thread_pool_max_threads=65536;
2998+select @@global.thread_pool_max_threads;
2999+--error ER_GLOBAL_VARIABLE
3000+set session thread_pool_max_threads=1;
3001+
3002+#
3003+# incorrect types
3004+#
3005+--error ER_WRONG_TYPE_FOR_VAR
3006+set global thread_pool_max_threads=1.1;
3007+--error ER_WRONG_TYPE_FOR_VAR
3008+set global thread_pool_max_threads=1e1;
3009+--error ER_WRONG_TYPE_FOR_VAR
3010+set global thread_pool_max_threads="foo";
3011+
3012+
3013+set global thread_pool_max_threads=0;
3014+select @@global.thread_pool_max_threads;
3015+set global thread_pool_max_threads=10000000000;
3016+select @@global.thread_pool_max_threads;
3017+
3018+SET @@global.thread_pool_max_threads = @start_global_value;
3019
3020=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test'
3021--- Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test 1970-01-01 00:00:00 +0000
3022+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test 2013-02-01 18:07:28 +0000
3023@@ -0,0 +1,43 @@
3024+# uint global
3025+--source include/not_embedded.inc
3026+--source include/windows.inc
3027+SET @start_global_value = @@global.thread_pool_min_threads;
3028+
3029+#
3030+# exists as global only
3031+#
3032+select @@global.thread_pool_min_threads;
3033+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
3034+select @@session.thread_pool_min_threads;
3035+show global variables like 'thread_pool_min_threads';
3036+show session variables like 'thread_pool_min_threads';
3037+select * from information_schema.global_variables where variable_name='thread_pool_min_threads';
3038+select * from information_schema.session_variables where variable_name='thread_pool_min_threads';
3039+
3040+#
3041+# show that it's writable
3042+#
3043+set global thread_pool_min_threads=1;
3044+select @@global.thread_pool_min_threads;
3045+set global thread_pool_min_threads=65536;
3046+select @@global.thread_pool_min_threads;
3047+--error ER_GLOBAL_VARIABLE
3048+set session thread_pool_min_threads=1;
3049+
3050+#
3051+# incorrect types
3052+#
3053+--error ER_WRONG_TYPE_FOR_VAR
3054+set global thread_pool_min_threads=1.1;
3055+--error ER_WRONG_TYPE_FOR_VAR
3056+set global thread_pool_min_threads=1e1;
3057+--error ER_WRONG_TYPE_FOR_VAR
3058+set global thread_pool_min_threads="foo";
3059+
3060+
3061+set global thread_pool_min_threads=0;
3062+select @@global.thread_pool_min_threads;
3063+set global thread_pool_min_threads=10000000000;
3064+select @@global.thread_pool_min_threads;
3065+
3066+SET @@global.thread_pool_min_threads = @start_global_value;
3067
3068=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test'
3069--- Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test 1970-01-01 00:00:00 +0000
3070+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test 2013-02-01 18:07:28 +0000
3071@@ -0,0 +1,43 @@
3072+# uint global
3073+--source include/not_windows.inc
3074+--source include/not_embedded.inc
3075+SET @start_global_value = @@global.thread_pool_oversubscribe;
3076+
3077+#
3078+# exists as global only
3079+#
3080+select @@global.thread_pool_oversubscribe;
3081+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
3082+select @@session.thread_pool_oversubscribe;
3083+show global variables like 'thread_pool_oversubscribe';
3084+show session variables like 'thread_pool_oversubscribe';
3085+select * from information_schema.global_variables where variable_name='thread_pool_oversubscribe';
3086+select * from information_schema.session_variables where variable_name='thread_pool_oversubscribe';
3087+
3088+#
3089+# show that it's writable
3090+#
3091+set global thread_pool_oversubscribe=60;
3092+select @@global.thread_pool_oversubscribe;
3093+set global thread_pool_oversubscribe=1000;
3094+select @@global.thread_pool_oversubscribe;
3095+--error ER_GLOBAL_VARIABLE
3096+set session thread_pool_oversubscribe=1;
3097+
3098+#
3099+# incorrect types
3100+#
3101+--error ER_WRONG_TYPE_FOR_VAR
3102+set global thread_pool_oversubscribe=1.1;
3103+--error ER_WRONG_TYPE_FOR_VAR
3104+set global thread_pool_oversubscribe=1e1;
3105+--error ER_WRONG_TYPE_FOR_VAR
3106+set global thread_pool_oversubscribe="foo";
3107+
3108+
3109+set global thread_pool_oversubscribe=-1;
3110+select @@global.thread_pool_oversubscribe;
3111+set global thread_pool_oversubscribe=10000000000;
3112+select @@global.thread_pool_oversubscribe;
3113+
3114+set @@global.thread_pool_oversubscribe = @start_global_value;
3115
3116=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test'
3117--- Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test 1970-01-01 00:00:00 +0000
3118+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test 2013-02-01 18:07:28 +0000
3119@@ -0,0 +1,47 @@
3120+# uint global
3121+--source include/not_windows.inc
3122+--source include/not_embedded.inc
3123+SET @start_global_value = @@global.thread_pool_size;
3124+
3125+#
3126+# exists as global only
3127+#
3128+--replace_column 1 #
3129+select @@global.thread_pool_size;
3130+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
3131+select @@session.thread_pool_size;
3132+--replace_column 2 #
3133+show global variables like 'thread_pool_size';
3134+--replace_column 2 #
3135+show session variables like 'thread_pool_size';
3136+--replace_column 2 #
3137+select * from information_schema.global_variables where variable_name='thread_pool_size';
3138+--replace_column 2 #
3139+select * from information_schema.session_variables where variable_name='thread_pool_size';
3140+--replace_column 2 #
3141+
3142+#
3143+# show that it's writable
3144+#
3145+set global thread_pool_size=1;
3146+select @@global.thread_pool_size;
3147+set global thread_pool_size=128;
3148+select @@global.thread_pool_size;
3149+--error ER_GLOBAL_VARIABLE
3150+set session thread_pool_size=1;
3151+
3152+#
3153+# incorrect types
3154+#
3155+--error ER_WRONG_TYPE_FOR_VAR
3156+set global thread_pool_size=1.1;
3157+--error ER_WRONG_TYPE_FOR_VAR
3158+set global thread_pool_size=1e1;
3159+--error ER_WRONG_TYPE_FOR_VAR
3160+set global thread_pool_size="foo";
3161+
3162+set global thread_pool_size=-1;
3163+
3164+set global thread_pool_size=100000;
3165+
3166+SET @@global.thread_pool_size = @start_global_value;
3167
3168=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test'
3169--- Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test 1970-01-01 00:00:00 +0000
3170+++ Percona-Server/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test 2013-02-01 18:07:28 +0000
3171@@ -0,0 +1,43 @@
3172+# uint global
3173+--source include/not_windows.inc
3174+--source include/not_embedded.inc
3175+SET @start_global_value = @@global.thread_pool_stall_limit;
3176+
3177+#
3178+# exists as global only
3179+#
3180+select @@global.thread_pool_stall_limit;
3181+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
3182+select @@session.thread_pool_stall_limit;
3183+show global variables like 'thread_pool_stall_limit';
3184+show session variables like 'thread_pool_stall_limit';
3185+select * from information_schema.global_variables where variable_name='thread_pool_stall_limit';
3186+select * from information_schema.session_variables where variable_name='thread_pool_stall_limit';
3187+
3188+#
3189+# show that it's writable
3190+#
3191+set global thread_pool_stall_limit=60;
3192+select @@global.thread_pool_stall_limit;
3193+set global thread_pool_stall_limit=4294967295;
3194+select @@global.thread_pool_stall_limit;
3195+--error ER_GLOBAL_VARIABLE
3196+set session thread_pool_stall_limit=1;
3197+
3198+#
3199+# incorrect types
3200+#
3201+--error ER_WRONG_TYPE_FOR_VAR
3202+set global thread_pool_stall_limit=1.1;
3203+--error ER_WRONG_TYPE_FOR_VAR
3204+set global thread_pool_stall_limit=1e1;
3205+--error ER_WRONG_TYPE_FOR_VAR
3206+set global thread_pool_stall_limit="foo";
3207+
3208+
3209+set global thread_pool_stall_limit=-1;
3210+select @@global.thread_pool_stall_limit;
3211+set global thread_pool_stall_limit=10000000000;
3212+select @@global.thread_pool_stall_limit;
3213+
3214+set @@global.thread_pool_stall_limit = @start_global_value;
3215
3216=== added file 'Percona-Server/mysql-test/t/aborted_clients.test'
3217--- Percona-Server/mysql-test/t/aborted_clients.test 1970-01-01 00:00:00 +0000
3218+++ Percona-Server/mysql-test/t/aborted_clients.test 2013-02-01 18:07:28 +0000
3219@@ -0,0 +1,28 @@
3220+# Test case for https://mariadb.atlassian.net/browse/MDEV-246, lp:992983
3221+# Check that ordinary connect/disconnect does not increase aborted_clients
3222+# status variable, but KILL connection does
3223+
3224+--source include/not_embedded.inc
3225+--source include/count_sessions.inc
3226+
3227+FLUSH STATUS;
3228+# Connect/Disconnect look that aborted_clients stays 0
3229+connect (con1,localhost,root,,);
3230+disconnect con1;
3231+connection default;
3232+
3233+# Check that there is 0 aborted clients so far
3234+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
3235+
3236+# Kill a connection, check that aborted_clients is incremented
3237+connect(con2,localhost,root,,);
3238+--disable_reconnect
3239+--error 1317
3240+KILL CONNECTION_ID();
3241+disconnect con2;
3242+connection default;
3243+
3244+--source include/wait_until_count_sessions.inc
3245+# aborted clients must be 1 now
3246+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
3247+FLUSH STATUS;
3248
3249=== added file 'Percona-Server/mysql-test/t/pool_of_threads.cnf'
3250--- Percona-Server/mysql-test/t/pool_of_threads.cnf 1970-01-01 00:00:00 +0000
3251+++ Percona-Server/mysql-test/t/pool_of_threads.cnf 2013-02-01 18:07:28 +0000
3252@@ -0,0 +1,15 @@
3253+!include include/default_my.cnf
3254+
3255+[mysqld.1]
3256+loose-thread-handling= pool-of-threads
3257+loose-thread_pool_size= 2
3258+loose-thread_pool_max_threads= 2
3259+#extra-port= @ENV.MASTER_EXTRA_PORT
3260+extra-port= @OPT.port
3261+
3262+[client]
3263+connect-timeout= 2
3264+
3265+[ENV]
3266+;MASTER_EXTRA_PORT= @mysqld.2.port
3267+MASTER_EXTRA_PORT= @OPT.port
3268
3269=== added file 'Percona-Server/mysql-test/t/pool_of_threads.test'
3270--- Percona-Server/mysql-test/t/pool_of_threads.test 1970-01-01 00:00:00 +0000
3271+++ Percona-Server/mysql-test/t/pool_of_threads.test 2013-02-01 18:07:28 +0000
3272@@ -0,0 +1,80 @@
3273+# Start with thread_handling=pool-of-threads
3274+# and run a number of tests
3275+
3276+-- source include/have_pool_of_threads.inc
3277+-- source include/common-tests.inc
3278+
3279+# Test that we cannot have more simultaneous connections than
3280+# --thread-pool-size on the standard port, but _can_ have additional
3281+# connections on the extra port.
3282+
3283+# First set two connections running, and check that extra connection
3284+# on normal port fails due to --thread-pool-max_threads=2
3285+connection default;
3286+let $default_id = `select connection_id()`;
3287+send SELECT sleep(50000);
3288+--sleep 1
3289+
3290+connect(con2,localhost,root,,);
3291+connection con2;
3292+let $con2_id = `select connection_id()`;
3293+send SELECT sleep(50000);
3294+--sleep 0.5
3295+
3296+--disable_abort_on_error
3297+--disable_result_log
3298+--disable_query_log
3299+connect(con3,localhost,root,,);
3300+--enable_query_log
3301+--enable_result_log
3302+--enable_abort_on_error
3303+let $error = $mysql_errno;
3304+if (!$error)
3305+{
3306+ --echo # -- Error: managed to establish more than --thread_pool_max_threads connections
3307+}
3308+if ($error)
3309+{
3310+ --echo # -- Success: more than --thread_pool_max_threads normal connections not possible
3311+}
3312+
3313+# This time use the extra port to successfully connect.
3314+
3315+connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
3316+connection extracon;
3317+SELECT 'Connection on extra port ok';
3318+
3319+# Kill long queries in other connections
3320+let @ignore = `select @id := $default_id`;
3321+KILL QUERY @id;
3322+let @ignore = `select @id := $con2_id`;
3323+KILL QUERY @id;
3324+
3325+connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
3326+connection extracon2;
3327+SELECT 'Connection on extra port 2 ok';
3328+
3329+--disable_query_log
3330+call mtr.add_suppression("Too many connections");
3331+--enable_query_log
3332+--disable_abort_on_error
3333+--disable_result_log
3334+--disable_query_log
3335+connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
3336+--enable_query_log
3337+--enable_result_log
3338+--enable_abort_on_error
3339+let $error = $mysql_errno;
3340+if (!$error)
3341+{
3342+ --echo # -- Error: managed to establish more than --extra-max-connections + 1 connections
3343+}
3344+if ($error)
3345+{
3346+ --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
3347+}
3348+
3349+connection default;
3350+--reap
3351+connection con2;
3352+--reap
3353
3354=== modified file 'Percona-Server/mysys/thr_lock.c'
3355--- Percona-Server/mysys/thr_lock.c 2011-09-07 10:08:09 +0000
3356+++ Percona-Server/mysys/thr_lock.c 2013-02-01 18:07:28 +0000
3357@@ -401,6 +401,7 @@
3358 struct timespec wait_timeout;
3359 enum enum_thr_lock_result result= THR_LOCK_ABORTED;
3360 PSI_stage_info old_stage;
3361+ my_bool use_wait_callbacks= FALSE;
3362 DBUG_ENTER("wait_for_lock");
3363
3364 /*
3365@@ -454,7 +455,10 @@
3366 and once after the thread has exited the wait loop.
3367 */
3368 if ((!thread_var->abort || in_wait_list) && before_lock_wait)
3369+ {
3370+ use_wait_callbacks= TRUE;
3371 (*before_lock_wait)();
3372+ }
3373
3374 set_timespec(wait_timeout, lock_wait_timeout);
3375 while (!thread_var->abort || in_wait_list)
3376@@ -492,7 +496,7 @@
3377 We call the after_lock_wait callback once the wait loop has
3378 finished.
3379 */
3380- if (after_lock_wait)
3381+ if (after_lock_wait && use_wait_callbacks)
3382 (*after_lock_wait)();
3383
3384 DBUG_PRINT("thr_lock", ("aborted: %d in_wait_list: %d",
3385
3386=== modified file 'Percona-Server/sql/CMakeLists.txt'
3387--- Percona-Server/sql/CMakeLists.txt 2012-12-04 08:24:59 +0000
3388+++ Percona-Server/sql/CMakeLists.txt 2013-02-01 18:07:28 +0000
3389@@ -31,7 +31,7 @@
3390
3391 SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1)
3392
3393-ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER)
3394+ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER -DHAVE_POOL_OF_THREADS)
3395 IF(SSL_DEFINES)
3396 ADD_DEFINITIONS(${SSL_DEFINES})
3397 ENDIF()
3398@@ -168,8 +168,15 @@
3399 tztime.cc
3400 uniques.cc
3401 unireg.cc
3402+ threadpool_common.cc
3403 )
3404
3405+IF(WIN32)
3406+ SET(SQL_SHARED_SOURCES ${SQL_SHARED_SOURCES} threadpool_win.cc)
3407+ELSE()
3408+ SET(SQL_SHARED_SOURCES ${SQL_SHARED_SOURCES} threadpool_unix.cc)
3409+ENDIF()
3410+
3411 SET(SQL_EXPORTED_SOURCES ${SQL_SHARED_SOURCES} PARENT_SCOPE)
3412
3413 SET(SQL_SOURCE
3414
3415=== modified file 'Percona-Server/sql/mysqld.cc'
3416--- Percona-Server/sql/mysqld.cc 2012-12-04 08:24:59 +0000
3417+++ Percona-Server/sql/mysqld.cc 2013-02-01 18:07:28 +0000
3418@@ -77,6 +77,7 @@
3419 #include "global_threads.h"
3420 #include "mysqld.h"
3421 #include "my_default.h"
3422+#include "threadpool.h"
3423
3424 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
3425 #include "../storage/perfschema/pfs_server.h"
3426@@ -488,6 +489,7 @@
3427 volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */
3428 #endif
3429 uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
3430+uint mysqld_extra_port;
3431 uint mysqld_port_timeout;
3432 ulong delay_key_write_options;
3433 uint protocol_version;
3434@@ -534,6 +536,7 @@
3435 ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
3436 ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
3437 ulong max_connections, max_connect_errors;
3438+ulong extra_max_connections;
3439 my_bool log_bin_use_v1_row_events= 0;
3440 bool thread_cache_size_specified= false;
3441 bool host_cache_size_specified= false;
3442@@ -1122,7 +1125,7 @@
3443 }
3444 C_MODE_END
3445
3446-static MYSQL_SOCKET unix_sock, ip_sock;
3447+static MYSQL_SOCKET unix_sock, base_ip_sock, extra_ip_sock;
3448 struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD()
3449
3450 #ifndef EMBEDDED_LIBRARY
3451@@ -1214,7 +1217,7 @@
3452 Number of currently active user connections. The variable is protected by
3453 LOCK_connection_count.
3454 */
3455-uint connection_count= 0;
3456+uint connection_count= 0, extra_connection_count= 0;
3457
3458 /* Function declarations */
3459
3460@@ -1313,11 +1316,17 @@
3461 DBUG_PRINT("quit",("Closing sockets"));
3462 if (!opt_disable_networking )
3463 {
3464- if (mysql_socket_getfd(ip_sock) != INVALID_SOCKET)
3465- {
3466- (void) mysql_socket_shutdown(ip_sock, SHUT_RDWR);
3467- (void) mysql_socket_close(ip_sock);
3468- ip_sock= MYSQL_INVALID_SOCKET;
3469+ if (mysql_socket_getfd(base_ip_sock) != INVALID_SOCKET)
3470+ {
3471+ (void) mysql_socket_shutdown(base_ip_sock, SHUT_RDWR);
3472+ (void) mysql_socket_close(base_ip_sock);
3473+ base_ip_sock= MYSQL_INVALID_SOCKET;
3474+ }
3475+ if (mysql_socket_getfd(extra_ip_sock) != INVALID_SOCKET)
3476+ {
3477+ (void) mysql_socket_shutdown(extra_ip_sock, SHUT_RDWR);
3478+ (void) mysql_socket_close(extra_ip_sock);
3479+ extra_ip_sock= MYSQL_INVALID_SOCKET;
3480 }
3481 }
3482 #ifdef _WIN32
3483@@ -1455,20 +1464,15 @@
3484 DBUG_ENTER("close_server_sock");
3485 MYSQL_SOCKET tmp_sock;
3486 tmp_sock=ip_sock;
3487- if (mysql_socket_getfd(tmp_sock) != INVALID_SOCKET)
3488- {
3489- ip_sock= MYSQL_INVALID_SOCKET;
3490- DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
3491- (void) mysql_socket_shutdown(tmp_sock, SHUT_RDWR);
3492- }
3493- tmp_sock=unix_sock;
3494- if (mysql_socket_getfd(tmp_sock) != INVALID_SOCKET)
3495- {
3496- unix_sock= MYSQL_INVALID_SOCKET;
3497- DBUG_PRINT("info",("calling shutdown on unix socket"));
3498- (void) mysql_socket_shutdown(tmp_sock, SHUT_RDWR);
3499+
3500+ close_socket(base_ip_sock, "TCP/IP");
3501+ close_socket(extra_ip_sock, "TCP/IP");
3502+ close_socket(unix_sock, "unix/IP");
3503+
3504+ if (mysql_socket_getfd(unix_sock) != INVALID_SOCKET)
3505 (void) unlink(mysqld_unix_port);
3506- }
3507+ base_ip_sock= extra_ip_sock= unix_sock= MYSQL_INVALID_SOCKET;
3508+
3509 DBUG_VOID_RETURN;
3510 #endif
3511 }
3512@@ -2144,19 +2148,215 @@
3513 }
3514
3515
3516-static void network_init(void)
3517+static MYSQL_SOCKET activate_tcp_port(uint port)
3518 {
3519-#ifdef HAVE_SYS_UN_H
3520- struct sockaddr_un UNIXaddr;
3521-#endif
3522 int arg;
3523 int ret;
3524 uint waited;
3525 uint this_wait;
3526 uint retry;
3527+ struct addrinfo *ai;
3528+ struct addrinfo hints;
3529 char port_buf[NI_MAXSERV];
3530+ MYSQL_SOCKET ip_sock= MYSQL_INVALID_SOCKET;
3531+
3532+ const char *bind_address_str= NULL;
3533+ const char *ipv6_all_addresses= "::";
3534+ const char *ipv4_all_addresses= "0.0.0.0";
3535+
3536+ DBUG_ENTER("activate_tcp_port");
3537+ sql_print_information("Server hostname (bind-address): '%s'; port: %d",
3538+ my_bind_addr_str, mysqld_port);
3539+
3540+ LINT_INIT(ret);
3541+
3542+ // Get list of IP-addresses associated with the bind-address.
3543+
3544+ memset(&hints, 0, sizeof (hints));
3545+ hints.ai_flags= AI_PASSIVE;
3546+ hints.ai_socktype= SOCK_STREAM;
3547+ hints.ai_family= AF_UNSPEC;
3548+
3549+ my_snprintf(port_buf, NI_MAXSERV, "%d", port);
3550+
3551+ if (strcasecmp(my_bind_addr_str, MY_BIND_ALL_ADDRESSES) == 0)
3552+ {
3553+ /*
3554+ That's the case when bind-address is set to a special value ('*'),
3555+ meaning "bind to all available IP addresses". If the box supports
3556+ the IPv6 stack, that means binding to '::'. If only IPv4 is available,
3557+ bind to '0.0.0.0'.
3558+ */
3559+
3560+ bool ipv6_available= false;
3561+
3562+ if (!getaddrinfo(ipv6_all_addresses, port_buf, &hints, &ai))
3563+ {
3564+ /*
3565+ IPv6 might be available (the system might be able to resolve an IPv6
3566+ address, but not be able to create an IPv6-socket). Try to create a
3567+ dummy IPv6-socket. Do not instrument that socket by P_S.
3568+ */
3569+
3570+ MYSQL_SOCKET s= mysql_socket_socket(0, AF_INET6, SOCK_STREAM, 0);
3571+
3572+ ipv6_available= mysql_socket_getfd(s) != INVALID_SOCKET;
3573+
3574+ mysql_socket_close(s);
3575+ }
3576+
3577+ if (ipv6_available)
3578+ {
3579+ sql_print_information("IPv6 is available.");
3580+
3581+ // Address info (ai) for IPv6 address is already set.
3582+
3583+ bind_address_str= ipv6_all_addresses;
3584+ }
3585+ else
3586+ {
3587+ sql_print_information("IPv6 is not available.");
3588+
3589+ // Retrieve address info (ai) for IPv4 address.
3590+
3591+ if (getaddrinfo(ipv4_all_addresses, port_buf, &hints, &ai))
3592+ {
3593+ sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR));
3594+ sql_print_error("Can't start server: cannot resolve hostname!");
3595+ unireg_abort(1);
3596+ }
3597+
3598+ bind_address_str= ipv4_all_addresses;
3599+ }
3600+ }
3601+ else
3602+ {
3603+ if (getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai))
3604+ {
3605+ sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
3606+ sql_print_error("Can't start server: cannot resolve hostname!");
3607+ unireg_abort(1); /* purecov: tested */
3608+ }
3609+
3610+ bind_address_str= my_bind_addr_str;
3611+ }
3612+
3613+ // Log all the IP-addresses.
3614+ for (struct addrinfo *cur_ai= ai; cur_ai != NULL; cur_ai= cur_ai->ai_next)
3615+ {
3616+ char ip_addr[INET6_ADDRSTRLEN];
3617+
3618+ if (vio_getnameinfo(cur_ai->ai_addr, ip_addr, sizeof (ip_addr),
3619+ NULL, 0, NI_NUMERICHOST))
3620+ {
3621+ sql_print_error("Fails to print out IP-address.");
3622+ continue;
3623+ }
3624+
3625+ sql_print_information(" - '%s' resolves to '%s';",
3626+ bind_address_str, ip_addr);
3627+ }
3628+
3629+ /*
3630+ If the 'bind-address' option specifies the hostname, which resolves to
3631+ multiple IP-address, use the following rule:
3632+ - if there are IPv4-addresses, use the first IPv4-address
3633+ returned by getaddrinfo();
3634+ - if there are IPv6-addresses, use the first IPv6-address
3635+ returned by getaddrinfo();
3636+ */
3637+
3638+ struct addrinfo *a;
3639+ ip_sock= create_socket(ai, AF_INET, &a);
3640+
3641+ if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
3642+ ip_sock= create_socket(ai, AF_INET6, &a);
3643+
3644+ // Report user-error if we failed to create a socket.
3645+ if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
3646+ {
3647+ sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
3648+ unireg_abort(1); /* purecov: tested */
3649+ }
3650+
3651+ mysql_socket_set_thread_owner(ip_sock);
3652+
3653+#ifndef __WIN__
3654+ /*
3655+ We should not use SO_REUSEADDR on windows as this would enable a
3656+ user to open two mysqld servers with the same TCP/IP port.
3657+ */
3658+ arg= 1;
3659+ (void) mysql_socket_setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg,sizeof(arg));
3660+#endif /* __WIN__ */
3661+
3662+#ifdef IPV6_V6ONLY
3663+ /*
3664+ For interoperability with older clients, IPv6 socket should
3665+ listen on both IPv6 and IPv4 wildcard addresses.
3666+ Turn off IPV6_V6ONLY option.
3667+
3668+ NOTE: this will work starting from Windows Vista only.
3669+ On Windows XP dual stack is not available, so it will not
3670+ listen on the corresponding IPv4-address.
3671+ */
3672+ if (a->ai_family == AF_INET6)
3673+ {
3674+ arg= 0;
3675+
3676+ if (mysql_socket_setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY,
3677+ (char *) &arg, sizeof (arg)))
3678+ {
3679+ sql_print_warning("Failed to reset IPV6_V6ONLY flag (error: %d). "
3680+ "The server will listen to IPv6 addresses only.",
3681+ (int) socket_errno);
3682+ }
3683+ }
3684+#endif
3685+ /*
3686+ Sometimes the port is not released fast enough when stopping and
3687+ restarting the server. This happens quite often with the test suite
3688+ on busy Linux systems. Retry to bind the address at these intervals:
3689+ Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ...
3690+ Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ...
3691+ Limit the sequence by mysqld_port_timeout (set --port-open-timeout=#).
3692+ */
3693+ for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
3694+ {
3695+ if (((ret= mysql_socket_bind(ip_sock, a->ai_addr, a->ai_addrlen)) >= 0 ) ||
3696+ (socket_errno != SOCKET_EADDRINUSE) ||
3697+ (waited >= mysqld_port_timeout))
3698+ break;
3699+ sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port);
3700+ this_wait= retry * retry / 3 + 1;
3701+ sleep(this_wait);
3702+ }
3703+ freeaddrinfo(ai);
3704+ if (ret < 0)
3705+ {
3706+ DBUG_PRINT("error",("Got error: %d from bind",socket_errno));
3707+ sql_perror("Can't start server: Bind on TCP/IP port");
3708+ sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port);
3709+ unireg_abort(1);
3710+ }
3711+ if (mysql_socket_listen(ip_sock, (int)back_log) < 0)
3712+ {
3713+ sql_perror("Can't start server: listen() on TCP/IP port");
3714+ sql_print_error("listen() on TCP/IP failed with error %d",
3715+ socket_errno);
3716+ unireg_abort(1);
3717+ }
3718+ DBUG_RETURN(ip_sock);
3719+}
3720+
3721+
3722+static void network_init(void)
3723+{
3724+#ifdef HAVE_SYS_UN_H
3725+ struct sockaddr_un UNIXaddr;
3726+ int arg;
3727+#endif
3728 DBUG_ENTER("network_init");
3729- LINT_INIT(ret);
3730
3731 if (MYSQL_CALLBACK_ELSE(thread_scheduler, init, (), 0))
3732 unireg_abort(1); /* purecov: inspected */
3733@@ -2175,192 +2375,10 @@
3734
3735 if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap)
3736 {
3737- struct addrinfo *ai;
3738- struct addrinfo hints;
3739-
3740- const char *bind_address_str= NULL;
3741- const char *ipv6_all_addresses= "::";
3742- const char *ipv4_all_addresses= "0.0.0.0";
3743-
3744- sql_print_information("Server hostname (bind-address): '%s'; port: %d",
3745- my_bind_addr_str, mysqld_port);
3746-
3747- // Get list of IP-addresses associated with the bind-address.
3748-
3749- memset(&hints, 0, sizeof (hints));
3750- hints.ai_flags= AI_PASSIVE;
3751- hints.ai_socktype= SOCK_STREAM;
3752- hints.ai_family= AF_UNSPEC;
3753-
3754- my_snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port);
3755-
3756- if (strcasecmp(my_bind_addr_str, MY_BIND_ALL_ADDRESSES) == 0)
3757- {
3758- /*
3759- That's the case when bind-address is set to a special value ('*'),
3760- meaning "bind to all available IP addresses". If the box supports
3761- the IPv6 stack, that means binding to '::'. If only IPv4 is available,
3762- bind to '0.0.0.0'.
3763- */
3764-
3765- bool ipv6_available= false;
3766-
3767- if (!getaddrinfo(ipv6_all_addresses, port_buf, &hints, &ai))
3768- {
3769- /*
3770- IPv6 might be available (the system might be able to resolve an IPv6
3771- address, but not be able to create an IPv6-socket). Try to create a
3772- dummy IPv6-socket. Do not instrument that socket by P_S.
3773- */
3774-
3775- MYSQL_SOCKET s= mysql_socket_socket(0, AF_INET6, SOCK_STREAM, 0);
3776-
3777- ipv6_available= mysql_socket_getfd(s) != INVALID_SOCKET;
3778-
3779- mysql_socket_close(s);
3780- }
3781-
3782- if (ipv6_available)
3783- {
3784- sql_print_information("IPv6 is available.");
3785-
3786- // Address info (ai) for IPv6 address is already set.
3787-
3788- bind_address_str= ipv6_all_addresses;
3789- }
3790- else
3791- {
3792- sql_print_information("IPv6 is not available.");
3793-
3794- // Retrieve address info (ai) for IPv4 address.
3795-
3796- if (getaddrinfo(ipv4_all_addresses, port_buf, &hints, &ai))
3797- {
3798- sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR));
3799- sql_print_error("Can't start server: cannot resolve hostname!");
3800- unireg_abort(1);
3801- }
3802-
3803- bind_address_str= ipv4_all_addresses;
3804- }
3805- }
3806- else
3807- {
3808- if (getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai))
3809- {
3810- sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
3811- sql_print_error("Can't start server: cannot resolve hostname!");
3812- unireg_abort(1); /* purecov: tested */
3813- }
3814-
3815- bind_address_str= my_bind_addr_str;
3816- }
3817-
3818- // Log all the IP-addresses.
3819- for (struct addrinfo *cur_ai= ai; cur_ai != NULL; cur_ai= cur_ai->ai_next)
3820- {
3821- char ip_addr[INET6_ADDRSTRLEN];
3822-
3823- if (vio_getnameinfo(cur_ai->ai_addr, ip_addr, sizeof (ip_addr),
3824- NULL, 0, NI_NUMERICHOST))
3825- {
3826- sql_print_error("Fails to print out IP-address.");
3827- continue;
3828- }
3829-
3830- sql_print_information(" - '%s' resolves to '%s';",
3831- bind_address_str, ip_addr);
3832- }
3833-
3834- /*
3835- If the 'bind-address' option specifies the hostname, which resolves to
3836- multiple IP-address, use the following rule:
3837- - if there are IPv4-addresses, use the first IPv4-address
3838- returned by getaddrinfo();
3839- - if there are IPv6-addresses, use the first IPv6-address
3840- returned by getaddrinfo();
3841- */
3842-
3843- struct addrinfo *a;
3844- ip_sock= create_socket(ai, AF_INET, &a);
3845-
3846- if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
3847- ip_sock= create_socket(ai, AF_INET6, &a);
3848-
3849- // Report user-error if we failed to create a socket.
3850- if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
3851- {
3852- sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
3853- unireg_abort(1); /* purecov: tested */
3854- }
3855-
3856- mysql_socket_set_thread_owner(ip_sock);
3857-
3858-#ifndef __WIN__
3859- /*
3860- We should not use SO_REUSEADDR on windows as this would enable a
3861- user to open two mysqld servers with the same TCP/IP port.
3862- */
3863- arg= 1;
3864- (void) mysql_socket_setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg,sizeof(arg));
3865-#endif /* __WIN__ */
3866-
3867-#ifdef IPV6_V6ONLY
3868- /*
3869- For interoperability with older clients, IPv6 socket should
3870- listen on both IPv6 and IPv4 wildcard addresses.
3871- Turn off IPV6_V6ONLY option.
3872-
3873- NOTE: this will work starting from Windows Vista only.
3874- On Windows XP dual stack is not available, so it will not
3875- listen on the corresponding IPv4-address.
3876- */
3877- if (a->ai_family == AF_INET6)
3878- {
3879- arg= 0;
3880-
3881- if (mysql_socket_setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY,
3882- (char *) &arg, sizeof (arg)))
3883- {
3884- sql_print_warning("Failed to reset IPV6_V6ONLY flag (error: %d). "
3885- "The server will listen to IPv6 addresses only.",
3886- (int) socket_errno);
3887- }
3888- }
3889-#endif
3890- /*
3891- Sometimes the port is not released fast enough when stopping and
3892- restarting the server. This happens quite often with the test suite
3893- on busy Linux systems. Retry to bind the address at these intervals:
3894- Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ...
3895- Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ...
3896- Limit the sequence by mysqld_port_timeout (set --port-open-timeout=#).
3897- */
3898- for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
3899- {
3900- if (((ret= mysql_socket_bind(ip_sock, a->ai_addr, a->ai_addrlen)) >= 0 ) ||
3901- (socket_errno != SOCKET_EADDRINUSE) ||
3902- (waited >= mysqld_port_timeout))
3903- break;
3904- sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port);
3905- this_wait= retry * retry / 3 + 1;
3906- sleep(this_wait);
3907- }
3908- freeaddrinfo(ai);
3909- if (ret < 0)
3910- {
3911- DBUG_PRINT("error",("Got error: %d from bind",socket_errno));
3912- sql_perror("Can't start server: Bind on TCP/IP port");
3913- sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port);
3914- unireg_abort(1);
3915- }
3916- if (mysql_socket_listen(ip_sock, (int)back_log) < 0)
3917- {
3918- sql_perror("Can't start server: listen() on TCP/IP port");
3919- sql_print_error("listen() on TCP/IP failed with error %d",
3920- socket_errno);
3921- unireg_abort(1);
3922- }
3923+ if (mysqld_port)
3924+ base_ip_sock= activate_tcp_port(mysqld_port);
3925+ if (mysqld_extra_port)
3926+ extra_ip_sock= activate_tcp_port(mysqld_extra_port);
3927 }
3928
3929 #ifdef _WIN32
3930@@ -2506,7 +2524,7 @@
3931 if (thd && ! thd->bootstrap)
3932 {
3933 statistic_increment(killed_threads, &LOCK_status);
3934- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd,0)); /* purecov: inspected */
3935+ MYSQL_CALLBACK(thd->scheduler, end_thread, (thd,0)); /* purecov: inspected */
3936 }
3937 }
3938
3939@@ -2529,12 +2547,13 @@
3940
3941 SYNOPSIS
3942 dec_connection_count()
3943+ thd Thread handler
3944 */
3945
3946-void dec_connection_count()
3947+void dec_connection_count(THD *thd)
3948 {
3949 mysql_mutex_lock(&LOCK_connection_count);
3950- --connection_count;
3951+ (*thd->scheduler->connection_count)--;
3952 mysql_mutex_unlock(&LOCK_connection_count);
3953 }
3954
3955@@ -2650,7 +2669,7 @@
3956 DBUG_PRINT("info", ("thd %p block_pthread %d", thd, (int) block_pthread));
3957
3958 thd->release_resources();
3959- dec_connection_count();
3960+ dec_connection_count(thd);
3961
3962 mysql_mutex_lock(&LOCK_thread_count);
3963 /*
3964@@ -3021,7 +3040,7 @@
3965 This should actually be '+ max_number_of_slaves' instead of +10,
3966 but the +10 should be quite safe.
3967 */
3968- init_thr_alarm(thread_scheduler->max_threads +
3969+ init_thr_alarm(thread_scheduler->max_threads + extra_max_connections +
3970 global_system_variables.max_insert_delayed_threads + 10);
3971 if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT))
3972 {
3973@@ -3825,7 +3844,8 @@
3974 uint files, wanted_files, max_open_files;
3975
3976 /* MyISAM requires two file handles per table. */
3977- wanted_files= 10 + max_connections + table_cache_size * 2;
3978+ wanted_files= (10 + max_connections + extra_max_connections +
3979+ table_cache_size*2);
3980 /*
3981 We are trying to allocate no less than max_connections*5 file
3982 handles (i.e. we are trying to set the limit so that they will
3983@@ -3837,8 +3857,9 @@
3984 requested (value of wanted_files).
3985 Try to allocate no less than 5000 by default.
3986 */
3987- max_open_files= max(max<ulong>(wanted_files, max_connections * 5),
3988- open_files_limit ? open_files_limit : 5000);
3989+ max_open_files= max<uint>(max<uint>(wanted_files,
3990+ (max_connections + extra_max_connections)*5),
3991+ open_files_limit);
3992
3993 files= my_set_max_open_files(max_open_files);
3994
3995@@ -5981,7 +6002,8 @@
3996
3997 mysql_mutex_lock(&LOCK_connection_count);
3998
3999- if (connection_count >= max_connections + 1 || abort_loop)
4000+ if (*thd->scheduler->connection_count >=
4001+ *thd->scheduler->max_connections + 1 || abort_loop)
4002 {
4003 mysql_mutex_unlock(&LOCK_connection_count);
4004
4005@@ -6004,10 +6026,10 @@
4006 DBUG_VOID_RETURN;
4007 }
4008
4009- ++connection_count;
4010+ ++*thd->scheduler->connection_count;
4011
4012- if (connection_count > max_used_connections)
4013- max_used_connections= connection_count;
4014+ if (connection_count + extra_connection_count > max_used_connections)
4015+ max_used_connections= connection_count + extra_connection_count;
4016
4017 mysql_mutex_unlock(&LOCK_connection_count);
4018
4019@@ -6022,7 +6044,7 @@
4020 */
4021 thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
4022
4023- MYSQL_CALLBACK(thread_scheduler, add_connection, (thd));
4024+ MYSQL_CALLBACK(thd->scheduler, add_connection, (thd));
4025
4026 DBUG_VOID_RETURN;
4027 }
4028@@ -6034,10 +6056,12 @@
4029 {
4030 /* hack to get around signals ignored in syscalls for problem OS's */
4031 if (mysql_get_fd(unix_sock) == INVALID_SOCKET ||
4032- (!opt_disable_networking && mysql_socket_getfd(ip_sock) == INVALID_SOCKET))
4033+ (!opt_disable_networking &&
4034+ mysql_socket_getfd(base_ip_sock) == INVALID_SOCKET))
4035 {
4036 select_thread_in_use = 0;
4037 /* The following call will never return */
4038+ DBUG_PRINT("general", ("killing server because socket is closed"));
4039 kill_server((void*) MYSQL_KILL_SIGNAL);
4040 }
4041 }
4042@@ -6057,51 +6081,53 @@
4043 uint error_count=0;
4044 THD *thd;
4045 struct sockaddr_storage cAddr;
4046- int ip_flags=0,socket_flags=0,flags=0,retval;
4047+ int ip_flags __attribute__((unused))=0;
4048+ int socket_flags __attribute__((unused))= 0;
4049+ int extra_ip_flags __attribute__((unused))=0;
4050+ int flags=0,retval;
4051 st_vio *vio_tmp;
4052 #ifdef HAVE_POLL
4053 int socket_count= 0;
4054- struct pollfd fds[2]; // for ip_sock and unix_sock
4055- MYSQL_SOCKET pfs_fds[2]; // for performance schema
4056+ struct pollfd fds[3]; // for ip_sock, unix_sock and extra_sock
4057+ MYSQL_SOCKET pfs_fds[3]; // for performance schema
4058+#define setup_fds(X) \
4059+ fds[socket_count].fd= mysql_socket_getfd(X); \
4060+ fds[socket_count].events= POLLIN; \
4061+ pfs_fds[socket_count]= X; \
4062+ socket_count++
4063 #else
4064 fd_set readFDs,clientFDs;
4065- uint max_used_connection= max<uint>(mysql_socket_getfd(ip_sock), mysql_socket_getfd(unix_sock)) + 1;
4066+ uint max_used_connection= max<uint>(mysql_socket_getfd(base_ip_sock),
4067+ mysql_socket_getfd(unix_sock),
4068+ mysql_socket_getfd(extra_ip_sock)) + 1;
4069+#define setup_fds(X) FD_SET(X,&clientFDs)
4070 #endif
4071
4072 DBUG_ENTER("handle_connections_sockets");
4073
4074- (void) ip_flags;
4075- (void) socket_flags;
4076-
4077 #ifndef HAVE_POLL
4078 FD_ZERO(&clientFDs);
4079 #endif
4080
4081- if (mysql_socket_getfd(ip_sock) != INVALID_SOCKET)
4082+ if (mysql_socket_getfd(base_ip_sock) != INVALID_SOCKET)
4083 {
4084- mysql_socket_set_thread_owner(ip_sock);
4085-#ifdef HAVE_POLL
4086- fds[socket_count].fd= mysql_socket_getfd(ip_sock);
4087- fds[socket_count].events= POLLIN;
4088- pfs_fds[socket_count]= ip_sock;
4089- socket_count++;
4090-#else
4091- FD_SET(mysql_socket_getfd(ip_sock), &clientFDs);
4092+ mysql_socket_set_thread_owner(base_ip_sock);
4093+ setup_fds(base_ip_sock);
4094+#ifdef HAVE_FCNTL
4095+ ip_flags = fcntl(mysql_socket_getfd(base_ip_sock), F_GETFL, 0);
4096 #endif
4097+ }
4098+ if (mysql_socket_getfd(extra_ip_sock) != INVALID_SOCKET)
4099+ {
4100+ mysql_socket_set_thread_owner(extra_ip_sock);
4101+ setup_fds(extra_ip_sock);
4102 #ifdef HAVE_FCNTL
4103- ip_flags = fcntl(mysql_socket_getfd(ip_sock), F_GETFL, 0);
4104+ extra_ip_flags = fcntl(mysql_socket_getfd(extra_ip_sock), F_GETFL, 0);
4105 #endif
4106 }
4107 #ifdef HAVE_SYS_UN_H
4108 mysql_socket_set_thread_owner(unix_sock);
4109-#ifdef HAVE_POLL
4110- fds[socket_count].fd= mysql_socket_getfd(unix_sock);
4111- fds[socket_count].events= POLLIN;
4112- pfs_fds[socket_count]= unix_sock;
4113- socket_count++;
4114-#else
4115- FD_SET(mysql_socket_getfd(unix_sock), &clientFDs);
4116-#endif
4117+ setup_fds(unix_sock);
4118 #ifdef HAVE_FCNTL
4119 socket_flags=fcntl(mysql_socket_getfd(unix_sock), F_GETFL, 0);
4120 #endif
4121@@ -6166,10 +6192,15 @@
4122 }
4123 else
4124 #endif // HAVE_SYS_UN_H
4125- {
4126- sock = ip_sock;
4127- flags= ip_flags;
4128- }
4129+ if (FD_ISSET(mysql_socket_getfd(base_ip_sock), &readFDs)) {
4130+ sock = base_ip_sock;
4131+ flags= ip_flags;
4132+ }
4133+ else
4134+ if (FD_ISSET(mysql_socket_getfd(extra_ip_sock), &readFDs)) {
4135+ sock = extra_ip_sock;
4136+ flags= extra_ip_flagss;
4137+ }
4138 #endif // HAVE_POLL
4139
4140 #if !defined(NO_FCNTL_NONBLOCK)
4141@@ -6300,9 +6331,15 @@
4142 if (mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock))
4143 thd->security_ctx->host=(char*) my_localhost;
4144
4145+ if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
4146+ {
4147+ thd->extra_port= 1;
4148+ thd->scheduler= extra_thread_scheduler;
4149+ }
4150 create_new_thread(thd);
4151 }
4152 DBUG_VOID_RETURN;
4153+#undef setup_fds
4154 }
4155
4156
4157@@ -7643,6 +7680,15 @@
4158
4159 #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
4160
4161+#ifdef HAVE_POOL_OF_THREADS
4162+int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff)
4163+{
4164+ var->type= SHOW_INT;
4165+ var->value= buff;
4166+ *(int *)buff= tp_get_idle_thread_count();
4167+ return 0;
4168+}
4169+#endif
4170
4171 /*
4172 Variables shown by SHOW STATUS in alphabetical order
4173@@ -7788,6 +7834,10 @@
4174 {"Tc_log_page_size", (char*) &tc_log_page_size, SHOW_LONG},
4175 {"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG},
4176 #endif
4177+#ifdef HAVE_POOL_OF_THREADS
4178+ {"Threadpool_idle_threads", (char *) &show_threadpool_idle_threads, SHOW_FUNC},
4179+ {"Threadpool_threads", (char *) &tp_stats.num_worker_threads, SHOW_INT},
4180+#endif
4181 {"Threads_cached", (char*) &blocked_pthread_count, SHOW_LONG_NOFLUSH},
4182 {"Threads_connected", (char*) &connection_count, SHOW_INT},
4183 {"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
4184@@ -7986,7 +8036,7 @@
4185
4186 opt_specialflag= SPECIAL_ENGLISH;
4187 unix_sock= MYSQL_INVALID_SOCKET;
4188- ip_sock= MYSQL_INVALID_SOCKET;
4189+ base_ip_sock= extra_ip_sock= MYSQL_INVALID_SOCKET;
4190 mysql_home_ptr= mysql_home;
4191 pidfile_name_ptr= pidfile_name;
4192 log_error_file_ptr= log_error_file;
4193@@ -8700,12 +8750,29 @@
4194 return 1;
4195
4196 #ifdef EMBEDDED_LIBRARY
4197- one_thread_scheduler();
4198+ one_thread_scheduler(thread_scheduler);
4199+ one_thread_scheduler(extra_thread_scheduler);
4200 #else
4201+
4202+#ifdef _WIN32
4203+ /* workaround: disable thread pool on XP */
4204+ if (GetProcAddress(GetModuleHandle("kernel32"),"CreateThreadpool") == 0 &&
4205+ thread_handling > SCHEDULER_NO_THREADS)
4206+ thread_handling = SCHEDULER_ONE_THREAD_PER_CONNECTION;
4207+#endif
4208+
4209 if (thread_handling <= SCHEDULER_ONE_THREAD_PER_CONNECTION)
4210- one_thread_per_connection_scheduler();
4211- else /* thread_handling == SCHEDULER_NO_THREADS) */
4212- one_thread_scheduler();
4213+ one_thread_per_connection_scheduler(thread_scheduler, &max_connections,
4214+ &connection_count);
4215+ else if (thread_handling == SCHEDULER_NO_THREADS)
4216+ one_thread_scheduler(thread_scheduler);
4217+ else
4218+ pool_of_threads_scheduler(thread_scheduler, &max_connections,
4219+ &connection_count);
4220+
4221+ one_thread_per_connection_scheduler(extra_thread_scheduler,
4222+ &extra_max_connections,
4223+ &extra_connection_count);
4224 #endif
4225
4226 global_system_variables.engine_condition_pushdown=
4227
4228=== modified file 'Percona-Server/sql/mysqld.h'
4229--- Percona-Server/sql/mysqld.h 2012-12-04 08:24:59 +0000
4230+++ Percona-Server/sql/mysqld.h 2013-02-01 18:07:28 +0000
4231@@ -73,7 +73,7 @@
4232 void kill_blocked_pthreads();
4233 void refresh_status(THD *thd);
4234 bool is_secure_file_path(char *path);
4235-void dec_connection_count();
4236+void dec_connection_count(THD *thd);
4237
4238 // These are needed for unit testing.
4239 void set_remaining_args(int argc, char **argv);
4240@@ -197,6 +197,9 @@
4241 extern ulong opt_mts_slave_parallel_workers;
4242 extern ulonglong opt_mts_pending_jobs_size_max;
4243 extern uint max_user_connections;
4244+extern ulong extra_max_connections;
4245+extern ulong thread_created;
4246+extern scheduler_functions *thread_scheduler, *extra_thread_scheduler;
4247 extern my_bool log_bin_use_v1_row_events;
4248 extern ulong what_to_log,flush_time;
4249 extern ulong max_prepared_stmt_count, prepared_stmt_count;
4250@@ -281,6 +284,8 @@
4251 extern ulong connection_errors_peer_addr;
4252 extern ulong log_warnings;
4253
4254+extern uint mysqld_extra_port;
4255+
4256 /*
4257 THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
4258 using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
4259
4260=== modified file 'Percona-Server/sql/net_serv.cc'
4261--- Percona-Server/sql/net_serv.cc 2012-08-22 01:40:20 +0000
4262+++ Percona-Server/sql/net_serv.cc 2013-02-01 18:07:28 +0000
4263@@ -1024,6 +1024,8 @@
4264 {
4265 DBUG_ENTER("my_net_set_read_timeout");
4266 DBUG_PRINT("enter", ("timeout: %d", timeout));
4267+ if (net->read_timeout == timeout)
4268+ DBUG_VOID_RETURN;
4269 net->read_timeout= timeout;
4270 if (net->vio)
4271 vio_timeout(net->vio, 0, timeout);
4272@@ -1035,6 +1037,8 @@
4273 {
4274 DBUG_ENTER("my_net_set_write_timeout");
4275 DBUG_PRINT("enter", ("timeout: %d", timeout));
4276+ if (net->write_timeout == timeout)
4277+ DBUG_VOID_RETURN;
4278 net->write_timeout= timeout;
4279 if (net->vio)
4280 vio_timeout(net->vio, 1, timeout);
4281
4282=== modified file 'Percona-Server/sql/scheduler.cc'
4283--- Percona-Server/sql/scheduler.cc 2012-08-22 01:40:20 +0000
4284+++ Percona-Server/sql/scheduler.cc 2013-02-01 18:07:28 +0000
4285@@ -33,7 +33,7 @@
4286 static bool no_threads_end(THD *thd, bool put_in_cache)
4287 {
4288 thd_release_resources(thd);
4289- dec_connection_count();
4290+ dec_connection_count(thd);
4291
4292 // THD is an incomplete type here, so use destroy_thd() to delete it.
4293 mysql_mutex_lock(&LOCK_thread_count);
4294@@ -44,40 +44,9 @@
4295 return 1; // Abort handle_one_connection
4296 }
4297
4298-static scheduler_functions one_thread_scheduler_functions=
4299-{
4300- 1, // max_threads
4301- NULL, // init
4302- init_new_connection_handler_thread, // init_new_connection_thread
4303-#ifndef EMBEDDED_LIBRARY
4304- handle_connection_in_main_thread, // add_connection
4305-#else
4306- NULL, // add_connection
4307-#endif // EMBEDDED_LIBRARY
4308- NULL, // thd_wait_begin
4309- NULL, // thd_wait_end
4310- NULL, // post_kill_notification
4311- no_threads_end, // end_thread
4312- NULL, // end
4313-};
4314-
4315-#ifndef EMBEDDED_LIBRARY
4316-static scheduler_functions one_thread_per_connection_scheduler_functions=
4317-{
4318- 0, // max_threads
4319- NULL, // init
4320- init_new_connection_handler_thread, // init_new_connection_thread
4321- create_thread_to_handle_connection, // add_connection
4322- NULL, // thd_wait_begin
4323- NULL, // thd_wait_end
4324- NULL, // post_kill_notification
4325- one_thread_per_connection_end, // end_thread
4326- NULL, // end
4327-};
4328-#endif // EMBEDDED_LIBRARY
4329-
4330-
4331-scheduler_functions *thread_scheduler= NULL;
4332+static scheduler_functions thread_scheduler_struct, extra_thread_scheduler_struct;
4333+scheduler_functions *thread_scheduler= &thread_scheduler_struct,
4334+ *extra_thread_scheduler= &extra_thread_scheduler_struct;
4335
4336 /** @internal
4337 Helper functions to allow mysys to call the thread scheduler when
4338@@ -88,21 +57,19 @@
4339 extern "C"
4340 {
4341 static void scheduler_wait_lock_begin(void) {
4342- MYSQL_CALLBACK(thread_scheduler,
4343- thd_wait_begin, (current_thd, THD_WAIT_TABLE_LOCK));
4344+ thd_wait_begin(NULL, THD_WAIT_TABLE_LOCK);
4345 }
4346
4347 static void scheduler_wait_lock_end(void) {
4348- MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (current_thd));
4349+ thd_wait_end(NULL);
4350 }
4351
4352 static void scheduler_wait_sync_begin(void) {
4353- MYSQL_CALLBACK(thread_scheduler,
4354- thd_wait_begin, (current_thd, THD_WAIT_TABLE_LOCK));
4355+ thd_wait_begin(NULL, THD_WAIT_SYNC);
4356 }
4357
4358 static void scheduler_wait_sync_end(void) {
4359- MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (current_thd));
4360+ thd_wait_end(NULL);
4361 }
4362 };
4363 /**@}*/
4364@@ -114,7 +81,7 @@
4365 one_thread_scheduler() or one_thread_per_connection_scheduler() in
4366 mysqld.cc, so this init function will always be called.
4367 */
4368-static void scheduler_init() {
4369+void scheduler_init() {
4370 thr_set_lock_wait_callback(scheduler_wait_lock_begin,
4371 scheduler_wait_lock_end);
4372 thr_set_sync_wait_callback(scheduler_wait_sync_begin,
4373@@ -126,11 +93,17 @@
4374 */
4375
4376 #ifndef EMBEDDED_LIBRARY
4377-void one_thread_per_connection_scheduler()
4378+void one_thread_per_connection_scheduler(scheduler_functions *func,
4379+ ulong *arg_max_connections,
4380+ uint *arg_connection_count)
4381 {
4382 scheduler_init();
4383- one_thread_per_connection_scheduler_functions.max_threads= max_connections;
4384- thread_scheduler= &one_thread_per_connection_scheduler_functions;
4385+ func->max_threads= *arg_max_connections + 1;
4386+ func->max_connections= arg_max_connections;
4387+ func->connection_count= arg_connection_count;
4388+ func->init_new_connection_thread= init_new_connection_handler_thread;
4389+ func->add_connection= create_thread_to_handle_connection;
4390+ func->end_thread= one_thread_per_connection_end;
4391 }
4392 #endif
4393
4394@@ -138,10 +111,17 @@
4395 Initailize scheduler for --thread-handling=no-threads
4396 */
4397
4398-void one_thread_scheduler()
4399+void one_thread_scheduler(scheduler_functions *func)
4400 {
4401 scheduler_init();
4402- thread_scheduler= &one_thread_scheduler_functions;
4403+ func->max_threads= 1;
4404+ func->max_connections= &max_connections;
4405+ func->connection_count= &connection_count;
4406+#ifndef EMBEDDED_LIBRARY
4407+ func->init_new_connection_thread= init_new_connection_handler_thread;
4408+ func->add_connection= handle_connection_in_main_thread;
4409+#endif
4410+ func->end_thread= no_threads_end;
4411 }
4412
4413
4414@@ -164,6 +144,14 @@
4415 {
4416 }
4417
4418+
4419+
4420+/*
4421+ no pluggable schedulers in mariadb.
4422+ when we'll want it, we'll do it properly
4423+*/
4424+#if 0
4425+
4426 static scheduler_functions *saved_thread_scheduler;
4427 static uint saved_thread_handling;
4428
4429@@ -197,6 +185,11 @@
4430 saved_thread_scheduler= 0;
4431 return 0;
4432 }
4433-
4434-
4435+#else
4436+extern "C" int my_thread_scheduler_set(scheduler_functions *scheduler)
4437+{ return 1; }
4438+
4439+extern "C" int my_thread_scheduler_reset()
4440+{ return 1; }
4441+#endif
4442
4443
4444=== modified file 'Percona-Server/sql/scheduler.h'
4445--- Percona-Server/sql/scheduler.h 2011-09-07 10:08:09 +0000
4446+++ Percona-Server/sql/scheduler.h 2013-02-01 18:07:28 +0000
4447@@ -26,7 +26,8 @@
4448
4449 struct scheduler_functions
4450 {
4451- uint max_threads;
4452+ uint max_threads, *connection_count;
4453+ ulong *max_connections;
4454 bool (*init)(void);
4455 bool (*init_new_connection_thread)(void);
4456 void (*add_connection)(THD *thd);
4457@@ -65,8 +66,11 @@
4458 SCHEDULER_TYPES_COUNT
4459 };
4460
4461-void one_thread_per_connection_scheduler();
4462-void one_thread_scheduler();
4463+void one_thread_per_connection_scheduler(scheduler_functions *func,
4464+ ulong *arg_max_connections, uint *arg_connection_count);
4465+void one_thread_scheduler(scheduler_functions *func);
4466+
4467+extern void scheduler_init();
4468
4469 /*
4470 To be used for pool-of-threads (implemeneted differently on various OSs)
4471@@ -92,11 +96,21 @@
4472 ~thd_scheduler();
4473 };
4474
4475+#if !defined(EMBEDDED_LIBRARY)
4476+#define HAVE_POOL_OF_THREADS 1
4477+void pool_of_threads_scheduler(scheduler_functions* func,
4478+ ulong *arg_max_connections,
4479+ uint *arg_connection_count);
4480+#else
4481+#define pool_of_threads_scheduler(A,B,C) \
4482+ one_thread_per_connection_scheduler(A, B, C)
4483+#endif
4484+
4485 void *thd_get_scheduler_data(THD *thd);
4486 void thd_set_scheduler_data(THD *thd, void *data);
4487 PSI_thread* thd_get_psi(THD *thd);
4488 void thd_set_psi(THD *thd, PSI_thread *psi);
4489
4490-extern scheduler_functions *thread_scheduler;
4491+extern scheduler_functions *thread_scheduler, *extra_thread_scheduler;
4492
4493 #endif
4494
4495=== modified file 'Percona-Server/sql/signal_handler.cc'
4496--- Percona-Server/sql/signal_handler.cc 2012-08-22 01:40:20 +0000
4497+++ Percona-Server/sql/signal_handler.cc 2013-02-01 18:07:28 +0000
4498@@ -112,7 +112,8 @@
4499 (ulong) max_used_connections);
4500
4501 my_safe_printf_stderr("max_threads=%u\n",
4502- (uint) thread_scheduler->max_threads);
4503+ (uint) thread_scheduler->max_threads +
4504+ (uint) extra_max_connections);
4505
4506 my_safe_printf_stderr("thread_count=%u\n", get_thread_count());
4507
4508@@ -122,11 +123,11 @@
4509 "key_buffer_size + "
4510 "(read_buffer_size + sort_buffer_size)*max_threads = "
4511 "%lu K bytes of memory\n",
4512- ((ulong) dflt_key_cache->key_cache_mem_size +
4513+ (ulong)(dflt_key_cache->key_cache_mem_size +
4514 (global_system_variables.read_buff_size +
4515 global_system_variables.sortbuff_size) *
4516- thread_scheduler->max_threads +
4517- max_connections * sizeof(THD)) / 1024);
4518+ (thread_scheduler->max_threads + extra_max_connections) +
4519+ (max_connections + extra_max_connections)* sizeof(THD)) / 1024);
4520
4521 my_safe_printf_stderr("%s",
4522 "Hope that's ok; if not, decrease some variables in the equation.\n\n");
4523
4524=== modified file 'Percona-Server/sql/sql_class.cc'
4525--- Percona-Server/sql/sql_class.cc 2012-12-04 08:24:59 +0000
4526+++ Percona-Server/sql/sql_class.cc 2013-02-01 18:07:28 +0000
4527@@ -217,7 +217,7 @@
4528 */
4529 void *thd_get_scheduler_data(THD *thd)
4530 {
4531- return thd->scheduler.data;
4532+ return thd->event_scheduler.data;
4533 }
4534
4535 /**
4536@@ -228,7 +228,7 @@
4537 */
4538 void thd_set_scheduler_data(THD *thd, void *data)
4539 {
4540- thd->scheduler.data= data;
4541+ thd->event_scheduler.data= data;
4542 }
4543
4544 /**
4545@@ -240,7 +240,7 @@
4546 */
4547 PSI_thread *thd_get_psi(THD *thd)
4548 {
4549- return thd->scheduler.m_psi;
4550+ return thd->event_scheduler.m_psi;
4551 }
4552
4553 /**
4554@@ -263,7 +263,7 @@
4555 */
4556 void thd_set_psi(THD *thd, PSI_thread *psi)
4557 {
4558- thd->scheduler.m_psi= psi;
4559+ thd->event_scheduler.m_psi= psi;
4560 }
4561
4562 /**
4563@@ -921,6 +921,11 @@
4564 init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
4565 stmt_arena= this;
4566 thread_stack= 0;
4567+ scheduler= thread_scheduler; // Will be fixed later
4568+ event_scheduler.data= 0;
4569+ event_scheduler.m_psi= 0;
4570+ skip_wait_timeout= false;
4571+ extra_port= 0;
4572 catalog= (char*)"std"; // the only catalog we have for now
4573 main_security_ctx.init();
4574 security_ctx= &main_security_ctx;
4575@@ -966,8 +971,8 @@
4576 #endif
4577 #ifndef EMBEDDED_LIBRARY
4578 mysql_audit_init_thd(this);
4579+#endif
4580 net.vio=0;
4581-#endif
4582 client_capabilities= 0; // minimalistic client
4583 ull=0;
4584 system_thread= NON_SYSTEM_THREAD;
4585@@ -1699,33 +1704,8 @@
4586 #ifdef SIGNAL_WITH_VIO_CLOSE
4587 if (this != current_thd)
4588 {
4589- /*
4590- Before sending a signal, let's close the socket of the thread
4591- that is being killed ("this", which is not the current thread).
4592- This is to make sure it does not block if the signal is lost.
4593- This needs to be done only on platforms where signals are not
4594- a reliable interruption mechanism.
4595-
4596- Note that the downside of this mechanism is that we could close
4597- the connection while "this" target thread is in the middle of
4598- sending a result to the application, thus violating the client-
4599- server protocol.
4600-
4601- On the other hand, without closing the socket we have a race
4602- condition. If "this" target thread passes the check of
4603- thd->killed, and then the current thread runs through
4604- THD::awake(), sets the 'killed' flag and completes the
4605- signaling, and then the target thread runs into read(), it will
4606- block on the socket. As a result of the discussions around
4607- Bug#37780, it has been decided that we accept the race
4608- condition. A second KILL awakes the target from read().
4609-
4610- If we are killing ourselves, we know that we are not blocked.
4611- We also know that we will check thd->killed before we go for
4612- reading the next statement.
4613- */
4614-
4615- close_active_vio();
4616+ if(active_vio)
4617+ vio_shutdown(active_vio, SHUT_RDWR);
4618 }
4619 #endif
4620
4621@@ -1734,7 +1714,7 @@
4622
4623 /* Send an event to the scheduler that a thread should be killed. */
4624 if (!slave_thread)
4625- MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (this));
4626+ MYSQL_CALLBACK(scheduler, post_kill_notification, (this));
4627 }
4628
4629 /* Broadcast a condition to kick the target if it is waiting on it. */
4630@@ -1886,7 +1866,7 @@
4631 */
4632 mysys_var->id= thread_id;
4633 real_id= pthread_self(); // For debugging
4634-
4635+ vio_set_thread_id(net.vio, real_id);
4636 /*
4637 We have to call thr_lock_info_init() again here as THD may have been
4638 created in another thread
4639@@ -4097,6 +4077,7 @@
4640 SYNOPSIS
4641 thd_wait_begin()
4642 thd Thread object
4643+ Can be NULL, in this case current THD is used.
4644 wait_type Type of wait
4645 1 -- short wait (e.g. for mutex)
4646 2 -- medium wait (e.g. for disk io)
4647@@ -4113,7 +4094,13 @@
4648 */
4649 extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type)
4650 {
4651- MYSQL_CALLBACK(thread_scheduler, thd_wait_begin, (thd, wait_type));
4652+ if (!thd)
4653+ {
4654+ thd= current_thd;
4655+ if (unlikely(!thd))
4656+ return;
4657+ }
4658+ MYSQL_CALLBACK(thd->scheduler, thd_wait_begin, (thd, wait_type));
4659 }
4660
4661 /**
4662@@ -4121,10 +4108,17 @@
4663 when they waking up from a sleep/stall.
4664
4665 @param thd Thread handle
4666+ Can be NULL, in this case current THD is used.
4667 */
4668 extern "C" void thd_wait_end(MYSQL_THD thd)
4669 {
4670- MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (thd));
4671+ if (!thd)
4672+ {
4673+ thd= current_thd;
4674+ if (unlikely(!thd))
4675+ return;
4676+ }
4677+ MYSQL_CALLBACK(thd->scheduler, thd_wait_end, (thd));
4678 }
4679 #else
4680 extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type)
4681
4682=== modified file 'Percona-Server/sql/sql_class.h'
4683--- Percona-Server/sql/sql_class.h 2012-12-04 08:24:59 +0000
4684+++ Percona-Server/sql/sql_class.h 2013-02-01 18:07:28 +0000
4685@@ -2011,6 +2011,7 @@
4686 NET net; // client connection descriptor
4687 /** Aditional network instrumentation for the server only. */
4688 NET_SERVER m_net_server_extension;
4689+ scheduler_functions *scheduler; // Scheduler for this connection
4690 Protocol *protocol; // Current protocol
4691 Protocol_text protocol_text; // Normal protocol
4692 Protocol_binary protocol_binary; // Binary protocol
4693@@ -2134,6 +2135,9 @@
4694 /* <> 0 if we are inside of trigger or stored function. */
4695 uint in_sub_stmt;
4696
4697+ /* Do not set socket timeouts for wait_timeout (used with threadpool) */
4698+ bool skip_wait_timeout;
4699+
4700 /* container for handler's private per-connection data */
4701 Ha_data ha_data[MAX_HA];
4702
4703@@ -2814,6 +2818,8 @@
4704
4705 /// @todo: slave_thread is completely redundant, we should use 'system_thread' instead /sven
4706 bool slave_thread, one_shot_set;
4707+ bool extra_port; /* If extra connection */
4708+
4709 bool no_errors;
4710 uchar password;
4711 /**
4712@@ -3003,6 +3009,7 @@
4713 {
4714 mysql_mutex_lock(&LOCK_thd_data);
4715 active_vio = vio;
4716+ vio_set_thread_id(vio, pthread_self());
4717 mysql_mutex_unlock(&LOCK_thd_data);
4718 }
4719 inline void clear_active_vio()
4720@@ -3655,7 +3662,7 @@
4721 *p_db_length= db_length;
4722 return FALSE;
4723 }
4724- thd_scheduler scheduler;
4725+ thd_scheduler event_scheduler;
4726
4727 public:
4728 inline Internal_error_handler *get_internal_handler()
4729@@ -5052,6 +5059,8 @@
4730 return thd->lex->current_select->add_group_to_list(thd, item, asc);
4731 }
4732
4733+extern pthread_attr_t *get_connection_attrib(void);
4734+
4735 #endif /* MYSQL_SERVER */
4736
4737 #endif /* SQL_CLASS_INCLUDED */
4738
4739=== modified file 'Percona-Server/sql/sql_client.cc'
4740--- Percona-Server/sql/sql_client.cc 2011-12-09 21:08:37 +0000
4741+++ Percona-Server/sql/sql_client.cc 2013-02-01 18:07:28 +0000
4742@@ -35,6 +35,7 @@
4743 #ifndef EMBEDDED_LIBRARY
4744 net->max_packet= (uint) global_system_variables.net_buffer_length;
4745
4746+ net->read_timeout= net->write_timeout= 0;
4747 my_net_set_read_timeout(net, (uint)global_system_variables.net_read_timeout);
4748 my_net_set_write_timeout(net,
4749 (uint)global_system_variables.net_write_timeout);
4750
4751=== modified file 'Percona-Server/sql/sql_connect.cc'
4752--- Percona-Server/sql/sql_connect.cc 2012-12-04 08:24:59 +0000
4753+++ Percona-Server/sql/sql_connect.cc 2013-02-01 18:07:28 +0000
4754@@ -695,9 +695,10 @@
4755 {
4756 close_connection(thd, ER_OUT_OF_RESOURCES);
4757 statistic_increment(aborted_connects,&LOCK_status);
4758- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
4759+ MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 0));
4760 return 1; // Error
4761 }
4762+
4763 return 0;
4764 }
4765
4766@@ -918,11 +919,11 @@
4767
4768 thd->thr_create_utime= my_micro_time();
4769
4770- if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0))
4771+ if (MYSQL_CALLBACK_ELSE(thd->scheduler, init_new_connection_thread, (), 0))
4772 {
4773 close_connection(thd, ER_OUT_OF_RESOURCES);
4774 statistic_increment(aborted_connects,&LOCK_status);
4775- MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0));
4776+ MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 0));
4777 return;
4778 }
4779
4780@@ -973,7 +974,7 @@
4781
4782 end_thread:
4783 close_connection(thd);
4784- if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0))
4785+ if (MYSQL_CALLBACK_ELSE(thd->scheduler, end_thread, (thd, 1), 0))
4786 return; // Probably no-threads
4787
4788 /*
4789
4790=== modified file 'Percona-Server/sql/sql_parse.cc'
4791--- Percona-Server/sql/sql_parse.cc 2012-12-04 08:24:59 +0000
4792+++ Percona-Server/sql/sql_parse.cc 2013-02-01 18:07:28 +0000
4793@@ -928,7 +928,8 @@
4794 the client, the connection is closed or "net_wait_timeout"
4795 number of seconds has passed.
4796 */
4797- my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
4798+ if(!thd->skip_wait_timeout)
4799+ my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
4800
4801 /*
4802 XXX: this code is here only to clear possible errors of init_connect.
4803
4804=== modified file 'Percona-Server/sql/sys_vars.cc'
4805--- Percona-Server/sql/sys_vars.cc 2012-12-04 08:24:59 +0000
4806+++ Percona-Server/sql/sys_vars.cc 2013-02-01 18:07:28 +0000
4807@@ -61,6 +61,7 @@
4808 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
4809 #include "../storage/perfschema/pfs_server.h"
4810 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
4811+#include "threadpool.h"
4812
4813 TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 };
4814
4815@@ -613,6 +614,7 @@
4816 VALID_RANGE(0, 100000), DEFAULT(0), BLOCK_SIZE(1),
4817 NO_MUTEX_GUARD, NOT_IN_BINLOG);
4818
4819+
4820 static bool check_has_super(sys_var *self, THD *thd, set_var *var)
4821 {
4822 DBUG_ASSERT(self->scope() != sys_var::GLOBAL);// don't abuse check_has_super()
4823@@ -1720,6 +1722,19 @@
4824 VALID_RANGE(1, ULONG_MAX), DEFAULT(100),
4825 BLOCK_SIZE(1));
4826
4827+static Sys_var_uint Sys_extra_port(
4828+ "extra_port",
4829+ "Extra port number to use for tcp connections in a "
4830+ "one-thread-per-connection manner. 0 means don't use another port",
4831+ READ_ONLY GLOBAL_VAR(mysqld_extra_port), CMD_LINE(REQUIRED_ARG),
4832+ VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
4833+
4834+static Sys_var_ulong Sys_extra_max_connections(
4835+ "extra_max_connections", "The number of connections on extra-port",
4836+ GLOBAL_VAR(extra_max_connections), CMD_LINE(REQUIRED_ARG),
4837+ VALID_RANGE(1, 100000), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD,
4838+ NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections));
4839+
4840 static bool check_max_delayed_threads(sys_var *self, THD *thd, set_var *var)
4841 {
4842 return var->type != OPT_GLOBAL &&
4843@@ -2423,15 +2438,31 @@
4844
4845 static const char *thread_handling_names[]=
4846 {
4847- "one-thread-per-connection", "no-threads", "loaded-dynamically",
4848+ "one-thread-per-connection", "no-threads",
4849+#ifdef HAVE_POOL_OF_THREADS
4850+ "pool-of-threads",
4851+#endif
4852 0
4853 };
4854+
4855+#if defined (_WIN32) && defined (HAVE_POOL_OF_THREADS)
4856+/* Windows is using OS threadpool, so we're pretty sure it works well */
4857+#define DEFAULT_THREAD_HANDLING 2
4858+#else
4859+#define DEFAULT_THREAD_HANDLING 0
4860+#endif
4861+
4862 static Sys_var_enum Sys_thread_handling(
4863 "thread_handling",
4864 "Define threads usage for handling queries, one of "
4865- "one-thread-per-connection, no-threads, loaded-dynamically"
4866+ "one-thread-per-connection, no-threads"
4867+#ifdef HAVE_POOL_OF_THREADS
4868+ ", pool-of-threads"
4869+#endif
4870 , READ_ONLY GLOBAL_VAR(thread_handling), CMD_LINE(REQUIRED_ARG),
4871- thread_handling_names, DEFAULT(0));
4872+ thread_handling_names,
4873+ DEFAULT(DEFAULT_THREAD_HANDLING)
4874+ );
4875
4876 #ifdef HAVE_QUERY_CACHE
4877 static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
4878@@ -2916,6 +2947,96 @@
4879 CMD_LINE(REQUIRED_ARG, OPT_THREAD_CACHE_SIZE),
4880 VALID_RANGE(0, 16384), DEFAULT(0), BLOCK_SIZE(1));
4881
4882+
4883+static bool fix_tp_max_threads(sys_var *, THD *, enum_var_type)
4884+{
4885+#ifdef _WIN32
4886+ tp_set_max_threads(threadpool_max_threads);
4887+#endif
4888+ return false;
4889+}
4890+
4891+
4892+#ifdef _WIN32
4893+static bool fix_tp_min_threads(sys_var *, THD *, enum_var_type)
4894+{
4895+ tp_set_min_threads(threadpool_min_threads);
4896+ return false;
4897+}
4898+#endif
4899+
4900+
4901+#ifndef _WIN32
4902+static bool fix_threadpool_size(sys_var*, THD*, enum_var_type)
4903+{
4904+ tp_set_threadpool_size(threadpool_size);
4905+ return false;
4906+}
4907+
4908+
4909+static bool fix_threadpool_stall_limit(sys_var*, THD*, enum_var_type)
4910+{
4911+ tp_set_threadpool_stall_limit(threadpool_stall_limit);
4912+ return false;
4913+}
4914+#endif
4915+
4916+#ifdef HAVE_POOL_OF_THREADS
4917+#ifdef _WIN32
4918+static Sys_var_uint Sys_threadpool_min_threads(
4919+ "thread_pool_min_threads",
4920+ "Minimum number of threads in the thread pool.",
4921+ GLOBAL_VAR(threadpool_min_threads), CMD_LINE(REQUIRED_ARG),
4922+ VALID_RANGE(1, 256), DEFAULT(1), BLOCK_SIZE(1),
4923+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
4924+ ON_UPDATE(fix_tp_min_threads)
4925+ );
4926+#else
4927+static Sys_var_uint Sys_threadpool_idle_thread_timeout(
4928+ "thread_pool_idle_timeout",
4929+ "Timeout in seconds for an idle thread in the thread pool."
4930+ "Worker thread will be shut down after timeout",
4931+ GLOBAL_VAR(threadpool_idle_timeout), CMD_LINE(REQUIRED_ARG),
4932+ VALID_RANGE(1, UINT_MAX), DEFAULT(60), BLOCK_SIZE(1)
4933+);
4934+static Sys_var_uint Sys_threadpool_oversubscribe(
4935+ "thread_pool_oversubscribe",
4936+ "How many additional active worker threads in a group are allowed.",
4937+ GLOBAL_VAR(threadpool_oversubscribe), CMD_LINE(REQUIRED_ARG),
4938+ VALID_RANGE(1, 1000), DEFAULT(3), BLOCK_SIZE(1)
4939+);
4940+static Sys_var_uint Sys_threadpool_size(
4941+ "thread_pool_size",
4942+ "Number of thread groups in the pool. "
4943+ "This parameter is roughly equivalent to maximum number of concurrently "
4944+ "executing threads (threads in a waiting state do not count as executing).",
4945+ GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG),
4946+ VALID_RANGE(1, MAX_THREAD_GROUPS), DEFAULT(my_getncpus()), BLOCK_SIZE(1),
4947+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
4948+ ON_UPDATE(fix_threadpool_size)
4949+);
4950+static Sys_var_uint Sys_threadpool_stall_limit(
4951+ "thread_pool_stall_limit",
4952+ "Maximum query execution time in milliseconds,"
4953+ "before an executing non-yielding thread is considered stalled."
4954+ "If a worker thread is stalled, additional worker thread "
4955+ "may be created to handle remaining clients.",
4956+ GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG),
4957+ VALID_RANGE(10, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1),
4958+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
4959+ ON_UPDATE(fix_threadpool_stall_limit)
4960+);
4961+#endif /* !WIN32 */
4962+static Sys_var_uint Sys_threadpool_max_threads(
4963+ "thread_pool_max_threads",
4964+ "Maximum allowed number of worker threads in the thread pool",
4965+ GLOBAL_VAR(threadpool_max_threads), CMD_LINE(REQUIRED_ARG),
4966+ VALID_RANGE(1, 65536), DEFAULT(500), BLOCK_SIZE(1),
4967+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
4968+ ON_UPDATE(fix_tp_max_threads)
4969+);
4970+#endif /* HAVE_POOL_OF_THREADS */
4971+
4972 /**
4973 Can't change the 'next' tx_isolation if we are already in a
4974 transaction.
4975
4976=== added file 'Percona-Server/sql/threadpool.h'
4977--- Percona-Server/sql/threadpool.h 1970-01-01 00:00:00 +0000
4978+++ Percona-Server/sql/threadpool.h 2013-02-01 18:07:28 +0000
4979@@ -0,0 +1,69 @@
4980+/* Copyright (C) 2012 Monty Program Ab
4981+
4982+ This program is free software; you can redistribute it and/or modify
4983+ it under the terms of the GNU General Public License as published by
4984+ the Free Software Foundation; version 2 of the License.
4985+
4986+ This program is distributed in the hope that it will be useful,
4987+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4988+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4989+ GNU General Public License for more details.
4990+
4991+ You should have received a copy of the GNU General Public License
4992+ along with this program; if not, write to the Free Software
4993+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
4994+
4995+#define MAX_THREAD_GROUPS 128
4996+
4997+/* Threadpool parameters */
4998+extern uint threadpool_min_threads; /* Minimum threads in pool */
4999+extern uint threadpool_idle_timeout; /* Shutdown idle worker threads after this timeout */
5000+extern uint threadpool_size; /* Number of parallel executing threads */
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches