List:Internals« Previous MessageNext Message »
From:tomas Date:October 11 2005 3:48pm
Subject:bk commit into 5.0 tree (tomas:1.2027) BUG#9249
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.2027 05/10/11 15:48:07 tomas@stripped +15 -0
  Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission

  ndb/src/ndbapi/TransporterFacade.cpp
    1.41 05/10/11 15:47:58 tomas@stripped +8 -5
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - minor syntax changes

  ndb/src/mgmsrv/ConfigInfo.cpp
    1.69 05/10/11 15:47:58 tomas@stripped +3 -2
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - enable usage of SHM default section

  ndb/src/kernel/vm/VMSignal.hpp
    1.6 05/10/11 15:47:57 tomas@stripped +10 -0
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added struct to allocate smaller Signal

  ndb/src/kernel/vm/TransporterCallback.cpp
    1.10 05/10/11 15:47:57 tomas@stripped +72 -18
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added error info
    - corrected stak overflow issues

  ndb/src/kernel/vm/FastScheduler.cpp
    1.8 05/10/11 15:47:57 tomas@stripped +8 -7
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - corrected stack overflow issues

  ndb/src/kernel/error/ndbd_exit_codes.c
    1.7 05/10/11 15:47:57 tomas@stripped +1 -0
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - new exit code

  ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.22 05/10/11 15:47:57 tomas@stripped +10 -0
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added error reporting on connect failure

  ndb/src/common/transporter/TransporterRegistry.cpp
    1.60 05/10/11 15:47:57 tomas@stripped +2 -2
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission

  ndb/src/common/transporter/Transporter.hpp
    1.13 05/10/11 15:47:57 tomas@stripped +2 -1
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added more info to report error

  ndb/src/common/transporter/SHM_Transporter.win32.cpp
    1.4 05/10/11 15:47:57 tomas@stripped +6 -0
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission

  ndb/src/common/transporter/SHM_Transporter.unix.cpp
    1.6 05/10/11 15:47:57 tomas@stripped +27 -1
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added more error info to errors

  ndb/src/common/transporter/SHM_Transporter.hpp
    1.9 05/10/11 15:47:57 tomas@stripped +2 -0
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission

  ndb/src/common/transporter/SHM_Transporter.cpp
    1.16 05/10/11 15:47:57 tomas@stripped +13 -9
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added error info to errors

  ndb/include/transporter/TransporterCallback.hpp
    1.3 05/10/11 15:47:57 tomas@stripped +41 -31
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - corrected transporter callback error codes to have consistant usage of 0x8000 flag
for flagging call to do disconnect

  ndb/include/mgmapi/ndbd_exit_codes.h
    1.7 05/10/11 15:47:57 tomas@stripped +1 -0
    Bug #9249  	NDBD crashes when mapping SHM segment w/o correct permission
    - added new exit code for connection setup 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/mysql-5.0

--- 1.2/ndb/include/transporter/TransporterCallback.hpp	2005-07-22 12:29:14 +02:00
+++ 1.3/ndb/include/transporter/TransporterCallback.hpp	2005-10-11 15:47:57 +02:00
@@ -81,7 +81,9 @@
 void 
 reportDisconnect(void * callbackObj,
 		 NodeId nodeId, Uint32 errNo); 
