List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:September 22 2011 8:35am
Subject:bzr push into mysql-5.1-telco-7.0 branch (pekka.nousiainen:4537 to 4539)
WL#4124
View as plain text  
 4539 Pekka Nousiainen	2011-09-22
      wl#4124 x23_fix.diff
      fixes to idle list processing

    modified:
      sql/ha_ndb_index_stat.cc
 4538 Pekka Nousiainen	2011-09-22
      wl#4124 x22_fix.diff
      add entry list verification in debug mode

    modified:
      sql/ha_ndb_index_stat.cc
 4537 magnus.blaudd@stripped	2011-09-19 [merge]
      Merge

    modified:
      storage/ndb/include/mgmcommon/ConfigRetriever.hpp
      storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
      storage/ndb/src/mgmapi/mgmapi.cpp
      storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
      storage/ndb/test/ndbapi/testNdbApi.cpp
=== modified file 'sql/ha_ndb_index_stat.cc'
--- a/sql/ha_ndb_index_stat.cc	2011-09-19 09:26:42 +0000
+++ b/sql/ha_ndb_index_stat.cc	2011-09-22 08:29:21 +0000
@@ -1141,11 +1141,14 @@ ndb_index_stat_proc_idle(Ndb_index_stat_
   if (st->force_update)
   {
     pr.lt= Ndb_index_stat::LT_Update;
+    // this is not final solution to delay in analyze start
+    pr.busy= true;
     return;
   }
   if (check_wait <= 0)
   {
     pr.lt= Ndb_index_stat::LT_Check;
+    pr.busy= true;
     return;
   }
   pr.lt= Ndb_index_stat::LT_Idle;
@@ -1157,7 +1160,10 @@ ndb_index_stat_proc_idle(Ndb_index_stat_
   const int lt= Ndb_index_stat::LT_Idle;
   Ndb_index_stat_list &list= ndb_index_stat_list[lt];
   const Ndb_index_stat_opt &opt= ndb_index_stat_opt;
-  const uint batch= opt.get(Ndb_index_stat_opt::Iidle_batch);
+  uint batch= opt.get(Ndb_index_stat_opt::Iidle_batch);
+  // because entry may be moved to end of this list
+  if (batch > list.count)
+    batch= list.count;
   pr.now= ndb_index_stat_time();
 
   Ndb_index_stat *st_loop= list.head;
@@ -1172,8 +1178,7 @@ ndb_index_stat_proc_idle(Ndb_index_stat_
     ndb_index_stat_list_move(st, pr.lt);
     cnt++;
   }
-  if (cnt == batch)
-    pr.busy= true;
+  // not marked busy even if full batch
 }
 
 void
@@ -1492,6 +1497,65 @@ ndb_index_stat_proc_event(Ndb_index_stat
 
 #ifndef DBUG_OFF
 void
+ndb_index_stat_list_verify(int lt)
+{
+  const Ndb_index_stat_list &list= ndb_index_stat_list[lt];
+  const Ndb_index_stat *st= list.head;
+  uint count= 0;
+  while (st != 0)
+  {
+    count++;
+    assert(count <= list.count);
+    if (st->list_prev != 0)
+    {
+      assert(st->list_prev->list_next == st);
+    }
+    if (st->list_next != 0)
+    {
+      assert(st->list_next->list_prev == st);
+    }
+    if (count == 1)
+    {
+      assert(st == list.head);
+    }
+    if (count == list.count)
+    {
+      assert(st == list.tail);
+    }
+    if (st == list.head)
+    {
+      assert(count == 1);
+      assert(st->list_prev == 0);
+    }
+    if (st == list.tail)
+    {
+      assert(count == list.count);
+      assert(st->list_next == 0);
+    }
+    const Ndb_index_stat *st2= st->list_next;
+    uint guard= 0;
+    while (st2 != 0)
+    {
+      assert(st != st2);
+      guard++;
+      assert(guard <= list.count);
+      st2= st2->list_next;
+    }
+    st= st->list_next;
+  }
+  assert(count == list.count);
+}
+
+void
+ndb_index_stat_list_verify()
+{
+  pthread_mutex_lock(&ndb_index_stat_list_mutex);
+  for (int lt= 0; lt < Ndb_index_stat::LT_Count; lt++)
+    ndb_index_stat_list_verify(lt);
+  pthread_mutex_unlock(&ndb_index_stat_list_mutex);
+}
+
+void
 ndb_index_stat_report(const Ndb_index_stat_glob& old_glob)
 {
   Ndb_index_stat_glob new_glob= ndb_index_stat_glob;
@@ -1559,6 +1623,7 @@ void
 ndb_index_stat_proc(Ndb_index_stat_proc &pr)
 {
 #ifndef DBUG_OFF
+  ndb_index_stat_list_verify();
   Ndb_index_stat_glob old_glob= ndb_index_stat_glob;
   old_glob.set_list_count();
 #endif
@@ -1576,6 +1641,7 @@ ndb_index_stat_proc(Ndb_index_stat_proc
   ndb_index_stat_proc_event(pr);
 
 #ifndef DBUG_OFF
+  ndb_index_stat_list_verify();
   ndb_index_stat_report(old_glob);
 #endif
   DBUG_VOID_RETURN;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (pekka.nousiainen:4537 to 4539)WL#4124Pekka Nousiainen22 Sep