List:Commits« Previous MessageNext Message »
From:jonas Date:January 24 2007 8:13pm
Subject:bk commit into 5.1 tree (jonas:1.2101)
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@stripped, 2007-01-24 21:13:30+01:00, jonas@stripped +6 -0
  Merge perch.ndb.mysql.com:/home/jonas/src/drop5
  into  perch.ndb.mysql.com:/home/jonas/src/drop6
  MERGE: 1.2071.1.25

  configure.in@stripped, 2007-01-24 21:12:45+01:00, jonas@stripped +0 -3
    MERGE: 1.321.1.6

  mysql-test/t/ndb_partition_key.test@stripped, 2007-01-24 21:12:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.1

  storage/ndb/include/ndb_version.h.in@stripped, 2007-01-24 21:13:28+01:00, jonas@stripped +1 -1
    merge
    MERGE: 1.4.1.2

  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp@stripped, 2007-01-24 21:12:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.53.1.2

  storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp@stripped, 2007-01-24 21:12:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.12.1.4

  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp@stripped, 2007-01-24 21:12:26+01:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.30.1.8

# 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/drop6/RESYNC

--- 1.7/storage/ndb/include/ndb_version.h.in	2007-01-24 21:13:33 +01:00
+++ 1.8/storage/ndb/include/ndb_version.h.in	2007-01-24 21:13:33 +01:00
@@ -59,6 +59,7 @@
 
 #define NDBD_NODE_VERSION_REP MAKE_VERSION(5,1,3)
 #define NDBD_255_NODES_VERSION MAKE_VERSION(5,2,0)
+#define NDBD_QMGR_APIFAIL_REQ MAKE_VERSION(5,1,4)
 
 #endif
  

--- 1.54/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2007-01-24 21:13:33 +01:00
+++ 1.55/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2007-01-24 21:13:33 +01:00
@@ -3490,7 +3490,6 @@
   takeOverPtr.i = takeOverPtrI;
   ptrCheckGuard(takeOverPtr, MAX_NDB_NODES, takeOverRecord);
 
-  releaseTakeOver(takeOverPtrI);
   if ((takeOverPtr.p->toMasterStatus != TakeOverRecord::IDLE) &&
       (takeOverPtr.p->toMasterStatus != TakeOverRecord::TO_WAIT_START_TAKE_OVER)) {
     jam();
@@ -3504,6 +3503,7 @@
   }//if
   setAllowNodeStart(takeOverPtr.p->toStartingNode, true);
   initTakeOver(takeOverPtr);
+  releaseTakeOver(takeOverPtrI);
 }//Dbdih::endTakeOver()
 
 void Dbdih::releaseTakeOver(Uint32 takeOverPtrI)
@@ -3794,6 +3794,11 @@
   Uint32 newMasterId = nodeFail->masterNodeId;
   const Uint32 noOfFailedNodes = nodeFail->noOfNodes;
 
+  if (ERROR_INSERTED(7179))
+  {
+    CLEAR_ERROR_INSERT_VALUE;
+  }
+
   /*-------------------------------------------------------------------------*/
   // The first step is to convert from a bit mask to an array of failed nodes.
   /*-------------------------------------------------------------------------*/
@@ -4631,6 +4636,7 @@
       break;
     }
     ndbrequire(ok);
+    endTakeOver(takeOverPtr.i);
   }//if
 }//Dbdih::handleTakeOverNewMaster()
 
@@ -9913,12 +9919,42 @@
   Uint32 fragId = lcpReport->fragId;
   
   jamEntry();
+
+  if (ERROR_INSERTED(7178) && nodeId != getOwnNodeId())
+  {
+    jam();
+    Uint32 owng =Sysfile::getNodeGroup(getOwnNodeId(), SYSFILE->nodeGroups);
+    Uint32 nodeg = Sysfile::getNodeGroup(nodeId, SYSFILE->nodeGroups);
+    if (owng == nodeg)
+    {
+      jam();
+      ndbout_c("throwing away LCP_FRAG_REP from  (and killing) %d", nodeId);
+      SET_ERROR_INSERT_VALUE(7179);
+      signal->theData[0] = 9999;
+      sendSignal(numberToRef(CMVMI, nodeId), 
+		 GSN_NDB_TAMPER, signal, 1, JBA);  
+      return;
+    }
+  }
  
