List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:April 8 2009 1:35pm
Subject:bzr commit into mysql-5.1-telco-6.2 branch (magnus.blaudd:2896)
Bug#44036
View as plain text  
#At file:///home/msvensson/mysql/bug/44036/ based on revid:jonas@strippedcdc00fceyr

 2896 Magnus Blåudd	2009-04-08
      BUG#44036 compiler error - ndberror.c contains C++ comment
       - Fixes for compiling with BUILD/compile-pentium-debug-max --warning-mode=pedantic
     @ storage/ndb/include/ndbapi/NdbScanOperation.hpp
        - Remove duplicate ";"
     @ storage/ndb/src/common/portlib/NdbThread.c
        - Remove C++ comment in c
     @ storage/ndb/src/ndbapi/Makefile.am
        - Compile ndberror_check.c as ndberror_check-t so it's automatically
        run by "make test-unit"
        - Remove crap
     @ storage/ndb/src/ndbapi/NdbBlob.cpp
        - Add adress of operato in order to print the adress of the object
        - Remove duplicate ";"
     @ storage/ndb/src/ndbapi/NdbDictionary.cpp
        - Remove duplicate ";"
     @ storage/ndb/src/ndbapi/ndberror.c
        - Remove C++ comment in c code
        - Remove duplicate unit test code, the real test is now in ndberror_check.cpp
     @ storage/ndb/src/ndbapi/ndberror_check.cpp
        - Rename ndberror_check.c to ndberror_check.cpp
        - Convert to TAP enabled test
        - Implement mock 'my_snprintf' to avoid having to link with all
          libraries in the whole source tree.
     @ storage/ndb/src/ndbapi/signal-sender
        - Remove crap directory
     @ storage/ndb/src/ndbapi/signal-sender/Makefile
        - Remove crap directory
     @ storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp
        - Remove crap directory
     @ storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp
        - Remove crap directory

    removed:
      storage/ndb/src/ndbapi/signal-sender/
      storage/ndb/src/ndbapi/signal-sender/Makefile
      storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp
      storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp
    renamed:
      storage/ndb/src/ndbapi/ndberror_check.c => storage/ndb/src/ndbapi/ndberror_check.cpp
    modified:
      storage/ndb/include/ndbapi/NdbScanOperation.hpp
      storage/ndb/src/common/portlib/NdbThread.c
      storage/ndb/src/ndbapi/Makefile.am
      storage/ndb/src/ndbapi/NdbBlob.cpp
      storage/ndb/src/ndbapi/NdbDictionary.cpp
      storage/ndb/src/ndbapi/ndberror.c
      storage/ndb/src/ndbapi/ndberror_check.cpp
=== modified file 'storage/ndb/include/ndbapi/NdbScanOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbScanOperation.hpp	2009-02-09 13:28:30 +0000
+++ b/storage/ndb/include/ndbapi/NdbScanOperation.hpp	2009-04-08 13:35:51 +0000
@@ -670,6 +670,6 @@ NdbScanOperation::getNdbTransaction() co
    * scan's 'internal' / buddy transaction object
    */
   return m_transConnection;
-};
+}
 
 #endif

