From 4ebb631f3a1c03a111c20af22df28cf585585536 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin <alik@sun.com> Date: Fri, 16 Oct 2009 19:14:39 +0400 Subject: [PATCH] Backporting patch for Bug#38992 from 6.0. Original revision: revno: 2617.55.2 committer: Alexander Nozdrin <alik@sun.com> branch nick: azalea-bf-bug38992 timestamp: Fri 2009-06-19 16:41:16 +0400 message: Fix for Bug#38992: Server crashes sporadically with 'waiting for initial ...' msg on windows. The problem is that connection timeout is too small for busy windows box. The fix is to - add support for connect_timeout command line argument to mysqltest; - set default value of the connect_timeout option to 120 seconds. --- client/mysqltest.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index b2e006396ce..4b336d246c6 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -112,6 +112,8 @@ static uint my_end_arg= 0; /* Number of lines of the result to include in failure report */ static uint opt_tail_lines= 0; +static uint opt_connect_timeout= 0; + static char delimiter[MAX_DELIMITER_LENGTH]= ";"; static uint delimiter_length= 1; @@ -5007,6 +5009,11 @@ void do_connect(struct st_command *command) #endif if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); + + if (opt_connect_timeout) + mysql_options(&con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); + if (opt_compress || con_compress) mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); @@ -5762,6 +5769,11 @@ static struct my_option my_long_options[] = {"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select", (uchar**) &view_protocol, (uchar**) &view_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect_timeout", OPT_CONNECT_TIMEOUT, + "Number of seconds before connection timeout.", + (uchar**) &opt_connect_timeout, + (uchar**) &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG, + 120, 0, 3600 * 12, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -6985,6 +6997,10 @@ int util_query(MYSQL* org_mysql, const char* query){ if (!(mysql= mysql_init(mysql))) die("Failed in mysql_init()"); + if (opt_connect_timeout) + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); + /* enable local infile, in non-binary builds often disabled by default */ mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0); safe_connect(mysql, "util", org_mysql->host, org_mysql->user, @@ -7644,6 +7660,9 @@ int main(int argc, char **argv) st_connection *con= connections; if (!( mysql_init(&con->mysql))) die("Failed in mysql_init()"); + if (opt_connect_timeout) + mysql_options(&con->mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); if (opt_compress) mysql_options(&con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); -- 2.30.9