List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:November 6 2008 6:34pm
Subject:bzr commit into mysql-5.1 branch (msvensson:3052)
View as plain text  
#At file:///home/msvensson/mysql/6.4/

 3052 Magnus Svensson	2008-11-06 [merge]
      Merge
modified:
  storage/ndb/include/util/Bitmask.hpp
  storage/ndb/src/common/portlib/NdbThread.c
  storage/ndb/src/common/util/Bitmask.cpp
  storage/ndb/src/kernel/vm/Configuration.cpp
  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
  storage/ndb/src/ndbapi/Ndb.cpp

=== modified file 'storage/ndb/include/util/Bitmask.hpp'
--- a/storage/ndb/include/util/Bitmask.hpp	2008-04-04 17:36:54 +0000
+++ b/storage/ndb/include/util/Bitmask.hpp	2008-11-06 16:29:57 +0000
@@ -170,6 +170,16 @@ public:
    * getText - Return as hex-digits (only for debug routines).
    */
   static char* getText(unsigned size, const Uint32 data[], char* buf);
+
+  /**
+   * Parse string with numbers format
+   *   1,2,3-5
+   * @return -1 if unparsable chars found, 
+   *         -2 str has number > bitmask size
+   *            else returns number of bits set 
+   */
+  static int parseMask(unsigned size, Uint32 data[], const char * str);
+
 private:
   static void getFieldImpl(const Uint32 data[], unsigned, unsigned, Uint32 []);
   static void setFieldImpl(Uint32 data[], unsigned, unsigned, const Uint32 []);
@@ -601,6 +611,9 @@ public:
    */
   static char* getText(const Uint32 data[], char* buf);
   char* getText(char* buf) const;
+
+  static int parseMask(Uint32 data[], const char * src);
+  int parseMask(const char * src);
 };
 
 template <unsigned size>
@@ -917,6 +930,21 @@ BitmaskPOD<size>::overlaps(BitmaskPOD<si
 }
 
 template <unsigned size>