- 
+
+#define TE_DO_DISCONNECT 0x8000
+
 enum TransporterError { 
   TE_NO_ERROR = 0,
   /** 
@@ -111,7 +113,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisconnect) 
    */ 
-  TE_INVALID_MESSAGE_LENGTH = 0x8003, 
+  TE_INVALID_MESSAGE_LENGTH = 0x3 | TE_DO_DISCONNECT, 
    
   /** 
    * TE_INVALID_CHECKSUM 
@@ -120,7 +122,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  TE_INVALID_CHECKSUM = 0x8004, 
+  TE_INVALID_CHECKSUM = 0x4 | TE_DO_DISCONNECT, 
  
   /** 
    * TE_COULD_NOT_CREATE_SOCKET 
@@ -129,7 +131,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  TE_COULD_NOT_CREATE_SOCKET = 0x8005, 
+  TE_COULD_NOT_CREATE_SOCKET = 0x5, 
  
   /** 
    * TE_COULD_NOT_BIND_SOCKET 
@@ -138,7 +140,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  TE_COULD_NOT_BIND_SOCKET = 0x8006, 
+  TE_COULD_NOT_BIND_SOCKET = 0x6, 
  
   /** 
    * TE_LISTEN_FAILED 
@@ -147,7 +149,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  TE_LISTEN_FAILED = 0x8007, 
+  TE_LISTEN_FAILED = 0x7, 
  
   /** 
    * TE_ACCEPT_RETURN_ERROR 
@@ -158,7 +160,7 @@
    * Recommended behavior: Ignore  
    *   (or possible do setPerformState(PerformDisconnect) 
    */ 
-  TE_ACCEPT_RETURN_ERROR = 0x8008 
+  TE_ACCEPT_RETURN_ERROR = 0x8 
  
   /** 
    * TE_SHM_DISCONNECT  
@@ -167,7 +169,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SHM_DISCONNECT = 0x800b 
+  ,TE_SHM_DISCONNECT = 0xb | TE_DO_DISCONNECT
  
   /** 
    * TE_SHM_IPC_STAT 
@@ -178,7 +180,12 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SHM_IPC_STAT = 0x800c 
+  ,TE_SHM_IPC_STAT = 0xc | TE_DO_DISCONNECT
+
+  /**
+   * Permanent error
+   */
+  ,TE_SHM_IPC_PERMANENT = 0x21 
  
   /** 
    * TE_SHM_UNABLE_TO_CREATE_SEGMENT 
@@ -188,7 +195,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0x800d 
+  ,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0xd 
  
   /** 
    * TE_SHM_UNABLE_TO_ATTACH_SEGMENT 
@@ -198,7 +205,7 @@
    * 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0x800e 
+  ,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0xe 
  
   /** 
    * TE_SHM_UNABLE_TO_REMOVE_SEGMENT 
@@ -208,12 +215,12 @@
    * Recommended behavior: Ignore (not much to do) 
    *                       Print warning to logfile 
    */ 
-  ,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0x800f 
+  ,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0xf 
  
-  ,TE_TOO_SMALL_SIGID = 0x0010 
-  ,TE_TOO_LARGE_SIGID = 0x0011 
-  ,TE_WAIT_STACK_FULL = 0x8012 
-  ,TE_RECEIVE_BUFFER_FULL = 0x8013 
+  ,TE_TOO_SMALL_SIGID = 0x10 
+  ,TE_TOO_LARGE_SIGID = 0x11 
+  ,TE_WAIT_STACK_FULL = 0x12 | TE_DO_DISCONNECT
+  ,TE_RECEIVE_BUFFER_FULL = 0x13 | TE_DO_DISCONNECT
  
   /** 
    * TE_SIGNAL_LOST_SEND_BUFFER_FULL 
@@ -222,7 +229,7 @@
    *   a signal is dropped!! very bad very bad 
    * 
    */ 
-  ,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x8014 
+  ,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x14 | TE_DO_DISCONNECT
  
   /** 
    * TE_SIGNAL_LOST 
@@ -231,14 +238,14 @@
    *   a signal is dropped!! very bad very bad 
    * 
    */ 
-  ,TE_SIGNAL_LOST = 0x8015 
+  ,TE_SIGNAL_LOST = 0x15 
  
   /** 
    * TE_SEND_BUFFER_FULL 
    *  
    *   The send buffer was full, but sleeping for a while solved it 
    */ 
-  ,TE_SEND_BUFFER_FULL = 0x0016 
+  ,TE_SEND_BUFFER_FULL = 0x16 
  
   /** 
    * TE_SCI_UNABLE_TO_CLOSE_CHANNEL 
@@ -246,7 +253,7 @@
    *  Unable to close the sci channel and the resources allocated by  
    *  the sisci api. 
    */ 
-  ,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x8016 
+  ,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x22 
  
   /** 
    * TE_SCI_LINK_ERROR 
@@ -255,7 +262,7 @@
    *  No point in continuing. Must check the connections. 
    * Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_LINK_ERROR = 0x8017 
+  ,TE_SCI_LINK_ERROR = 0x0017 
  
   /** 
    * TE_SCI_UNABLE_TO_START_SEQUENCE 
@@ -264,14 +271,14 @@
    *  are exumed or no sequence has been created. 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x8018 
+  ,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x18 | TE_DO_DISCONNECT
    
   /** 
    * TE_SCI_UNABLE_TO_REMOVE_SEQUENCE 
    *  
    *  Could not remove a sequence 
    */ 
-  ,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x8019 
+  ,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x19 | TE_DO_DISCONNECT
  
   /** 
    * TE_SCI_UNABLE_TO_CREATE_SEQUENCE 
@@ -280,7 +287,7 @@
    *  exempted. Must reboot. 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x801a 
+  ,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x1a | TE_DO_DISCONNECT
  
   /** 
    * TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR 
@@ -288,7 +295,7 @@
    *  Tried to send data on redundant link but failed. 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x801b 
+  ,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x1b | TE_DO_DISCONNECT
  
   /** 
    * TE_SCI_CANNOT_INIT_LOCALSEGMENT 
@@ -297,7 +304,7 @@
    *  gone wrong (no system resources). Must reboot. 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x801c 
+  ,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x1c | TE_DO_DISCONNECT
  
   /** 
    * TE_SCI_CANNOT_MAP_REMOTESEGMENT 
@@ -306,7 +313,7 @@
    *  Must reboot system. 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x801d 
+  ,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x1d | TE_DO_DISCONNECT
  
    /** 
    * TE_SCI_UNABLE_TO_UNMAP_SEGMENT 
@@ -314,7 +321,7 @@
    *  Cannot free the resources used by this segment (step 1). 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x801e 
+  ,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x1e | TE_DO_DISCONNECT
  
    /** 
    * TE_SCI_UNABLE_TO_REMOVE_SEGMENT 
@@ -324,7 +331,7 @@
    *  to map more segment 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x801f 
+  ,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x1f  | TE_DO_DISCONNECT
  
    /** 
    * TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT 
@@ -332,15 +339,18 @@
    *  Cannot disconnect from a remote segment. 
    *  Recommended behavior: setPerformState(PerformDisonnect) 
    */ 
-  ,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x8020 
+  ,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x20 | TE_DO_DISCONNECT
  
+  /* Used 0x21 */
+  /* Used 0x22 */
 }; 
  
 /** 
  * Report error 
  */ 
 void 
-reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode); 
+reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode,
+	    const char *info = 0);
 
 void
 transporter_recv_from(void* callbackObj, NodeId node);

--- 1.68/ndb/src/mgmsrv/ConfigInfo.cpp	2005-09-30 10:02:54 +02:00
+++ 1.69/ndb/src/mgmsrv/ConfigInfo.cpp	2005-10-11 15:47:58 +02:00
@@ -150,7 +150,6 @@
   { "TCP",  fixPortNumber, 0 }, // has to come after fixHostName
   { "SHM",  fixPortNumber, 0 }, // has to come after fixHostName
   { "SCI",  fixPortNumber, 0 }, // has to come after fixHostName
-  { "SHM",  fixShmKey, 0 },
 
   /**
    * fixExtConnection must be after fixNodeId
@@ -164,6 +163,8 @@
   { "*",    fixDepricated, 0 },
   { "*",    applyDefaultValues, "system" },
 
+  { "SHM",  fixShmKey, 0 }, // has to come after apply default values
+
   { DB_TOKEN,   checkLocalhostHostnameMix, 0 },
   { API_TOKEN,  checkLocalhostHostnameMix, 0 },
   { MGM_TOKEN,  checkLocalhostHostnameMix, 0 },
@@ -1798,7 +1799,7 @@
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "0",
+    UNDEFINED,
     "0",
     STR_VALUE(MAX_INT_RNIL) },
   

--- 1.15/ndb/src/common/transporter/SHM_Transporter.cpp	2005-05-26 22:07:29 +02:00
+++ 1.16/ndb/src/common/transporter/SHM_Transporter.cpp	2005-10-11 15:47:57 +02:00
@@ -47,6 +47,9 @@
   shmKey(_shmKey),
   shmSize(_shmSize)
 {
+#ifndef NDB_WIN32
+  shmId= 0;
+#endif
   _shmSegCreated = false;
   _attached = false;
 
@@ -202,7 +205,8 @@
   // Create
   if(!_shmSegCreated){
     if (!ndb_shm_create()) {
-      report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT);
+      make_error_info(buf, sizeof(buf));
+      report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT, buf);
       NDB_CLOSE_SOCKET(sockfd);
       DBUG_RETURN(false);
     }
@@ -212,7 +216,8 @@
   // Attach
   if(!_attached){
     if (!ndb_shm_attach()) {
-      report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
+      make_error_info(buf, sizeof(buf));
+      report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT, buf);
       NDB_CLOSE_SOCKET(sockfd);
       DBUG_RETURN(false);
     }
@@ -224,7 +229,8 @@
 		   m_transporter_registry.m_shm_own_pid);
   
   // Wait for ok from client
-  if (s_input.gets(buf, 256) == 0) 
+  DBUG_PRINT("info", ("Wait for ok from client"));
+  if (s_input.gets(buf, sizeof(buf)) == 0) 
   {
     NDB_CLOSE_SOCKET(sockfd);
     DBUG_RETURN(false);
@@ -262,10 +268,8 @@
   SocketOutputStream s_output(sockfd);
   char buf[256];
 
-#if 1
-#endif
-
   // Wait for server to create and attach
+  DBUG_PRINT("info", ("Wait for server to create and attach"));
   if (s_input.gets(buf, 256) == 0) {
     NDB_CLOSE_SOCKET(sockfd);
     DBUG_PRINT("error", ("Server id %d did not attach",
@@ -293,7 +297,8 @@
   // Attach
   if(!_attached){
     if (!ndb_shm_attach()) {
-      report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
+      make_error_info(buf, sizeof(buf));
+      report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT, buf);
       NDB_CLOSE_SOCKET(sockfd);
       DBUG_PRINT("error", ("Failed attach of shm seg to node %d",
                   remoteNodeId));
@@ -310,6 +315,7 @@
   
   if (r) {
     // Wait for ok from server
+    DBUG_PRINT("info", ("Wait for ok from server"));
     if (s_input.gets(buf, 256) == 0) {
       NDB_CLOSE_SOCKET(sockfd);
       DBUG_PRINT("error", ("No ok from server node %d",
@@ -330,8 +336,6 @@
 SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
 {
   if (!checkConnected()) {
-    DBUG_PRINT("error", ("Already connected to node %d",
-                remoteNodeId));
     return false;
   }
   

--- 1.8/ndb/src/common/transporter/SHM_Transporter.hpp	2005-05-26 22:07:29 +02:00
+++ 1.9/ndb/src/common/transporter/SHM_Transporter.hpp	2005-10-11 15:47:57 +02:00
@@ -170,6 +170,8 @@
   bool hasDataToRead() const {
     return reader->empty() == false;
   }
+
+  void make_error_info(char info[], int sz);
 };
 
 #endif

--- 1.5/ndb/src/common/transporter/SHM_Transporter.unix.cpp	2004-06-30 14:29:46 +02:00
+++ 1.6/ndb/src/common/transporter/SHM_Transporter.unix.cpp	2005-10-11 15:47:57 +02:00
@@ -26,6 +26,12 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
+void SHM_Transporter::make_error_info(char info[], int sz)
+{
+  snprintf(info,sz,"Shm key=%d sz=%d id=%d",
+	   shmKey, shmSize, shmId);
+}
+
 bool
 SHM_Transporter::ndb_shm_create()
 {
@@ -64,12 +70,30 @@
   struct shmid_ds info;
   const int res = shmctl(shmId, IPC_STAT, &info);
   if(res == -1){
-    report_error(TE_SHM_IPC_STAT);
+    char buf[128];
+    int r= snprintf(buf, sizeof(buf),
+		    "shmctl(%d, IPC_STAT) errno: %d(%s). ", shmId,
+		    errno, strerror(errno));
+    make_error_info(buf+r, sizeof(buf)-r);
+    DBUG_PRINT("error",(buf));
+    switch (errno)
+    {
+    case EACCES:
+      report_error(TE_SHM_IPC_PERMANENT, buf);
+      break;
+    default:
+      report_error(TE_SHM_IPC_STAT, buf);
+      break;
+    }
     return false;
   }
  
   if(info.shm_nattch != 2){
+    char buf[128];
+    make_error_info(buf, sizeof(buf));
     report_error(TE_SHM_DISCONNECT);
+    DBUG_PRINT("error", ("Already connected to node %d",
+                remoteNodeId));
     return false;
   }
   return true;
@@ -91,6 +115,8 @@
   if(isServer && _shmSegCreated){
     const int res = shmctl(shmId, IPC_RMID, 0);
     if(res == -1){
+      char buf[64];
+      make_error_info(buf, sizeof(buf));
       report_error(TE_SHM_UNABLE_TO_REMOVE_SEGMENT);
       return;
     }

--- 1.3/ndb/src/common/transporter/SHM_Transporter.win32.cpp	2004-05-11 22:34:10 +02:00
+++ 1.4/ndb/src/common/transporter/SHM_Transporter.win32.cpp	2005-10-11 15:47:57 +02:00
@@ -26,6 +26,12 @@
 #include <windows.h>
 
 
+void SHM_Transporter::make_error_info(char info[], int sz)
+{
+  snprintf(info,sz,"Shm key=%d sz=%d",
+	   shmKey, shmSize);
+}
+
 bool
 SHM_Transporter::connectServer(Uint32 timeOutMillis){
   if(!_shmSegCreated)

--- 1.12/ndb/src/common/transporter/Transporter.hpp	2005-07-15 14:00:02 +02:00
+++ 1.13/ndb/src/common/transporter/Transporter.hpp	2005-10-11 15:47:57 +02:00
@@ -161,7 +161,8 @@
   TransporterRegistry &m_transporter_registry;
   void *get_callback_obj() { return m_transporter_registry.callbackObj; };
   void report_disconnect(int
err){m_transporter_registry.report_disconnect(remoteNodeId,err);};
-  void report_error(enum TransporterError
err){reportError(get_callback_obj(),remoteNodeId,err);};
+  void report_error(enum TransporterError err, const char *info = 0)
+    { reportError(get_callback_obj(), remoteNodeId, err, info); };
 };
 
 inline

--- 1.59/ndb/src/common/transporter/TransporterRegistry.cpp	2005-07-22 14:22:40 +02:00
+++ 1.60/ndb/src/common/transporter/TransporterRegistry.cpp	2005-10-11 15:47:57 +02:00
@@ -1508,8 +1508,8 @@
     {
       DBUG_PRINT("error",("Install failed"));
       g_eventLogger.error("Failed to install signal handler for"
-			  " SHM transporter errno: %d (%s)", errno, 
-			  strerror(errno));
+			  " SHM transporter, signum %d, errno: %d (%s)",
+			  g_ndb_shm_signum, errno, strerror(errno));
     }
   }
 #endif // NDB_SHM_TRANSPORTER

--- 1.21/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-10-05 16:35:21 +02:00
+++ 1.22/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-10-11 15:47:57 +02:00
@@ -1823,11 +1823,14 @@
 /*******************************/
 /* DISCONNECT_REP             */
 /*******************************/
