List:Internals« Previous MessageNext Message »
From:jonas Date:August 18 2005 12:25pm
Subject:bk commit into 5.0 tree (jonas:1.1901)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.1901 05/08/18 14:25:00 jonas@eel.(none) +24 -0
  Merge eel.(none):/home/jonas/src/mysql-4.1
  into  eel.(none):/home/jonas/src/mysql-5.0

  ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.84 05/08/18 14:24:56 jonas@eel.(none) +1 -2
    merge

  ndb/src/common/util/version.c
    1.22 05/08/18 14:24:56 jonas@eel.(none) +4 -4
    merge

  mysql-test/t/ndb_alter_table.test
    1.23 05/08/18 14:24:56 jonas@eel.(none) +0 -1
    merge

  sql/ha_ndbcluster.cc
    1.195 05/08/18 14:09:09 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/ndbapi/TransporterFacade.cpp
    1.39 05/08/18 14:09:09 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/ndbapi/DictCache.hpp
    1.9 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/ndbapi/DictCache.cpp
    1.15 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/mgmsrv/MgmtSrvr.cpp
    1.78 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/suma/Suma.cpp
    1.20 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.16 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
    1.5 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/qmgr/Qmgr.hpp
    1.6 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.15 05/08/18 14:09:08 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
    1.80 05/08/18 14:09:07 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dbtc/Dbtc.hpp
    1.29 05/08/18 14:09:07 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
    1.70 05/08/18 14:09:07 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
    1.32 05/08/18 14:09:06 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp
    1.10 05/08/18 14:09:06 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dbdict/Dbdict.hpp
    1.14 05/08/18 14:09:06 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.50 05/08/18 14:09:06 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
    1.20 05/08/18 14:09:05 jonas@eel.(none) +0 -0
    Auto merged

  ndb/src/kernel/SimBlockList.cpp
    1.8 05/08/18 14:09:05 jonas@eel.(none) +0 -0
    Auto merged

  ndb/include/ndbapi/NdbDictionary.hpp
    1.51 05/08/18 14:09:05 jonas@eel.(none) +0 -0
    Auto merged

  mysql-test/r/ndb_alter_table.result
    1.29 05/08/18 14:09:05 jonas@eel.(none) +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:	eel.(none)
# Root:	/home/jonas/src/mysql-5.0/RESYNC

--- 1.28/mysql-test/r/ndb_alter_table.result	2005-04-08 19:41:00 +02:00
+++ 1.29/mysql-test/r/ndb_alter_table.result	2005-08-18 14:09:05 +02:00
@@ -179,8 +179,24 @@
 2	two	two
 alter table t1 drop index c;
 select * from t1 where b = 'two';
-ERROR HY000: Table definition has changed, please retry transaction
+a	b	c
+2	two	two
 select * from t1 where b = 'two';
 a	b	c
 2	two	two
 drop table t1;
+create table t3 (a int primary key) engine=ndbcluster;
+begin;
+insert into t3 values (1);
+alter table t3 rename t4;
+delete from t3;
+insert into t3 values (1);
+commit;
+select * from t3;
+ERROR HY000: Can't lock file (errno: 155)
+select * from t4;
+a
+1
+drop table t4;
+show tables;
+Tables_in_test

--- 1.22/mysql-test/t/ndb_alter_table.test	2005-07-03 13:17:45 +02:00
+++ 1.23/mysql-test/t/ndb_alter_table.test	2005-08-18 14:24:56 +02:00
@@ -151,7 +151,6 @@
 connection server1;
 alter table t1 drop index c;
 connection server2;
---error 1412
 select * from t1 where b = 'two';
 select * from t1 where b = 'two';
 connection server1;
@@ -179,3 +178,28 @@
 #truncate table t2;
 #select count(*) from t2;
 #drop table t2;
+
+connection server1;
+create table t3 (a int primary key) engine=ndbcluster;
+
+connection server2;
+begin;
+insert into t3 values (1);
+
+connection server1;
+alter table t3 rename t4;
+
+connection server2;
+# This should work as transaction is ongoing...
+delete from t3;
+insert into t3 values (1);
+commit; 
+
+# This should fail as its a new transaction
+--error 1015
+select * from t3;
+select * from t4;
+drop table t4;
+show tables;
+connection server1;
+

--- 1.50/ndb/include/ndbapi/NdbDictionary.hpp	2005-07-20 13:22:36 +02:00
+++ 1.51/ndb/include/ndbapi/NdbDictionary.hpp	2005-08-18 14:09:05 +02:00
@@ -78,9 +78,10 @@
                               ///< changes to take effect
       Retrieved,              ///< The object exist and has been read 
                               ///< into main memory from NDB Kernel
-      Invalid                 ///< The object has been invalidated
+      Invalid,                ///< The object has been invalidated
                               ///< and should not be used
