MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Petr Chardin Date:October 28 2005 10:29am
Subject:bk commit into 5.0 tree (petr:1.1944) BUG#14103
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cps. When cps 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
  1.1944 05/10/28 14:29:46 petr@stripped +4 -0
  fix Bug #14103 IM tests fail on SCO

  server-tools/instance-manager/priv.h
    1.7 05/10/28 14:29:37 petr@stripped +4 -0
    declare new function

  server-tools/instance-manager/priv.cc
    1.7 05/10/28 14:29:37 petr@stripped +35 -0
    Add a new function, which is a wrapper around pthread_create to increase the stack size

  server-tools/instance-manager/manager.cc
    1.30 05/10/28 14:29:37 petr@stripped +6 -6
    change stack size of listener and guardian threads

  server-tools/instance-manager/listener.cc
    1.23 05/10/28 14:29:36 petr@stripped +4 -3
    every new connection should have sufficient thread stack to
    handle all IM commands

# 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:	petr
# Host:	owlet.
# Root:	/home/cps/mysql/trees/mysql-5.0-virgin

--- 1.22/server-tools/instance-manager/listener.cc	2005-10-27 15:53:49 +04:00
+++ 1.23/server-tools/instance-manager/listener.cc	2005-10-28 14:29:36 +04:00
@@ -362,12 +362,13 @@
     pthread_attr_t mysql_thd_attr;
     pthread_attr_init(&mysql_thd_attr);
     pthread_attr_setdetachstate(&mysql_thd_attr, PTHREAD_CREATE_DETACHED);
-    if (pthread_create(&mysql_thd_id, &mysql_thd_attr, mysql_connection,
-                       mysql_thread_args))
+    if (set_stacksize_n_create_thread(&mysql_thd_id, &mysql_thd_attr,
+                                      mysql_connection, mysql_thread_args))
     {
       delete mysql_thread_args;
       vio_delete(vio);
-      log_error("handle_one_mysql_connection(): pthread_create(mysql) failed");
+      log_error("handle_one_mysql_connection():"
+                "set_stacksize_n_create_thread(mysql) failed");
     }
     pthread_attr_destroy(&mysql_thd_attr);
   }

--- 1.29/server-tools/instance-manager/manager.cc	2005-10-27 04:00:17 +04:00
+++ 1.30/server-tools/instance-manager/manager.cc	2005-10-28 14:29:37 +04:00
@@ -162,12 +162,12 @@
 
     pthread_attr_init(&listener_thd_attr);
     pthread_attr_setdetachstate(&listener_thd_attr, PTHREAD_CREATE_DETACHED);
-    rc= pthread_create(&listener_thd_id, &listener_thd_attr, listener,
-                       &listener_args);
+    rc= set_stacksize_n_create_thread(&listener_thd_id, &listener_thd_attr,
+                                      listener, &listener_args);
     pthread_attr_destroy(&listener_thd_attr);
     if (rc)
     {
-      log_error("manager(): pthread_create(listener) failed");
+      log_error("manager(): set_stacksize_n_create_thread(listener) failed");
       goto err;
     }
 
@@ -187,12 +187,12 @@
 
     pthread_attr_init(&guardian_thd_attr);
     pthread_attr_setdetachstate(&guardian_thd_attr, PTHREAD_CREATE_DETACHED);
-    rc= pthread_create(&guardian_thd_id, &guardian_thd_attr, guardian,
-                       &guardian_thread);
+    rc= set_stacksize_n_create_thread(&guardian_thd_id, &guardian_thd_attr,
+                                      guardian, &guardian_thread);
     pthread_attr_destroy(&guardian_thd_attr);
     if (rc)
     {
-      log_error("manager(): pthread_create(guardian) failed");
+      log_error("manager(): set_stacksize_n_create_thread(guardian) failed");
       goto err;
     }
 

--- 1.6/server-tools/instance-manager/priv.cc	2005-08-05 22:44:46 +04:00
+++ 1.7/server-tools/instance-manager/priv.cc	2005-10-28 14:29:37 +04:00
@@ -18,6 +18,17 @@
 #include "priv.h"
 #include "portability.h"
 
+#if defined(__ia64__) || defined(__ia64)
+/*
+  We can live with 32K, but reserve 64K. Just to be safe.
+  On ia64 we need to reserve double of the size.
+*/
+#define IM_THREAD_STACK_SIZE    (128*1024L)
+#else
+#define IM_THREAD_STACK_SIZE    (64*1024)
+#endif
+
+
 /* the pid of the manager process (of the signal thread on the LinuxThreads) */
 pid_t manager_pid;
 
@@ -52,3 +63,27 @@
 unsigned long bytes_sent = 0L, bytes_received = 0L;
 unsigned long mysqld_net_retry_count = 10L;
 unsigned long open_files_limit;
+
+/*
+  Change the stack size and start a thread. Return an error if either
+  pthread_attr_setstacksize or pthread_create fails.
+  Arguments are the same as for pthread_create().
+*/
+
+int set_stacksize_n_create_thread(pthread_t  *thread, pthread_attr_t *attr,
+                                  void *(*start_routine)(void *), void *arg)
+{
+  int rc;
+
+  /*
+    Set stack size to be safe on the platforms with too small
+    default thread stack.
+  */
+  rc= pthread_attr_setstacksize(attr,
+                                (size_t) (PTHREAD_STACK_MIN +
+                                          IM_THREAD_STACK_SIZE));
+
+  if (!rc)
+    rc= pthread_create(thread, attr, start_routine, arg);
+  return rc;
+}

--- 1.6/server-tools/instance-manager/priv.h	2005-08-05 22:44:46 +04:00
+++ 1.7/server-tools/instance-manager/priv.h	2005-10-28 14:29:37 +04:00
@@ -80,4 +80,8 @@
 extern unsigned long mysqld_net_retry_count;
 extern unsigned long open_files_limit;
 
+
+int set_stacksize_n_create_thread(pthread_t  *thread, pthread_attr_t *attr,
+                                  void *(*start_routine)(void *), void *arg);
+
 #endif // INCLUDES_MYSQL_INSTANCE_MANAGER_PRIV_H
Thread
bk commit into 5.0 tree (petr:1.1944) BUG#14103Petr Chardin28 Oct