+int
+BitmaskPOD<size>::parseMask(Uint32 data[], const char* buf)
+{
+  return BitmaskImpl::parseMask(size, data, buf);
+}
+
+template <unsigned size>
+inline
+int
+BitmaskPOD<size>::parseMask(const char* buf)
+{
+  return BitmaskPOD<size>::parseMask(rep.data, buf);
+}
+
+template <unsigned size>
 class Bitmask : public BitmaskPOD<size> {
 public:
   Bitmask() { this->clear();}

=== modified file 'storage/ndb/src/common/portlib/NdbThread.c'
--- a/storage/ndb/src/common/portlib/NdbThread.c	2008-11-06 10:17:49 +0000
+++ b/storage/ndb/src/common/portlib/NdbThread.c	2008-11-06 15:00:44 +0000
@@ -118,6 +118,8 @@ ndb_thread_wrapper(void* _ss){
 #ifdef NDB_SHM_TRANSPORTER
     NdbThread_set_shm_sigmask(TRUE);
 #endif
+
+#ifdef HAVE_PTHREAD_SIGMASK
     {
       /**
        * Block all signals to thread by default
@@ -127,6 +129,7 @@ ndb_thread_wrapper(void* _ss){
       sigfillset(&mask);
       pthread_sigmask(SIG_BLOCK, &mask, 0);
     }      
+#endif
 
     {
       void *ret;

=== modified file 'storage/ndb/src/common/util/Bitmask.cpp'
--- a/storage/ndb/src/common/util/Bitmask.cpp	2008-01-23 14:04:43 +0000
+++ b/storage/ndb/src/common/util/Bitmask.cpp	2008-11-06 16:29:57 +0000
@@ -115,3 +115,62 @@ BitmaskImpl::setFieldImpl(Uint32 dst[],
  * storage/ndb/test/ndbapi/testBitfield.cpp
  * to get coverage from automated testing
  */
+
+int
+BitmaskImpl::parseMask(unsigned size, Uint32 data[], const char * src)
+{
+  int cnt = 0;
+  BaseString tmp(src);
+  Vector<BaseString> list;
+  tmp.split(list, ",");
+  for (unsigned i = 0; i<list.size(); i++)
+  {
+    list[i].trim();
+    if (list[i].empty())
+      continue;
+    unsigned num = 0;
+    char * delim = strchr(list[i].c_str(), '-');
+    unsigned first = 0;
+    unsigned last = 0;
+    if (delim == 0)
+    {
+      int res = sscanf(list[i].c_str(), "%u", &first);
+      if (res != 1)
+      {
+        return -1;
+      }
+      last = first;
+    }
+    else
+    {
+      * delim = 0;
+      delim++;
+      int res0 = sscanf(list[i].c_str(), "%u", &first);
+      if (res0 != 1)
+      {
+        return -1;
+      }
+      int res1 = sscanf(delim, "%u", &last);
+      if (res1 != 1)
+      {
+        return -1;
+      }
+      if (first > last)
+      {
+        unsigned tmp = first;
+        first = last;
+        last = tmp;
+      }
+    }
+    
+    for (unsigned j = first; j<(last+1); j++)
+    {
+      if (j >= (size << 5))
+        return -2;
+
+      cnt++;
+      BitmaskImpl::set(size, data, j);
+    }
+  }
+  return cnt;
+}

=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp	2008-11-06 10:17:49 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp	2008-11-06 16:29:57 +0000
@@ -174,29 +174,21 @@ Configuration::init(int argc, char** arg
 
   if (_nowait_nodes)
   {
-    BaseString str(_nowait_nodes);
-    Vector<BaseString> arr;
-    str.split(arr, ",");
-    for (Uint32 i = 0; i<arr.size(); i++)
+    int res = g_nowait_nodes.parseMask(_nowait_nodes);
+    if(res == -2 || (res > 0 && g_nowait_nodes.get(0)))
     {
-      char *endptr = 0;
-      long val = strtol(arr[i].c_str(), &endptr, 10);
-      if (*endptr)
-      {
-	ndbout_c("Unable to parse nowait-nodes argument: %s : %s", 
-		 arr[i].c_str(), _nowait_nodes);
-	exit(-1);
-      }
-      if (! (val > 0 && val < MAX_NDB_NODES))
-      {
-	ndbout_c("Invalid nodeid specified in nowait-nodes: %ld : %s", 
-		 val, _nowait_nodes);
-	exit(-1);
-      }
-      g_nowait_nodes.set(val);
+      ndbout_c("Invalid nodeid specified in nowait-nodes: %s", 
+               _nowait_nodes);
+      exit(-1);
+    }
+    else if (res < 0)
+    {
+      ndbout_c("Unable to parse nowait-nodes argument: %s",
+               _nowait_nodes);
+      exit(-1);
     }
   }
-
+  
   if (_initialstart)
   {
     _initialStart = true;

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-11-06 10:56:21 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-11-06 16:39:26 +0000
@@ -3883,7 +3883,5 @@ template class MutexVector<Ndb_mgmd_even
 template class Vector<EventSubscribeReq>;
 template class MutexVector<EventSubscribeReq>;
 
-template class Vector<BaseString>;
-template class Vector< Vector<Uint32> >;
 template class Vector< Vector<BaseString> >;
 

=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp	2008-11-06 16:52:59 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp	2008-11-06 17:34:29 +0000
@@ -1826,8 +1826,11 @@ int Ndb::dropEventOperation(NdbEventOper
   DBUG_ENTER("Ndb::dropEventOperation");
   DBUG_PRINT("info", ("name: %s", tOp->getEvent()->getTable()->getName()));
   // remove it from list
+
+#ifdef REMOVED_WARNING_SURROUNDING_WEIRD_CODE
   NdbEventOperationImpl *op=
     NdbEventBuffer::getEventOperationImpl(tOp);
+#endif  
   
   theEventBuffer->dropEventOperation(tOp);
   DBUG_RETURN(0);

Thread
bzr commit into mysql-5.1 branch (msvensson:3052) Magnus Svensson6 Nov