List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 31 2011 3:26pm
Subject:bzr push into mysql-5.5-cluster branch (magnus.blaudd:3667 to 3669)
View as plain text  
 3669 Magnus Blåudd	2011-10-31
      ndbcluster
       - move Ndb_binlog_type enum in to the only file where it's used

    modified:
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_tables.h
 3668 Magnus Blåudd	2011-10-31
      ndb schema dist
       - move the "public" interface for logging a schema op into ndb_schema_dist.h
       - add ndb_schema_dist.cc although it's still virtually empty(coward!)

    added:
      sql/ndb_schema_dist.cc
      sql/ndb_schema_dist.h
    modified:
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_binlog.h
      storage/ndb/CMakeLists.txt
 3667 Magnus Blåudd	2011-10-31
      ndb schema dist
       - put the NDB_SCHEMA_OBJECT and it's hash in a seprate file.
       - add comment desrcibing what NDB_SCHEM_OBJECT is used for.

    added:
      sql/ndb_schema_object.cc
      sql/ndb_schema_object.h
    modified:
      sql/ha_ndbcluster_binlog.cc
      storage/ndb/CMakeLists.txt
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-10-29 09:02:21 +0000
+++ b/sql/ha_ndbcluster.cc	2011-10-31 15:10:59 +0000
@@ -54,6 +54,7 @@
 #include "ndb_anyvalue.h"
 #include "ndb_binlog_extra_row_info.h"
 #include "ndb_event_data.h"
+#include "ndb_schema_dist.h"
 
 // ndb interface initialization/cleanup
 extern "C" void ndb_init_internal();

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-10-31 12:39:50 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-10-31 15:15:16 +0000
@@ -60,6 +60,7 @@ bool ndb_log_empty_epochs(void);
 #include "ndb_binlog_extra_row_info.h"
 #include "ndb_event_data.h"
 #include "ndb_schema_object.h"
+#include "ndb_schema_dist.h"
 
 /*
   Timeout for syncing schema events between
@@ -1549,54 +1550,6 @@ static void ndb_report_waiting(const cha
   }
 }
 
-static
-const char*
-get_schema_type_name(uint type)
-{
-  switch(type){
-  case SOT_DROP_TABLE:
-    return "DROP_TABLE";
-  case SOT_CREATE_TABLE:
-    return "CREATE_TABLE";
-  case SOT_RENAME_TABLE_NEW:
-    return "RENAME_TABLE_NEW";
-  case SOT_ALTER_TABLE_COMMIT:
-    return "ALTER_TABLE_COMMIT";
-  case SOT_DROP_DB:
-    return "DROP_DB";
-  case SOT_CREATE_DB:
-    return "CREATE_DB";
-  case SOT_ALTER_DB:
-    return "ALTER_DB";
-  case SOT_CLEAR_SLOCK:
-    return "CLEAR_SLOCK";
-  case SOT_TABLESPACE:
-    return "TABLESPACE";
-  case SOT_LOGFILE_GROUP:
-    return "LOGFILE_GROUP";
-  case SOT_RENAME_TABLE:
-    return "RENAME_TABLE";
-  case SOT_TRUNCATE_TABLE:
-    return "TRUNCATE_TABLE";
-  case SOT_RENAME_TABLE_PREPARE:
-    return "RENAME_TABLE_PREPARE";
-  case SOT_ONLINE_ALTER_TABLE_PREPARE:
-    return "ONLINE_ALTER_TABLE_PREPARE";
-  case SOT_ONLINE_ALTER_TABLE_COMMIT:
-    return "ONLINE_ALTER_TABLE_COMMIT";
-  case SOT_CREATE_USER:
-    return "CREATE_USER";
-  case SOT_DROP_USER:
-    return "DROP_USER";
-  case SOT_RENAME_USER:
-    return "RENAME_USER";
-  case SOT_GRANT:
-    return "GRANT";
-  case SOT_REVOKE:
-    return "REVOKE";
-  }
-  return "<unknown>";
-}
 
 extern void update_slave_api_stats(Ndb*);
 
@@ -3728,6 +3681,18 @@ ndb_rep_event_name(String *event_name,co
 }
 
 #ifdef HAVE_NDB_BINLOG
+
+enum Ndb_binlog_type
+{
+  NBT_DEFAULT                   = 0
+  ,NBT_NO_LOGGING               = 1
+  ,NBT_UPDATED_ONLY             = 2
+  ,NBT_FULL                     = 3
+  ,NBT_USE_UPDATE               = 4 /* bit 0x4 indicates USE_UPDATE */
+  ,NBT_UPDATED_ONLY_USE_UPDATE  = NBT_UPDATED_ONLY | NBT_USE_UPDATE
+  ,NBT_FULL_USE_UPDATE          = NBT_FULL         | NBT_USE_UPDATE
+};
+
 static void 
 set_binlog_flags(NDB_SHARE *share,
                  Ndb_binlog_type ndb_binlog_type)

