List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 28 2011 8:55am
Subject:bzr push into mysql-5.5-cluster branch (magnus.blaudd:3641 to 3644)
View as plain text  
 3644 Magnus Blåudd	2011-10-28
      ndb schema dist
       - rename Ndb_schema_op::slock to slock_buf

    modified:
      sql/ha_ndbcluster_binlog.cc
 3643 Magnus Blåudd	2011-10-28
      ndb schema dist
       - rename Cluster_schema to Ndb_schema_op, add backward compatibility typedef to avoid
        changing old code(now).

    modified:
      sql/ha_ndbcluster_binlog.cc
 3642 Magnus Blåudd	2011-10-28
      ndb schema dist
       - rename 'ndb_binlog_query' to 'write_schema_op_to_binlog'
       - fold the check of condition 'if binlog is running' into the function so that caller does not have to do it

    modified:
      sql/ha_ndbcluster_binlog.cc
 3641 Magnus Blåudd	2011-10-28
      ndb schema dist
       - remove faulty friend declaration of 'ndb_handle_schema_change'

    modified:
      sql/ha_ndbcluster.h
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-10-28 07:12:35 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-10-28 08:29:31 +0000
@@ -2207,14 +2207,14 @@ private:
 
 class Ndb_schema_event_handler {
 
-  struct Cluster_schema
+  struct Ndb_schema_op
   {
     uchar db_length;
     char db[64];
     uchar name_length;
     char name[64];
     uchar slock_length;
-    uint32 slock[SCHEMA_SLOCK_SIZE/4];
+    uint32 slock_buf[SCHEMA_SLOCK_SIZE/4];
     unsigned short query_length;
     char *query;
     Uint64 epoch;
@@ -2224,6 +2224,7 @@ class Ndb_schema_event_handler {
     uint32 type;
     uint32 any_value;
   };
+  typedef Ndb_schema_op Cluster_schema; // Old name
 
 
   static void
@@ -2280,8 +2281,8 @@ class Ndb_schema_event_handler {
     /* slock fixed length */
     field++;
     s->slock_length= (*field)->field_length;
-    DBUG_ASSERT((*field)->field_length == sizeof(s->slock));
-    memcpy(s->slock, (*field)->ptr, s->slock_length);
+    DBUG_ASSERT((*field)->field_length == sizeof(s->slock_buf));
+    memcpy(s->slock_buf, (*field)->ptr, s->slock_length);
     /* query blob */
     field++;
     {
@@ -2314,8 +2315,16 @@ class Ndb_schema_event_handler {
   }
 
 
-  static void ndb_binlog_query(THD *thd, Cluster_schema *schema)
+  static void
+  write_schema_op_to_binlog(THD *thd, Cluster_schema *schema)
   {
+
+    if (!ndb_binlog_running)
+    {
+      // This mysqld is not writing a binlog
+      return;
+    }
+
     /* any_value == 0 means local cluster sourced change that
      * should be logged
      */
@@ -2612,7 +2621,7 @@ class Ndb_schema_event_handler {
       Cluster_schema *schema= (Cluster_schema *)
         sql_alloc(sizeof(Cluster_schema));
       MY_BITMAP slock;
-      bitmap_init(&slock, schema->slock, 8*SCHEMA_SLOCK_SIZE, FALSE);
+      bitmap_init(&slock, schema->slock_buf, 8*SCHEMA_SLOCK_SIZE, FALSE);
       uint node_id= g_ndb_cluster_connection->node_id();
       {
         ndbcluster_get_schema(event_data, schema);
@@ -2834,10 +2843,10 @@ class Ndb_schema_event_handler {
           break;
 
         }
-        if (log_query && ndb_binlog_running)
-          ndb_binlog_query(thd, schema);
+        if (log_query)
+          write_schema_op_to_binlog(thd, schema);
         /* signal that schema operation has been handled */
-        DBUG_DUMP("slock", (uchar*) schema->slock, schema->slock_length);
+        DBUG_DUMP("slock", (uchar*) schema->slock_buf, schema->slock_length);
         if (bitmap_is_set(&slock, node_id))
         {
           if (post_epoch_unlock)
@@ -3003,10 +3012,10 @@ handle_schema_log_post_epoch(THD *thd,
                                   key, schema->id, schema->version,
                                   ndb_schema_object->slock[0],
                                   ndb_schema_object->slock[1],
-                                  schema->slock[0],
-                                  schema->slock[1]);
+                                  schema->slock_buf[0],
+                                  schema->slock_buf[1]);
           }
-          memcpy(ndb_schema_object->slock, schema->slock,
+          memcpy(ndb_schema_object->slock, schema->slock_buf,
                  sizeof(ndb_schema_object->slock));
           DBUG_DUMP("ndb_schema_object->slock_bitmap.bitmap",
                     (uchar*)ndb_schema_object->slock_bitmap.bitmap,
@@ -3326,8 +3335,8 @@ handle_schema_log_post_epoch(THD *thd,
         share= 0;
       }
     }
-    if (ndb_binlog_running && log_query)
-      ndb_binlog_query(thd, schema);
+    if (log_query)
+      write_schema_op_to_binlog(thd, schema);
   }
   DBUG_VOID_RETURN;
 }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (magnus.blaudd:3641 to 3644) Magnus Blåudd28 Oct