diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet mysql-5.1.12/config/ac-macros/ha_ndbcluster.m4 clean_dolphin_fixes/config/ac-macros/ha_ndbcluster.m4
--- mysql-5.1.12/config/ac-macros/ha_ndbcluster.m4	2006-06-09 03:06:40 -04:00
+++ clean_dolphin_fixes/config/ac-macros/ha_ndbcluster.m4	2006-08-17 04:14:15 -04:00
@@ -43,7 +43,7 @@
       if test -f "$mysql_sci_dir/lib/libsisci.a" -a \ 
               -f "$mysql_sci_dir/include/sisci_api.h"; then
         NDB_SCI_INCLUDES="-I$mysql_sci_dir/include"
-        NDB_SCI_LIBS="-L$mysql_sci_dir/lib -lsisci"
+        NDB_SCI_LIBS="$mysql_sci_dir/lib/libsisci.a"
         AC_MSG_RESULT([-- including sci transporter])
         AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
                   [Including Ndb Cluster DB sci transporter])
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet mysql-5.1.12/libmysqld/Makefile.am clean_dolphin_fixes/libmysqld/Makefile.am
--- mysql-5.1.12/libmysqld/Makefile.am	2006-09-19 02:38:45 -04:00
+++ clean_dolphin_fixes/libmysqld/Makefile.am	2006-10-21 13:05:42 -04:00
@@ -88,7 +88,7 @@
 		$(top_builddir)/dbug/libdbug.a \
 		$(top_builddir)/vio/libvio.a \
 		@mysql_plugin_libs@ \
-		$(yassl_inc_libs)
+		$(yassl_inc_libs) @NDB_SCI_LIBS@
 
 if HAVE_YASSL
 yassl_inc_libs=	$(top_srcdir)/extra/yassl/src/.libs/libyassl.a \
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet mysql-5.1.12/libmysqld/examples/Makefile.am clean_dolphin_fixes/libmysqld/examples/Makefile.am
--- mysql-5.1.12/libmysqld/examples/Makefile.am	2006-06-09 03:07:25 -04:00
+++ clean_dolphin_fixes/libmysqld/examples/Makefile.am	2006-08-17 04:14:15 -04:00
@@ -36,7 +36,8 @@
 		-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
 		$(openssl_includes)
 LIBS =		@LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
-LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS)
+LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
+                @NDB_SCI_LIBS@
 
 mysqltest_embedded_LINK = $(CXXLINK)
 mysqltest_embedded_SOURCES =	mysqltest.c
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet mysql-5.1.12/sql/Makefile.am clean_dolphin_fixes/sql/Makefile.am
--- mysql-5.1.12/sql/Makefile.am	2006-10-16 15:33:29 -04:00
+++ clean_dolphin_fixes/sql/Makefile.am	2006-10-21 13:05:42 -04:00
@@ -34,7 +34,8 @@
 			$(top_builddir)/mysys/libmysys.a \
 			$(top_builddir)/dbug/libdbug.a \
 			$(top_builddir)/regex/libregex.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ \
+                        @NDB_SCI_LIBS@
 mysqld_DEPENDENCIES=	@mysql_plugin_libs@ $(LDADD)
 mysqld_LDADD =		@MYSQLD_EXTRA_LDFLAGS@ \
 			@pstack_libs@ \
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet mysql-5.1.12/storage/ndb/src/common/transporter/SCI_Transporter.cpp clean_dolphin_fixes/storage/ndb/src/common/transporter/SCI_Transporter.cpp
--- mysql-5.1.12/storage/ndb/src/common/transporter/SCI_Transporter.cpp	2005-06-13 09:16:11 -04:00
+++ clean_dolphin_fixes/storage/ndb/src/common/transporter/SCI_Transporter.cpp	2006-09-22 04:46:52 -04:00
@@ -66,13 +66,10 @@
  
    
   m_initLocal=false; 
-  m_swapCounter=0; 
   m_failCounter=0; 
   m_remoteNodes[0]=remoteSciNodeId0; 
   m_remoteNodes[1]=remoteSciNodeId1; 
   m_adapters = nAdapters;   
-  // The maximum number of times to try and create,  
-  // start and destroy a sequence 
   m_ActiveAdapterId=0; 
   m_StandbyAdapterId=1; 
   
