List:Commits« Previous MessageNext Message »
From:jonas Date:May 29 2007 7:35am
Subject:bk commit into 5.1 tree (jonas:1.2147) BUG#28443
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-05-29 07:35:04+02:00, jonas@stripped +6 -0
  ndb - bug#28443 (wl2325-5.0)
      Make sure that data can not be left lingering in receive buffer

  storage/ndb/src/common/transporter/Packer.cpp@stripped, 2007-05-29 07:35:02+02:00,
jonas@stripped +5 -0
    make MAKE_RECEIVED_SIGNALS a variable ifdef ERROR_INSERT

  storage/ndb/src/common/transporter/TCP_Transporter.hpp@stripped, 2007-05-29 07:35:02+02:00,
jonas@stripped +4 -0
    check for data in receive buffer

  storage/ndb/src/common/transporter/TransporterRegistry.cpp@stripped, 2007-05-29
07:35:02+02:00, jonas@stripped +41 -36
    make sure also signals recv:ed last loop are executed

  storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp@stripped, 2007-05-29 07:35:02+02:00,
jonas@stripped +17 -0
    debug code for testing bug28443

  storage/ndb/test/ndbapi/testNdbApi.cpp@stripped, 2007-05-29 07:35:02+02:00,
jonas@stripped +35 -0
    test prg

  storage/ndb/test/run-test/daily-basic-tests.txt@stripped, 2007-05-29 07:35:02+02:00,
jonas@stripped +4 -0
    test prg

# 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/drop5

--- 1.54/storage/ndb/test/run-test/daily-basic-tests.txt	2007-05-29 07:35:07 +02:00
+++ 1.55/storage/ndb/test/run-test/daily-basic-tests.txt	2007-05-29 07:35:07 +02:00
@@ -633,6 +633,10 @@
 cmd: testNdbApi
 args: -n CheckNdbObjectList T1
 
+max-time: 1000
+cmd: testNdbApi
+args: -n Bug28443
+
 #max-time: 500
 #cmd: testInterpreter
 #args: T1 

--- 1.8/storage/ndb/src/common/transporter/Packer.cpp	2007-05-29 07:35:07 +02:00
+++ 1.9/storage/ndb/src/common/transporter/Packer.cpp	2007-05-29 07:35:07 +02:00
@@ -21,7 +21,12 @@
 #include <TransporterCallback.hpp>
 #include <RefConvert.hpp>
 
+#ifdef ERROR_INSERT
+Uint32 MAX_RECEIVED_SIGNALS = 1024;
+#else
 #define MAX_RECEIVED_SIGNALS 1024