-      
+      Altered                 ///< Table has been altered in NDB kernel
+                              ///< but is still valid for usage
     };
 
     /**

--- 1.21/ndb/src/common/util/version.c	2005-07-14 19:52:40 +02:00
+++ 1.22/ndb/src/common/util/version.c	2005-08-18 14:24:56 +02:00
@@ -92,9 +92,10 @@
 
 #ifndef TEST_VERSION
 struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
-  { MAKE_VERSION(5,0,NDB_VERSION_BUILD), MAKE_VERSION(5,0,3), UG_Range},
-  { MAKE_VERSION(5,0,3), MAKE_VERSION(5,0,2), UG_Exact },
-  { MAKE_VERSION(4,1,12), MAKE_VERSION(4,1,10), UG_Range },
+  { MAKE_VERSION(5,0,NDB_VERSION_BUILD), MAKE_VERSION(5,0,12), UG_Range},
+  { MAKE_VERSION(5,0,11), MAKE_VERSION(5,0,2), UG_Range},
+  { MAKE_VERSION(4,1,NDB_VERSION_BUILD), MAKE_VERSION(4,1,15), UG_Range },
+  { MAKE_VERSION(4,1,14), MAKE_VERSION(4,1,10), UG_Range },
   { MAKE_VERSION(4,1,10), MAKE_VERSION(4,1,9), UG_Exact },
   { MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
   { MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact },
@@ -102,7 +103,9 @@
 };
 
 struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
+  { MAKE_VERSION(5,0,12), MAKE_VERSION(5,0,11), UG_Exact },
   { MAKE_VERSION(5,0,2), MAKE_VERSION(4,1,8), UG_Exact },
+  { MAKE_VERSION(4,1,15), MAKE_VERSION(4,1,14), UG_Exact },
   { MAKE_VERSION(3,5,4), MAKE_VERSION(3,5,3), UG_Exact },
   { 0, 0, UG_Null }
 };

--- 1.19/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2005-04-22 09:09:16 +02:00
+++ 1.20/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2005-08-18 14:09:05 +02:00
@@ -988,7 +988,6 @@
   sendSignal(BACKUP_REF, GSN_DUMP_STATE_ORD,  signal, signal->length(), JBB);
   sendSignal(DBUTIL_REF, GSN_DUMP_STATE_ORD,  signal, signal->length(), JBB);
   sendSignal(SUMA_REF, GSN_DUMP_STATE_ORD,    signal, signal->length(), JBB);
-  sendSignal(GREP_REF, GSN_DUMP_STATE_ORD,    signal, signal->length(), JBB);
   sendSignal(TRIX_REF, GSN_DUMP_STATE_ORD,    signal, signal->length(), JBB);
   sendSignal(DBTUX_REF, GSN_DUMP_STATE_ORD,   signal, signal->length(), JBB);
   

--- 1.49/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-07-21 11:25:35 +02:00
+++ 1.50/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-08-18 14:09:06 +02:00
@@ -77,6 +77,7 @@
 #include <signaldata/CreateFragmentation.hpp>
 #include <signaldata/CreateTab.hpp>
 #include <NdbSleep.h>
+#include <signaldata/ApiBroadcast.hpp>
 
 #define ZNOT_FOUND 626
 #define ZALREADYEXIST 630
@@ -91,6 +92,27 @@
 #define DIV(x,y) (((x)+(y)-1)/(y))
 #include <ndb_version.h>
 
+static
+Uint32
+alter_table_inc_schema_version(Uint32 old)
+{
+   return (old & 0x00FFFFFF) + ((old + 0x1000000) & 0xFF000000);
+}
+
+static
+Uint32
+alter_table_dec_schema_version(Uint32 old)
+{
+  return (old & 0x00FFFFFF) + ((old - 0x1000000) & 0xFF000000);
+}
+
+static
+Uint32
+create_table_inc_schema_version(Uint32 old)
+{
+  return (old + 0x00000001) & 0x00FFFFFF;
+}
+
 /* **************************************************************** */
 /* ---------------------------------------------------------------- */
 /* MODULE:          GENERAL MODULE -------------------------------- */
@@ -604,7 +626,7 @@
     jam();
     fsOpenReq->fileFlags = FsOpenReq::OM_READONLY;
   }//if
-  ndbrequire(tablePtr.p->tableVersion < ZNIL);
+
   fsOpenReq->fileNumber[3] = 0; // Initialise before byte changes
   FsOpenReq::setVersion(fsOpenReq->fileNumber, 1);
   FsOpenReq::setSuffix(fsOpenReq->fileNumber, FsOpenReq::S_TABLELIST);
@@ -794,7 +816,7 @@
   case SchemaFile::ADD_STARTED:
     jam();
     ok = true;
