List:Internals« Previous MessageNext Message »
From:tomas Date:July 14 2005 4:02pm
Subject:bk commit into 4.1 tree (tomas:1.2354)
View as plain text  
Below is the list of changes that have just been committed into a local
4.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.2354 05/07/14 18:02:11 tomas@stripped +6 -0
      stilled mem leak in usage on getVersionString
      added __LINE__ so systemErrorLab for better error printout

  ndb/tools/restore/restore_main.cpp
    1.27 05/07/14 18:02:05 tomas@stripped +2 -1
    stilled mem leak in usage on getVersionString

  ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.13 05/07/14 18:02:05 tomas@stripped +25 -26
    stilled mem leak in usage on getVersionString
    added __LINE__ so systemErrorLab for better error printout

  ndb/src/kernel/blocks/qmgr/Qmgr.hpp
    1.3 05/07/14 18:02:05 tomas@stripped +2 -2
    added __LINE__ so systemErrorLab for better error printout

  ndb/src/common/util/version.c
    1.18 05/07/14 18:02:04 tomas@stripped +7 -5
    stilled mem leak in usage on getVersionString

  ndb/include/util/version.h
    1.3 05/07/14 18:02:04 tomas@stripped +2 -1
    stilled mem leak in usage on getVersionString

  ndb/include/ndb_version.h.in
    1.2 05/07/14 18:02:04 tomas@stripped +10 -2
    stilled mem leak in usage on getVersionString

# 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-4.1-new

--- 1.1/ndb/include/ndb_version.h.in	2004-11-10 21:43:09 +01:00
+++ 1.2/ndb/include/ndb_version.h.in	2005-07-14 18:02:04 +02:00
@@ -36,8 +36,16 @@
 #define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8)  | ((C) << 0))
 
 #define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD)
-
-#define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS))
+#define NDB_VERSION_STRING_BUF_SZ 100
+#ifdef __cplusplus
+extern "C"
+#else
+extern
+#endif
+char ndb_version_string_buf[NDB_VERSION_STRING_BUF_SZ];
+#define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS, \
+                                             ndb_version_string_buf, \
+                                             sizeof(ndb_version_string_buf)))
 
 #define NDB_VERSION ndbGetOwnVersion()
 

--- 1.2/ndb/include/util/version.h	2004-10-12 14:03:24 +02:00
+++ 1.3/ndb/include/util/version.h	2005-07-14 18:02:04 +02:00
@@ -30,7 +30,8 @@
 
   Uint32 makeVersion(Uint32 major, Uint32 minor, Uint32 build);
 
-  const char* getVersionString(Uint32 version, const char * status);
+  const char* getVersionString(Uint32 version, const char * status,
+			       char *buf, unsigned sz);
   
   void ndbPrintVersion();
   Uint32 ndbGetOwnVersion();

--- 1.17/ndb/src/common/util/version.c	2005-06-22 11:18:00 +02:00
+++ 1.18/ndb/src/common/util/version.c	2005-07-14 18:02:04 +02:00
@@ -38,22 +38,24 @@
   
 }
 