@@ -103,8 +100,6 @@
   DBUG_VOID_RETURN;
 } 
  
- 
- 
 void SCI_Transporter::disconnectImpl() 
 { 
   DBUG_ENTER("SCI_Transporter::disconnectImpl");
@@ -130,7 +125,8 @@
       
       if(err != SCI_ERR_OK)  { 
 	report_error(TE_SCI_UNABLE_TO_CLOSE_CHANNEL); 
-        DBUG_PRINT("error", ("Cannot close channel to the driver. Error code 0x%x",  
+        DBUG_PRINT("error",
+        ("Cannot close channel to the driver. Error code 0x%x",  
 		    err)); 
       } 
     } 
@@ -165,19 +161,18 @@
   m_sendBuffer.m_buffer = new Uint32[m_sendBuffer.m_sendBufferSize / 4];
   m_sendBuffer.m_dataSize = 0;
  
-  DBUG_PRINT("info", ("Created SCI Send Buffer with buffer size %d and packet size %d",
+  DBUG_PRINT("info",
+  ("Created SCI Send Buffer with buffer size %d and packet size %d",
               m_sendBuffer.m_sendBufferSize, m_PacketSize * 4));
   if(!getLinkStatus(m_ActiveAdapterId) ||  
      (m_adapters > 1 &&
      !getLinkStatus(m_StandbyAdapterId))) { 
-    DBUG_PRINT("error", ("The link is not fully operational. Check the cables and the switches")); 
-    //reportDisconnect(remoteNodeId, 0); 
-    //doDisconnect(); 
+    DBUG_PRINT("error",
+    ("The link is not fully operational. Check the cables and the switches")); 
     //NDB should terminate 
     report_error(TE_SCI_LINK_ERROR); 
     DBUG_RETURN(false); 
   } 
-  
   DBUG_RETURN(true); 
 } // initTransporter()  
 
@@ -236,7 +231,8 @@
       DBUG_PRINT("info", ("SCInode iD %d  adapter %d\n",  
 	         sciAdapters[i].localSciNodeId, i)); 
       if(err != SCI_ERR_OK) { 
-        DBUG_PRINT("error", ("Cannot open an SCI virtual device. Error code 0x%x", 
+        DBUG_PRINT("error",
+        ("Cannot open an SCI virtual device. Error code 0x%x", 
 		   err)); 
 	DBUG_RETURN(err); 
       } 
@@ -270,7 +266,8 @@
 		      &err); 
      
     if(err != SCI_ERR_OK) { 
-      DBUG_PRINT("error", ("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
+      DBUG_PRINT("error",
+    ("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
                   err)); 
       DBUG_RETURN(err); 
     } 
@@ -304,15 +301,13 @@
 			   &err); 
      
     if(err != SCI_ERR_OK) { 
-      DBUG_PRINT("error", ("Local Segment is not available for remote connections. Error code 0x%x\n",
+      DBUG_PRINT("error",
+   ("Local Segment is not available for remote connections. Error code 0x%x\n",
                  err)); 
       DBUG_RETURN(err); 
     } 
   } 
-  
-  
   setupLocalSegment(); 
-  
   DBUG_RETURN(err); 
    
 } // initLocalSegment() 
@@ -344,12 +339,6 @@
     if(sizeToSend==4097) 
       i4097++; 
 #endif
-    if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-      DBUG_PRINT("error", ("Start sequence failed")); 
-      report_error(TE_SCI_UNABLE_TO_START_SEQUENCE); 
-      return false; 
-    } 
-    
       
   tryagain:
     retry++;
@@ -375,119 +364,36 @@
 		SCI_FLAG_ERROR_CHECK, 
 		&err);   
       
-      
       if (err != SCI_ERR_OK) { 
-      if(err == SCI_ERR_OUT_OF_RANGE) { 
-        DBUG_PRINT("error", ("Data transfer : out of range error")); 
-	goto tryagain; 
-      } 
-      if(err == SCI_ERR_SIZE_ALIGNMENT) { 
-        DBUG_PRINT("error", ("Data transfer : alignment error")); 
-        DBUG_PRINT("info", ("sendPtr 0x%x, sizeToSend = %d", sendPtr, sizeToSend));
-	goto tryagain; 
-      } 
-      if(err == SCI_ERR_OFFSET_ALIGNMENT) { 
-        DBUG_PRINT("error", ("Data transfer : offset alignment")); 
-	goto tryagain; 
-      }   
-      if(err == SCI_ERR_TRANSFER_FAILED) { 
-	//(m_TargetSegm[m_StandbyAdapterId].writer)->heavyLock(); 
-	if(getLinkStatus(m_ActiveAdapterId)) { 
-	  goto tryagain; 
-	}
-        if (m_adapters == 1) {
-          DBUG_PRINT("error", ("SCI Transfer failed"));
+        if (err == SCI_ERR_OUT_OF_RANGE ||
+            err == SCI_ERR_SIZE_ALIGNMENT ||
+            err == SCI_ERR_OFFSET_ALIGNMENT) { 
+          DBUG_PRINT("error", ("Data transfer error = %d", err));
           report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
 	  return false; 
-        }
-	m_failCounter++; 
-	Uint32 temp=m_ActiveAdapterId;	    	     
-	switch(m_swapCounter) { 
-	case 0:  
-	  /**swap from active (0) to standby (1)*/ 
-	  if(getLinkStatus(m_StandbyAdapterId)) { 
-            DBUG_PRINT("error", ("Swapping from adapter 0 to 1")); 
+        } 
+        if(err == SCI_ERR_TRANSFER_FAILED) { 
+	  if(getLinkStatus(m_ActiveAdapterId))
+	    goto tryagain; 
+          if (m_adapters == 1) {
+            DBUG_PRINT("error", ("SCI Transfer failed"));
+            report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
+	    return false; 
+          }
+	  m_failCounter++; 
+	  Uint32 temp=m_ActiveAdapterId;	    	     
+	  if (getLinkStatus(m_StandbyAdapterId)) { 
 	    failoverShmWriter();		 
 	    SCIStoreBarrier(m_TargetSegm[m_StandbyAdapterId].sequence,0); 
 	    m_ActiveAdapterId=m_StandbyAdapterId; 
 	    m_StandbyAdapterId=temp; 
-	    SCIRemoveSequence((m_TargetSegm[m_StandbyAdapterId].sequence),
-			      FLAGS,  
-			      &err); 
-	    if(err!=SCI_ERR_OK) { 
-	      report_error(TE_SCI_UNABLE_TO_REMOVE_SEQUENCE); 
-              DBUG_PRINT("error", ("Unable to remove sequence"));
-	      return false; 
-	    } 
-	    if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Start sequence failed")); 
-	      report_error(TE_SCI_UNABLE_TO_START_SEQUENCE); 
-	      return false; 
-	    } 
-	    m_swapCounter++; 
-            DBUG_PRINT("info", ("failover complete")); 
-	    goto tryagain; 
-	  }  else {
-	    report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
-            DBUG_PRINT("error", ("SCI Transfer failed")); 
-	    return false;
-	  }
-	  return false; 
-	  break; 
-	case 1: 
-	  /** swap back from 1 to 0 
-	      must check that the link is up */ 
-	  
-	  if(getLinkStatus(m_StandbyAdapterId)) { 
-	    failoverShmWriter(); 
-	    m_ActiveAdapterId=m_StandbyAdapterId; 
-	    m_StandbyAdapterId=temp; 
-            DBUG_PRINT("info", ("Swapping from 1 to 0"));	 
-	    if(createSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Unable to create sequence"));
-	      report_error(TE_SCI_UNABLE_TO_CREATE_SEQUENCE); 
-	      return false; 
-	    } 
-	    if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("startSequence failed... disconnecting")); 
-	      report_error(TE_SCI_UNABLE_TO_START_SEQUENCE); 
-	      return false; 
-	    } 
-	    
-	    SCIRemoveSequence((m_TargetSegm[m_StandbyAdapterId].sequence) 
-			      , FLAGS,  
-			      &err); 
-	    if(err!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Unable to remove sequence"));
-	      report_error(TE_SCI_UNABLE_TO_REMOVE_SEQUENCE); 
-	      return false;
-	    } 
-	    
-	    if(createSequence(m_StandbyAdapterId)!=SCI_ERR_OK) { 
-              DBUG_PRINT("error", ("Unable to create sequence on standby"));
-	      report_error(TE_SCI_UNABLE_TO_CREATE_SEQUENCE); 
-	      return false; 
-	    } 
-	    
-	    m_swapCounter=0; 
-	    
-            DBUG_PRINT("info", ("failover complete..")); 
-	    goto tryagain; 
-	    
+            DBUG_PRINT("error", ("Swapping from adapter %u to %u",
+                       m_StandbyAdapterId, m_ActiveAdapterId));
 	  } else {
-            DBUG_PRINT("error", ("Unrecoverable data transfer error")); 
 	    report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
-	    return false;
+            DBUG_PRINT("error", ("SCI Transfer failed")); 
 	  }
-	  
-	  break; 
-	default: 
-          DBUG_PRINT("error", ("Unrecoverable data transfer error")); 
-	  report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR); 
-	  return false; 
-	  break; 
-	}  
-      }
+        }
       } else { 
 	SHM_Writer * writer = (m_TargetSegm[m_ActiveAdapterId].writer);
 	writer->updateWritePtr(sizeToSend); 
@@ -498,7 +404,6 @@
 	m_sendBuffer.m_dataSize = 0;
 	m_sendBuffer.m_forceSendLimit = sendLimit;
       } 
