List:Commits« Previous MessageNext Message »
From:tomas Date:March 1 2006 5:23pm
Subject:bk commit into 5.1 tree (tomas:1.2216) BUG#17827
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2216 06/03/01 18:23:00 tomas@stripped +3 -0
  Bug #17827  	cluster: rename of several tables in one statement, gets multiply logged
  - redo log table query for log, split into separate entries per rename, to avoid duplicates, also to only log renames that relate to ndb tables

  sql/ha_ndbcluster_binlog.h
    1.9 06/03/01 18:22:54 tomas@stripped +3 -1
    Bug #17827  	cluster: rename of several tables in one statement, gets multiply logged

  sql/ha_ndbcluster_binlog.cc
    1.30 06/03/01 18:22:54 tomas@stripped +20 -10
    Bug #17827  	cluster: rename of several tables in one statement, gets multiply logged
    - redo log table query for log, split into separate entries per rename, to avoid duplicates, also to only log renames that relate to ndb tables

  sql/ha_ndbcluster.cc
    1.280 06/03/01 18:22:54 tomas@stripped +5 -2
    Bug #17827  	cluster: rename of several tables in one statement, gets multiply logged
    - redo log table query for log, split into separate entries per rename, to avoid duplicates, also to only log renames that relate to ndb tables

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-new

--- 1.279/sql/ha_ndbcluster.cc	2006-03-01 15:24:38 +01:00
+++ 1.280/sql/ha_ndbcluster.cc	2006-03-01 18:22:54 +01:00
@@ -4728,13 +4728,14 @@
 int ha_ndbcluster::rename_table(const char *from, const char *to)
 {
   NDBDICT *dict;
+  char old_dbname[FN_HEADLEN];
   char new_tabname[FN_HEADLEN];
   const NDBTAB *orig_tab;
   int result;
 
   DBUG_ENTER("ha_ndbcluster::rename_table");
   DBUG_PRINT("info", ("Renaming %s to %s", from, to));
-  set_dbname(from);
+  set_dbname(from, old_dbname);
   set_tabname(from);
   set_tabname(to, new_tabname);
 
@@ -4742,6 +4743,7 @@
     DBUG_RETURN(my_errno= HA_ERR_NO_CONNECTION);
 
   Ndb *ndb= get_ndb();
+  ndb->setDatabaseName(old_dbname);
   dict= ndb->getDictionary();
   if (!(orig_tab= dict->getTable(m_tabname)))
     ERR_RETURN(dict->getNdbError());
@@ -4833,7 +4835,8 @@
                                current_thd->query, current_thd->query_length,
                                m_dbname, new_tabname,
                                0, 0,
-                               SOT_RENAME_TABLE);
+                               SOT_RENAME_TABLE,
+                               old_dbname, m_tabname);
   }
   if (share)
     free_share(&share);

--- 1.29/sql/ha_ndbcluster_binlog.cc	2006-03-01 13:31:13 +01:00
+++ 1.30/sql/ha_ndbcluster_binlog.cc	2006-03-01 18:22:54 +01:00
@@ -885,7 +885,8 @@
                              const char *db, const char *table_name,
                              uint32 ndb_table_id,
                              uint32 ndb_table_version,
-                             enum SCHEMA_OP_TYPE type)
+                             enum SCHEMA_OP_TYPE type,
+                             const char *old_db, const char *old_table_name)
 {
   DBUG_ENTER("ndbcluster_log_schema_op");
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -919,10 +920,19 @@
     query= tmp_buf2;
     query_length= (uint) (strxmov(tmp_buf2, "drop table `",
                                   table_name, "`", NullS) - tmp_buf2);
-    // fall through
-  case SOT_CREATE_TABLE:
-    // fall through
+    if (!share)
+      get_a_share= 1;
+    break;
   case SOT_RENAME_TABLE:
+    /* redo the rename table query as is may contain several tables */
+    query= tmp_buf2;
+    query_length= (uint) (strxmov(tmp_buf2, "rename table `",
+                                  old_db, ".", old_table_name, "` to `",
+                                  db, ".", table_name, "`", NullS) - tmp_buf2);
+    if (!share)
+      get_a_share= 1;
+    break;
+  case SOT_CREATE_TABLE:
     // fall through
   case SOT_ALTER_TABLE:
     if (!share)
@@ -983,8 +993,8 @@
   }
 
   Ndb *ndb= thd_ndb->ndb;
-  char old_db[FN_REFLEN];
-  strcpy(old_db, ndb->getDatabaseName());
+  char save_db[FN_REFLEN];
+  strcpy(save_db, ndb->getDatabaseName());
 
   char tmp_buf[SCHEMA_QUERY_SIZE];
   NDBDICT *dict= ndb->getDictionary();
@@ -1091,7 +1101,7 @@
           
   if (trans)
     ndb->closeTransaction(trans);
-  ndb->setDatabaseName(old_db);
+  ndb->setDatabaseName(save_db);
 
   /*
     Wait for other mysqld's to acknowledge the table operation
@@ -1169,8 +1179,8 @@
   const NdbError *ndb_error= 0;
   uint32 node_id= g_ndb_cluster_connection->node_id();
   Ndb *ndb= check_ndb_in_thd(thd);
-  char old_db[128];
-  strcpy(old_db, ndb->getDatabaseName());
+  char save_db[FN_HEADLEN];
+  strcpy(save_db, ndb->getDatabaseName());
 
   char tmp_buf[SCHEMA_QUERY_SIZE];
   NDBDICT *dict= ndb->getDictionary();
@@ -1292,7 +1302,7 @@
                         db, table_name);
   if (trans)
     ndb->closeTransaction(trans);
-  ndb->setDatabaseName(old_db);
+  ndb->setDatabaseName(save_db);
   DBUG_RETURN(0);
 }
 

--- 1.8/sql/ha_ndbcluster_binlog.h	2006-02-21 13:50:11 +01:00
+++ 1.9/sql/ha_ndbcluster_binlog.h	2006-03-01 18:22:54 +01:00
@@ -95,7 +95,9 @@
                              const char *db, const char *table_name,
                              uint32 ndb_table_id,
                              uint32 ndb_table_version,
-                             enum SCHEMA_OP_TYPE type);
+                             enum SCHEMA_OP_TYPE type,
+                             const char *old_db= 0,
+                             const char *old_table_name= 0);
 int ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
                                  NDB_SHARE *share);
 void ndb_rep_event_name(String *event_name,
Thread
bk commit into 5.1 tree (tomas:1.2216) BUG#17827tomas1 Mar