-    ndbrequire((oldVersion + 1) == newVersion);
+    ndbrequire(create_table_inc_schema_version(oldVersion) == newVersion);
     ndbrequire(oldState == SchemaFile::INIT ||
 	       oldState == SchemaFile::DROP_TABLE_COMMITTED);
     break;
@@ -807,7 +829,7 @@
   case SchemaFile::ALTER_TABLE_COMMITTED:
     jam();
     ok = true;
-    ndbrequire((oldVersion + 1) == newVersion);
+    ndbrequire(alter_table_inc_schema_version(oldVersion) == newVersion);
     ndbrequire(oldState == SchemaFile::TABLE_ADD_COMMITTED ||
 	       oldState == SchemaFile::ALTER_TABLE_COMMITTED);
     break;
@@ -2982,6 +3004,21 @@
   }
 }
 
+bool
+Dbdict::check_ndb_versions() const
+{
+  Uint32 node = 0;
+  Uint32 version = getNodeInfo(getOwnNodeId()).m_version;
+  while((node = c_aliveNodes.find(node + 1)) != BitmaskImpl::NotFound)
+  {
+    if(getNodeInfo(node).m_version != version)
+    {
+      return false;
+    }
+  }
+  return true;
+}
+
 void
 Dbdict::execALTER_TABLE_REQ(Signal* signal)
 {
@@ -3018,6 +3055,13 @@
     alterTableRef(signal, req, AlterTableRef::Busy);
     return;
   }
+
+  if (!check_ndb_versions())
+  {
+    jam();
+    alterTableRef(signal, req, AlterTableRef::IncompatibleVersions);
+    return;
+  }
   
   const TableRecord::TabState tabState = tablePtr.p->tabState;
   bool ok = false;
@@ -3168,7 +3212,7 @@
   lreq->clientData = alterTabPtr.p->m_senderData;
   lreq->changeMask = alterTabPtr.p->m_changeMask;
   lreq->tableId = tablePtr.p->tableId;
-  lreq->tableVersion = tablePtr.p->tableVersion + 1;
+  lreq->tableVersion = alter_table_inc_schema_version(tablePtr.p->tableVersion);
   lreq->gci = tablePtr.p->gciTableCreated;
   lreq->requestType = AlterTabReq::AlterTablePrepare;
   
@@ -3248,6 +3292,14 @@
     alterTabRef(signal, req, AlterTableRef::Busy);
     return;
   }
+
+  if (!check_ndb_versions())
+  {
+    jam();
+    alterTabRef(signal, req, AlterTableRef::IncompatibleVersions);
+    return;
+  }
+
   alterTabPtr.p->m_alterTableId = tableId;
   alterTabPtr.p->m_coordinatorRef = senderRef;
   
@@ -3290,7 +3342,7 @@
     }
     ndbrequire(ok);
 
