List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:May 4 2010 1:09pm
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:3191) Bug#52225
Bug#53409
View as plain text  
#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped

 3191 Jonas Oreland	2010-05-04
      ndb - bug#52225
        in addition to fixing bug#53409, also handle tab/db-name vs. filename
        consistently wrt to replication (events)
        (for now settle on using tab/db-name instead of filename...which might
         actually be incorrect, but now it's atleast consistent)

    modified:
      mysql-test/suite/ndb/r/ndb_database.result
      mysql-test/suite/ndb/t/ndb_database.test
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_binlog.h
=== modified file 'mysql-test/suite/ndb/r/ndb_database.result'
--- a/mysql-test/suite/ndb/r/ndb_database.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/ndb/r/ndb_database.result	2010-05-04 13:09:06 +0000
@@ -11,3 +11,9 @@ use mysqltest;
 show tables;
 Tables_in_mysqltest
 drop database mysqltest;
+create database `mysqltest.db`;
+create table `mysqltest.db`.t1 (a int primary key, b int) engine=ndb;
+alter offline table `mysqltest.db`.t1 add column c int;
+alter online table `mysqltest.db`.t1 add column d int column_format dynamic;
+drop table `mysqltest.db`.t1;
+drop database `mysqltest.db`;

=== modified file 'mysql-test/suite/ndb/t/ndb_database.test'
--- a/mysql-test/suite/ndb/t/ndb_database.test	2007-11-29 10:29:35 +0000
+++ b/mysql-test/suite/ndb/t/ndb_database.test	2010-05-04 13:09:06 +0000
@@ -21,3 +21,13 @@ show tables;
 drop database mysqltest;
 
 # End of 4.1 tests
+
+#
+# bug#52225 - special characters in database name
+#
+create database `mysqltest.db`;
+create table `mysqltest.db`.t1 (a int primary key, b int) engine=ndb;
+alter offline table `mysqltest.db`.t1 add column c int;
+alter online table `mysqltest.db`.t1 add column d int column_format dynamic;
+drop table `mysqltest.db`.t1;
+drop database `mysqltest.db`;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-04-26 09:12:20 +0000
+++ b/sql/ha_ndbcluster.cc	2010-05-04 13:09:06 +0000
@@ -7409,17 +7409,6 @@ int ha_ndbcluster::final_drop_index(TABL
   DBUG_RETURN(error);
 }
 
-/*
-  Find the base name in the format "<database>/<table>"
-*/
-static const char *get_base_name(const char *ptr)
-{
-  ptr+= strlen(ptr);
-  while (*(--ptr) != '/');
-  while (*(--ptr) != '/');
-  return ptr+1;
-}
-
 /**
   Rename a table in NDB Cluster.
 */
@@ -7541,8 +7530,8 @@ int ha_ndbcluster::rename_table(const ch
   /* handle old table */
   if (!is_old_table_tmpfile)
   {
-    const char *ptr= get_base_name(from);
-    ndbcluster_drop_event(thd, ndb, share, "rename table", ptr);
+    ndbcluster_drop_event(thd, ndb, share, "rename table", 
+                          old_dbname, m_tabname);
   }
 
   if (!result && !is_new_table_tmpfile)
@@ -7556,8 +7545,8 @@ int ha_ndbcluster::rename_table(const ch
 #endif
     /* always create an event for the table */
     String event_name(INJECTOR_EVENT_LEN);
-    const char *ptr= get_base_name(to);
-    ndb_rep_event_name(&event_name, ptr, 0, get_binlog_full(share));
+    ndb_rep_event_name(&event_name, new_dbname, new_tabname, 
+                       get_binlog_full(share));
 
     if (!ndbcluster_create_event(thd, ndb, ndbtab, event_name.c_ptr(), share,
                                  share && ndb_binlog_running ? 2 : 1/* push warning */))
@@ -7775,9 +7764,19 @@ retry_temporary_error1:
   int table_dropped= dict->getNdbError().code != 709;
 
   {
-    const char *ptr= get_base_name(path);
-    ndbcluster_handle_drop_table(thd, ndb, share, "delete table",
-                                 table_dropped ? ptr : 0);
+    if (table_dropped)
+    {
+      ndbcluster_handle_drop_table(thd, ndb, share, "delete table", 
+                                   db, table_name);
+    }
+    else
+    {
+      /**
+       * Setting 0,0 will cause ndbcluster_drop_event *not* to be called
+       */
+      ndbcluster_handle_drop_table(thd, ndb, share, "delete table", 
+                                   0, 0);
+    }
   }
 
   if (!IS_TMP_PREFIX(table_name) && share &&

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2010-03-24 15:11:56 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2010-05-04 13:09:06 +0000
@@ -4618,7 +4618,8 @@ ndbcluster_create_event_ops(THD *thd, ND
 int
 ndbcluster_drop_event(THD *thd, Ndb *ndb, NDB_SHARE *share,
                       const char *type_str,
-                      const char *event_name_prefix)
+                      const char *dbname,
+                      const char *tabname)
 {
   DBUG_ENTER("ndbcluster_drop_event");
   /*
@@ -4626,12 +4627,12 @@ ndbcluster_drop_event(THD *thd, Ndb *ndb
     which ones are supposed to be there as they may have been created
     differently for different mysqld's.  So we drop both
   */
-  for (uint i= 0; event_name_prefix && i < 2; i++)
+  for (uint i= 0; i < 2; i++)
   {
     NDBDICT *dict= ndb->getDictionary();
     String event_name(INJECTOR_EVENT_LEN);
-    ndb_rep_event_name(&event_name, event_name_prefix, 0, i);
-
+    ndb_rep_event_name(&event_name, dbname, tabname, i);
+    
     if (!dict->dropEvent(event_name.c_ptr()))
       continue;
 
@@ -4707,12 +4708,15 @@ ndbcluster_handle_alter_table(THD *thd, 
 int
 ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, NDB_SHARE *share,
                              const char *type_str,
-                             const char *event_name_prefix)
+                             const char * dbname, const char * tabname)
 {
   DBUG_ENTER("ndbcluster_handle_drop_table");
 
-  if (ndbcluster_drop_event(thd, ndb, share, type_str, event_name_prefix))
-    DBUG_RETURN(-1);
+  if (dbname && tabname)
+  {
+    if (ndbcluster_drop_event(thd, ndb, share, type_str, dbname, tabname))
+      DBUG_RETURN(-1);
+  }
 
   if (share == 0 || share->op == 0)
   {

=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h	2009-09-21 13:53:09 +0000
+++ b/sql/ha_ndbcluster_binlog.h	2010-05-04 13:09:06 +0000
@@ -220,12 +220,12 @@ int ndbcluster_log_schema_op(THD *thd,
                              int have_lock_open);
 int ndbcluster_drop_event(THD *thd, Ndb *ndb, NDB_SHARE *share,
                           const char *type_str,
-                          const char *event_name_prefix);
+                          const char * dbname, const char * tabname);
 int ndbcluster_handle_alter_table(THD *thd, NDB_SHARE *share,
                                   const char *type_str);
 int ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, NDB_SHARE *share,
                                  const char *type_str,
-                                 const char *event_name_prefix);
+                                 const char * db, const char * tabname);
 void ndb_rep_event_name(String *event_name,
                         const char *db, const char *tbl, my_bool full);
 #ifdef HAVE_NDB_BINLOG


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100504130906-vsp23m8380itegak.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:3191) Bug#52225Bug#53409Jonas Oreland4 May