=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h	2011-10-29 14:21:55 +0000
+++ b/sql/ha_ndbcluster_binlog.h	2011-10-31 15:10:59 +0000
@@ -31,36 +31,6 @@ typedef NdbDictionary::Event  NDBEVENT;
 
 extern handlerton *ndbcluster_hton;
 
-/*
-  The numbers below must not change as they
-  are passed between mysql servers, and if changed
-  would break compatablility.  Add new numbers to
-  the end.
-*/
-enum SCHEMA_OP_TYPE
-{
-  SOT_DROP_TABLE= 0,
-  SOT_CREATE_TABLE= 1,
-  SOT_RENAME_TABLE_NEW= 2,
-  SOT_ALTER_TABLE_COMMIT= 3,
-  SOT_DROP_DB= 4,
-  SOT_CREATE_DB= 5,
-  SOT_ALTER_DB= 6,
-  SOT_CLEAR_SLOCK= 7,
-  SOT_TABLESPACE= 8,
-  SOT_LOGFILE_GROUP= 9,
-  SOT_RENAME_TABLE= 10,
-  SOT_TRUNCATE_TABLE= 11,
-  SOT_RENAME_TABLE_PREPARE= 12,
-  SOT_ONLINE_ALTER_TABLE_PREPARE= 13,
-  SOT_ONLINE_ALTER_TABLE_COMMIT= 14,
-  SOT_CREATE_USER= 15,
-  SOT_DROP_USER= 16,
-  SOT_RENAME_USER= 17,
-  SOT_GRANT= 18,
-  SOT_REVOKE= 19
-};
-
 const uint max_ndb_nodes= 256; /* multiple of 32 */
 
 static const char *ha_ndb_ext=".ndb";

=== modified file 'sql/ha_ndbcluster_tables.h'
--- a/sql/ha_ndbcluster_tables.h	2011-07-05 12:46:07 +0000
+++ b/sql/ha_ndbcluster_tables.h	2011-10-31 15:15:16 +0000
@@ -21,14 +21,3 @@
 #define NDB_APPLY_TABLE "ndb_apply_status"
 #define NDB_SCHEMA_TABLE "ndb_schema"
 #define NDB_REPLICATION_TABLE "ndb_replication"
-
-enum Ndb_binlog_type
-{
-  NBT_DEFAULT                   = 0
-  ,NBT_NO_LOGGING               = 1
-  ,NBT_UPDATED_ONLY             = 2
-  ,NBT_FULL                     = 3
-  ,NBT_USE_UPDATE               = 4 /* bit 0x4 indicates USE_UPDATE */
-  ,NBT_UPDATED_ONLY_USE_UPDATE  = NBT_UPDATED_ONLY | NBT_USE_UPDATE
-  ,NBT_FULL_USE_UPDATE          = NBT_FULL         | NBT_USE_UPDATE
-};

