List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:November 21 2011 11:02am
Subject:bzr push into mysql-5.5-cluster branch (magnus.blaudd:3657 to 3658)
View as plain text  
 3658 magnus.blaudd@stripped	2011-11-21
      ndb schema dist
       - rename 'log_efter_epoch' to 'handle_after_epoch'
       - rename 'unlock_after_epoch' to 'ack_after_epoch'
       - rename the lists for post epoch processing similarly as above
       - remove the two different functions used fro preocssing the lists and instead
        handle them directly in the 'post_epoch' function

    modified:
      sql/ha_ndbcluster_binlog.cc
 3657 magnus.blaudd@stripped	2011-11-21
      ndb schema dist
       - handle SOT_RENAME_TABLE_NEW by printing and ewrror message descibing that it's
        an old schema operation and it has been skipped.

    modified:
      sql/ha_ndbcluster_binlog.cc
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-11-21 09:47:00 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-11-21 10:21:57 +0000
@@ -2492,21 +2492,23 @@ class Ndb_schema_event_handler {
 
 
   void
-  log_after_epoch(Ndb_schema_op* schema)
+  handle_after_epoch(Ndb_schema_op* schema)
   {
-    DBUG_ENTER("log_after_epoch");
+    DBUG_ENTER("handle_after_epoch");
+    DBUG_PRINT("info", ("Pushing Ndb_schema_op on list to be "
+                        "handled after epoch"));
     assert(!is_post_epoch()); // Only before epoch
-    m_post_epoch_log_list.push_back(schema, m_mem_root);
+    m_post_epoch_handle_list.push_back(schema, m_mem_root);
     DBUG_VOID_RETURN;
   }
 
 
   void
-  unlock_after_epoch(Ndb_schema_op* schema)
+  ack_after_epoch(Ndb_schema_op* schema)
   {
-    DBUG_ENTER("unlock_after_epoch");
+    DBUG_ENTER("ack_after_epoch");
     assert(!is_post_epoch()); // Only before epoch
-    m_post_epoch_unlock_list.push_back(schema, m_mem_root);
+    m_post_epoch_ack_list.push_back(schema, m_mem_root);
     DBUG_VOID_RETURN;
   }
 
@@ -3230,7 +3232,7 @@ class Ndb_schema_event_handler {
           schema events get inserted in the binlog after any data
           events
         */
-        log_after_epoch(schema);
+        handle_after_epoch(schema);
         DBUG_RETURN(0);
 
       case SOT_ALTER_TABLE_COMMIT:
@@ -3240,8 +3242,8 @@ class Ndb_schema_event_handler {
       case SOT_RENAME_TABLE:
       case SOT_DROP_TABLE:
       case SOT_DROP_DB:
-        log_after_epoch(schema);
-        unlock_after_epoch(schema);
+        handle_after_epoch(schema);
+        ack_after_epoch(schema);
         DBUG_RETURN(0);
 
       case SOT_TRUNCATE_TABLE:
@@ -3358,39 +3360,6 @@ class Ndb_schema_event_handler {
     DBUG_VOID_RETURN;
   }
 
-
-  /*
-    process any operations that should be done after
-    the epoch is complete
-  */
-  void
-  handle_schema_log_post_epoch(List<Ndb_schema_op> *log_list)
-  {
-    DBUG_ENTER("handle_schema_log_post_epoch");
-
-    Ndb_schema_op* schema;
-    while ((schema= log_list->pop()))
-    {
-      handle_schema_op_post_epoch(schema);
-    }
-    DBUG_VOID_RETURN;
-  }
-
-
-  void
-  handle_schema_unlock_post_epoch(List<Ndb_schema_op> *unlock_list)
-  {
-    DBUG_ENTER("handle_schema_unlock_post_epoch");
-
-    Ndb_schema_op *schema;
-    while ((schema= unlock_list->pop()))
-    {
-      ack_schema_op(schema->db, schema->name,
-                    schema->id, schema->version);
-    }
-    DBUG_VOID_RETURN;
-  }
-
   THD* m_thd;
   MEM_ROOT* m_mem_root;
   uint m_own_nodeid;
@@ -3398,8 +3367,8 @@ class Ndb_schema_event_handler {
 
   bool is_post_epoch(void) const { return m_post_epoch; };
 
-  List<Ndb_schema_op> m_post_epoch_log_list;
-  List<Ndb_schema_op> m_post_epoch_unlock_list;
+  List<Ndb_schema_op> m_post_epoch_handle_list;
+  List<Ndb_schema_op> m_post_epoch_ack_list;
 
 public:
   Ndb_schema_event_handler(); // Not implemented
@@ -3415,8 +3384,8 @@ public:
   ~Ndb_schema_event_handler()
   {
     // There should be no work left todo...
-    DBUG_ASSERT(m_post_epoch_log_list.elements == 0);
-    DBUG_ASSERT(m_post_epoch_unlock_list.elements == 0);
+    DBUG_ASSERT(m_post_epoch_handle_list.elements == 0);
+    DBUG_ASSERT(m_post_epoch_ack_list.elements == 0);
   }
 
 
@@ -3560,18 +3529,34 @@ public:
 
   void post_epoch()
   {
-    if (m_post_epoch_log_list.elements > 0)
+    if (unlikely(m_post_epoch_handle_list.elements > 0))
     {
       // Set the flag used to check that functions are called at correct time
       m_post_epoch= true;
 
-      handle_schema_log_post_epoch(&m_post_epoch_log_list);
-      // NOTE post_epoch_unlock_list may not be handled!
-      handle_schema_unlock_post_epoch(&m_post_epoch_unlock_list);
+      /*
+       process any operations that should be done after
+       the epoch is complete
+      */
+      Ndb_schema_op* schema;
+      while ((schema= m_post_epoch_handle_list.pop()))
+      {
+        handle_schema_op_post_epoch(schema);
+      }
+
+      /*
+       process any operations that should be unlocked/acked after
+       the epoch is complete
+      */
+      while ((schema= m_post_epoch_ack_list.pop()))
+      {
+        ack_schema_op(schema->db, schema->name,
+                      schema->id, schema->version);
+      }
     }
     // There should be no work left todo...
-    DBUG_ASSERT(m_post_epoch_log_list.elements == 0);
-    DBUG_ASSERT(m_post_epoch_unlock_list.elements == 0);
+    DBUG_ASSERT(m_post_epoch_handle_list.elements == 0);
+    DBUG_ASSERT(m_post_epoch_ack_list.elements == 0);
   }
 };
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (magnus.blaudd:3657 to 3658) magnus.blaudd21 Nov