+const char *lookupConnectionError(Uint32 err);
+
 void Qmgr::execDISCONNECT_REP(Signal* signal) 
 {
   jamEntry();
   const DisconnectRep * const rep = (DisconnectRep *)&signal->theData[0];
   const Uint32 nodeId = rep->nodeId;
+  const Uint32 err = rep->err;
   c_connectedNodes.clear(nodeId);
 
   NodeRecPtr nodePtr;
@@ -1838,10 +1841,17 @@
     jam();
     break;
   case ZINIT:
+    ndbrequire(false);
   case ZSTARTING:
+    progError(__LINE__, NDBD_EXIT_CONNECTION_SETUP_FAILED,
+	      lookupConnectionError(err));
+    ndbrequire(false);
   case ZPREPARE_FAIL:
+    ndbrequire(false);
   case ZFAIL_CLOSING:
+    ndbrequire(false);
   case ZAPI_ACTIVE:
+    ndbrequire(false);
   case ZAPI_INACTIVE:
     ndbrequire(false);
   }

--- 1.6/ndb/include/mgmapi/ndbd_exit_codes.h	2005-10-05 16:35:20 +02:00
+++ 1.7/ndb/include/mgmapi/ndbd_exit_codes.h	2005-10-11 15:47:57 +02:00
@@ -100,6 +100,7 @@
 #define NDBD_EXIT_SIGNAL_LOST                 6051
 #define NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL 6052
 #define NDBD_EXIT_ILLEGAL_SIGNAL              6053