=== added file 'sql/ndb_schema_dist.cc'
--- a/sql/ndb_schema_dist.cc	1970-01-01 00:00:00 +0000
+++ b/sql/ndb_schema_dist.cc	2011-10-31 15:10:59 +0000
@@ -0,0 +1,67 @@
+/*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#include "ndb_schema_dist.h"
+
+
+const char*
+get_schema_type_name(uint type)
+{
+  switch(type){
+  case SOT_DROP_TABLE:
+    return "DROP_TABLE";
+  case SOT_CREATE_TABLE:
+    return "CREATE_TABLE";
+  case SOT_RENAME_TABLE_NEW:
+    return "RENAME_TABLE_NEW";
+  case SOT_ALTER_TABLE_COMMIT:
+    return "ALTER_TABLE_COMMIT";
+  case SOT_DROP_DB:
+    return "DROP_DB";
+  case SOT_CREATE_DB:
+    return "CREATE_DB";
+  case SOT_ALTER_DB:
+    return "ALTER_DB";
+  case SOT_CLEAR_SLOCK:
+    return "CLEAR_SLOCK";
+  case SOT_TABLESPACE:
+    return "TABLESPACE";
+  case SOT_LOGFILE_GROUP:
+    return "LOGFILE_GROUP";
+  case SOT_RENAME_TABLE:
+    return "RENAME_TABLE";
+  case SOT_TRUNCATE_TABLE:
+    return "TRUNCATE_TABLE";
+  case SOT_RENAME_TABLE_PREPARE:
+    return "RENAME_TABLE_PREPARE";
+  case SOT_ONLINE_ALTER_TABLE_PREPARE:
+    return "ONLINE_ALTER_TABLE_PREPARE";
+  case SOT_ONLINE_ALTER_TABLE_COMMIT:
+    return "ONLINE_ALTER_TABLE_COMMIT";
+  case SOT_CREATE_USER:
+    return "CREATE_USER";
+  case SOT_DROP_USER:
+    return "DROP_USER";
+  case SOT_RENAME_USER:
+    return "RENAME_USER";
+  case SOT_GRANT:
+    return "GRANT";
+  case SOT_REVOKE:
+    return "REVOKE";
+  }
+  return "<unknown>";
+}

=== added file 'sql/ndb_schema_dist.h'
--- a/sql/ndb_schema_dist.h	1970-01-01 00:00:00 +0000
+++ b/sql/ndb_schema_dist.h	2011-10-31 15:10:59 +0000
@@ -0,0 +1,68 @@
+/*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#ifndef NDB_SCHEMA_DIST_H
+#define NDB_SCHEMA_DIST_H
+
+#include <mysql/plugin.h>
+#include <my_global.h>
+
+
+/*
+  The numbers below must not change as they
+  are passed between mysql servers, and if changed
+  would break compatablility.  Add new numbers to
+  the end.
+*/
+enum SCHEMA_OP_TYPE
+{
+  SOT_DROP_TABLE= 0,
+  SOT_CREATE_TABLE= 1,
+  SOT_RENAME_TABLE_NEW= 2,
+  SOT_ALTER_TABLE_COMMIT= 3,
+  SOT_DROP_DB= 4,
+  SOT_CREATE_DB= 5,
+  SOT_ALTER_DB= 6,
+  SOT_CLEAR_SLOCK= 7,
+  SOT_TABLESPACE= 8,
+  SOT_LOGFILE_GROUP= 9,
+  SOT_RENAME_TABLE= 10,
+  SOT_TRUNCATE_TABLE= 11,
+  SOT_RENAME_TABLE_PREPARE= 12,
+  SOT_ONLINE_ALTER_TABLE_PREPARE= 13,
+  SOT_ONLINE_ALTER_TABLE_COMMIT= 14,
+  SOT_CREATE_USER= 15,
+  SOT_DROP_USER= 16,
+  SOT_RENAME_USER= 17,
+  SOT_GRANT= 18,
+  SOT_REVOKE= 19
+};
+
+
+int ndbcluster_log_schema_op(THD* thd,
+                             const char *query, int query_length,
+                             const char *db, const char *table_name,
+                             uint32 ndb_table_id,
+                             uint32 ndb_table_version,
+                             SCHEMA_OP_TYPE type,
+                             const char *new_db,
+                             const char *new_table_name);
+
+const char* get_schema_type_name(uint type);
+
+
+#endif

=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt	2011-10-31 12:39:50 +0000
+++ b/storage/ndb/CMakeLists.txt	2011-10-31 15:10:59 +0000
@@ -85,6 +85,7 @@ SET(NDBCLUSTER_SOURCES
   ../../sql/ndb_binlog_extra_row_info.cc
   ../../sql/ndb_event_data.cc
   ../../sql/ndb_schema_object.cc
+  ../../sql/ndb_schema_dist.cc
 )
 
 # Include directories used when building ha_ndbcluster

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (magnus.blaudd:3667 to 3669) Magnus Blåudd1 Nov