List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:October 17 2012 1:20pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4999 to 5001)
Bug#14730537
View as plain text  
 5001 magnus.blaudd@stripped	2012-10-17
      Bug#14730537    NDB_MGMD --CONFIG-CACHE=FALSE OFTEN HANGS IN SHUTDOWN
         - Problem in mysys on certain MySQL versions where the thread id is
            used as the thread identifier. Since the thread id may be reused
            by another thread(when the current thread exits) one may end up
            waiting for the wrong thread.
        - Workaround by using a HANDLE which is opened by thread itself in
           'ndb_thread_wrapper' and subsequently used to wait for the
           thread in 'NdbThread_WaitFor'.

    modified:
      storage/ndb/src/common/portlib/NdbThread.c
 5000 magnus.blaudd@stripped	2012-10-17
      Backport fix for ndb_backup_rate.test to 7.0

    modified:
      mysql-test/suite/ndb/t/ndb_backup_rate.test
 4999 Maitrayi Sabaratnam	2012-10-12
      Bug #4671934 - NDB_CONFIG: DEFAULT VALUES MISSING FOR PARAMETERS

    modified:
      storage/ndb/src/mgmsrv/ConfigInfo.cpp
=== modified file 'mysql-test/suite/ndb/t/ndb_backup_rate.test'
--- a/mysql-test/suite/ndb/t/ndb_backup_rate.test	2012-09-13 20:18:47 +0000
+++ b/mysql-test/suite/ndb/t/ndb_backup_rate.test	2012-10-17 12:59:41 +0000
@@ -1,5 +1,9 @@
 -- source include/have_ndb.inc
 
+# Valgrinding slows the mysqld down and thus making it
+# impossible to fill the redo log of ndbd(s) -> skip test
+--source include/not_valgrind.inc
+
 use test;
 create table t1 (a varchar(1024)) engine=ndb max_rows=100000000;
 insert into t1 values (repeat('I', 1024));

=== modified file 'storage/ndb/src/common/portlib/NdbThread.c'
--- a/storage/ndb/src/common/portlib/NdbThread.c	2011-11-10 15:06:03 +0000
+++ b/storage/ndb/src/common/portlib/NdbThread.c	2012-10-17 13:18:33 +0000
@@ -61,6 +61,25 @@ struct NdbThread
 { 
   volatile int inited;
   pthread_t thread;
+#ifdef _WIN32
+  /*
+    Problem in mysys on certain MySQL versions where the thread id is
+    used as the thread identifier. Since the thread id may be reused
+    by another thread(when the current thread exits) one may end up
+    waiting for the wrong thread.
+
+    Workaround by using a HANDLE which is opened by thread itself in
+    'ndb_thread_wrapper' and subsequently used to wait for the
+    thread in 'NdbThread_WaitFor'.
+
+    NOTE: Windows implementation of 'pthread_join' and support for non
+    detached threads as implemented in MySQL Cluster 7.0 and 7.1 is not
+    affected, only MySQL Cluster based on 5.5+ affected(slightly
+    different implementation). The current workaround in NdbThread is
+    generic and works regardless of pthread_join implementation in mysys.
+  */
+  HANDLE thread_handle;
+#endif
 #if defined HAVE_SOLARIS_AFFINITY
   id_t tid;
 #elif defined HAVE_LINUX_SCHEDULING
@@ -149,6 +168,15 @@ ndb_thread_wrapper(void* _ss){
       struct NdbThread * ss = (struct NdbThread *)_ss;
       settid(ss);
 
+#ifdef _WIN32
+      /*
+        Create the thread handle, ignore failure since it's unlikely
+        to fail and the functions using this handle checks for NULL.
+      */
+      ss->thread_handle =
+        OpenThread(SYNCHRONIZE, FALSE, GetCurrentThreadId());
+#endif
+
 #ifdef NDB_MUTEX_DEADLOCK_DETECTOR
       ndb_mutex_thread_init(&ss->m_mutex_thr_state);
 #endif
@@ -313,6 +341,11 @@ void NdbThread_Destroy(struct NdbThread*
   DBUG_ENTER("NdbThread_Destroy");
   if (*p_thread != NULL){
     DBUG_PRINT("enter",("*p_thread: 0x%lx", (long) *p_thread));
+#ifdef _WIN32
+    HANDLE thread_handle = (*p_thread)->thread_handle;
+    if (thread_handle)
+      CloseHandle(thread_handle);
+#endif
     free(* p_thread); 
     * p_thread = 0;
   }
@@ -322,17 +355,35 @@ void NdbThread_Destroy(struct NdbThread*
 
 int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
 {
-  int result;
-
   if (p_wait_thread == NULL)
     return 0;
 
   if (p_wait_thread->thread == 0)
     return 0;
 
-  result = pthread_join(p_wait_thread->thread, status);
-  
-  return result;
+#ifdef _WIN32
+  {
+    DWORD ret;
+    HANDLE thread_handle = p_wait_thread->thread_handle;
+
+    if (thread_handle == NULL)
+    {
+      return -1;
+    }
+
+    ret = WaitForSingleObject(thread_handle, INFINITE);
+    if (ret != WAIT_OBJECT_0)
+    {
+      return -1;
+    }
+
+    /* Don't fill in "status", never used anyway */
+
+    return 0;
+  }
+#else
+  return pthread_join(p_wait_thread->thread, status);
+#endif
 }
 
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4999 to 5001)Bug#14730537magnus.blaudd18 Oct