+#define NDBD_EXIT_CONNECTION_SETUP_FAILED     6054
 
 /* NDBCNTR 6100-> */
 #define NDBD_EXIT_RESTART_TIMEOUT             6100

--- 1.6/ndb/src/kernel/error/ndbd_exit_codes.c	2005-10-06 22:23:14 +02:00
+++ 1.7/ndb/src/kernel/error/ndbd_exit_codes.c	2005-10-11 15:47:57 +02:00
@@ -95,6 +95,7 @@
    {NDBD_EXIT_SIGNAL_LOST,    XIE, "Signal lost (unknown reason)"},
    {NDBD_EXIT_ILLEGAL_SIGNAL, XIE,
     "Illegal signal (version mismatch a possibility)"},
+   {NDBD_EXIT_CONNECTION_SETUP_FAILED, XCE, "Connection setup failed"},
 
    /* Ndbcntr */
    {NDBD_EXIT_RESTART_TIMEOUT, XCE,

--- 1.7/ndb/src/kernel/vm/FastScheduler.cpp	2005-10-03 20:04:26 +02:00
+++ 1.8/ndb/src/kernel/vm/FastScheduler.cpp	2005-10-11 15:47:57 +02:00
@@ -394,7 +394,8 @@
 
 void FastScheduler::dumpSignalMemory(FILE * output)
 {
-  Signal signal;
+  SignalT<25> signalT;
+  Signal &signal= *(Signal*)&signalT;
   Uint32 ReadPtr[5];
   Uint32 tJob;
   Uint32 tLastJob;
@@ -483,16 +484,16 @@
  */
 void 
 FastScheduler::reportDoJobStatistics(Uint32 tMeanLoopCount) {
-  Signal signal; 
+  SignalT<2> signalT;
+  Signal &signal= *(Signal*)&signalT;
+
   memset(&signal.header, 0, sizeof(signal.header));
+  signal.header.theLength = 2;
+  signal.header.theSendersSignalId = 0;
+  signal.header.theSendersBlockRef = numberToRef(0, 0);  
 
   signal.theData[0] = NDB_LE_JobStatistic;
   signal.theData[1] = tMeanLoopCount;
-  
-  memset(&signal.header, 0, sizeof(SignalHeader));
-  signal.header.theLength = 2;
-  signal.header.theSendersSignalId = 0;
-  signal.header.theSendersBlockRef = numberToRef(0, 0);
   
   execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
 }

--- 1.9/ndb/src/kernel/vm/TransporterCallback.cpp	2005-10-03 20:04:27 +02:00
+++ 1.10/ndb/src/kernel/vm/TransporterCallback.cpp	2005-10-11 15:47:57 +02:00
@@ -39,6 +39,26 @@
  */
 SectionSegmentPool g_sectionSegmentPool;
 
+struct ConnectionError
+{
+  enum TransporterError err;
+  const char *text;
+};
+
+static const ConnectionError connectionError[] =
+{
+  { TE_NO_ERROR, "No error"},
+  { TE_SHM_UNABLE_TO_CREATE_SEGMENT, "Unable to create shared memory segment"},
+  { (enum TransporterError) -1, "No connection error message available (please report a
bug)"}
+};
+
+const char *lookupConnectionError(Uint32 err)
+{
+  int i= 0;
+  while ((Uint32)connectionError[i].err != err && (Uint32)connectionError[i].err
!= -1);
+  return connectionError[i].text;
+}
+
 bool
 import(Ptr<SectionSegment> & first, const Uint32 * src, Uint32 len){
   /**
@@ -306,30 +326,54 @@
 }
 
 void
-reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
+reportError(void * callbackObj, NodeId nodeId,
+	    TransporterError errorCode, const char *info)
+{
 #ifdef DEBUG_TRANSPORTER
-  char buf[255];
-  sprintf(buf, "reportError (%d, 0x%x)", nodeId, errorCode);
-  ndbout << buf << endl;
+  ndbout_c("reportError (%d, 0x%x) %s", nodeId, errorCode, info ? info : "")
 #endif
 
-  if(errorCode == TE_SIGNAL_LOST_SEND_BUFFER_FULL){
+  DBUG_ENTER("reportError");
+  DBUG_PRINT("info",("nodeId %d  errorCode: 0x%x  info: %s",
+		     nodeId, errorCode, info));
+
+  switch (errorCode)
+  {
+  case TE_SIGNAL_LOST_SEND_BUFFER_FULL:
+  {
+    char msg[64];
+    snprintf(msg, sizeof(msg), "Remote note id %d.%s%s", nodeId,
+	     info ? " " : "", info ? info : "");
     ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL,
-			       "", __FILE__,
-			       NST_ErrorHandler);
+			       msg, __FILE__, NST_ErrorHandler);
   }
-
-  if(errorCode == TE_SIGNAL_LOST){
+  case TE_SIGNAL_LOST:
+  {
+    char msg[64];
+    snprintf(msg, sizeof(msg), "Remote node id %d,%s%s", nodeId,
+	     info ? " " : "", info ? info : "");
     ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST,
-			       "", __FILE__,
-			       NST_ErrorHandler);
+			       msg, __FILE__, NST_ErrorHandler);
   }
-  
-  if(errorCode & 0x8000){
+  case TE_SHM_IPC_PERMANENT:
+  {
+    char msg[128];
+    snprintf(msg, sizeof(msg),
+	     "Remote node id %d.%s%s",
+	     nodeId, info ? " " : "", info ? info : "");
+    ErrorReporter::handleError(NDBD_EXIT_CONNECTION_SETUP_FAILED,
+			       msg, __FILE__, NST_ErrorHandler);
+  }
+  default:
+    break;
+  }
+ 
+  if(errorCode &  & TE_DO_DISCONNECT){
     reportDisconnect(callbackObj, nodeId, errorCode);
   }
   
-  Signal signal;
+  SignalT<3> signalT;
+  Signal &signal= *(Signal*)&signalT;
   memset(&signal.header, 0, sizeof(signal.header));
 
 
@@ -345,6 +389,8 @@
   signal.header.theSendersSignalId = 0;
   signal.header.theSendersBlockRef = numberToRef(0, globalData.ownId);
   globalScheduler.execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
+
+  DBUG_VOID_RETURN;
 }
 
 /**
@@ -354,7 +400,8 @@
 reportSendLen(void * callbackObj, 
 	      NodeId nodeId, Uint32 count, Uint64 bytes){
 
-  Signal signal;
+  SignalT<3> signalT;
+  Signal &signal= *(Signal*)&signalT;
   memset(&signal.header, 0, sizeof(signal.header));
 
   signal.header.theLength = 3;
@@ -373,7 +420,8 @@
 reportReceiveLen(void * callbackObj, 
 		 NodeId nodeId, Uint32 count, Uint64 bytes){
 
-  Signal signal;
+  SignalT<3> signalT;
+  Signal &signal= *(Signal*)&signalT;
   memset(&signal.header, 0, sizeof(signal.header));
 
   signal.header.theLength = 3;  
@@ -392,7 +440,8 @@
 void
 reportConnect(void * callbackObj, NodeId nodeId){
 
-  Signal signal;
+  SignalT<1> signalT;
+  Signal &signal= *(Signal*)&signalT;
   memset(&signal.header, 0, sizeof(signal.header));
 
   signal.header.theLength = 1; 
@@ -409,7 +458,10 @@
 void
 reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){
 
-  Signal signal;
+  DBUG_ENTER("reportDisconnect");
+
+  SignalT<sizeof(DisconnectRep)/4> signalT;
+  Signal &signal= *(Signal*)&signalT;
   memset(&signal.header, 0, sizeof(signal.header));
 
   signal.header.theLength = DisconnectRep::SignalLength; 
@@ -422,6 +474,8 @@
   rep->err = errNo;
 
   globalScheduler.execute(&signal, JBA, CMVMI, GSN_DISCONNECT_REP);
+
+  DBUG_VOID_RETURN;
 }
 
 void

--- 1.5/ndb/src/kernel/vm/VMSignal.hpp	2004-12-16 21:47:34 +01:00
+++ 1.6/ndb/src/kernel/vm/VMSignal.hpp	2005-10-11 15:47:57 +02:00
@@ -42,6 +42,16 @@
   NodeBitmask m_nodes;
 };
 
+template <unsigned T> struct SignalT
+{
+  SignalHeader header;
+  SegmentedSectionPtr m_sectionPtr[3]; 
+  union {
+    Uint32 theData[T];
+    Uint64 dummyAlign;
+  };
+};
+
 /**
  * class used for passing argumentes to blocks
  */

--- 1.40/ndb/src/ndbapi/TransporterFacade.cpp	2005-08-21 16:24:48 +02:00
+++ 1.41/ndb/src/ndbapi/TransporterFacade.cpp	2005-10-11 15:47:58 +02:00
@@ -63,13 +63,16 @@
  *****************************************************************************/
 
 void
-reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
+reportError(void * callbackObj, NodeId nodeId,
+	    TransporterError errorCode, const char *info)
+{
 #ifdef REPORT_TRANSPORTER
-  ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d)", 
-	   (int)nodeId, (int)errorCode);
+  ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d) %s", 
+	   (int)nodeId, (int)errorCode, info ? info : "");
 #endif
-  if(errorCode & 0x8000) {
-    ndbout_c("reportError (%d, %d)\n", (int)nodeId, (int)errorCode);
+  if(errorCode & TE_DO_DISCONNECT) {
+    ndbout_c("reportError (%d, %d) %s", (int)nodeId, (int)errorCode,
+	     info ? info : "");
     ((TransporterFacade*)(callbackObj))->doDisconnect(nodeId);
   }
 }
Thread
bk commit into 5.0 tree (tomas:1.2027) BUG#9249tomas11 Oct