-    if(tablePtr.p->tableVersion + 1 != tableVersion){
+    if(alter_table_inc_schema_version(tablePtr.p->tableVersion) != tableVersion){
       jam();
       alterTabRef(signal, req, AlterTableRef::InvalidTableVersion);
       return;
@@ -3775,7 +3827,7 @@
     // Restore name
     strcpy(tablePtr.p->tableName, alterTabPtrP->previousTableName);
     // Revert schema version
-    tablePtr.p->tableVersion = tablePtr.p->tableVersion - 1;
+    tablePtr.p->tableVersion = alter_table_dec_schema_version(tablePtr.p->tableVersion);
     // Put it back
 #ifdef VM_TRACE
     ndbrequire(!c_tableRecordHash.find(tmp, * tablePtr.p));
@@ -3835,6 +3887,27 @@
   conf->requestType = AlterTabReq::AlterTableCommit;
   sendSignal(coordinatorRef, GSN_ALTER_TAB_CONF, signal, 
 	       AlterTabConf::SignalLength, JBB);
+
+
+  {
+    ApiBroadcastRep* api= (ApiBroadcastRep*)signal->getDataPtrSend();
+    api->gsn = GSN_ALTER_TABLE_REP;
+    api->minVersion = MAKE_VERSION(4,1,15);
+
+    AlterTableRep* rep = (AlterTableRep*)api->theData;
+    rep->tableId = tabPtr.p->tableId;
+    rep->tableVersion = alter_table_dec_schema_version(tabPtr.p->tableVersion);
+    rep->changeType = AlterTableRep::CT_ALTERED;
+    
+    LinearSectionPtr ptr[3];
+    ptr[0].p = (Uint32*)alterTabPtr.p->previousTableName;
+    ptr[0].sz = (sizeof(alterTabPtr.p->previousTableName) + 3) >> 2;
+    
+    sendSignal(QMGR_REF, GSN_API_BROADCAST_REP, signal, 
+	       ApiBroadcastRep::SignalLength + AlterTableRep::SignalLength,
+	       JBB, ptr,1);
+  }
+
   if(coordinatorRef != reference()) {
     jam();
     // Release resources
@@ -3886,7 +3959,7 @@
   XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
   SchemaFile::TableEntry * tabEntry = getTableEntry(xsf, tabPtr.i);
 
-  tabPtr.p->tableVersion = tabEntry->m_tableVersion + 1;
+  tabPtr.p->tableVersion = create_table_inc_schema_version(tabEntry->m_tableVersion);
 
   /**
    * Pack
@@ -3915,7 +3988,7 @@
 
   req->gci = 0;
   req->tableId = tabPtr.i;
-  req->tableVersion = tabEntry->m_tableVersion + 1;
+  req->tableVersion = create_table_inc_schema_version(tabEntry->m_tableVersion);
   
   sendFragmentedSignal(rg, GSN_CREATE_TAB_REQ, signal, 
 		       CreateTabReq::SignalLength, JBB);

--- 1.13/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2005-07-20 14:27:39 +02:00
+++ 1.14/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2005-08-18 14:09:06 +02:00
@@ -587,6 +587,7 @@
   void execALTER_TAB_REQ(Signal* signal);
   void execALTER_TAB_REF(Signal* signal);
   void execALTER_TAB_CONF(Signal* signal);
+  bool check_ndb_versions() const;
 
   /*
    *  2.4 COMMON STORED VARIABLES

--- 1.9/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp	2005-05-15 18:08:38 +02:00
+++ 1.10/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp	2005-08-18 14:09:06 +02:00
@@ -85,7 +85,8 @@
          te.m_tableState != SchemaFile::DROP_TABLE_COMMITTED)) {
       ndbout << "Table " << i << ":"
              << " State = " << te.m_tableState 
-	     << " version = " << te.m_tableVersion
+	     << " version = " << table_version_major(te.m_tableVersion) <<
+	     << "(" << table_version_minor(te.m_tableVersion) << ")"
              << " type = " << te.m_tableType
 	     << " noOfPages = " << te.m_noOfPages
 	     << " gcp: " << te.m_gcp << endl;

--- 1.31/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2005-07-12 16:34:05 +02:00
+++ 1.32/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2005-08-18 14:09:06 +02:00
@@ -1886,8 +1886,6 @@
     
     // Suma will not send response to this for now, later...
     sendSignal(SUMA_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
-   // Grep will not send response to this for now, later...
-    sendSignal(GREP_REF, GSN_INCL_NODEREQ, signal, 2, JBB);
     return;
   }//if
   if (TstartNode_or_blockref == numberToRef(BACKUP, getOwnNodeId())){

--- 1.69/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2005-07-12 16:31:11 +02:00
+++ 1.70/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2005-08-18 14:09:07 +02:00
@@ -3522,7 +3522,8 @@
     LQHKEY_abort(signal, 4);
     return;
   }
-  if(tabptr.p->schemaVersion != schemaVersion){
+  if(table_version_major(tabptr.p->schemaVersion) != 
+     table_version_major(schemaVersion)){
     LQHKEY_abort(signal, 5);
     return;
   }
@@ -4461,7 +4462,7 @@
   lqhKeyReq->requestInfo = Treqinfo;
   lqhKeyReq->tcBlockref = sig4;
 
-  sig0 = regTcPtr->tableref + (regTcPtr->schemaVersion << 16);
+  sig0 = regTcPtr->tableref + ((regTcPtr->schemaVersion << 16) & 0xFFFF0000);
   sig1 = regTcPtr->fragmentid + (regTcPtr->nodeAfterNext[0] << 16);
   sig2 = regTcPtr->transid[0];
   sig3 = regTcPtr->transid[1];
@@ -15922,7 +15923,7 @@
   tabptr.i = tcConnectptr.p->tableref;
   ptrCheckGuard(tabptr, ctabrecFileSize, tablerec);
   if (getFragmentrec(signal, tcConnectptr.p->fragmentid) &&
-      (tabptr.p->schemaVersion == tcConnectptr.p->schemaVersion)) {
+      (table_version_major(tabptr.p->schemaVersion) == table_version_major(tcConnectptr.p->schemaVersion))) {
     if (fragptr.p->execSrStatus != Fragrecord::IDLE) {
       if (fragptr.p->execSrNoReplicas > logPartPtr.p->execSrExecuteIndex) {
         ndbrequire((fragptr.p->execSrNoReplicas - 1) < 4);

--- 1.28/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2005-05-10 12:33:40 +02:00
+++ 1.29/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2005-08-18 14:09:07 +02:00
@@ -968,7 +968,8 @@
     } keyAttr[MAX_ATTRIBUTES_IN_INDEX];
 
     bool checkTable(Uint32 schemaVersion) const {
-      return enabled && !dropping && (schemaVersion == currentSchemaVersion);
+      return enabled && !dropping && 
+	(table_version_major(schemaVersion) == table_version_major(currentSchemaVersion));
     }
 
     Uint32 getErrorCode(Uint32 schemaVersion) const;

--- 1.79/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2005-07-19 03:59:55 +02:00
+++ 1.80/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2005-08-18 14:09:07 +02:00
@@ -3347,7 +3347,7 @@
   lqhKeyReq->tcBlockref = sig4;
   lqhKeyReq->savePointId = sig5;
 
-  sig0 = regCachePtr->tableref + (regCachePtr->schemaVersion << 16);
+  sig0 = regCachePtr->tableref + ((regCachePtr->schemaVersion << 16) & 0xFFFF0000);
   sig1 = regCachePtr->fragmentid + (regTcPtr->tcNodedata[1] << 16);
   sig2 = regApiPtr->transid[0];
   sig3 = regApiPtr->transid[1];
@@ -13093,7 +13093,7 @@
     return ZNO_SUCH_TABLE;
   if(dropping)
     return ZDROP_TABLE_IN_PROGRESS;
-  if(schemaVersion != currentSchemaVersion)
+  if(table_version_major(schemaVersion) != table_version_major(currentSchemaVersion))
     return ZWRONG_SCHEMA_VERSION_ERROR;
   ErrorReporter::handleAssert("Dbtc::TableRecord::getErrorCode",
 			      __FILE__, __LINE__);

--- 1.14/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2005-03-10 08:57:29 +01:00
+++ 1.15/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2005-08-18 14:09:08 +02:00
@@ -76,7 +76,6 @@
   { BACKUP_REF,  1 , 10000, 10999 },
   { DBUTIL_REF,  1 , 11000, 11999 },
   { SUMA_REF,    1 , 13000, 13999 },
-  { GREP_REF,    1 ,     0,     0 },
   { DBTUX_REF,   1 , 12000, 12999 }
 };
 
@@ -1453,9 +1452,6 @@
   sendSignal(SUMA_REF, GSN_NODE_FAILREP, signal,
 	     NodeFailRep::SignalLength, JBB);
 
-  sendSignal(GREP_REF, GSN_NODE_FAILREP, signal,
-	     NodeFailRep::SignalLength, JBB);
-
   Uint32 nodeId = 0;
   while(!allFailed.isclear()){
     nodeId = allFailed.find(nodeId + 1);
@@ -2377,7 +2373,6 @@
 
 void Ndbcntr::execSTART_ORD(Signal* signal){
   jamEntry();
-  ndbrequire(NO_OF_BLOCKS == ALL_BLOCKS_SZ);
   c_missra.execSTART_ORD(signal);
 }
 
@@ -2452,7 +2447,7 @@
    * Finished...
    */
   currentStartPhase = 0;
-  for(Uint32 i = 0; i<NO_OF_BLOCKS; i++){
+  for(Uint32 i = 0; i<ALL_BLOCKS_SZ; i++){
     if(ALL_BLOCKS[i].NextSP < currentStartPhase)
       currentStartPhase = ALL_BLOCKS[i].NextSP;
   }

--- 1.5/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2005-07-22 12:29:15 +02:00
+++ 1.6/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2005-08-18 14:09:08 +02:00
@@ -219,6 +219,7 @@
 
 
   void execAPI_VERSION_REQ(Signal* signal);
+  void execAPI_BROADCAST_REP(Signal* signal);
 
   // Arbitration signals
   void execARBIT_CFG(Signal* signal);

--- 1.4/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2005-03-04 20:20:48 +01:00
+++ 1.5/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2005-08-18 14:09:08 +02:00
@@ -83,7 +83,8 @@
   addRecSignal(GSN_API_FAILCONF, &Qmgr::execAPI_FAILCONF);
   addRecSignal(GSN_READ_NODESREQ, &Qmgr::execREAD_NODESREQ);
   addRecSignal(GSN_SET_VAR_REQ,  &Qmgr::execSET_VAR_REQ);
-
+  addRecSignal(GSN_API_BROADCAST_REP,  &Qmgr::execAPI_BROADCAST_REP);
+  
   // Arbitration signals
   addRecSignal(GSN_ARBIT_PREPREQ, &Qmgr::execARBIT_PREPREQ);
   addRecSignal(GSN_ARBIT_PREPCONF, &Qmgr::execARBIT_PREPCONF);

--- 1.15/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-07-22 12:29:15 +02:00
+++ 1.16/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-08-18 14:09:08 +02:00
@@ -34,6 +34,7 @@
 #include <signaldata/BlockCommitOrd.hpp>
 #include <signaldata/FailRep.hpp>
 #include <signaldata/DisconnectRep.hpp>
+#include <signaldata/ApiBroadcast.hpp>
 
 #include <ndb_version.h>
 
@@ -1703,16 +1704,6 @@
   sendSignal(DBDICT_REF, GSN_API_FAILREQ, signal, 2, JBA);
   sendSignal(SUMA_REF, GSN_API_FAILREQ, signal, 2, JBA);
 
-  /**
-   * GREP also need the information that an API node 
-   * (actually a REP node) has failed.
-   *
-   * GREP does however NOT send a CONF on this signal, i.e.
-   * the API_FAILREQ signal to GREP is like a REP signal 
-   * (i.e. without any confirmation).
-   */
-  sendSignal(GREP_REF, GSN_API_FAILREQ, signal, 2, JBA);
-  
   /**-------------------------------------------------------------------------
    * THE OTHER NODE WAS AN API NODE. THE COMMUNICATION LINK IS ALREADY 
    * BROKEN AND THUS NO ACTION IS NEEDED TO BREAK THE CONNECTION. 
@@ -3926,3 +3917,30 @@
   }// switch
 #endif
 }//execSET_VAR_REQ()
+
+void
+Qmgr::execAPI_BROADCAST_REP(Signal* signal)
+{
+  jamEntry();
+  ApiBroadcastRep api= *(const ApiBroadcastRep*)signal->getDataPtr();
+
+  Uint32 len = signal->getLength() - ApiBroadcastRep::SignalLength;
+  memmove(signal->theData, signal->theData+ApiBroadcastRep::SignalLength, 
+	  4*len);
+  
+  NodeBitmask mask;
+  NodeRecPtr nodePtr;
+  for (nodePtr.i = 1; nodePtr.i < MAX_NODES; nodePtr.i++) 
+  {
+    jam();
+    ptrAss(nodePtr, nodeRec);
+    if (nodePtr.p->phase == ZAPI_ACTIVE && 
+	getNodeInfo(nodePtr.i).m_version >= api.minVersion)
+    {
+      mask.set(nodePtr.i);
+    }
+  }
+  
+  NodeReceiverGroup rg(API_CLUSTERMGR, mask);
+  sendSignal(rg, api.gsn, signal, len, JBB); // forward sections
+}

--- 1.19/ndb/src/kernel/blocks/suma/Suma.cpp	2005-03-09 11:49:40 +01:00
+++ 1.20/ndb/src/kernel/blocks/suma/Suma.cpp	2005-08-18 14:09:08 +02:00
@@ -2185,7 +2185,8 @@
   case SubCreateReq::DatabaseSnapshot:
   case SubCreateReq::SelectiveTableSnapshot:
     jam();
-    subbPtr.p->m_subscriberRef = GREP_REF;
+    ndbrequire(false);
+    //subbPtr.p->m_subscriberRef = GREP_REF;
     subbPtr.p->m_subscriberData = subPtr.p->m_subscriberData;
     break;
   case SubCreateReq::SingleTableScan:
@@ -3018,16 +3019,6 @@
   c_lastCompleteGCI = gci;
 
   /**
-   * always send SUB_GCP_COMPLETE_REP to Grep (so 
-   * Lars can do funky stuff calculating intervals,
-   * even before the subscription is started
-   */
-  rep->senderRef  = reference();
-  rep->senderData = 0; //ignored in grep
-  EXECUTE_DIRECT(refToBlock(GREP_REF), GSN_SUB_GCP_COMPLETE_REP, signal,
-		 SubGcpCompleteRep::SignalLength);  
-
-  /**
    * Signal to subscriber(s)
    */
 
@@ -3051,13 +3042,6 @@
     ndbout_c("GSN_SUB_GCP_COMPLETE_REP to %s:",
 	     getBlockName(refToBlock(ref)));
 #else
-    /**
-     * Ignore sending to GREP (since we sent earlier)
-     */
-    if (ref == GREP_REF) {
-      jam();
-      continue;
-    }
 
     CRASH_INSERTION(13018);
 

--- 1.7/ndb/src/kernel/SimBlockList.cpp	2005-06-20 07:32:50 +02:00
+++ 1.8/ndb/src/kernel/SimBlockList.cpp	2005-08-18 14:09:05 +02:00
@@ -30,7 +30,6 @@
 #include <Backup.hpp>
 #include <DbUtil.hpp>
 #include <Suma.hpp>
-#include <Grep.hpp>
 #include <Dbtux.hpp>
 #include <NdbEnv.h>
 
@@ -97,13 +96,14 @@
   theList[11] = NEW_BLOCK(Backup)(conf);
   theList[12] = NEW_BLOCK(DbUtil)(conf);
   theList[13] = NEW_BLOCK(Suma)(conf);
-  theList[14] = NEW_BLOCK(Grep)(conf);
+  theList[14] = 0; //NEW_BLOCK(Grep)(conf);
   theList[15] = NEW_BLOCK(Dbtux)(conf);
 
   // Metadata common part shared by block instances
   ptrMetaDataCommon = new MetaData::Common(*dbdict, *dbdih);
   for (int i = 0; i < noOfBlocks; i++)
-    theList[i]->setMetaDataCommon(ptrMetaDataCommon);
+    if(theList[i])
+      theList[i]->setMetaDataCommon(ptrMetaDataCommon);
 }
 
 void

--- 1.77/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-07-15 14:00:03 +02:00
+++ 1.78/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-08-18 14:09:08 +02:00
@@ -2581,44 +2581,7 @@
 int
 MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
 {
-  bool    next;
-  NodeId  nodeId = 0;
-  
-  while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
-	theFacade->get_node_alive(nodeId) == false);
-  
-  if(!next){
-    return NO_CONTACT_WITH_DB_NODES;
-  }
-
-  NdbApiSignal* signal = getSignal();
-  if (signal == NULL) {
-    return COULD_NOT_ALLOCATE_MEMORY;
-  }
-
-  GrepReq* req = CAST_PTR(GrepReq, signal->getDataPtrSend());
-  signal->set(TestOrd::TraceAPI, GREP, GSN_GREP_REQ, GrepReq::SignalLength);
-  req->senderRef = _ownReference;
-  req->request   = request;
-
-  int result;
-  if (waitCompleted)
-    result = sendRecSignal(nodeId, NO_WAIT, signal, true);
-  else
-    result = sendRecSignal(nodeId, NO_WAIT, signal, true);
-  if (result == -1) {
-    return SEND_OR_RECEIVE_FAILED;
-  }
-
-  /**
-   * @todo
-   * Maybe add that we should receive a confirmation that the 
-   * request was received ok.
-   * Then we should give the user the correct repReqId.
-   */
-
-  *repReqId = 4711;
-
+  abort();
   return 0;
 }
 

--- 1.14/ndb/src/ndbapi/DictCache.cpp	2005-06-07 17:09:41 +02:00
+++ 1.15/ndb/src/ndbapi/DictCache.cpp	2005-08-18 14:09:08 +02:00
@@ -21,6 +21,9 @@
 #include <NdbCondition.h>
 #include <NdbSleep.h>
 
+static NdbTableImpl f_invalid_table;
+static NdbTableImpl f_altered_table;
+
 Ndb_local_table_info *
 Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
 {
@@ -203,21 +206,41 @@
   
   TableVersion & ver = vers->back();
   if(ver.m_status != RETREIVING || 
-     ver.m_impl != 0 || 
+     !(ver.m_impl == 0 || 
+       ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) || 
      ver.m_version != 0 || 
      ver.m_refCount == 0){
     abort();
   }
   
-  if(tab == 0){
+  if(tab == 0)
+  {
     DBUG_PRINT("info", ("No table found in db"));
     vers->erase(sz - 1);
-  } else {
+  } 
+  else if (ver.m_impl == 0) {
     ver.m_impl = tab;
     ver.m_version = tab->m_version;
     ver.m_status = OK;
+  } 
+  else if (ver.m_impl == &f_invalid_table) 
+  {
+    ver.m_impl = tab;
+    ver.m_version = tab->m_version;
+    ver.m_status = DROPPED;
+    ver.m_impl->m_status = NdbDictionary::Object::Invalid;    
+  }
+  else if(ver.m_impl == &f_altered_table)
+  {
+    ver.m_impl = tab;
+    ver.m_version = tab->m_version;
+    ver.m_status = DROPPED;
+    ver.m_impl->m_status = NdbDictionary::Object::Altered;    
+  }
+  else
+  {
+    abort();
   }
-  
   NdbCondition_Broadcast(m_waitForTableCondition);
   DBUG_RETURN(tab);
 } 
@@ -323,6 +346,47 @@
   }
   
   abort();
+}
+
+void
+GlobalDictCache::alter_table_rep(const char * name, 
+				 Uint32 tableId, 
+				 Uint32 tableVersion,
+				 bool altered)
+{
+  const Uint32 len = strlen(name);
+  Vector<TableVersion> * vers = 
+    m_tableHash.getData(name, len);
+  
+  if(vers == 0)
+  {
+    return;
+  }
+
+  const Uint32 sz = vers->size();
+  if(sz == 0)
+  {
+    return;
+  }
+  
+  for(Uint32 i = 0; i < sz; i++)
+  {
+    TableVersion & ver = (* vers)[i];
+    if(ver.m_version == tableVersion && ver.m_impl && 
+       ver.m_impl->m_tableId == tableId)
+    {
+      ver.m_status = DROPPED;
+      ver.m_impl->m_status = altered ? 
+	NdbDictionary::Object::Altered : NdbDictionary::Object::Invalid;
+      return;
+    }
+
+    if(i == sz - 1 && ver.m_status == RETREIVING)
+    {
+      ver.m_impl = altered ? &f_altered_table : &f_invalid_table;
+      return;
+    } 
+  }
 }
 
 template class Vector<GlobalDictCache::TableVersion>;

--- 1.8/ndb/src/ndbapi/DictCache.hpp	2005-06-07 17:09:41 +02:00
+++ 1.9/ndb/src/ndbapi/DictCache.hpp	2005-08-18 14:09:08 +02:00
@@ -68,6 +68,9 @@
   NdbTableImpl* put(const char * name, NdbTableImpl *);
   void drop(NdbTableImpl *);
   void release(NdbTableImpl *);
+
+  void alter_table_rep(const char * name, 
+		       Uint32 tableId, Uint32 tableVersion, bool altered);
 public:
   enum Status {
     OK = 0,

--- 1.83/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2005-07-20 13:22:37 +02:00
+++ 1.84/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2005-08-18 14:24:56 +02:00
@@ -1534,25 +1534,22 @@
   const char * originalInternalName = internalName.c_str();
 
   DBUG_ENTER("NdbDictionaryImpl::alterTable");
-  if(!get_local_table_info(internalName, false)){
-    m_error.code= 709;
+  Ndb_local_table_info * local = 0;
+  if((local= get_local_table_info(originalInternalName, false)) == 0)
+  {
+    m_error.code = 709;
     DBUG_RETURN(-1);
   }
+
   // Alter the table
   int ret = m_receiver.alterTable(m_ndb, impl);
   if(ret == 0){
     // Remove cached information and let it be refreshed at next access
-    if (m_localHash.get(originalInternalName) != NULL) {
-      m_localHash.drop(originalInternalName);
-      m_globalHash->lock();
-      NdbTableImpl * cachedImpl = m_globalHash->get(originalInternalName);
-      // If in local cache it must be in global
-      if (!cachedImpl)
-	abort();
-      cachedImpl->m_status = NdbDictionary::Object::Invalid;
-      m_globalHash->drop(cachedImpl);
-      m_globalHash->unlock();
-    }
+    m_globalHash->lock();
+    local->m_table_impl->m_status = NdbDictionary::Object::Invalid;
+    m_globalHash->drop(local->m_table_impl);
+    m_globalHash->unlock();
+    m_localHash.drop(originalInternalName);
   }
   DBUG_RETURN(ret);
 }

--- 1.38/ndb/src/ndbapi/TransporterFacade.cpp	2005-07-22 12:29:16 +02:00
+++ 1.39/ndb/src/ndbapi/TransporterFacade.cpp	2005-08-18 14:09:09 +02:00
@@ -35,6 +35,7 @@
 #include <ndb_version.h>
 #include <SignalLoggerManager.hpp>
 #include <kernel/ndb_limits.h>
+#include <signaldata/AlterTable.hpp>
 
 //#define REPORT_TRANSPORTER
 //#define API_TRACE;
@@ -309,6 +310,17 @@
 	 theFacade->theArbitMgr->doStop(theData);
        break;
 
+     case GSN_ALTER_TABLE_REP:
+     {
+       const AlterTableRep* rep = (const AlterTableRep*)theData;
+       theFacade->m_globalDictCache.lock();
+       theFacade->m_globalDictCache.
+	 alter_table_rep((const char*)ptr[0].p, 
+			 rep->tableId,
+			 rep->tableVersion,
+			 rep->changeType == AlterTableRep::CT_ALTERED);
+       theFacade->m_globalDictCache.unlock();
+     }
      default:
        break;
        

--- 1.194/sql/ha_ndbcluster.cc	2005-07-21 09:35:01 +02:00
+++ 1.195/sql/ha_ndbcluster.cc	2005-08-18 14:09:09 +02:00
@@ -3289,7 +3289,10 @@
       DBUG_PRINT("info", ("Table schema version: %d", 
                           tab->getObjectVersion()));
       // Check if thread has stale local cache
-      if (tab->getObjectStatus() == NdbDictionary::Object::Invalid)
+      // New transaction must not use old tables... (trans != 0)
+      // Running might...
+      if ((trans && tab->getObjectStatus() != NdbDictionary::Object::Retrieved)
+	  || tab->getObjectStatus() == NdbDictionary::Object::Invalid)
       {
         invalidate_dictionary_cache(FALSE);
         if (!(tab= dict->getTable(m_tabname, &tab_info)))
Thread
bk commit into 5.0 tree (jonas:1.1901)jonas18 Aug