summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-10-16 19:14:39 +0400
committerAlexander Nozdrin <alik@sun.com>2009-10-16 19:14:39 +0400
commit4ebb631f3a1c03a111c20af22df28cf585585536 (patch)
tree3eae37c4a5b49ce9a976cbe835f0a07f029c0c88
parentadc8d5eea0fe790b43ddc892d26aefd084ae20d9 (diff)
downloadmariadb-git-4ebb631f3a1c03a111c20af22df28cf585585536.tar.gz
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.
-rw-r--r--client/mysqltest.cc19
1 files changed, 19 insertions, 0 deletions
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);