MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:February 17 2010 12:39pm
Subject:bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2894) Bug#51135
View as plain text  
#At file:///home/bm136801/my/maxconn-51/ based on revid:bjorn.munch@stripped

 2894 Bjorn Munch	2010-02-17
      Bug #51135 Please increase the maximum number of connections allowed in mysqltest
      Added --max-connections= argument to mysqltest and mtr

    modified:
      client/mysqltest.cc
      mysql-test/mysql-test-run.pl
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-02-09 17:13:57 +0000
+++ b/client/mysqltest.cc	2010-02-17 12:38:35 +0000
@@ -67,6 +67,7 @@
 #define MAX_COLUMNS            256
 #define MAX_EMBEDDED_SERVER_ARGS 64
 #define MAX_DELIMITER_LENGTH 16
+#define DEFAULT_MAX_CONN       128
 
 /* Flags controlling send and reap */
 #define QUERY_SEND_FLAG  1
@@ -75,7 +76,8 @@
 enum {
   OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
   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_MAX_CONNECTIONS,
+  OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES
 };
 
 static int record= 0, opt_sleep= -1;
@@ -88,6 +90,7 @@ const char *opt_logdir= "";
 const char *opt_include= 0, *opt_charsets_dir;
 static int opt_port= 0;
 static int opt_max_connect_retries;
+static int opt_max_connections= DEFAULT_MAX_CONN;
 static my_bool opt_compress= 0, silent= 0, verbose= 0;
 static my_bool debug_info_flag= 0, debug_check_flag= 0;
 static my_bool tty_password= 0;
@@ -240,7 +243,8 @@ struct st_connection
   int query_done;
 #endif /*EMBEDDED_LIBRARY*/
 };
-struct st_connection connections[128];
+
+struct st_connection *connections= 0;
 struct st_connection* cur_con= NULL, *next_con, *connections_end;
 
 /*
@@ -1105,6 +1109,7 @@ void close_connections()
       mysql_close(next_con->util_mysql);
     my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
   }
+  my_free(connections, MYF(MY_WME));
   DBUG_VOID_RETURN;
 }
 
@@ -5121,7 +5126,7 @@ void do_connect(struct st_command *comma
   {
     if (!(con_slot= find_connection_by_name("-closed_connection-")))
       die("Connection limit exhausted, you can have max %d connections",
-          (int) (sizeof(connections)/sizeof(struct st_connection)));
+          opt_max_connections);
   }
 
 #ifdef EMBEDDED_LIBRARY
@@ -5870,6 +5875,10 @@ static struct my_option my_long_options[
    "Max number of connection attempts when connecting to server",
    (uchar**) &opt_max_connect_retries, (uchar**) &opt_max_connect_retries, 0,
    GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
+  {"max-connections", OPT_MAX_CONNECTIONS,
+   "Max number of open connections to server",
+   (uchar**) &opt_max_connections, (uchar**) &opt_max_connections, 0,
+   GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0},
   {"password", 'p', "Password to use when connecting to server.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
@@ -7741,12 +7750,6 @@ int main(int argc, char **argv)
   /* Init expected errors */
   memset(&saved_expected_errors, 0, sizeof(saved_expected_errors));
 
-  /* Init connections */
-  memset(connections, 0, sizeof(connections));
-  connections_end= connections +
-    (sizeof(connections)/sizeof(struct st_connection)) - 1;
-  next_con= connections + 1;
-
 #ifdef EMBEDDED_LIBRARY
   /* set appropriate stack for the 'query' threads */
   (void) pthread_attr_init(&cn_thd_attrib);
@@ -7808,6 +7811,13 @@ int main(int argc, char **argv)
     verbose_msg("Tracing progress in '%s'.", progress_file.file_name());
   }
 
+  /* Init connections, allocate 1 extra as buffer + 1 for default */
+  connections= (struct st_connection*)
+    my_malloc((opt_max_connections+2) * sizeof(struct st_connection),
+              MYF(MY_WME | MY_ZEROFILL));
+  connections_end= connections + opt_max_connections +1;
+  next_con= connections + 1;
+  
   var_set_int("$PS_PROTOCOL", ps_protocol);
   var_set_int("$SP_PROTOCOL", sp_protocol);
   var_set_int("$VIEW_PROTOCOL", view_protocol);

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-02-11 13:00:34 +0000
+++ b/mysql-test/mysql-test-run.pl	2010-02-17 12:38:35 +0000
@@ -203,6 +203,7 @@ my $opt_skip_core;
 
 our $opt_check_testcases= 1;
 my $opt_mark_progress;
+my $opt_max_connections;
 
 my $opt_sleep;
 
@@ -922,6 +923,7 @@ sub command_line_setup {
              'warnings!'                => \$opt_warnings,
 	     'timestamp'                => \&report_option,
 	     'timediff'                 => \&report_option,
+	     'max-connections=i'        => \$opt_max_connections,
 
              'help|h'                   => \$opt_usage,
 	       'list-options'             => \$opt_list_options,
@@ -4908,6 +4910,10 @@ sub start_mysqltest ($) {
     mtr_add_arg($args, "--ssl");
   }
 
+  if ( $opt_max_connections ) {
+    mtr_add_arg($args, "--max-connections=%d", $opt_max_connections);
+  }
+
   if ( $opt_embedded_server )
   {
 
@@ -5466,6 +5472,7 @@ Misc options
   timestamp             Print timestamp before each test report line
   timediff              With --timestamp, also print time passed since
                         *previous* test started
+  max-connections=N     Max number of open connection to server in mysqltest
 
 HERE
   exit(1);


Attachment: [text/bzr-bundle] bzr/bjorn.munch@sun.com-20100217123835-2743me7wvjizec2d.bundle
Thread
bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2894) Bug#51135Bjorn Munch17 Feb