List:Commits« Previous MessageNext Message »
From:jonas Date:June 26 2006 10:31am
Subject:bk commit into 5.1 tree (jonas:1.2203) BUG#20683
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.2203 06/06/26 12:31:09 jonas@stripped +3 -0
  ndb - bug#20683
    part 2 - handle safecounter.init() failing in all parts of event code

  storage/ndb/test/ndbapi/test_event.cpp
    1.22 06/06/26 12:31:06 jonas@stripped +57 -0
    Add testcase for subscribe/unscubscribe

  storage/ndb/src/kernel/blocks/suma/Suma.cpp
    1.43 06/06/26 12:31:06 jonas@stripped +2 -1
    Dont try to get table RNIL

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.91 06/06/26 12:31:06 jonas@stripped +40 -10
    Handle out safecounter.init() failing

# 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.90/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-06-22 14:57:40 +02:00
+++ 1.91/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-06-26 12:31:06 +02:00
@@ -9476,7 +9476,14 @@ Dbdict::createEventComplete_RT_USER_GET(
 
   NodeReceiverGroup rg(DBDICT, c_aliveNodes);
   RequestTracker & p = evntRecPtr.p->m_reqTracker;
-  p.init<CreateEvntRef>(c_counterMgr, rg, GSN_CREATE_EVNT_REF, evntRecPtr.i);
+  if (!p.init<CreateEvntRef>(c_counterMgr, rg, GSN_CREATE_EVNT_REF, 
+			     evntRecPtr.i))
+  {
+    jam();
+    evntRecPtr.p->m_errorCode = 701;
+    createEvent_sendReply(signal, evntRecPtr);
+    return;
+  }
 
   sendSignal(rg, GSN_CREATE_EVNT_REQ, signal, CreateEvntReq::SignalLength, JBB);
 }
@@ -9764,8 +9771,12 @@ void Dbdict::execSUB_START_REQ(Signal* s
     return;
   }
   OpSubEventPtr subbPtr;