-      
     } else { 
       /** 
        * If we end up here, the SCI segment is full.  
@@ -553,15 +458,12 @@
    DBUG_VOID_RETURN;
 } //setupLocalSegment 
  
- 
- 
 void SCI_Transporter::setupRemoteSegment()   
 { 
    DBUG_ENTER("SCI_Transporter::setupRemoteSegment");
    Uint32 sharedSize = 0; 
    sharedSize =4096;   //start of the buffer is page aligned 
  
- 
    Uint32 sizeOfBuffer = m_BufferSize; 
    const Uint32 slack = MAX_MESSAGE_SIZE;
    sizeOfBuffer -= sharedSize; 
@@ -667,7 +569,6 @@
         DBUG_PRINT("error", ("Error connecting segment, err 0x%x", err));
         DBUG_RETURN(false);
       }
-
     }
     // Map the remote memory segment into program space  
     for(Uint32 i=0; i < m_adapters ; i++) {
@@ -680,13 +581,14 @@
                             FLAGS,
                             &err);
 
-
-        if(err!= SCI_ERR_OK) {
-          DBUG_PRINT("error", ("Cannot map a segment to the remote node %d. Error code 0x%x",m_RemoteSciNodeId, err));
-          //NDB SHOULD TERMINATE AND COMPUTER REBOOTED! 
-          report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT);
-          DBUG_RETURN(false);
-        }
+      if(err!= SCI_ERR_OK) {
+        DBUG_PRINT("error",
+          ("Cannot map a segment to the remote node %d. Error code 0x%x",
+          m_RemoteSciNodeId, err));
+        //NDB SHOULD TERMINATE AND COMPUTER REBOOTED! 
+        report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT);
+        DBUG_RETURN(false);
+      }
     }
     m_mapped=true;
     setupRemoteSegment();
@@ -714,7 +616,6 @@
     NDB_CLOSE_SOCKET(sockfd);
     DBUG_RETURN(false);
   }
-
   if (!init_local()) {
     NDB_CLOSE_SOCKET(sockfd);
     DBUG_RETURN(false);
@@ -789,29 +690,9 @@
 		       &(m_TargetSegm[adapterid].sequence),  
 		       SCI_FLAG_FAST_BARRIER,  
 		       &err);  
-  
-  
   return err; 
 } // createSequence()  
  
- 
-sci_error_t SCI_Transporter::startSequence(Uint32 adapterid) { 
-  
-  sci_error_t err; 
-  /** Perform preliminary error check on an SCI adapter before starting a 
-   * sequence of read and write operations on the mapped segment. 
-   */ 
-  m_SequenceStatus = SCIStartSequence( 
-				       (m_TargetSegm[adapterid].sequence),  
-				       FLAGS, &err); 
-   
-   
-  // If there still is an error then data cannot be safely send 
-  return err; 
-} // startSequence() 
- 
-   
- 
 bool SCI_Transporter::disconnectLocal()  
 {
   DBUG_ENTER("SCI_Transporter::disconnectLocal"); 
@@ -879,9 +760,6 @@
   DBUG_VOID_RETURN;
 } // ~SCI_Transporter() 
  
