List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:January 19 2005 7:23am
Subject:bk commit into 4.1 tree (joreland:1.2143)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jonas. When jonas 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.2143 05/01/19 07:23:20 joreland@stripped +4 -0
  bug#7693 - ndb 
    when using shm transporter, set sigmask on each thread using pthread_sigmask

  sql/ha_ndbcluster.cc
    1.122 05/01/19 07:23:17 joreland@stripped +2 -2
    cast pointer to UintPtr before printout

  ndb/src/common/transporter/TransporterRegistry.cpp
    1.23 05/01/19 07:23:17 joreland@stripped +14 -2
    (un)block SIGUSR1 #ifdef NDB_SHM_TRANSPORTER

  ndb/src/common/portlib/NdbThread.c
    1.16 05/01/19 07:23:17 joreland@stripped +20 -2
    1) Create thread wrapper function
    2) block SIGUSR1 #ifdef NDB_SHM_TRANSPORTER

  configure.in
    1.340 05/01/19 07:23:17 joreland@stripped +5 -2
    Add more functions needed for SHM

# 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:	joreland
# Host:	eel.ndb.mysql.com
# Root:	/home/jonas/src/mysql-4.1

--- 1.339/configure.in	Tue Jan 18 14:22:57 2005
+++ 1.340/configure.in	Wed Jan 19 07:23:17 2005
@@ -1924,7 +1924,7 @@
   pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
   pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
   realpath rename rint rwlock_init setupterm \
-  shmget shmat shmdt shmctl sigaction \
+  shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
   sighold sigset sigthreadmask \
   snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
   strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
@@ -3098,7 +3098,10 @@
    test "$ac_cv_func_shmat" = "yes" &&
    test "$ac_cv_func_shmdt" = "yes" &&
    test "$ac_cv_func_shmctl" = "yes" &&
-   test "$ac_cv_func_sigaction" = "yes"
+   test "$ac_cv_func_sigaction" = "yes" &&
+   test "$ac_cv_func_sigemptyset" = "yes" &&
+   test "$ac_cv_func_sigaddset" = "yes" &&
+   test "$ac_cv_func_pthread_sigmask" = "yes"
 then
    AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
              [Including Ndb Cluster DB shared memory transporter])

--- 1.15/ndb/src/common/portlib/NdbThread.c	Tue Jan 11 10:02:29 2005
+++ 1.16/ndb/src/common/portlib/NdbThread.c	Wed Jan 19 07:23:17 2005
@@ -28,8 +28,24 @@
 { 
   pthread_t thread;
   char thread_name[MAX_THREAD_NAME];
+  NDB_THREAD_FUNC * func;
+  void * object;
 };
 
+static
+void*
+ndb_thread_wrapper(void* _ss){
+  void * ret;
+  struct NdbThread * ss = (struct NdbThread *)_ss;
+#ifdef NDB_SHM_TRANSPORTER
+  sigset_t mask;
+  sigemptyset(&mask);
+  sigaddset(&mask, SIGUSR1);
+  pthread_sigmask(SIG_BLOCK, &mask, 0);
+#endif
+  ret= (* ss->func)(ss->object);
+  return ret;
+}
 
 
 struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
@@ -67,10 +83,12 @@
 #ifdef PTHREAD_CREATE_JOINABLE /* needed on SCO */
   pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
 #endif
+  tmpThread->func= p_thread_func;
+  tmpThread->object= p_thread_arg;
   result = pthread_create(&tmpThread->thread, 
 			  &thread_attr,
-  		          p_thread_func,
-  		          p_thread_arg);
+  		          ndb_thread_wrapper,
+  		          tmpThread);
   assert(result==0);
 
   pthread_attr_destroy(&thread_attr);

--- 1.22/ndb/src/common/transporter/TransporterRegistry.cpp	Fri Jan  7 11:46:59 2005
+++ 1.23/ndb/src/common/transporter/TransporterRegistry.cpp	Wed Jan 19 07:23:17 2005
@@ -153,8 +153,17 @@
   
   DEBUG("TransporterRegistry started node: " << localNodeId);
   
-  //  return allocateLongSignalMemoryPool(nLargeSegments);
-  return true;
+#ifdef NDB_SHM_TRANSPORTER
+  /**
+   * Make sure to block SIGUSR1
+   *   TransporterRegistry::init is run from "main" thread
+   */
+  sigset_t mask;
+  sigemptyset(&mask);
+  sigaddset(&mask, SIGUSR1);
+  pthread_sigmask(SIG_BLOCK, &mask, 0);
+#endif
+return true;
 }
 
 bool
@@ -1321,6 +1330,9 @@
 #ifdef NDB_SHM_TRANSPORTER
   m_shm_own_pid = getpid();
   struct sigaction sa;
+  sigemptyset(&sa.sa_mask);
+  sigaddset(&sa.sa_mask, SIGUSR1);
+  pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
   sa.sa_handler = shm_sig_handler;
   sigemptyset(&sa.sa_mask);
   sa.sa_flags = 0;

--- 1.121/sql/ha_ndbcluster.cc	Sat Jan  8 19:27:43 2005
+++ 1.122/sql/ha_ndbcluster.cc	Wed Jan 19 07:23:17 2005
@@ -583,7 +583,7 @@
           char *buf= m_blobs_buffer + offset;
           uint32 len= 0xffffffff;  // Max uint32
           DBUG_PRINT("value", ("read blob ptr=%x len=%u",
-                               (uint)buf, (uint)blob_len));
+                               (UintPtr)buf, (uint)blob_len));
           if (ndb_blob->readData(buf, len) != 0)
             DBUG_RETURN(-1);
           DBUG_ASSERT(len == blob_len);
@@ -3169,7 +3169,7 @@
     
     NdbConnection *tablock_trans= 
       (NdbConnection*)thd->transaction.all.ndb_tid;
-    DBUG_PRINT("info", ("tablock_trans: %x", (uint)tablock_trans));
+    DBUG_PRINT("info", ("tablock_trans: %x", (UintPtr)tablock_trans));
     DBUG_ASSERT(tablock_trans);
 //    trans= ndb->hupp(tablock_trans);
     trans= ndb->startTransaction();
Thread
bk commit into 4.1 tree (joreland:1.2143)jonas.oreland19 Jan