=== modified file 'storage/ndb/src/common/portlib/NdbThread.c'
--- a/storage/ndb/src/common/portlib/NdbThread.c	2008-12-12 11:05:58 +0000
+++ b/storage/ndb/src/common/portlib/NdbThread.c	2009-04-08 13:35:51 +0000
@@ -42,7 +42,6 @@ void NdbThread_set_shm_sigmask(my_bool b
   if (g_ndb_shm_signum)
   {
     sigset_t mask;
-    // DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
     sigemptyset(&mask);
     sigaddset(&mask, g_ndb_shm_signum);
     if (block)

=== modified file 'storage/ndb/src/ndbapi/Makefile.am'
--- a/storage/ndb/src/ndbapi/Makefile.am	2008-04-25 06:32:23 +0000
+++ b/storage/ndb/src/ndbapi/Makefile.am	2009-04-08 13:35:51 +0000
@@ -13,11 +13,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#SUBDIRS = signal-sender
+noinst_PROGRAMS = ndberror_check-t
 
-noinst_PROGRAMS = ndberror_check
-
-ndberror_check_SOURCES = ndberror_check.c
+ndberror_check_t_SOURCES = ndberror_check.cpp
 
 noinst_LTLIBRARIES = libndbapi.la
 
@@ -67,12 +65,6 @@ NDB_CXXFLAGS_RELEASE_LOC = -O2
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
 
-ndberror_check_LDFLAGS = \
-         $(top_builddir)/dbug/libdbuglt.la \
-         $(top_builddir)/mysys/libmysyslt.la \
-         $(top_builddir)/strings/libmystringslt.la \
-         $(top_builddir)/zlib/libzlt.la
-
 # Don't update the files from bitkeeper
 %::SCCS/s.%
 

=== modified file 'storage/ndb/src/ndbapi/NdbBlob.cpp'
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp	2008-11-08 20:40:15 +0000
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp	2009-04-08 13:35:51 +0000
@@ -1172,7 +1172,7 @@ int
 NdbBlob::setActiveHook(ActiveHook activeHook, void* arg)
 {
   DBUG_ENTER("NdbBlob::setActiveHook");
-  DBUG_PRINT("info", ("hook=%p arg=%p", (void*)activeHook, arg));
+  DBUG_PRINT("info", ("hook=%p arg=%p", (void*)&activeHook, arg));
   if (theState != Prepared) {
     setErrorCode(NdbBlobImpl::ErrState);
     DBUG_RETURN(-1);
@@ -3074,4 +3074,4 @@ const NdbOperation*
 NdbBlob::getNdbOperation() const
 {
   return theNdbOp;
-};
+}

=== modified file 'storage/ndb/src/ndbapi/NdbDictionary.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionary.cpp	2008-04-01 15:37:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionary.cpp	2009-04-08 13:35:51 +0000
@@ -359,7 +359,7 @@ NdbDictionary::Column::getColumnNo() con
 
 int
 NdbDictionary::Column::getAttrId() const {
-  return m_impl.m_attrId;;
+  return m_impl.m_attrId;
 }
 
 bool
@@ -609,7 +609,7 @@ NdbDictionary::Table::getMinRows() const
 void
 NdbDictionary::Table::setDefaultNoPartitionsFlag(Uint32 flag)
 {
-  m_impl.m_default_no_part_flag = flag;;
+  m_impl.m_default_no_part_flag = flag;
 }
 
 Uint32

=== modified file 'storage/ndb/src/ndbapi/ndberror.c'
--- a/storage/ndb/src/ndbapi/ndberror.c	2009-03-16 23:49:57 +0000
+++ b/storage/ndb/src/ndbapi/ndberror.c	2009-04-08 13:35:51 +0000
@@ -589,7 +589,7 @@ ErrorBundle ErrorCodes[] = {
   { 4538, DMEC, AE, "NdbInterpretedCode instruction requires that table is set" },
   { 4539, DMEC, AE, "NdbInterpretedCode not supported for operation type" },
   { 4540, DMEC, AE, "Attempt to pass an Index column to createRecord.  Use base table columns only" },
-  { 4541, DMEC, AE, "IndexBound has no bound information" }, // No longer generated
+  /* 4541 No longer generated */
   /* 4542-4546 used in later releases */
   { 4547, DMEC, AE, "RecordSpecification has overlapping offsets" },
   { 4548, DMEC, AE, "RecordSpecification has too many elements" },
@@ -784,23 +784,6 @@ static
 const
 int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification);
 
-#ifdef NOT_USED
-/**
- * Complete all fields of an NdbError given the error code
- * and details
- */
-static
-void
-set(ndberror_struct * error, int code, const char * details, ...){
-  error->code = code;
-  {
-    va_list ap;
-    va_start(ap, details);
-    vsnprintf(error->details, sizeof(error->details), details, ap);
-    va_end(ap);
-  }
-}
-#endif
 
 void
 ndberror_update(ndberror_struct * error){
@@ -837,28 +820,6 @@ ndberror_update(ndberror_struct * error)
   }
 }
 
-#if CHECK_ERRORCODES
-int
-checkErrorCodes(){
-  int i, j;
-  for(i = 0; i<NbErrorCodes; i++)
-    for(j = i+1; j<NbErrorCodes; j++)
-      if(ErrorCodes[i].code == ErrorCodes[j].code){
-	printf("ErrorCode %d is defined multiple times!!\n", 
-		 ErrorCodes[i].code);
-	assert(0);
-      }
-  
-  return 1;
-}
-
-/*static const int a = checkErrorCodes();*/
-
-int main(void){
-  checkErrorCodes();
-  return 0;
-}
-#endif
 
 const char *ndberror_status_message(ndberror_status status)
 {

=== renamed file 'storage/ndb/src/ndbapi/ndberror_check.c' => 'storage/ndb/src/ndbapi/ndberror_check.cpp'
--- a/storage/ndb/src/ndbapi/ndberror_check.c	2007-02-21 07:26:47 +0000
+++ b/storage/ndb/src/ndbapi/ndberror_check.cpp	2009-04-08 13:35:51 +0000
@@ -16,23 +16,30 @@
 #include <stdio.h>
 #include "ndberror.c"
 
-int main()
+// Mock implementation of 'my_snprintf'
+size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
 {
-  int i, j, error = 0;
+  abort();
+}
+
+
+#include <NdbTap.hpp>
 
+TAPTEST(ndberror_check)
+{
+  int ok= 1;
   /* check for duplicate error codes */
-  for(i = 0; i < NbErrorCodes; i++)
+  for(int i = 0; i < NbErrorCodes; i++)
   {
-    for(j = i + 1; j < NbErrorCodes; j++)
+    for(int j = i + 1; j < NbErrorCodes; j++)
     {
       if (ErrorCodes[i].code == ErrorCodes[j].code)
       {
         fprintf(stderr, "Duplicate error code %u\n", ErrorCodes[i].code);
-        error = 1;
+        ok = 0;
       }
     }
   }
-  if (error)
-    return -1;
-  return 0;
+  return ok;
 }
+

=== removed directory 'storage/ndb/src/ndbapi/signal-sender'
=== removed file 'storage/ndb/src/ndbapi/signal-sender/Makefile'
--- a/storage/ndb/src/ndbapi/signal-sender/Makefile	2005-04-27 01:19:54 +0000
+++ b/storage/ndb/src/ndbapi/signal-sender/Makefile	1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-NONPIC_ARCHIVE := Y
-ARCHIVE_TARGET := signal-sender
-
-BIN_TARGET_LIBS     :=          # -lkalle
-BIN_TARGET_ARCHIVES := portlib  # $(NDB_TOP)/lib/libkalle.a
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = SignalSender.cpp 
-
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/src/ndbapi)
-
-include $(NDB_TOP)/Epilogue.mk
-
-###
-# Backward compatible

=== removed file 'storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp	1970-01-01 00:00:00 +0000
@@ -1,236 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#include "SignalSender.hpp"
-#include "ConfigRetriever.hpp"
-#include <NdbSleep.h>
-#include <SignalLoggerManager.hpp>
-
-SimpleSignal::SimpleSignal(bool dealloc){
-  memset(this, 0, sizeof(* this));
-  deallocSections = dealloc;
-}
-
-SimpleSignal::~SimpleSignal(){
-  if(!deallocSections)
-    return;
-  if(ptr[0].p != 0) delete []ptr[0].p;
-  if(ptr[1].p != 0) delete []ptr[1].p;
-  if(ptr[2].p != 0) delete []ptr[2].p;
-}
-
-void 
-SimpleSignal::set(class SignalSender& ss,
-		  Uint8  trace, Uint16 recBlock, Uint16 gsn, Uint32 len){
-  
-  header.theTrace                = trace;
-  header.theReceiversBlockNumber = recBlock;
-  header.theVerId_signalNumber   = gsn;
-  header.theLength               = len;
-  header.theSendersBlockRef      = refToBlock(ss.getOwnRef());
-}
-
-void
-SimpleSignal::print(FILE * out){
-  fprintf(out, "---- Signal ----------------\n");
-  SignalLoggerManager::printSignalHeader(out, header, 0, 0, false);
-  SignalLoggerManager::printSignalData(out, header, theData);
-  for(Uint32 i = 0; i<header.m_noOfSections; i++){
-    Uint32 len = ptr[i].sz;
-    fprintf(out, " --- Section %d size=%d ---\n", i, len);
-    Uint32 * signalData = ptr[i].p;
-    while(len >= 7){
-      fprintf(out, 
-              " H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
-              signalData[0], signalData[1], signalData[2], signalData[3], 
-              signalData[4], signalData[5], signalData[6]);
-      len -= 7;
-      signalData += 7;
-    }
-    if(len > 0){
-      fprintf(out, " H\'%.8x", signalData[0]);
-      for(Uint32 i = 1; i<len; i++)
-        fprintf(out, " H\'%.8x", signalData[i]);
-      fprintf(out, "\n");
-    }
-  }
-}
-
-SignalSender::SignalSender(const char * connectString){
-  m_cond = NdbCondition_Create();
-  theFacade = TransporterFacade::start_instance(connectString);
-  m_blockNo = theFacade->open(this, execSignal, execNodeStatus);
-  assert(m_blockNo > 0);
-}
-
-SignalSender::~SignalSender(){
-  theFacade->close(m_blockNo);
-  theFacade->stop_instance();
-  NdbCondition_Destroy(m_cond);
-}
-
-Uint32
-SignalSender::getOwnRef() const {
-  return numberToRef(m_blockNo, theFacade->ownId());
-}
-
-bool
-SignalSender::connectOne(Uint32 timeOutMillis){
-  NDB_TICKS start = NdbTick_CurrentMillisecond();
-  NDB_TICKS now = start;
-  while(theFacade->theClusterMgr->getNoOfConnectedNodes() == 0 &&
-	(timeOutMillis == 0 || (now - start) < timeOutMillis)){
-    NdbSleep_MilliSleep(100);
-  }
-  return theFacade->theClusterMgr->getNoOfConnectedNodes() > 0;
-}
-
-bool
-SignalSender::connectAll(Uint32 timeOutMillis){
-  NDB_TICKS start = NdbTick_CurrentMillisecond();
-  NDB_TICKS now = start;
-  while(theFacade->theClusterMgr->getNoOfConnectedNodes() < 1 &&
-	(timeOutMillis == 0 || (now - start) < timeOutMillis)){	
-    NdbSleep_MilliSleep(100);
-  }
-  return theFacade->theClusterMgr->getNoOfConnectedNodes() >= 1;
-}
-
-
-Uint32
-SignalSender::getAliveNode(){
-  return theFacade->get_an_alive_node();
-}
-
-const ClusterMgr::Node & 
-SignalSender::getNodeInfo(Uint16 nodeId) const {
-  return theFacade->theClusterMgr->getNodeInfo(nodeId);
-}
-
-Uint32
-SignalSender::getNoOfConnectedNodes() const {
-  return theFacade->theClusterMgr->getNoOfConnectedNodes();
-}
-
-SendStatus
-SignalSender::sendSignal(Uint16 nodeId, const SimpleSignal * s){
-  return theFacade->theTransporterRegistry->prepareSend(&s->header,
-							1, // JBB
-							&s->theData[0],
-							nodeId, 
-							&s->ptr[0]);
-}
-
-template<class T>
-SimpleSignal *
-SignalSender::waitFor(Uint32 timeOutMillis, T & t){
-  
-  Guard g(theFacade->theMutexPtr);
-  
-  SimpleSignal * s = t.check(m_jobBuffer);
-  if(s != 0){
-    return s;
-  }
-  
-  NDB_TICKS now = NdbTick_CurrentMillisecond();
-  NDB_TICKS stop = now + timeOutMillis;
-  Uint32 wait = (timeOutMillis == 0 ? 10 : timeOutMillis);
-  do {
-    NdbCondition_WaitTimeout(m_cond,
-			     theFacade->theMutexPtr, 
-			     wait);
-    
-    
-    SimpleSignal * s = t.check(m_jobBuffer);
-    if(s != 0){
-      return s;
-    }
-    
-    now = NdbTick_CurrentMillisecond();
-    wait = (timeOutMillis == 0 ? 10 : stop - now);
-  } while(stop > now || timeOutMillis == 0);
-  
-  return 0;
-} 
-
-class WaitForAny {
-public:
-  SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){
-    if(m_jobBuffer.size() > 0){
-      SimpleSignal * s = m_jobBuffer[0];
-      m_jobBuffer.erase(0);
-	return s;
-    }
-      return 0;
-  }
-};
-  
-SimpleSignal *
-SignalSender::waitFor(Uint32 timeOutMillis){
-  
-  WaitForAny w;
-  return waitFor(timeOutMillis, w);
-}
-
-class WaitForNode {
-public:
-  Uint32 m_nodeId;
-  SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){
-    Uint32 len = m_jobBuffer.size();
-    for(Uint32 i = 0; i<len; i++){
-      if(refToNode(m_jobBuffer[i]->header.theSendersBlockRef) == m_nodeId){
-	SimpleSignal * s = m_jobBuffer[i];
-	m_jobBuffer.erase(i);
-	return s;
-      }
-    }
-    return 0;
-  }
-};
-
-SimpleSignal *
-SignalSender::waitFor(Uint16 nodeId, Uint32 timeOutMillis){
-  
-  WaitForNode w;
-  w.m_nodeId = nodeId;
-  return waitFor(timeOutMillis, w);
-}
-
-#include <NdbApiSignal.hpp>
-
-void
-SignalSender::execSignal(void* signalSender, 
-			 NdbApiSignal* signal, 
-			 class LinearSectionPtr ptr[3]){
-  SimpleSignal * s = new SimpleSignal(true);
-  s->header = * signal;
-  memcpy(&s->theData[0], signal->getDataPtr(), 4 * s->header.theLength);
-  for(Uint32 i = 0; i<s->header.m_noOfSections; i++){
-    s->ptr[i].p = new Uint32[ptr[i].sz];
-    s->ptr[i].sz = ptr[i].sz;
-    memcpy(s->ptr[i].p, ptr[i].p, 4 * ptr[i].sz);
-  }
-  SignalSender * ss = (SignalSender*)signalSender;
-  ss->m_jobBuffer.push_back(s);
-  NdbCondition_Signal(ss->m_cond);
-}
-  
-void 
-SignalSender::execNodeStatus(void* signalSender, 
-			     Uint16 NodeId, 
-			     bool alive, 
-			     bool nfCompleted){
-}
-  

