MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jonas Date:June 26 2006 1:08pm
Subject:bk commit into 5.1 tree (jonas:1.2204) BUG#20053
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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.2204 06/06/26 15:08:09 jonas@stripped +7 -0
  ndb - bug#20053
    make sure we can only drop files from correct file group

  storage/ndb/tools/restore/consumer_restore.cpp
    1.32 06/06/26 15:08:06 jonas@stripped +8 -5
    Cleanup {data/undo}file get{tablespace/logfilegroup}

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
    1.62 06/06/26 15:08:06 jonas@stripped +10 -2
    Cleanup {data/undo}file get{tablespace/logfilegroup}

  storage/ndb/src/ndbapi/NdbDictionary.cpp
    1.60 06/06/26 15:08:06 jonas@stripped +22 -10
    Cleanup {data/undo}file get{tablespace/logfilegroup}

  storage/ndb/include/ndbapi/NdbDictionary.hpp
    1.79 06/06/26 15:08:06 jonas@stripped +4 -4
    Cleanup {data/undo}file get{tablespace/logfilegroup}

  sql/ha_ndbcluster.cc
    1.323 06/06/26 15:08:05 jonas@stripped +10 -5
    Make sure correct tablespace for dropping datafile

  mysql-test/t/ndb_dd_ddl.test
    1.11 06/06/26 15:08:05 jonas@stripped +26 -0
    add testcase

  mysql-test/r/ndb_dd_ddl.result
    1.12 06/06/26 15:08:05 jonas@stripped +18 -0
    add testcase

# 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:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/51-work

--- 1.11/mysql-test/r/ndb_dd_ddl.result	2006-06-22 13:52:58 +02:00
+++ 1.12/mysql-test/r/ndb_dd_ddl.result	2006-06-26 15:08:05 +02:00
@@ -188,6 +188,19 @@ ENGINE NDB;
 CREATE INDEX b_i on t1(b);
 CREATE INDEX bc_i on t1(b, c);
 DROP TABLE t1;
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile3.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+ERROR HY000: Failed to alter:  NO SUCH FILE
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+ERROR HY000: Failed to alter:  NO SUCH FILE
 ALTER TABLESPACE ts1
 DROP DATAFILE 'datafile2.dat'
 ENGINE NDB;
@@ -195,6 +208,11 @@ ALTER TABLESPACE ts1
 DROP DATAFILE 'datafile.dat'
 ENGINE NDB;
 DROP TABLESPACE ts1
+ENGINE NDB;
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+DROP TABLESPACE ts2
 ENGINE NDB;
 DROP LOGFILE GROUP lg1
 ENGINE NDB;

--- 1.10/mysql-test/t/ndb_dd_ddl.test	2006-06-22 13:52:58 +02:00
+++ 1.11/mysql-test/t/ndb_dd_ddl.test	2006-06-26 15:08:05 +02:00
@@ -280,6 +280,25 @@ CREATE INDEX bc_i on t1(b, c);
 
 DROP TABLE t1;
 
+# bug#20053
+
+CREATE TABLESPACE ts2
+ADD DATAFILE 'datafile3.dat'
+USE LOGFILE GROUP lg1
+INITIAL_SIZE 1M
+ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts1
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+
+--error ER_ALTER_FILEGROUP_FAILED
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile2.dat'
+ENGINE NDB;
+# bug#20053
+
 ALTER TABLESPACE ts1
 DROP DATAFILE 'datafile2.dat'
 ENGINE NDB;
@@ -289,6 +308,13 @@ DROP DATAFILE 'datafile.dat'
 ENGINE NDB;
 
 DROP TABLESPACE ts1
+ENGINE NDB;
+
+ALTER TABLESPACE ts2
+DROP DATAFILE 'datafile3.dat'
+ENGINE NDB;
+
+DROP TABLESPACE ts2
 ENGINE NDB;
 
 DROP LOGFILE GROUP lg1

--- 1.78/storage/ndb/include/ndbapi/NdbDictionary.hpp	2006-06-22 10:24:40 +02:00
+++ 1.79/storage/ndb/include/ndbapi/NdbDictionary.hpp	2006-06-26 15:08:06 +02:00
@@ -184,7 +184,7 @@ public:
     virtual int getObjectId() const;
     
   private:
-    friend class Dictionary;
+    friend class NdbDictObjectImpl;
     class NdbDictObjectImpl & m_impl;
   };
   
@@ -1462,11 +1462,11 @@ public:
     void setSize(Uint64);
     Uint64 getSize() const;
     Uint64 getFree() const;