- 
- 
- 
 void SCI_Transporter::closeSCI() { 
   // Termination of SCI 
   sci_error_t err; 
@@ -898,8 +776,9 @@
   SCIClose(activeSCIDescriptor, FLAGS, &err);  
    
   if(err != SCI_ERR_OK) {
-    DBUG_PRINT("error", ("Cannot close SCI channel to the driver. Error code 0x%x",  
-	        err)); 
+    DBUG_PRINT("error",
+      ("Cannot close SCI channel to the driver. Error code 0x%x",  
+      err)); 
   }
   SCITerminate(); 
   DBUG_VOID_RETURN;
@@ -974,7 +853,6 @@
     return false; 
 } 
  
- 
 void  
 SCI_Transporter::setConnected() { 
   *m_remoteStatusFlag = SCICONNECTED; 
@@ -984,7 +862,6 @@
   *m_localStatusFlag = SCICONNECTED; 
 } 
  
- 
 void  
 SCI_Transporter::setDisconnect() { 
   if(getLinkStatus(m_ActiveAdapterId)) 
@@ -995,7 +872,6 @@
   }
 } 
  
- 
 bool 
 SCI_Transporter::checkConnected() { 
   if (*m_localStatusFlag == SCIDISCONNECT) { 
@@ -1016,8 +892,9 @@
     SCIInitialize(0, &error); 
     if(error != SCI_ERR_OK)  { 
       DBUG_PRINT("error", ("Cannot initialize SISCI library."));
-      DBUG_PRINT("error", ("Inconsistency between SISCI library and SISCI driver. Error code 0x%x",
-                 error)); 
+      DBUG_PRINT("error",
+      ("Inconsistency between SISCI library and SISCI driver. Error code 0x%x",
+      error)); 
       DBUG_RETURN(false);
     } 
     init = true; 
@@ -1030,3 +907,4 @@
 {
   return (m_TargetSegm[m_ActiveAdapterId].writer)->get_free_buffer();
 }
+
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet mysql-5.1.12/storage/ndb/src/common/transporter/SCI_Transporter.hpp clean_dolphin_fixes/storage/ndb/src/common/transporter/SCI_Transporter.hpp
--- mysql-5.1.12/storage/ndb/src/common/transporter/SCI_Transporter.hpp	2005-06-07 06:21:21 -04:00
+++ clean_dolphin_fixes/storage/ndb/src/common/transporter/SCI_Transporter.hpp	2006-09-14 03:55:48 -04:00
@@ -55,12 +55,12 @@
  *  local segment, the SCI transporter connects to a segment created by another 
  *  transporter at a remote node, and the maps the remote segment into its  
  *  virtual address space. However, since NDB Cluster relies on redundancy 
- *  at the network level, by using dual SCI adapters communica 
- * 
+ *  at the network level, by using dual SCI adapters communication can be
+ *  maintained even if one of the adapter cards fails (or anything on the
+ *  network this adapter card exists in e.g. an SCI switch failure).
  * 
  */ 
 
-
 /**  
  * class SCITransporter 
  * @brief - main class for the SCI transporter. 
@@ -85,16 +85,6 @@
   sci_error_t createSequence(Uint32 adapterid);      
    
    
-  /** 
-   * starts a sequence for error checking. 
-   * The actual checking that a sequence is correct is done implicitly 
-   * in SCIMemCpy (in doSend).  
-   * @param adapterid the adapter on which to start the sequence. 
-   * @return SCI_ERR_OK if ok, otherwize something else. 
-   */ 
-  sci_error_t startSequence(Uint32 adapterid);          
- 
- 
   /** Initiate Local Segment: create a memory segment, 
    * prepare a memory segment, map the local segment  
    * into  memory space and make segment available. 
@@ -160,7 +150,6 @@
   bool m_mapped; 
   bool m_initLocal; 
   bool m_sciinit; 
-  Uint32 m_swapCounter; 
   Uint32 m_failCounter; 
   /** 
    * For statistics on transfered packets  
@@ -195,7 +184,6 @@
    * Statistics 
    */ 
   Uint32 m_reportFreq; 
- 
  
   Uint32 m_adapters;   
   Uint32 m_numberOfRemoteNodes; 