+  Uint32 errCode = 0;
   if (!c_opSubEvent.seize(subbPtr)) {
+    errCode = SubStartRef::Busy;
+busy:
     SubStartRef * ref = (SubStartRef *)signal->getDataPtrSend();
+
     { // fix
       Uint32 subcriberRef = ((SubStartReq*)signal->getDataPtr())->subscriberRef;
       ref->subscriberRef = subcriberRef;
@@ -9775,7 +9786,7 @@ void Dbdict::execSUB_START_REQ(Signal* s
     //      ret->setErrorLine(__LINE__);
     //      ret->setErrorNode(reference());
     ref->senderRef = reference();
-    ref->errorCode = SubStartRef::Busy;
+    ref->errorCode = errCode;
 
     sendSignal(origSenderRef, GSN_SUB_START_REF, signal,
 	       SubStartRef::SignalLength2, JBB);
@@ -9798,7 +9809,12 @@ void Dbdict::execSUB_START_REQ(Signal* s
     subbPtr.p->m_senderRef = origSenderRef; // not sure if API sets correctly
     NodeReceiverGroup rg(DBDICT, c_aliveNodes);
     RequestTracker & p = subbPtr.p->m_reqTracker;
-    p.init<SubStartRef>(c_counterMgr, rg, GSN_SUB_START_REF, subbPtr.i);
+    if (!p.init<SubStartRef>(c_counterMgr, rg, GSN_SUB_START_REF, subbPtr.i))
+    {
+      c_opSubEvent.release(subbPtr);
+      errCode = SubStartRef::Busy;
+      goto busy;
+    }
     
     SubStartReq* req = (SubStartReq*) signal->getDataPtrSend();
     
@@ -9988,14 +10004,17 @@ void Dbdict::execSUB_STOP_REQ(Signal* si
     return;
   }
   OpSubEventPtr subbPtr;
+  Uint32 errCode = 0;
   if (!c_opSubEvent.seize(subbPtr)) {
+    errCode = SubStopRef::Busy;
+busy:
     SubStopRef * ref = (SubStopRef *)signal->getDataPtrSend();
     jam();
     //      ret->setErrorCode(SubStartRef::SeizeError);
     //      ret->setErrorLine(__LINE__);
     //      ret->setErrorNode(reference());
     ref->senderRef = reference();
-    ref->errorCode = SubStopRef::Busy;
+    ref->errorCode = errCode;
 
     sendSignal(origSenderRef, GSN_SUB_STOP_REF, signal,
 	       SubStopRef::SignalLength, JBB);
@@ -10020,10 +10039,16 @@ void Dbdict::execSUB_STOP_REQ(Signal* si
     subbPtr.p->m_senderRef = origSenderRef; // not sure if API sets correctly
     NodeReceiverGroup rg(DBDICT, c_aliveNodes);
     RequestTracker & p = subbPtr.p->m_reqTracker;
-    p.init<SubStopRef>(c_counterMgr, rg, GSN_SUB_STOP_REF, subbPtr.i);
-
+    if (!p.init<SubStopRef>(c_counterMgr, rg, GSN_SUB_STOP_REF, subbPtr.i))
+    {
+      jam();
+      c_opSubEvent.release(subbPtr);
+      errCode = SubStopRef::Busy;
+      goto busy;
+    }
+    
     SubStopReq* req = (SubStopReq*) signal->getDataPtrSend();
-
+    
     req->senderRef  = reference();
     req->senderData = subbPtr.i;
     
@@ -10313,9 +10338,14 @@ Dbdict::dropEventUTIL_EXECUTE_READ(Signa
 
   NodeReceiverGroup rg(DBDICT, c_aliveNodes);
   RequestTracker & p = evntRecPtr.p->m_reqTracker;
-  p.init<SubRemoveRef>(c_counterMgr, rg, GSN_SUB_REMOVE_REF,
-						evntRecPtr.i);
-
+  if (!p.init<SubRemoveRef>(c_counterMgr, rg, GSN_SUB_REMOVE_REF,
+			    evntRecPtr.i))
+  {
+    evntRecPtr.p->m_errorCode = 701;
+    dropEvent_sendReply(signal, evntRecPtr);
+    return;
+  }
+  
   SubRemoveReq* req = (SubRemoveReq*) signal->getDataPtrSend();
 
   req->senderRef       = reference();

--- 1.42/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2006-05-18 23:37:53 +02:00
+++ 1.43/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2006-06-26 12:31:06 +02:00
@@ -2465,7 +2465,8 @@ Suma::execSUB_STOP_REQ(Signal* signal){
 
   TablePtr tabPtr;
   tabPtr.i = subPtr.p->m_table_ptrI;
-  if (!(tabPtr.p = c_tables.getPtr(tabPtr.i)) ||
+  if (tabPtr.i == RNIL ||
+      !(tabPtr.p = c_tables.getPtr(tabPtr.i)) ||
       tabPtr.p->m_tableId != subPtr.p->m_tableId)
   {
     jam();

--- 1.21/storage/ndb/test/ndbapi/test_event.cpp	2006-06-12 17:54:16 +02:00
+++ 1.22/storage/ndb/test/ndbapi/test_event.cpp	2006-06-26 12:31:06 +02:00
@@ -1559,6 +1559,56 @@ static int runCreateDropNR(NDBT_Context*
   DBUG_RETURN(result);
 }
 
+static
+int
+runSubscribeUnsubscribe(NDBT_Context* ctx, NDBT_Step* step)
+{
+  char buf[1024];
+  const NdbDictionary::Table & tab = * ctx->getTab();
+  sprintf(buf, "%s_EVENT", tab.getName());
+  Ndb* ndb = GETNDB(step);
+  int loops = 5 * ctx->getNumLoops();
+
+  while (--loops)
+  {
+    NdbEventOperation *pOp= ndb->createEventOperation(buf);
+    if (pOp == 0)
+    {
+      g_err << "createEventOperation: "
+	    << ndb->getNdbError().code << " "
+	    << ndb->getNdbError().message << endl;
+      return NDBT_FAILED;
+    }
+    
+    int n_columns= tab.getNoOfColumns();
+    for (int j = 0; j < n_columns; j++)
+    {
+      pOp->getValue(tab.getColumn(j)->getName());
+      pOp->getPreValue(tab.getColumn(j)->getName());
+    }
+    if ( pOp->execute() )
+    {
+      g_err << "pOp->execute(): "
+	    << pOp->getNdbError().code << " "
+	    << pOp->getNdbError().message << endl;
+      
+      ndb->dropEventOperation(pOp);
+      
+      return NDBT_FAILED;
+    }
+    
+    if (ndb->dropEventOperation(pOp))
+    {
+      g_err << "pOp->execute(): "
+	    << ndb->getNdbError().code << " "
+	    << ndb->getNdbError().message << endl;
+      return NDBT_FAILED;
+    }
+  }
+  
+  return NDBT_OK;
+}
+
 NDBT_TESTSUITE(test_event);
 TESTCASE("BasicEventOperation", 
 	 "Verify that we can listen to Events"
@@ -1672,6 +1722,13 @@ TESTCASE("CreateDropNR", 
 	 "Verify that we can Create and Drop in any order"
 	 "NOTE! No errors are allowed!" ){
   FINALIZER(runCreateDropNR);
+}
+TESTCASE("SubscribeUnsubscribe", 
+	 "A bunch of threads doing subscribe/unsubscribe in loop"
+	 "NOTE! No errors are allowed!" ){
+  INITIALIZER(runCreateEvent);
+  STEPS(runSubscribeUnsubscribe, 16);
+  FINALIZER(runDropEvent);
 }
 NDBT_TESTSUITE_END(test_event);
 
Thread
bk commit into 5.1 tree (jonas:1.2203) BUG#20683jonas26 Jun