Merge with trunk
This commit is contained in:
commit
806ec1b062
@ -76,7 +76,7 @@ enum {
|
|||||||
OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
|
OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
|
||||||
OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
|
OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
|
||||||
OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES,
|
OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES,
|
||||||
OPT_GLOBAL_SUBST
|
OPT_GLOBAL_SUBST, OPT_MY_CONNECT_TIMEOUT
|
||||||
};
|
};
|
||||||
|
|
||||||
static int record= 0, opt_sleep= -1;
|
static int record= 0, opt_sleep= -1;
|
||||||
@ -87,6 +87,7 @@ const char *opt_include= 0, *opt_charsets_dir;
|
|||||||
static int opt_port= 0;
|
static int opt_port= 0;
|
||||||
static int opt_max_connect_retries;
|
static int opt_max_connect_retries;
|
||||||
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
||||||
|
static int opt_connect_timeout= -1;
|
||||||
static my_bool debug_info_flag= 0, debug_check_flag= 0;
|
static my_bool debug_info_flag= 0, debug_check_flag= 0;
|
||||||
static my_bool tty_password= 0;
|
static my_bool tty_password= 0;
|
||||||
static my_bool opt_mark_progress= 0;
|
static my_bool opt_mark_progress= 0;
|
||||||
@ -4952,6 +4953,9 @@ void do_connect(struct st_command *command)
|
|||||||
if (opt_charsets_dir)
|
if (opt_charsets_dir)
|
||||||
mysql_options(&con_slot->mysql, MYSQL_SET_CHARSET_DIR,
|
mysql_options(&con_slot->mysql, MYSQL_SET_CHARSET_DIR,
|
||||||
opt_charsets_dir);
|
opt_charsets_dir);
|
||||||
|
if (opt_connect_timeout >= 0)
|
||||||
|
mysql_options(&con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
|
||||||
|
&opt_connect_timeout);
|
||||||
|
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
if (opt_use_ssl || con_ssl)
|
if (opt_use_ssl || con_ssl)
|
||||||
@ -5692,6 +5696,9 @@ static struct my_option my_long_options[] =
|
|||||||
#include "sslopt-longopts.h"
|
#include "sslopt-longopts.h"
|
||||||
{"test-file", 'x', "Read test from/in this file (default stdin).",
|
{"test-file", 'x', "Read test from/in this file (default stdin).",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"connect-timeout", OPT_MY_CONNECT_TIMEOUT, "Client connection timeout",
|
||||||
|
(uchar**) &opt_connect_timeout, (uchar**) &opt_connect_timeout, 0,
|
||||||
|
GET_INT, REQUIRED_ARG, -1, -1, 0, 0, 0, 0},
|
||||||
{"timer-file", 'm', "File where the timing in micro seconds is stored.",
|
{"timer-file", 'm', "File where the timing in micro seconds is stored.",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"tmpdir", 't', "Temporary directory where sockets are put.",
|
{"tmpdir", 't', "Temporary directory where sockets are put.",
|
||||||
|
@ -202,6 +202,7 @@ my @mysqld_rules=
|
|||||||
{ 'pid-file' => \&fix_pidfile },
|
{ 'pid-file' => \&fix_pidfile },
|
||||||
{ '#host' => \&fix_host },
|
{ '#host' => \&fix_host },
|
||||||
{ 'port' => \&fix_port },
|
{ 'port' => \&fix_port },
|
||||||
|
{ '#extra-port' => \&fix_port },
|
||||||
{ 'socket' => \&fix_socket },
|
{ 'socket' => \&fix_socket },
|
||||||
{ 'log-error' => \&fix_log_error },
|
{ 'log-error' => \&fix_log_error },
|
||||||
{ 'general-log' => sub { return 1; } },
|
{ 'general-log' => sub { return 1; } },
|
||||||
@ -353,7 +354,7 @@ sub post_check_client_group {
|
|||||||
sub post_check_client_groups {
|
sub post_check_client_groups {
|
||||||
my ($self, $config)= @_;
|
my ($self, $config)= @_;
|
||||||
|
|
||||||
my $first_mysqld= $config->first_like('mysqld.');
|
my $first_mysqld= $config->first_like('mysqld\.');
|
||||||
|
|
||||||
return unless $first_mysqld;
|
return unless $first_mysqld;
|
||||||
|
|
||||||
|
@ -215,6 +215,13 @@ SET GLOBAL event_scheduler = OFF;
|
|||||||
|
|
||||||
# -- End of Bug#35074.
|
# -- End of Bug#35074.
|
||||||
|
|
||||||
|
SELECT 'Connection on extra port ok';
|
||||||
|
Connection on extra port ok
|
||||||
|
Connection on extra port ok
|
||||||
|
SELECT 'Connection on extra port 2 ok';
|
||||||
|
Connection on extra port 2 ok
|
||||||
|
Connection on extra port 2 ok
|
||||||
|
# -- Success: more than --extra-max-connections + 1 normal connections not possible
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# -- End of 5.1 tests
|
# -- End of 5.1 tests
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
@ -2151,3 +2151,23 @@ Privat (Private Nutzung) Mobilfunk
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1052 Column 'kundentyp' in group statement is ambiguous
|
Warning 1052 Column 'kundentyp' in group statement is ambiguous
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
SELECT sleep(5);
|
||||||
|
SELECT sleep(5);
|
||||||
|
# -- Success: more than --thread-pool-size normal connections not possible
|
||||||
|
sleep(5)
|
||||||
|
0
|
||||||
|
sleep(5)
|
||||||
|
0
|
||||||
|
SELECT sleep(5);
|
||||||
|
SELECT sleep(5);
|
||||||
|
SELECT 'Connection on extra port ok';
|
||||||
|
Connection on extra port ok
|
||||||
|
Connection on extra port ok
|
||||||
|
SELECT 'Connection on extra port 2 ok';
|
||||||
|
Connection on extra port 2 ok
|
||||||
|
Connection on extra port 2 ok
|
||||||
|
# -- Success: more than --extra-max-connections + 1 normal connections not possible
|
||||||
|
sleep(5)
|
||||||
|
0
|
||||||
|
sleep(5)
|
||||||
|
0
|
||||||
|
8
mysql-test/t/connect.cnf
Normal file
8
mysql-test/t/connect.cnf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
!include include/default_my.cnf
|
||||||
|
|
||||||
|
[mysqld.1]
|
||||||
|
extra-port= @mysqld.1.#extra-port
|
||||||
|
extra-max-connections=1
|
||||||
|
|
||||||
|
[ENV]
|
||||||
|
MASTER_EXTRA_PORT= @mysqld.1.extra-port
|
@ -288,6 +288,33 @@ let $wait_condition =
|
|||||||
--echo # -- End of Bug#35074.
|
--echo # -- End of Bug#35074.
|
||||||
--echo
|
--echo
|
||||||
|
|
||||||
|
# Test connections to the extra port.
|
||||||
|
|
||||||
|
connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
|
||||||
|
connection extracon;
|
||||||
|
SELECT 'Connection on extra port ok';
|
||||||
|
|
||||||
|
connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
|
||||||
|
connection extracon2;
|
||||||
|
SELECT 'Connection on extra port 2 ok';
|
||||||
|
|
||||||
|
--disable_abort_on_error
|
||||||
|
--disable_result_log
|
||||||
|
--disable_query_log
|
||||||
|
connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
|
||||||
|
--enable_query_log
|
||||||
|
--enable_result_log
|
||||||
|
--enable_abort_on_error
|
||||||
|
let $error = $mysql_errno;
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
--echo # -- Error: managed to establish more than --extra-max-connections + 1 connections
|
||||||
|
}
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
--echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
|
||||||
|
}
|
||||||
|
|
||||||
--echo # ------------------------------------------------------------------
|
--echo # ------------------------------------------------------------------
|
||||||
--echo # -- End of 5.1 tests
|
--echo # -- End of 5.1 tests
|
||||||
--echo # ------------------------------------------------------------------
|
--echo # ------------------------------------------------------------------
|
||||||
|
@ -1 +0,0 @@
|
|||||||
--test-ignore-wrong-options --thread-handling=pool-of-threads
|
|
14
mysql-test/t/pool_of_threads.cnf
Normal file
14
mysql-test/t/pool_of_threads.cnf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
!include include/default_my.cnf
|
||||||
|
|
||||||
|
[mysqld.1]
|
||||||
|
test-ignore-wrong-options
|
||||||
|
thread-handling= pool-of-threads
|
||||||
|
thread_pool_size= 2
|
||||||
|
extra-port= @mysqld.1.#extra-port
|
||||||
|
extra-max-connections=1
|
||||||
|
|
||||||
|
[client]
|
||||||
|
connect-timeout= 2
|
||||||
|
|
||||||
|
[ENV]
|
||||||
|
MASTER_EXTRA_PORT= @mysqld.1.extra-port
|
@ -5,3 +5,78 @@
|
|||||||
|
|
||||||
-- source include/common-tests.inc
|
-- source include/common-tests.inc
|
||||||
|
|
||||||
|
|
||||||
|
# Test that we cannot have more simultaneous connections than
|
||||||
|
# --thread-pool-size on the standard port, but _can_ have additional
|
||||||
|
# connections on the extra port.
|
||||||
|
|
||||||
|
# First set two connections running, and check that extra connection
|
||||||
|
# on normal port fails due to--thread-pool-size=2
|
||||||
|
connection default;
|
||||||
|
send SELECT sleep(5);
|
||||||
|
|
||||||
|
connect(con2,localhost,root,,);
|
||||||
|
connection con2;
|
||||||
|
send SELECT sleep(5);
|
||||||
|
--sleep 1
|
||||||
|
|
||||||
|
--disable_abort_on_error
|
||||||
|
--disable_result_log
|
||||||
|
--disable_query_log
|
||||||
|
connect(con3,localhost,root,,);
|
||||||
|
--enable_query_log
|
||||||
|
--enable_result_log
|
||||||
|
--enable_abort_on_error
|
||||||
|
let $error = $mysql_errno;
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
--echo # -- Error: managed to establish more than --thread-pool-size connections
|
||||||
|
}
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
--echo # -- Success: more than --thread-pool-size normal connections not possible
|
||||||
|
}
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
--reap
|
||||||
|
connection con2;
|
||||||
|
--reap
|
||||||
|
|
||||||
|
# Now try again, but this time use the extra port to successfully connect.
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
send SELECT sleep(5);
|
||||||
|
|
||||||
|
connection con2;
|
||||||
|
send SELECT sleep(5);
|
||||||
|
--sleep 1
|
||||||
|
|
||||||
|
connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
|
||||||
|
connection extracon;
|
||||||
|
SELECT 'Connection on extra port ok';
|
||||||
|
|
||||||
|
connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
|
||||||
|
connection extracon2;
|
||||||
|
SELECT 'Connection on extra port 2 ok';
|
||||||
|
|
||||||
|
--disable_abort_on_error
|
||||||
|
--disable_result_log
|
||||||
|
--disable_query_log
|
||||||
|
connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
|
||||||
|
--enable_query_log
|
||||||
|
--enable_result_log
|
||||||
|
--enable_abort_on_error
|
||||||
|
let $error = $mysql_errno;
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
--echo # -- Error: managed to establish more than --extra-max-connections + 1 connections
|
||||||
|
}
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
--echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
|
||||||
|
}
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
--reap
|
||||||
|
connection con2;
|
||||||
|
--reap
|
||||||
|
Loading…
x
Reference in New Issue
Block a user