-const char * getVersionString(Uint32 version, const char * status) {
-  char buff[100];
+char ndb_version_string_buf[NDB_VERSION_STRING_BUF_SZ];
+const char * getVersionString(Uint32 version, const char * status,
+			      char *buf, unsigned sz)
+{
   if (status && status[0] != 0)
-	  basestring_snprintf(buff, sizeof(buff),
+	  basestring_snprintf(buf, sz,
 	     "Version %d.%d.%d (%s)",
 	     getMajor(version),
 	     getMinor(version),
 	     getBuild(version),
 	     status);
   else
-    basestring_snprintf(buff, sizeof(buff),
+    basestring_snprintf(buf, sz,
 	     "Version %d.%d.%d",
 	     getMajor(version),
 	     getMinor(version),
 	     getBuild(version));
-  return strdup(buff);
+  return buf;
 }
 
 typedef enum {

--- 1.26/ndb/tools/restore/restore_main.cpp	2005-01-28 00:42:34 +01:00
+++ 1.27/ndb/tools/restore/restore_main.cpp	2005-07-14 18:02:05 +02:00
@@ -251,8 +251,9 @@
   const BackupFormat::FileHeader & tmp = metaData.getFileHeader();
   const Uint32 version = tmp.NdbVersion;
   
+  char buf[NDB_VERSION_STRING_BUF_SZ];
   ndbout << "Ndb version in backup files: " 
-	 <<  getVersionString(version, 0) << endl;
+	 <<  getVersionString(version, 0, buf, sizeof(buf)) << endl;
   
   /**
    * check wheater we can restore the backup (right version).

--- 1.2/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2004-05-26 10:55:43 +02:00
+++ 1.3/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2005-07-14 18:02:05 +02:00
@@ -257,8 +257,8 @@
   void hbReceivedLab(Signal* signal);
   void sendCmRegrefLab(Signal* signal, BlockReference ref, 
 		       CmRegRef::ErrorCode);
-  void systemErrorBecauseOtherNodeFailed(Signal* signal, NodeId);
-  void systemErrorLab(Signal* signal,
+  void systemErrorBecauseOtherNodeFailed(Signal* signal, Uint32 line, NodeId);
+  void systemErrorLab(Signal* signal, Uint32 line,
 		      const char* message = NULL);
   void prepFailReqLab(Signal* signal);
   void prepFailConfLab(Signal* signal);

--- 1.12/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2004-11-18 16:47:23 +01:00
+++ 1.13/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2005-07-14 18:02:05 +02:00
@@ -76,7 +76,7 @@
 void Qmgr::execCM_NODEINFOREF(Signal* signal) 
 {
   jamEntry();
-  systemErrorLab(signal);
+  systemErrorLab(signal, __LINE__);
   return;
 }//Qmgr::execCM_NODEINFOREF()
 
@@ -121,7 +121,7 @@
   default:
     jam();
     // ZCOULD_NOT_OCCUR_ERROR;
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
     return;
     break;
   }//switch
@@ -593,7 +593,7 @@
     jam();
     char buf[128];
     BaseString::snprintf(buf,sizeof(buf),"incompatible version own=0x%x other=0x%x, shutting down", NDB_VERSION, cmRegConf->presidentVersion);
-    systemErrorLab(signal, buf);
+    systemErrorLab(signal, __LINE__, buf);
     return;
   }
 
@@ -688,7 +688,7 @@
   switch (TrefuseReason) {
   case CmRegRef::ZINCOMPATIBLE_VERSION:
     jam();
-    systemErrorLab(signal, "incompatible version, connection refused by running ndb node");
+    systemErrorLab(signal, __LINE__, "incompatible version, connection refused by running ndb node");
     break;
   case CmRegRef::ZBUSY:
   case CmRegRef::ZBUSY_TO_PRES:
@@ -1751,7 +1751,7 @@
 
     if (failedNodePtr.p->rcv[0] == failedNodePtr.p->rcv[1]) {
       jam();
-      systemErrorLab(signal);
+      systemErrorLab(signal, __LINE__);
     } else {
       jam();
       failedNodePtr.p->rcv[0] = 0;
@@ -1763,7 +1763,7 @@
     ndbout << "failedNodePtr.p->failState = "
 	   << (Uint32)(failedNodePtr.p->failState) << endl;
 #endif   
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
   }//if
   return;
 }//Qmgr::execAPI_FAILCONF()
@@ -1780,7 +1780,7 @@
     failedNodePtr.p->failState = NORMAL;
   } else {
     jam();
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
   }//if
   if (cpresident == getOwnNodeId()) {
     jam();
@@ -1931,20 +1931,13 @@
 #endif
 
   bool compatability_check;
-  switch(getNodeInfo(apiNodePtr.i).getType()){
+  NodeInfo::NodeType type= getNodeInfo(apiNodePtr.i).getType();
+  switch(type){
   case NodeInfo::API:
     compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
-    if (!compatability_check)
-      infoEvent("Connection attempt from api or mysqld id=%d with %s "
-		"incompatible with %s", apiNodePtr.i,
-		getVersionString(version,""), NDB_VERSION_STRING);
     break;
   case NodeInfo::MGM:
     compatability_check = ndbCompatible_ndb_mgmt(NDB_VERSION, version);
-    if (!compatability_check)
-      infoEvent("Connection attempt from management server id=%d with %s "
-		"incompatible with %s", apiNodePtr.i,
-		getVersionString(version,""), NDB_VERSION_STRING);
     break;
   case NodeInfo::REP:
     //    compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
@@ -1953,13 +1946,19 @@
   case NodeInfo::INVALID:
   default:
     sendApiRegRef(signal, ref, ApiRegRef::WrongType);
-    infoEvent("Invalid connection attempt with type %d",
-	      getNodeInfo(apiNodePtr.i).getType());
+    infoEvent("Invalid connection attempt with type %d", type);
     return;
   }
 
   if (!compatability_check) {
     jam();
+    char buf[NDB_VERSION_STRING_BUF_SZ];
+    infoEvent("Connection attempt from %s id=%d with %s "
+	      "incompatible with %s",
+	      type == NodeInfo::API ? "api or mysqld" : "management server",
+	      apiNodePtr.i,
+	      getVersionString(version,"",buf,sizeof(buf)),
+	      NDB_VERSION_STRING);
     apiNodePtr.p->phase = ZAPI_INACTIVE;
     sendApiRegRef(signal, ref, ApiRegRef::UnsupportedVersion);
     return;
@@ -2085,7 +2084,7 @@
   ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
   if (failedNodePtr.i == getOwnNodeId()) {
     jam();
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
     return;
   }//if
 
@@ -2093,7 +2092,7 @@
   ptrCheckGuard(myNodePtr, MAX_NDB_NODES, nodeRec);
   if (myNodePtr.p->phase != ZRUNNING) {
     jam();
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
     return;
   }//if
   TnoFailedNodes = cnoFailedNodes;
@@ -2172,7 +2171,7 @@
   ptrCheckGuard(myNodePtr, MAX_NDB_NODES, nodeRec);
   if (myNodePtr.p->phase != ZRUNNING) {
     jam();
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
     return;
   }//if
 
@@ -2675,7 +2674,7 @@
 	     ReadNodesConf::SignalLength, JBB);
 }//Qmgr::execREAD_NODESREQ()
 
-void Qmgr::systemErrorBecauseOtherNodeFailed(Signal* signal, 
+void Qmgr::systemErrorBecauseOtherNodeFailed(Signal* signal, Uint32 line,
 					     NodeId failedNodeId) {
   jam();
 
@@ -2687,11 +2686,11 @@
 	   "Node was shutdown during startup because node %d failed",
 	   failedNodeId);
 
-  progError(__LINE__, ERR_SR_OTHERNODEFAILED, buf);  
+  progError(line, ERR_SR_OTHERNODEFAILED, buf);  
 }
 
 
-void Qmgr::systemErrorLab(Signal* signal, const char * message) 
+void Qmgr::systemErrorLab(Signal* signal, Uint32 line, const char * message) 
 {
   jam();
   // Broadcast that this node is failing to other nodes
@@ -2699,7 +2698,7 @@
 
   // If it's known why shutdown occured
   // an error message has been passed to this function
-  progError(__LINE__, 0, message);  
+  progError(line, 0, message);  
 
   return;
 }//Qmgr::systemErrorLab()
@@ -2867,7 +2866,7 @@
   }//for
   if (TtdiNodeId == ZNIL) {
     jam();
-    systemErrorLab(signal);
+    systemErrorLab(signal, __LINE__);
   }//if
   return TtdiNodeId;
 }//Qmgr::translateDynamicIdToNodeId()
Thread
bk commit into 4.1 tree (tomas:1.2354)tomas14 Jul