-
+    
     void setTablespace(const char * name);
     void setTablespace(const class Tablespace &);
     const char * getTablespace() const;
-    Uint32 getTablespaceId() const;
+    void getTablespaceId(ObjectId * dst) const;
 
     void setNode(Uint32 nodeId);
     Uint32 getNode() const;
@@ -1509,7 +1509,7 @@ public:
     void setLogfileGroup(const char * name);
     void setLogfileGroup(const class LogfileGroup &);
     const char * getLogfileGroup() const;
-    Uint32 getLogfileGroupId() const;
+    void getLogfileGroupId(ObjectId * dst) const;
 
     void setNode(Uint32 nodeId);
     Uint32 getNode() const;

--- 1.59/storage/ndb/src/ndbapi/NdbDictionary.cpp	2006-06-22 10:24:40 +02:00
+++ 1.60/storage/ndb/src/ndbapi/NdbDictionary.cpp	2006-06-26 15:08:06 +02:00
@@ -1224,9 +1224,14 @@ NdbDictionary::Datafile::getTablespace()
   return m_impl.m_filegroup_name.c_str();
 }
 
-Uint32
-NdbDictionary::Datafile::getTablespaceId() const {
-  return m_impl.m_filegroup_id;
+void
+NdbDictionary::Datafile::getTablespaceId(NdbDictionary::ObjectId* dst) const 
+{
+  if (dst)
+  {
+    NdbDictObjectImpl::getImpl(* dst).m_id = m_impl.m_filegroup_id;
+    NdbDictObjectImpl::getImpl(* dst).m_version = m_impl.m_filegroup_version;
+  }
 }
 
 NdbDictionary::Object::Status
@@ -1310,9 +1315,14 @@ NdbDictionary::Undofile::getLogfileGroup
   return m_impl.m_filegroup_name.c_str();
 }
 
-Uint32
-NdbDictionary::Undofile::getLogfileGroupId() const {
-  return m_impl.m_filegroup_id;
+void
+NdbDictionary::Undofile::getLogfileGroupId(NdbDictionary::ObjectId * dst)const 
+{
+  if (dst)
+  {
+    NdbDictObjectImpl::getImpl(* dst).m_id = m_impl.m_filegroup_id;
+    NdbDictObjectImpl::getImpl(* dst).m_version = m_impl.m_filegroup_version;
+  }
 }
 
 NdbDictionary::Object::Status
@@ -1829,7 +1839,8 @@ NdbDictionary::Dictionary::createLogfile
 					      ObjectId * obj)
 {
   return m_impl.createLogfileGroup(NdbLogfileGroupImpl::getImpl(lg),
-				   obj ? &obj->m_impl : 0);
+				   obj ? 
+				   & NdbDictObjectImpl::getImpl(* obj) : 0);
 }
 
 int
@@ -1852,7 +1863,8 @@ NdbDictionary::Dictionary::createTablesp
 					    ObjectId * obj)
 {
   return m_impl.createTablespace(NdbTablespaceImpl::getImpl(lg),
-				 obj ? &obj->m_impl : 0);
+				 obj ? 
+				 & NdbDictObjectImpl::getImpl(* obj) : 0);
 }
 
 int
@@ -1887,7 +1899,7 @@ NdbDictionary::Dictionary::createDatafil
 {
   return m_impl.createDatafile(NdbDatafileImpl::getImpl(df), 
 			       force,
-			       obj ? &obj->m_impl : 0);
+			       obj ? & NdbDictObjectImpl::getImpl(* obj) : 0);
 }
 
 int
@@ -1913,7 +1925,7 @@ NdbDictionary::Dictionary::createUndofil
 {
   return m_impl.createUndofile(NdbUndofileImpl::getImpl(df), 
 			       force,
-			       obj ? &obj->m_impl : 0);
+			       obj ? & NdbDictObjectImpl::getImpl(* obj) : 0);
 }
 
 int

--- 1.61/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-06-22 10:24:40 +02:00
+++ 1.62/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-06-26 15:08:06 +02:00
@@ -46,14 +46,22 @@ public:
   NdbDictionary::Object::Status m_status;
   
   bool change();
+  
+  static NdbDictObjectImpl & getImpl(NdbDictionary::ObjectId & t) { 
+    return t.m_impl;
+  }
+  static const NdbDictObjectImpl & getImpl(const NdbDictionary::ObjectId & t){
+    return t.m_impl;
+  }
+  
 protected:
+  friend class NdbDictionary::ObjectId;
+
   NdbDictObjectImpl(NdbDictionary::Object::Type type) :
     m_type(type),
     m_status(NdbDictionary::Object::New) {
     m_id = -1;
   }
-  
-  friend class NdbDictionary::ObjectId;
 };
 
 /**

--- 1.322/sql/ha_ndbcluster.cc	2006-06-22 10:24:40 +02:00
+++ 1.323/sql/ha_ndbcluster.cc	2006-06-26 15:08:05 +02:00
@@ -9949,7 +9949,7 @@ int ndbcluster_alter_tablespace(THD* thd
   }
 
   NdbError err;
-  NDBDICT *dict = ndb->getDictionary();
+  NDBDICT *dict= ndb->getDictionary();
   int error;
   const char * errmsg;
   LINT_INIT(errmsg);
@@ -10013,9 +10013,12 @@ int ndbcluster_alter_tablespace(THD* thd
     }
     else if(info->ts_alter_tablespace_type == ALTER_TABLESPACE_DROP_FILE)
     {
-      NdbDictionary::Datafile df = dict->getDatafile(0, 
-						     info->data_file_name);
-      if (strcmp(df.getPath(), info->data_file_name) == 0)
+      NdbDictionary::Tablespace ts= dict->getTablespace(info->tablespace_name);
+      NdbDictionary::Datafile df= dict->getDatafile(0, info->data_file_name);
+      NdbDictionary::ObjectId objid;
+      df.getTablespaceId(&objid);
+      if (ts.getObjectId() == objid.getObjectId() && 
+	  strcmp(df.getPath(), info->data_file_name) == 0)
       {
 	errmsg= " DROP DATAFILE";
 	if (dict->dropDatafile(df))
@@ -10344,10 +10347,12 @@ static int ndbcluster_fill_files_table(T
       table->field[c++]->set_null(); // TABLE_NAME
 
       // LOGFILE_GROUP_NAME
+      NdbDictionary::ObjectId objid;
+      uf.getLogfileGroupId(&objid);
       table->field[c++]->store(uf.getLogfileGroup(),
                                strlen(uf.getLogfileGroup()),
                                system_charset_info);
-      table->field[c++]->store(uf.getLogfileGroupId()); // LOGFILE_GROUP_NUMBER
+      table->field[c++]->store(objid.getObjectId()); // LOGFILE_GROUP_NUMBER
       table->field[c++]->store(ndbcluster_hton_name,
                                ndbcluster_hton_name_length,
                                system_charset_info); // ENGINE

--- 1.31/storage/ndb/tools/restore/consumer_restore.cpp	2006-05-17 12:43:16 +02:00
+++ 1.32/storage/ndb/tools/restore/consumer_restore.cpp	2006-06-26 15:08:06 +02:00
@@ -533,9 +533,11 @@ BackupRestore::object(Uint32 type, const
     if (!m_no_restore_disk)
     {
       NdbDictionary::Datafile old(*(NdbDictionary::Datafile*)ptr);
-      NdbDictionary::Tablespace * ts = m_tablespaces[old.getTablespaceId()];
+      NdbDictionary::ObjectId objid;
+      old.getTablespaceId(&objid);
+      NdbDictionary::Tablespace * ts = m_tablespaces[objid.getObjectId()];
       debug << "Connecting datafile " << old.getPath() 
-	    << " to tablespace: oldid: " << old.getTablespaceId() 
+	    << " to tablespace: oldid: " << objid.getObjectId()
 	    << " newid: " << ts->getObjectId() << endl;
       old.setTablespace(* ts);
       info << "Creating datafile \"" << old.getPath() << "\"..." << flush;
@@ -554,10 +556,11 @@ BackupRestore::object(Uint32 type, const
     if (!m_no_restore_disk)
     {
       NdbDictionary::Undofile old(*(NdbDictionary::Undofile*)ptr);
-      NdbDictionary::LogfileGroup * lg = 
-	m_logfilegroups[old.getLogfileGroupId()];
+      NdbDictionary::ObjectId objid;
+      old.getLogfileGroupId(&objid);
+      NdbDictionary::LogfileGroup * lg = m_logfilegroups[objid.getObjectId()];
       debug << "Connecting undofile " << old.getPath() 
-	    << " to logfile group: oldid: " << old.getLogfileGroupId() 
+	    << " to logfile group: oldid: " << objid.getObjectId()
 	    << " newid: " << lg->getObjectId() 
 	    << " " << (void*)lg << endl;
       old.setLogfileGroup(* lg);
Thread
bk commit into 5.1 tree (jonas:1.2204) BUG#20053jonas26 Jun