List:Commits« Previous MessageNext Message »
From:tomas Date:June 28 2006 11:06pm
Subject:bk commit into 5.1 tree (tomas:1.2032) BUG#20683
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.2032 06/06/29 01:06:35 tomas@stripped +5 -0
  Bug #20683 Unhandled resource shortage in SUB_STOP_REQ causes node failure

  storage/ndb/test/ndbapi/test_event.cpp
    1.14 06/06/29 01:06:29 tomas@stripped +57 -0
    Bug #20683 Unhandled resource shortage in SUB_STOP_REQ causes node failure

  storage/ndb/src/kernel/vm/SafeCounter.hpp
    1.4 06/06/29 01:06:29 tomas@stripped +14 -8
    Bug #20683 Unhandled resource shortage in SUB_STOP_REQ causes node failure

  storage/ndb/src/kernel/vm/RequestTracker.hpp
    1.3 06/06/29 01:06:29 tomas@stripped +2 -2
    Bug #20683 Unhandled resource shortage in SUB_STOP_REQ causes node failure

  storage/ndb/src/kernel/blocks/suma/Suma.cpp
    1.31 06/06/29 01:06:29 tomas@stripped +2 -1
    Bug #20683 Unhandled resource shortage in SUB_STOP_REQ causes node failure

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.62 06/06/29 01:06:28 tomas@stripped +40 -10
    Bug #20683 Unhandled resource shortage in SUB_STOP_REQ causes node failure

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/wl2325-alcatel

--- 1.61/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-06-28 16:40:17 +02:00
+++ 1.62/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-06-29 01:06:28 +02:00
@@ -8488,7 +8488,14 @@
 
   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);
 }
@@ -8756,8 +8763,12 @@
   Uint32 origSenderRef = signal->senderBlockRef();
 
   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;
@@ -8767,7 +8778,7 @@
     //      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);
@@ -8790,7 +8801,12 @@
     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();
     
@@ -8963,14 +8979,17 @@
   Uint32 origSenderRef = signal->senderBlockRef();
 
   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);
@@ -8995,10 +9014,16 @@
     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;
     
@@ -9271,9 +9296,14 @@
 
   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.30/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2006-03-27 18:55:41 +02:00
+++ 1.31/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2006-06-29 01:06:29 +02:00
@@ -2402,7 +2402,8 @@
 
   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.2/storage/ndb/src/kernel/vm/RequestTracker.hpp	2005-04-08 02:44:07 +02:00
+++ 1.3/storage/ndb/src/kernel/vm/RequestTracker.hpp	2006-06-29 01:06:29 +02:00
@@ -26,12 +26,12 @@
   void init() { m_confs.clear(); m_nRefs = 0; }
 
   template<typename SignalClass>
-  void init(SafeCounterManager& mgr,
+  bool init(SafeCounterManager& mgr,
 	    NodeReceiverGroup rg, Uint16 GSN, Uint32 senderData)
   {
     init();
     SafeCounter tmp(mgr, m_sc);
-    tmp.init<SignalClass>(rg, GSN, senderData);
+    return tmp.init<SignalClass>(rg, GSN, senderData);
   }
 
   bool ignoreRef(SafeCounterManager& mgr, Uint32 nodeId)

--- 1.3/storage/ndb/src/kernel/vm/SafeCounter.hpp	2005-10-07 01:06:21 +02:00
+++ 1.4/storage/ndb/src/kernel/vm/SafeCounter.hpp	2006-06-29 01:06:29 +02:00
@@ -230,10 +230,13 @@
 bool
 SafeCounter::init(NodeReceiverGroup rg, Uint16 GSN, Uint32 senderData){
   
-  bool b = init<Ref>(rg.m_block, GSN, senderData);
-  m_nodes = rg.m_nodes;
-  m_count = m_nodes.count();
-  return b;
+  if (init<Ref>(rg.m_block, GSN, senderData))
+  {
+    m_nodes = rg.m_nodes;
+    m_count = m_nodes.count();
+    return true;
+  }
+  return false;
 }
 
 template<typename Ref>
@@ -241,10 +244,13 @@
 bool
 SafeCounter::init(NodeReceiverGroup rg, Uint32 senderData){
   
-  bool b = init<Ref>(rg.m_block, Ref::GSN, senderData);
-  m_nodes = rg.m_nodes;
-  m_count = m_nodes.count();
-  return b;
+  if (init<Ref>(rg.m_block, Ref::GSN, senderData))
+  {
+    m_nodes = rg.m_nodes;
+    m_count = m_nodes.count();
+    return true;
+  }
+  return false;
 }
 
 inline

--- 1.13/storage/ndb/test/ndbapi/test_event.cpp	2006-03-27 18:55:41 +02:00
+++ 1.14/storage/ndb/test/ndbapi/test_event.cpp	2006-06-29 01:06:29 +02:00
@@ -1539,6 +1539,56 @@
   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"
@@ -1623,6 +1673,13 @@
 	 "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 (tomas:1.2032) BUG#20683tomas29 Jun