MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:January 30 2007 10:00pm
Subject:bk commit into 5.0 tree (cmiller:1.2359) BUG#24826
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-30 17:00:14-05:00, cmiller@stripped +4 -0
  Bug#24826: Number of connections to reserved for SUPER users
  
  There are two sites that control the number of connections that we
  support.  The network level is willing to listen for N + 1 
  connections.  The access control level is willing to accept N 
  connections.  In this way, we can answer a connection, tell it
  "sorry" if it's a normal user and drop it.  In this way, we reserve
  space for one superuser connection at present.
  
  This patch increases the number of network connections we're willing
  to support, above the N normal users.

  sql/mysql_priv.h@stripped, 2007-01-30 17:00:08-05:00, cmiller@stripped +1 -0
    Add knowledge of a global variable to all server source files.

  sql/mysqld.cc@stripped, 2007-01-30 17:00:08-05:00, cmiller@stripped +10 -1
    Add a new global variable, reserved_connection.
    
    Add the reserved connections to the number of connections/threads 
    we're willing to create.

  sql/set_var.cc@stripped, 2007-01-30 17:00:09-05:00, cmiller@stripped +8 -2
    Hook the new global variable into the SQL layer, so it can be set.

  sql/set_var.h@stripped, 2007-01-30 17:00:09-05:00, cmiller@stripped +8 -0
    Add a class to handle the new variable.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/mysql-5.0-community--bug24826

--- 1.427/sql/mysql_priv.h	2007-01-30 17:00:21 -05:00
+++ 1.428/sql/mysql_priv.h	2007-01-30 17:00:21 -05:00
@@ -1229,6 +1229,7 @@ extern ulong query_cache_size, query_cac
 extern ulong slow_launch_threads, slow_launch_time;
 extern ulong table_cache_size;
 extern ulong max_connections,max_connect_errors, connect_timeout;
+extern ulong reserved_connections;
 extern ulong slave_net_timeout, slave_trans_retries;
 extern uint max_user_connections;
 extern ulong what_to_log,flush_time;

--- 1.584/sql/mysqld.cc	2007-01-30 17:00:22 -05:00
+++ 1.585/sql/mysqld.cc	2007-01-30 17:00:22 -05:00
@@ -422,6 +422,7 @@ ulong max_prepared_stmt_count;
   statements.
 */
 ulong prepared_stmt_count=0;
+ulong reserved_connections;
 ulong thread_id=1L,current_pid;
 ulong slow_launch_threads = 0, sync_binlog_period;
 ulong expire_logs_days = 0;
@@ -3888,7 +3889,9 @@ static void create_new_thread(THD *thd)
     net->return_errno=1;
 
   /* don't allow too many connections */
-  if (thread_count - delayed_insert_threads >= max_connections+1 || abort_loop)
+  if (thread_count - delayed_insert_threads >= 
+        (max_connections + reserved_connections)
+        || abort_loop)
   {
     DBUG_PRINT("error",("Too many connections"));
     close_connection(thd, ER_CON_COUNT_ERROR, 1);
@@ -4621,6 +4624,7 @@ enum options_mysqld
   OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER,
   OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT,
   OPT_RELAY_LOG_PURGE,
+  OPT_RESERVED_CONNECTIONS,
   OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
   OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING,
   OPT_SORT_BUFFER, OPT_TABLE_CACHE,
@@ -5947,6 +5951,11 @@ The minimum value for this variable is 4
    (gptr*) &relay_log_space_limit,
    (gptr*) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
    (longlong) ULONG_MAX, 0, 1, 0},
+  {"reserved_connections", OPT_RESERVED_CONNECTIONS,
+   "The number of connections to reserved for SUPER users.",
+   (gptr*) &reserved_connections,
+   (gptr*) &reserved_connections, 0, GET_ULONG, REQUIRED_ARG, 1, 1, 32, 0, 1,
+   0},
   {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
    "Use compression on master/slave protocol.",
    (gptr*) &opt_slave_compressed_protocol,

--- 1.175/sql/set_var.cc	2007-01-30 17:00:22 -05:00
+++ 1.176/sql/set_var.cc	2007-01-30 17:00:22 -05:00
@@ -322,6 +322,9 @@ sys_var_thd_ulong	sys_div_precincrement(
 sys_var_bool_ptr	sys_relay_log_purge("relay_log_purge",
                                             &relay_log_purge);
 #endif
+sys_var_long_ptr	sys_reserved_connections("reserved_connections",
+                                           &reserved_connections,
+                                           fix_max_connections);
 sys_var_long_ptr	sys_rpl_recovery_rank("rpl_recovery_rank",
 					      &rpl_recovery_rank);
 sys_var_long_ptr	sys_query_cache_size("query_cache_size",
@@ -716,6 +719,7 @@ sys_var *sys_variables[]=
 #ifdef HAVE_REPLICATION
   &sys_relay_log_purge,
 #endif
+  &sys_reserved_connections,
   &sys_rpl_recovery_rank,
   &sys_safe_updates,
   &sys_secure_auth,
@@ -1025,6 +1029,8 @@ struct show_var_st init_vars[]= {
   {sys_relay_log_purge.name,  (char*) &sys_relay_log_purge,         SHOW_SYS},
   {"relay_log_space_limit",  (char*) &relay_log_space_limit,        SHOW_LONGLONG},
 #endif
+  {sys_reserved_connections.name,  (char*) &sys_reserved_connections,
+   SHOW_SYS},
   {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank,       SHOW_SYS},
   {"secure_auth",             (char*) &sys_secure_auth,             SHOW_SYS},
 #ifdef HAVE_SMEM
@@ -1381,8 +1387,8 @@ static int check_max_delayed_threads(THD
 static void fix_max_connections(THD *thd, enum_var_type type)
 {
 #ifndef EMBEDDED_LIBRARY
-  resize_thr_alarm(max_connections +
-		   global_system_variables.max_insert_delayed_threads + 10);
+  resize_thr_alarm(10 + max_connections + reserved_connections +
+		   global_system_variables.max_insert_delayed_threads);
 #endif
 }
 

--- 1.80/sql/set_var.h	2007-01-30 17:00:22 -05:00
+++ 1.81/sql/set_var.h	2007-01-30 17:00:22 -05:00
@@ -832,6 +832,14 @@ public:
   virtual void set_default(THD *thd, enum_var_type type);
 };
 
+class sys_var_reserved_connections :public sys_var_long_ptr
+{
+public:
+  sys_var_reserved_connections(const char *name_arg, ulong *value_ptr)
+    :sys_var_long_ptr(name_arg, value_ptr) {}
+};
+
+
 /****************************************************************************
   Classes for parsing of the SET command
 ****************************************************************************/
Thread
bk commit into 5.0 tree (cmiller:1.2359) BUG#24826Chad MILLER30 Jan