+  if (ERROR_INSERTED(7179) && nodeId != getOwnNodeId())
+  {
+    jam();
+    Uint32 owng =Sysfile::getNodeGroup(getOwnNodeId(), SYSFILE->nodeGroups);
+    Uint32 nodeg = Sysfile::getNodeGroup(nodeId, SYSFILE->nodeGroups);
+    if (owng == nodeg)
+    {
+      jam();
+      ndbout_c("throwing away LCP_FRAG_REP from %d", nodeId);
+      return;
+    }
+  }    
+
   CRASH_INSERTION2(7025, isMaster());
   CRASH_INSERTION2(7016, !isMaster());
-
+  
   bool fromTimeQueue = (signal->senderBlockRef() == reference());
-
+  
   TabRecordPtr tabPtr;
   tabPtr.i = tableId;
   ptrCheckGuard(tabPtr, ctabFileSize, tabRecord);
@@ -10118,6 +10154,37 @@
   ndbrequire(false);
 }//Dbdih::findReplica()
 
+
+int
+Dbdih::handle_invalid_lcp_no(const LcpFragRep* rep, 
+			     ReplicaRecordPtr replicaPtr)
+{
+  ndbrequire(!isMaster());
+  Uint32 lcpNo = rep->lcpNo;
+  Uint32 lcpId = rep->lcpId;
+  Uint32 replicaLcpNo = replicaPtr.p->nextLcp;
+  Uint32 prevReplicaLcpNo = prevLcpNo(replicaLcpNo);
+
+  warningEvent("Detected previous node failure of %d during lcp",
+	       rep->nodeId);
+  replicaPtr.p->nextLcp = lcpNo;
+  replicaPtr.p->lcpId[lcpNo] = 0;
+  replicaPtr.p->lcpStatus[lcpNo] = ZINVALID;
+  
+  for (Uint32 i = lcpNo; i != lcpNo; i = nextLcpNo(i))
+  {
+    jam();
+    if (replicaPtr.p->lcpStatus[i] == ZVALID &&
+	replicaPtr.p->lcpId[i] >= lcpId)
+    {
+      ndbout_c("i: %d lcpId: %d", i, replicaPtr.p->lcpId[i]);
+      ndbrequire(false);
+    }
+  }
+
+  return 0;
+}
+
 /**
  * Return true  if table is all fragment replicas have been checkpointed
  *                 to disk (in all LQHs)
@@ -10146,9 +10213,12 @@
   
   ndbrequire(replicaPtr.p->lcpOngoingFlag == true);
   if(lcpNo != replicaPtr.p->nextLcp){
-    ndbout_c("lcpNo = %d replicaPtr.p->nextLcp = %d", 
-	     lcpNo, replicaPtr.p->nextLcp);
-    ndbrequire(false);
+    if (handle_invalid_lcp_no(lcpReport, replicaPtr))
+    {
+      ndbout_c("lcpNo = %d replicaPtr.p->nextLcp = %d", 
+	       lcpNo, replicaPtr.p->nextLcp);
+      ndbrequire(false);
+    }
   }
   ndbrequire(lcpNo == replicaPtr.p->nextLcp);
   ndbrequire(lcpNo < MAX_LCP_STORED);

--- 1.17/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2007-01-24 21:13:33 +01:00
+++ 1.18/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2007-01-24 21:13:33 +01:00
@@ -249,6 +249,7 @@
   void execAPI_FAILCONF(Signal* signal);
   void execREAD_NODESREQ(Signal* signal);
   void execSET_VAR_REQ(Signal* signal);
+  void execAPI_FAILREQ(Signal* signal);
 
   void execREAD_NODESREF(Signal* signal);
   void execREAD_NODESCONF(Signal* signal);

--- 1.36/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2007-01-24 21:13:33 +01:00
+++ 1.37/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2007-01-24 21:13:33 +01:00
@@ -2394,6 +2394,9 @@
   ndbrequire(failedNodePtr.p->failState == NORMAL);
   
   failedNodePtr.p->failState = WAITING_FOR_FAILCONF1;
+  NodeReceiverGroup rg(QMGR, c_clusterNodes);
+  rg.m_nodes.clear(getOwnNodeId());
+  sendVersionedDb(rg, GSN_API_FAILREQ, signal, 2, JBA, NDBD_QMGR_APIFAIL_REQ);
   sendSignal(DBTC_REF, GSN_API_FAILREQ, signal, 2, JBA);
   sendSignal(DBDICT_REF, GSN_API_FAILREQ, signal, 2, JBA);
   sendSignal(SUMA_REF, GSN_API_FAILREQ, signal, 2, JBA);
@@ -2419,6 +2422,32 @@
 	     CloseComReqConf::SignalLength, JBA);
 }//Qmgr::sendApiFailReq()
 
+void Qmgr::execAPI_FAILREQ(Signal* signal)
+{
+  jamEntry();
+  NodeRecPtr failedNodePtr;
+  failedNodePtr.i = signal->theData[0];
+  // signal->theData[1] == QMGR_REF
+  ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
+  
+  ndbrequire(getNodeInfo(failedNodePtr.i).getType() != NodeInfo::DB);
+
+  // ignore if api not active
+  if (failedNodePtr.p->phase != ZAPI_ACTIVE)
+  {
+    jam();
+    // But send to SUMA anyway...
+    sendSignal(SUMA_REF, GSN_API_FAILREQ, signal, 2, JBA);
+    return;
+  }
+
+  signal->theData[0] = NDB_LE_Disconnected;
+  signal->theData[1] = failedNodePtr.i;
+  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
+
+  node_failed(signal, failedNodePtr.i);
+}
+
 void Qmgr::execAPI_FAILCONF(Signal* signal) 
 {
   NodeRecPtr failedNodePtr;
@@ -2789,7 +2818,8 @@
 	sendSignal(numberToRef(rg.m_block, i), gsn, signal, length, jbuf);
       }
     }
-    ndbassert(cnt < rg.m_nodes.count());
+    ndbassert((cnt == 0 && rg.m_nodes.count() == 0) ||
+	      (cnt < rg.m_nodes.count()));
   }
 }
 
@@ -3031,6 +3061,17 @@
     systemErrorLab(signal, __LINE__);
     return;
   }//if
+
+  if (getNodeState().startLevel < NodeState::SL_STARTED)
+  {
+    jam();
+    CRASH_INSERTION(932);
+    char buf[100];
+    BaseString::snprintf(buf, 100, "Node failure during restart");
+    progError(__LINE__, NDBD_EXIT_SR_OTHERNODEFAILED, buf);
+    ndbrequire(false);
+  }
+
   TnoFailedNodes = cnoFailedNodes;
   failReport(signal, failedNodePtr.i, (UintR)ZTRUE, aFailCause);
   if (cpresident == getOwnNodeId()) {
@@ -3116,6 +3157,16 @@
     systemErrorLab(signal, __LINE__);
     return;
   }//if
+
+  if (getNodeState().startLevel < NodeState::SL_STARTED)
+  {
+    jam();
+    CRASH_INSERTION(932);
+    char buf[100];
+    BaseString::snprintf(buf, 100, "Node failure during restart");
+    progError(__LINE__, NDBD_EXIT_SR_OTHERNODEFAILED, buf);
+    ndbrequire(false);
+  }
 
   guard0 = cnoPrepFailedNodes - 1;
   arrGuard(guard0, MAX_NDB_NODES);

--- 1.6/mysql-test/t/ndb_partition_key.test	2007-01-24 21:13:33 +01:00
+++ 1.7/mysql-test/t/ndb_partition_key.test	2007-01-24 21:13:33 +01:00
@@ -63,3 +63,31 @@
 show create table t1;
 
 DROP TABLE t1;
+
+# bug#25587
+
+CREATE TABLE t1 (
+a tinyint unsigned NOT NULL,
+b bigint(20) unsigned NOT NULL,
+c char(12),
+PRIMARY KEY (a,b)
+) ENGINE ndb DEFAULT CHARSET=latin1 PARTITION BY KEY (a);
+
+insert into t1 values(1,1,'1'), (2,2,'2'), (3,3,'3'), (4,4,'4'), (5,5,'5');
+select * from t1 where a = 1;
+select * from t1 where a = 2;
+select * from t1 where a = 3;
+select * from t1 where a = 4;
+select * from t1 where a = 5;
+delete from t1 where a = 1;
+select * from t1 order by 1;
+delete from t1 where a = 2;
+select * from t1 order by 1;
+delete from t1 where a = 3;
+select * from t1 order by 1;
+delete from t1 where a = 4;
+select * from t1 order by 1;
+delete from t1 where a = 5;
+select * from t1 order by 1;
+
+drop table t1;
Thread
bk commit into 5.1 tree (jonas:1.2101)jonas24 Jan