=== removed file 'storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp	1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#ifndef SIGNAL_SENDER_HPP
-#define SIGNAL_SENDER_HPP
-
-#include <ndb_global.h>
-#include <TransporterDefinitions.hpp>
-#include <TransporterFacade.hpp>
-#include <ClusterMgr.hpp>
-#include <Vector.hpp>
-
-struct SimpleSignal {
-public:
-  SimpleSignal(bool dealloc = false);
-  ~SimpleSignal();
-  
-  void set(class SignalSender&,
-	   Uint8  trace, Uint16 recBlock, Uint16 gsn, Uint32 len);
-  
-  struct SignalHeader header;
-  Uint32 theData[25];
-  LinearSectionPtr ptr[3];
-
-  void print(FILE * out = stdout);
-private:
-  bool deallocSections;
-};
-
-class SignalSender {
-public:
-  SignalSender(const char * connectString = 0);
-  virtual ~SignalSender();
-  
-  bool connectOne(Uint32 timeOutMillis = 0);
-  bool connectAll(Uint32 timeOutMillis = 0);
-  bool connect(Uint32 timeOutMillis = 0) { return connectAll(timeOutMillis);}
-  
-  Uint32 getOwnRef() const;
-  
-  Uint32 getAliveNode();
-  Uint32 getNoOfConnectedNodes() const;
-  const ClusterMgr::Node & getNodeInfo(Uint16 nodeId) const;
-  
-  SendStatus sendSignal(Uint16 nodeId, const SimpleSignal *);
-  
-  SimpleSignal * waitFor(Uint32 timeOutMillis = 0);
-  SimpleSignal * waitFor(Uint16 nodeId, Uint32 timeOutMillis = 0);
-  SimpleSignal * waitFor(Uint16 nodeId, Uint16 gsn, Uint32 timeOutMillis = 0);  
-  
-private:
-  int m_blockNo;
-  TransporterFacade * theFacade;
-  
-  static void execSignal(void* signalSender, 
-			 NdbApiSignal* signal, 
-			 class LinearSectionPtr ptr[3]);
-  
-  static void execNodeStatus(void* signalSender, NodeId, 
-			     bool alive, bool nfCompleted);
-  
-  struct NdbCondition * m_cond;
-  Vector<SimpleSignal *> m_jobBuffer;
-
-  template<class T>
-  SimpleSignal * waitFor(Uint32 timeOutMillis, T & t);
-};
-
-#endif

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20090408133551-vttnpxukpdmnzl34.bundle
Thread
bzr commit into mysql-5.1-telco-6.2 branch (magnus.blaudd:2896)Bug#44036Magnus Blåudd8 Apr