List:Commits« Previous MessageNext Message »
From:jonas Date:June 22 2006 8:52am
Subject:bk commit into 5.1 tree (jonas:1.2237)
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.2237 06/06/22 10:52:45 jonas@stripped +4 -0
  Merge perch.ndb.mysql.com:/home/jonas/src/51-work
  into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
    1.63 06/06/22 10:52:41 jonas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.143 06/06/22 10:52:41 jonas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.90 06/06/22 10:52:40 jonas@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.cc
    1.330 06/06/22 10:52:40 jonas@stripped +0 -0
    Auto merged

# 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/mysql-5.1-new-ndb/RESYNC

--- 1.89/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-06-21 16:03:06 +02:00
+++ 1.90/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-06-22 10:52:40 +02:00
@@ -13986,7 +13986,8 @@ Dbdict::trans_commit_complete_done(Signa
     conf->senderRef = reference();
     conf->senderData = trans_ptr.p->m_senderData;
     conf->fileId = f_ptr.p->key;
-    
+    conf->fileVersion = f_ptr.p->m_version;
+
     //@todo check api failed
     sendSignal(trans_ptr.p->m_senderRef, GSN_CREATE_FILE_CONF, signal, 
 	       CreateFileConf::SignalLength, JBB);

--- 1.142/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-06-16 08:46:45 +02:00
+++ 1.143/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-06-22 10:52:41 +02:00
@@ -4391,19 +4391,23 @@ NdbUndofileImpl::assign(const NdbUndofil
 }
 
 int 
-NdbDictionaryImpl::createDatafile(const NdbDatafileImpl & file, bool force){
+NdbDictionaryImpl::createDatafile(const NdbDatafileImpl & file, 
+				  bool force,
+				  NdbDictObjectImpl* obj)
+  
+{
   DBUG_ENTER("NdbDictionaryImpl::createDatafile");
   NdbFilegroupImpl tmp(NdbDictionary::Object::Tablespace);
   if(file.m_filegroup_version != ~(Uint32)0){
     tmp.m_id = file.m_filegroup_id;
     tmp.m_version = file.m_filegroup_version;
-    DBUG_RETURN(m_receiver.create_file(file, tmp));
+    DBUG_RETURN(m_receiver.create_file(file, tmp, force, obj));
   }
   
   
   if(m_receiver.get_filegroup(tmp, NdbDictionary::Object::Tablespace,
 			      file.m_filegroup_name.c_str()) == 0){
-    DBUG_RETURN(m_receiver.create_file(file, tmp, force));
+    DBUG_RETURN(m_receiver.create_file(file, tmp, force, obj));
   }
   DBUG_RETURN(-1); 
 }
@@ -4414,53 +4418,65 @@ NdbDictionaryImpl::dropDatafile(const Nd
 }
 
 int
-NdbDictionaryImpl::createUndofile(const NdbUndofileImpl & file, bool force){
+NdbDictionaryImpl::createUndofile(const NdbUndofileImpl & file, 
+				  bool force,
+				  NdbDictObjectImpl* obj)
+{
   DBUG_ENTER("NdbDictionaryImpl::createUndofile");
   NdbFilegroupImpl tmp(NdbDictionary::Object::LogfileGroup);
   if(file.m_filegroup_version != ~(Uint32)0){
     tmp.m_id = file.m_filegroup_id;
     tmp.m_version = file.m_filegroup_version;
-    DBUG_RETURN(m_receiver.create_file(file, tmp));
+    DBUG_RETURN(m_receiver.create_file(file, tmp, force, obj));
   }
   
   
   if(m_receiver.get_filegroup(tmp, NdbDictionary::Object::LogfileGroup,
 			      file.m_filegroup_name.c_str()) == 0){
-    DBUG_RETURN(m_receiver.create_file(file, tmp, force));
+    DBUG_RETURN(m_receiver.create_file(file, tmp, force, obj));
   }
   DBUG_PRINT("info", ("Failed to find filegroup"));
   DBUG_RETURN(-1);
 }
 
 int
-NdbDictionaryImpl::dropUndofile(const NdbUndofileImpl & file){
+NdbDictionaryImpl::dropUndofile(const NdbUndofileImpl & file)
+{
   return m_receiver.drop_file(file);
 }
 
 int
-NdbDictionaryImpl::createTablespace(const NdbTablespaceImpl & fg){
-  return m_receiver.create_filegroup(fg);
+NdbDictionaryImpl::createTablespace(const NdbTablespaceImpl & fg,
+				    NdbDictObjectImpl* obj)
+{
+  return m_receiver.create_filegroup(fg, obj);
 }
 
 int
-NdbDictionaryImpl::dropTablespace(const NdbTablespaceImpl & fg){
+NdbDictionaryImpl::dropTablespace(const NdbTablespaceImpl & fg)
+{
   return m_receiver.drop_filegroup(fg);
 }
 
 int
-NdbDictionaryImpl::createLogfileGroup(const NdbLogfileGroupImpl & fg){
- return m_receiver.create_filegroup(fg);
+NdbDictionaryImpl::createLogfileGroup(const NdbLogfileGroupImpl & fg,
+				      NdbDictObjectImpl* obj)
+{
+  return m_receiver.create_filegroup(fg, obj);
 }
 
 int
-NdbDictionaryImpl::dropLogfileGroup(const NdbLogfileGroupImpl & fg){
+NdbDictionaryImpl::dropLogfileGroup(const NdbLogfileGroupImpl & fg)
+{
   return m_receiver.drop_filegroup(fg);
 }
 
 int
 NdbDictInterface::create_file(const NdbFileImpl & file,
 			      const NdbFilegroupImpl & group,
-			      bool overwrite){
+			      bool overwrite,
+			      NdbDictObjectImpl* obj)
+{
   DBUG_ENTER("NdbDictInterface::create_file"); 
   UtilBufferWriter w(m_buffer);
   DictFilegroupInfo::File f; f.init();
@@ -4503,23 +4519,39 @@ NdbDictInterface::create_file(const NdbF
     Send signal without time-out since creating files can take a very long
     time if the file is very big.
   */
-  DBUG_RETURN(dictSignal(&tSignal, ptr, 1,
-	                 0, // master
-		         WAIT_CREATE_INDX_REQ,
-		         -1, 100,
-		         err));
+  int ret = dictSignal(&tSignal, ptr, 1,
+		       0, // master
+		       WAIT_CREATE_INDX_REQ,
+		       -1, 100,
+		       err);
+
+  if (ret == 0 && obj)
+  {
+    Uint32* data = (Uint32*)m_buffer.get_data();
+    obj->m_id = data[0];
+    obj->m_version = data[1];
+  }
+
+  DBUG_RETURN(ret);
 }
 
 void
 NdbDictInterface::execCREATE_FILE_CONF(NdbApiSignal * signal,
-					    LinearSectionPtr ptr[3])
+				       LinearSectionPtr ptr[3])
 {
+  const CreateFileConf* conf=
+    CAST_CONSTPTR(CreateFileConf, signal->getDataPtr());
+  m_buffer.grow(4 * 2); // 2 words
+  Uint32* data = (Uint32*)m_buffer.get_data();
+  data[0] = conf->fileId;
+  data[1] = conf->fileVersion;
+  
   m_waiter.signal(NO_WAIT);  
 }
 
 void
 NdbDictInterface::execCREATE_FILE_REF(NdbApiSignal * signal,
-					   LinearSectionPtr ptr[3])
+				      LinearSectionPtr ptr[3])
 {
   const CreateFileRef* ref = 
     CAST_CONSTPTR(CreateFileRef, signal->getDataPtr());
@@ -4529,7 +4561,8 @@ NdbDictInterface::execCREATE_FILE_REF(Nd
 }
 
 int
-NdbDictInterface::drop_file(const NdbFileImpl & file){
+NdbDictInterface::drop_file(const NdbFileImpl & file)
+{
   DBUG_ENTER("NdbDictInterface::drop_file");
   NdbApiSignal tSignal(m_reference);
   tSignal.theReceiversBlockNumber = DBDICT;
@@ -4569,7 +4602,9 @@ NdbDictInterface::execDROP_FILE_REF(NdbA
 }
 
 int
-NdbDictInterface::create_filegroup(const NdbFilegroupImpl & group){
+NdbDictInterface::create_filegroup(const NdbFilegroupImpl & group,
+				   NdbDictObjectImpl* obj)
+{
   DBUG_ENTER("NdbDictInterface::create_filegroup");
   UtilBufferWriter w(m_buffer);
   DictFilegroupInfo::Filegroup fg; fg.init();
@@ -4638,17 +4673,32 @@ NdbDictInterface::create_filegroup(const
   ptr[0].sz = m_buffer.length() / 4;
 
   int err[] = { CreateFilegroupRef::Busy, CreateFilegroupRef::NotMaster, 0};
-  DBUG_RETURN(dictSignal(&tSignal, ptr, 1,
-	                 0, // master
-		         WAIT_CREATE_INDX_REQ,
-		         DICT_WAITFOR_TIMEOUT, 100,
-		         err));
+  int ret = dictSignal(&tSignal, ptr, 1,
+		       0, // master
+		       WAIT_CREATE_INDX_REQ,
+		       DICT_WAITFOR_TIMEOUT, 100,
+		       err);
+  
+  if (ret == 0 && obj)
+  {
+    Uint32* data = (Uint32*)m_buffer.get_data();
+    obj->m_id = data[0];
+    obj->m_version = data[1];
+  }
+  
+  DBUG_RETURN(ret);
 }
 
 void
 NdbDictInterface::execCREATE_FILEGROUP_CONF(NdbApiSignal * signal,
 					    LinearSectionPtr ptr[3])
 {
+  const CreateFilegroupConf* conf=
+    CAST_CONSTPTR(CreateFilegroupConf, signal->getDataPtr());
+  m_buffer.grow(4 * 2); // 2 words
+  Uint32* data = (Uint32*)m_buffer.get_data();
+  data[0] = conf->filegroupId;
+  data[1] = conf->filegroupVersion;
   m_waiter.signal(NO_WAIT);  
 }
 
@@ -4664,7 +4714,8 @@ NdbDictInterface::execCREATE_FILEGROUP_R
 }
 
 int
-NdbDictInterface::drop_filegroup(const NdbFilegroupImpl & group){
+NdbDictInterface::drop_filegroup(const NdbFilegroupImpl & group)
+{
   DBUG_ENTER("NdbDictInterface::drop_filegroup");
   NdbApiSignal tSignal(m_reference);
   tSignal.theReceiversBlockNumber = DBDICT;

--- 1.62/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-06-16 08:46:45 +02:00
+++ 1.63/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-06-22 10:52:41 +02:00
@@ -52,6 +52,8 @@ protected:
     m_status(NdbDictionary::Object::New) {
     m_id = -1;
   }
+  
+  friend class NdbDictionary::ObjectId;
 };
 
 /**
@@ -468,9 +470,10 @@ public:
   static int parseFilegroupInfo(NdbFilegroupImpl &dst,
 				const Uint32 * data, Uint32 len);
   
-  int create_file(const NdbFileImpl &, const NdbFilegroupImpl&, bool overwrite = false);
+  int create_file(const NdbFileImpl &, const NdbFilegroupImpl&, 
+		  bool overwrite, NdbDictObjectImpl*);
   int drop_file(const NdbFileImpl &);
-  int create_filegroup(const NdbFilegroupImpl &);
+  int create_filegroup(const NdbFilegroupImpl &, NdbDictObjectImpl*);
   int drop_filegroup(const NdbFilegroupImpl &);
   
   int get_filegroup(NdbFilegroupImpl&, NdbDictionary::Object::Type, Uint32);
@@ -622,17 +625,17 @@ public:
   NdbEventImpl * getBlobEvent(const NdbEventImpl& ev, uint col_no);
   NdbEventImpl * getEventImpl(const char * internalName);
 
-  int createDatafile(const NdbDatafileImpl &, bool force = false);
+  int createDatafile(const NdbDatafileImpl &, bool force, NdbDictObjectImpl*);
   int dropDatafile(const NdbDatafileImpl &);
-  int createUndofile(const NdbUndofileImpl &, bool force = false);
+  int createUndofile(const NdbUndofileImpl &, bool force, NdbDictObjectImpl*);
   int dropUndofile(const NdbUndofileImpl &);
 
-  int createTablespace(const NdbTablespaceImpl &);
+  int createTablespace(const NdbTablespaceImpl &, NdbDictObjectImpl*);
   int dropTablespace(const NdbTablespaceImpl &);
 
-  int createLogfileGroup(const NdbLogfileGroupImpl &);
+  int createLogfileGroup(const NdbLogfileGroupImpl &, NdbDictObjectImpl*);
   int dropLogfileGroup(const NdbLogfileGroupImpl &);
-
+  
   const NdbError & getNdbError() const;
   NdbError m_error;
   Uint32 m_local_table_data_size;

--- 1.329/sql/ha_ndbcluster.cc	2006-06-19 16:30:10 +02:00
+++ 1.330/sql/ha_ndbcluster.cc	2006-06-22 10:52:40 +02:00
@@ -9976,7 +9976,8 @@ int ndbcluster_alter_tablespace(THD* thd
   {
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
   }
-  
+
+  NdbError err;
   NDBDICT *dict = ndb->getDictionary();
   int error;
   const char * errmsg;
@@ -9989,6 +9990,7 @@ int ndbcluster_alter_tablespace(THD* thd
     
     NdbDictionary::Tablespace ndb_ts;
     NdbDictionary::Datafile ndb_df;
+    NdbDictionary::ObjectId objid;
     if (set_up_tablespace(info, &ndb_ts))
     {
       DBUG_RETURN(1);
@@ -9998,7 +10000,7 @@ int ndbcluster_alter_tablespace(THD* thd
       DBUG_RETURN(1);
     }
     errmsg= "TABLESPACE";
-    if (dict->createTablespace(ndb_ts))
+    if (dict->createTablespace(ndb_ts, &objid))
     {
       DBUG_PRINT("error", ("createTablespace returned %d", error));
       goto ndberror;
@@ -10007,8 +10009,17 @@ int ndbcluster_alter_tablespace(THD* thd
     errmsg= "DATAFILE";
     if (dict->createDatafile(ndb_df))
     {
+      err= dict->getNdbError();
+      NdbDictionary::Tablespace tmp= dict->getTablespace(ndb_ts.getName());
+      if (dict->getNdbError().code == 0 &&
+	  tmp.getObjectId() == objid.getObjectId() &&
+	  tmp.getObjectVersion() == objid.getObjectVersion())
+      {
+	dict->dropTablespace(tmp);
+      }
+      
       DBUG_PRINT("error", ("createDatafile returned %d", error));
-      goto ndberror;
+      goto ndberror2;
     }
     is_tablespace= 1;
     break;
@@ -10062,6 +10073,7 @@ int ndbcluster_alter_tablespace(THD* thd
     error= ER_CREATE_FILEGROUP_FAILED;
     NdbDictionary::LogfileGroup ndb_lg;
     NdbDictionary::Undofile ndb_uf;
+    NdbDictionary::ObjectId objid;
     if (info->undo_file_name == NULL)
     {
       /*
@@ -10074,7 +10086,7 @@ int ndbcluster_alter_tablespace(THD* thd
       DBUG_RETURN(1);
     }
     errmsg= "LOGFILE GROUP";
-    if (dict->createLogfileGroup(ndb_lg))
+    if (dict->createLogfileGroup(ndb_lg, &objid))
     {
       goto ndberror;
     }
@@ -10086,7 +10098,15 @@ int ndbcluster_alter_tablespace(THD* thd
     errmsg= "UNDOFILE";
     if (dict->createUndofile(ndb_uf))
     {
-      goto ndberror;
+      err= dict->getNdbError();
+      NdbDictionary::LogfileGroup tmp= dict->getLogfileGroup(ndb_lg.getName());
+      if (dict->getNdbError().code == 0 &&
+	  tmp.getObjectId() == objid.getObjectId() &&
+	  tmp.getObjectVersion() == objid.getObjectVersion())
+      {
+	dict->dropLogfileGroup(tmp);
+      }
+      goto ndberror2;
     }
     break;
   }
@@ -10163,7 +10183,8 @@ int ndbcluster_alter_tablespace(THD* thd
   DBUG_RETURN(FALSE);
 
 ndberror:
-  const NdbError err= dict->getNdbError();
+  err= dict->getNdbError();
+ndberror2:
   ERR_PRINT(err);
   ndb_to_mysql_error(&err);
   
Thread
bk commit into 5.1 tree (jonas:1.2237)jonas22 Jun