+#endif
+
 Uint32
 TransporterRegistry::unpack(Uint32 * readPtr,
 			    Uint32 sizeOfData,

--- 1.6/storage/ndb/src/common/transporter/TCP_Transporter.hpp	2007-05-29 07:35:07 +02:00
+++ 1.7/storage/ndb/src/common/transporter/TCP_Transporter.hpp	2007-05-29 07:35:07 +02:00
@@ -102,6 +102,10 @@
   virtual void updateReceiveDataPtr(Uint32 bytesRead);
 
   virtual Uint32 get_free_buffer() const;
+
+  inline bool hasReceiveData () const {
+    return receiveBuffer.sizeOfData > 0;
+  }
 protected:
   /**
    * Setup client/server and perform connect/accept

--- 1.64/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-05-29 07:35:07
+02:00
+++ 1.65/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-05-29 07:35:07
+02:00
@@ -840,28 +840,13 @@
 Uint32 
 TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
 {
+  bool hasdata = false;
   if (false && nTCPTransporters == 0)
   {
     tcpReadSelectReply = 0;
     return 0;
   }
   
-  struct timeval timeout;
-#ifdef NDB_OSE
-  // Return directly if there are no TCP transporters configured
-  
-  if(timeOutMillis <= 1){
-    timeout.tv_sec  = 0;
-    timeout.tv_usec = 1025;
-  } else {
-    timeout.tv_sec  = timeOutMillis / 1000;
-    timeout.tv_usec = (timeOutMillis % 1000) * 1000;
-  }
-#else  
-  timeout.tv_sec  = timeOutMillis / 1000;
-  timeout.tv_usec = (timeOutMillis % 1000) * 1000;
-#endif
-
   NDB_SOCKET_TYPE maxSocketValue = -1;
   
   // Needed for TCP/IP connections
@@ -884,8 +869,27 @@
       // Put the connected transporters in the socket read-set 
       FD_SET(socket, &tcpReadset);
     }
+    hasdata |= t->hasReceiveData();
   }
   
+  timeOutMillis = hasdata ? 0 : timeOutMillis;
+  
+  struct timeval timeout;
+#ifdef NDB_OSE
+  // Return directly if there are no TCP transporters configured
+  
+  if(timeOutMillis <= 1){
+    timeout.tv_sec  = 0;
+    timeout.tv_usec = 1025;
+  } else {
+    timeout.tv_sec  = timeOutMillis / 1000;
+    timeout.tv_usec = (timeOutMillis % 1000) * 1000;
+  }
+#else  
+  timeout.tv_sec  = timeOutMillis / 1000;
+  timeout.tv_usec = (timeOutMillis % 1000) * 1000;
+#endif
+
   // The highest socket value plus one
   maxSocketValue++; 
   
@@ -900,7 +904,7 @@
   }
 #endif
   
-  return tcpReadSelectReply;
+  return tcpReadSelectReply || hasdata;
 }
 #endif
 
@@ -936,27 +940,28 @@
 #endif
 
 #ifdef NDB_TCP_TRANSPORTER
-  if(tcpReadSelectReply > 0)
+  for (int i=0; i<nTCPTransporters; i++) 
   {
-    for (int i=0; i<nTCPTransporters; i++) 
+    checkJobBuffer();
+    TCP_Transporter *t = theTCPTransporters[i];
+    const NodeId nodeId = t->getRemoteNodeId();
+    const NDB_SOCKET_TYPE socket    = t->getSocket();
+    if(is_connected(nodeId))
     {
-      checkJobBuffer();
-      TCP_Transporter *t = theTCPTransporters[i];
-      const NodeId nodeId = t->getRemoteNodeId();
-      const NDB_SOCKET_TYPE socket    = t->getSocket();
-      if(is_connected(nodeId)){
-	if(t->isConnected() && FD_ISSET(socket, &tcpReadset)) 
-	{
-	  const int receiveSize = t->doReceive();
-	  if(receiveSize > 0)
-	  {
-	    Uint32 * ptr;
-	    Uint32 sz = t->getReceiveData(&ptr);
-	    transporter_recv_from(callbackObj, nodeId);
-	    Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
-	    t->updateReceiveDataPtr(szUsed);
-          }
-	}
+      if(t->isConnected())
+      {
+        if (FD_ISSET(socket, &tcpReadset))
+  	{
+ 	  t->doReceive();
+        }
+        
+        if (t->hasReceiveData())
+        {
+          Uint32 * ptr;
+          Uint32 sz = t->getReceiveData(&ptr);
+          Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
+          t->updateReceiveDataPtr(szUsed);
+  	}
       } 
     }
   }

--- 1.31/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2007-05-29 07:35:07 +02:00
+++ 1.32/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2007-05-29 07:35:07 +02:00
@@ -136,6 +136,7 @@
 
 #ifdef ERROR_INSERT
 NodeBitmask c_error_9000_nodes_mask;
+extern Uint32 MAX_RECEIVED_SIGNALS;
 #endif
 
 void Cmvmi::execNDB_TAMPER(Signal* signal) 
@@ -163,6 +164,22 @@
   if(ERROR_INSERTED(9995)){
     simulate_error_during_shutdown= SIGSEGV;
     kill(getpid(), SIGABRT);
+  }
+#endif
+
+#ifdef ERROR_INSERT
+  if (signal->theData[0] == 9003)
+  {
+    if (MAX_RECEIVED_SIGNALS < 1024)
+    {
+      MAX_RECEIVED_SIGNALS = 1024;
+    }
+    else
+    {
+      MAX_RECEIVED_SIGNALS = 1 + (rand() % 128);
+    }
+    ndbout_c("MAX_RECEIVED_SIGNALS: %d", MAX_RECEIVED_SIGNALS);
+    CLEAR_ERROR_INSERT_VALUE;
   }
 #endif
 }//execNDB_TAMPER()

--- 1.22/storage/ndb/test/ndbapi/testNdbApi.cpp	2007-05-29 07:35:07 +02:00
+++ 1.23/storage/ndb/test/ndbapi/testNdbApi.cpp	2007-05-29 07:35:07 +02:00
@@ -1292,6 +1292,36 @@
   
 template class Vector<NdbScanOperation*>;
 
+int 
+runBug28443(NDBT_Context* ctx, NDBT_Step* step)
+{
+  int result = NDBT_OK;
+  int records = ctx->getNumRecords();
+  
+  NdbRestarter restarter;
+  
+  restarter.insertErrorInAllNodes(9003);
+  
+  for (Uint32 i = 0; i<ctx->getNumLoops(); i++)
+  {
+    HugoTransactions hugoTrans(*ctx->getTab());
+    if (hugoTrans.loadTable(GETNDB(step), records, 2048) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+    if (runClearTable(ctx, step) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+  }
+  
+done:
+  restarter.insertErrorInAllNodes(9003);
+  
+  return result;
+}
 
 NDBT_TESTSUITE(testNdbApi);
 TESTCASE("MaxNdb", 
@@ -1370,6 +1400,11 @@
 TESTCASE("Bug_11133", 
 	 "Test ReadEx-Delete-Write\n"){ 
   INITIALIZER(runBug_11133);
+  FINALIZER(runClearTable);
+}
+TESTCASE("Bug28443", 
+	 ""){ 
+  INITIALIZER(runBug28443);
   FINALIZER(runClearTable);
 }
 TESTCASE("Scan_4006", 
Thread
bk commit into 5.1 tree (jonas:1.2147) BUG#28443jonas29 May