List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:September 19 2011 9:27am
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4534 to 4535)
View as plain text  
 4535 Jonas Oreland	2011-09-19
      ndb index stat - use variable together with condition-variable, so that pthread_signal "doesn't get lost"

    modified:
      sql/ha_ndb_index_stat.cc
 4534 Pekka Nousiainen	2011-09-19
      wl#4124 z04_ms4.diff
      4-test-ndb-index-stat-partitions

    added:
      mysql-test/suite/ndb/r/ndb_index_stat_partitions.result
      mysql-test/suite/ndb/t/ndb_index_stat_partitions.test
=== modified file 'sql/ha_ndb_index_stat.cc'
--- a/sql/ha_ndb_index_stat.cc	2011-09-02 06:43:38 +0000
+++ b/sql/ha_ndb_index_stat.cc	2011-09-19 09:26:42 +0000
@@ -24,6 +24,9 @@
 #include <mysql/plugin.h>
 #include <ctype.h>
 
+// Do we have waiter...
+static bool ndb_index_stat_waiter= false;
+
 // copied from ha_ndbcluster_binlog.h
 
 extern handlerton *ndbcluster_hton;
@@ -1845,7 +1848,7 @@ ndb_index_stat_thread_func(void *arg __a
   for (;;)
   {
     pthread_mutex_lock(&LOCK_ndb_index_stat_thread);
-    if (!ndbcluster_terminating) {
+    if (!ndbcluster_terminating && ndb_index_stat_waiter == false) {
       int ret= pthread_cond_timedwait(&COND_ndb_index_stat_thread,
                                       &LOCK_ndb_index_stat_thread,
                                       &abstime);
@@ -1855,6 +1858,7 @@ ndb_index_stat_thread_func(void *arg __a
     }
     if (ndbcluster_terminating) /* Shutting down server */
       goto ndb_index_stat_thread_end;
+    ndb_index_stat_waiter= false;
     pthread_mutex_unlock(&LOCK_ndb_index_stat_thread);
 
     /* const bool enable_ok_new= THDVAR(NULL, index_stat_enable); */
@@ -2002,6 +2006,7 @@ ndb_index_stat_wait(Ndb_index_stat *st,
     DBUG_PRINT("index_stat", ("st %s wait count:%u",
                               st->id, ++count));
     pthread_mutex_lock(&LOCK_ndb_index_stat_thread);
+    ndb_index_stat_waiter= true;
     pthread_cond_signal(&COND_ndb_index_stat_thread);
     pthread_mutex_unlock(&LOCK_ndb_index_stat_thread);
     set_timespec(abstime, 1);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4534 to 4535) Jonas Oreland20 Sep