List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:June 1 2011 8:39am
Subject:Re: Ang.: bzr commit into mysql-5.1-telco-7.1 branch (jonas:4233)
View as plain text  
On 06/01/11 10:36, Magnus Blåudd wrote:
> The last printf is missing placeholder for error message

where do you mean exactly ?

> 
> / Magnus
> 
> ----- Reply message -----
> Från: "jonas oreland" <jonas@stripped>
> Datum: ons, jun 1, 2011 09:51
> Rubrik: bzr commit into mysql-5.1-telco-7.1 branch (jonas:4233)
> Till: <commits@stripped>
> 
> #At file:///home/jonas/src/telco-7.1/ based on
> revid:jonas@stripped
> 
>  4233 jonas oreland	2011-06-01 [merge]
>       ndb - merge 70 to 71
> 
>     modified:
>       storage/ndb/include/transporter/TransporterRegistry.hpp
>       storage/ndb/src/common/transporter/Transporter.cpp
>       storage/ndb/src/common/transporter/Transporter.hpp
>       storage/ndb/src/common/transporter/TransporterRegistry.cpp
>       storage/ndb/src/mgmsrv/MgmtSrvr.cpp
>       storage/ndb/src/mgmsrv/MgmtSrvr.hpp
>       storage/ndb/src/mgmsrv/Services.cpp
> === modified file 'storage/ndb/include/transporter/TransporterRegistry.hpp'
> --- a/storage/ndb/include/transporter/TransporterRegistry.hpp	2011-04-09 15:48:21
> +0000
> +++ b/storage/ndb/include/transporter/TransporterRegistry.hpp	2011-06-01 07:40:49
> +0000
> @@ -118,7 +118,7 @@ public:
>       NOTE! Connection should be closed if function
>       returns false
>    */
> -  bool connect_server(NDB_SOCKET_TYPE sockfd) const;
> +  bool connect_server(NDB_SOCKET_TYPE sockfd, BaseString& errormsg) const;
>  
>    bool connect_client(NdbMgmHandle *h);
>  
> 
> === modified file 'storage/ndb/src/common/transporter/Transporter.cpp'
> --- a/storage/ndb/src/common/transporter/Transporter.cpp	2011-02-01 23:27:25 +0000
> +++ b/storage/ndb/src/common/transporter/Transporter.cpp	2011-06-01 07:40:49 +0000
> @@ -130,18 +130,25 @@ Transporter::configure(const Transporter
>  
>  
>  bool
> -Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
> +Transporter::connect_server(NDB_SOCKET_TYPE sockfd,
> +                            BaseString& msg) {
>    // all initial negotiation is done in TransporterRegistry::connect_server
>    DBUG_ENTER("Transporter::connect_server");
>  
> -  if(m_connected)
> +  if (m_connected)
> +  {
> +    msg.assfmt("line: %u : already connected ??", __LINE__);
>      DBUG_RETURN(false);
> +  }
>  
>    // Cache the connect address
>    my_socket_connect_address(sockfd, &m_connect_address);
>  
>    if (!connect_server_impl(sockfd))
> +  {
> +    msg.assfmt("line: %u : connect_server_impl failed", __LINE__);
>      DBUG_RETURN(false);
> +  }
>  
>    m_connected  = true;
>  
> 
> === modified file 'storage/ndb/src/common/transporter/Transporter.hpp'
> --- a/storage/ndb/src/common/transporter/Transporter.hpp	2011-02-01 23:27:25 +0000
> +++ b/storage/ndb/src/common/transporter/Transporter.hpp	2011-06-01 07:40:49 +0000
> @@ -49,7 +49,7 @@ public:
>     */
>    virtual bool connect_client();
>    bool connect_client(NDB_SOCKET_TYPE sockfd);
> -  bool connect_server(NDB_SOCKET_TYPE socket);
> +  bool connect_server(NDB_SOCKET_TYPE socket, BaseString& errormsg);
>  
>    /**
>     * Blocking
> 
> === modified file 'storage/ndb/src/common/transporter/TransporterRegistry.cpp'
> --- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2011-04-09 15:48:21
> +0000
> +++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2011-06-01 07:40:49
> +0000
> @@ -64,7 +64,8 @@ SocketServer::Session * TransporterServi
>      DBUG_RETURN(0);
>    }
>  
> -  if (!m_transporter_registry->connect_server(sockfd))
> +  BaseString msg;
> +  if (!m_transporter_registry->connect_server(sockfd, msg))
>    {
>      NDB_CLOSE_SOCKET(sockfd);
>      DBUG_RETURN(0);
> @@ -305,7 +306,8 @@ TransporterRegistry::init(NodeId nodeId)
>  }
>  
>  bool
> -TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd) const
> +TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd,
> +                                    BaseString & msg) const
>  {
>    DBUG_ENTER("TransporterRegistry::connect_server(sockfd)");
>  
> @@ -314,6 +316,7 @@ TransporterRegistry::connect_server(NDB_
>    SocketInputStream s_input(sockfd);
>    char buf[11+1+11+1]; // <int> <int>
>    if (s_input.gets(buf, sizeof(buf)) == 0) {
> +    msg.assfmt("line: %u : Failed to get nodeid from client", __LINE__);
>      DBUG_PRINT("error", ("Failed to read 'hello' from client"));
>      DBUG_RETURN(false);
>    }
> @@ -328,6 +331,7 @@ TransporterRegistry::connect_server(NDB_
>      // ok, but with no checks on transporter configuration compatability
>      break;
>    default:
> +    msg.assfmt("line: %u : Incorrect reply from client: >%s<", __LINE__,
> buf);
>      DBUG_PRINT("error", ("Failed to parse 'hello' from client, buf: '%.*s'",
>                           (int)sizeof(buf), buf));
>      DBUG_RETURN(false);
> @@ -341,6 +345,7 @@ TransporterRegistry::connect_server(NDB_
>    if (nodeId < 0 ||
>        nodeId >= (int)maxTransporters)
>    {
> +    msg.assfmt("line: %u : Incorrect reply from client: >%s<", __LINE__,
> buf);
>      DBUG_PRINT("error", ("Out of range nodeId: %d from client",
>                           nodeId));
>      DBUG_RETURN(false);
> @@ -350,6 +355,8 @@ TransporterRegistry::connect_server(NDB_
>    Transporter *t= theTransporters[nodeId];
>    if (t == 0)
>    {
> +    msg.assfmt("line: %u : Incorrect reply from client: >%s<, node: %u",
> +               __LINE__, buf, nodeId);
>      DBUG_PRINT("error", ("No transporter available for node id %d", nodeId));
>      DBUG_RETURN(false);
>    }
> @@ -357,6 +364,11 @@ TransporterRegistry::connect_server(NDB_
>    // Check that the transporter should be connecting
>    if (performStates[nodeId] != TransporterRegistry::CONNECTING)
>    {
> +    msg.assfmt("line: %u : Incorrect state for node %u state: %s (%u)",
> +               __LINE__, nodeId,
> +               getPerformStateString(performStates[nodeId]),
> +               performStates[nodeId]);
> +
>      DBUG_PRINT("error", ("Transporter for node id %d in wrong state",
>                           nodeId));
>      DBUG_RETURN(false);
> @@ -376,15 +388,21 @@ TransporterRegistry::connect_server(NDB_
>    SocketOutputStream s_output(sockfd);
>    if (s_output.println("%d %d", t->getLocalNodeId(), t->m_type) < 0)
>    {
> +    msg.assfmt("line: %u : Failed to reply to connecting socket (node: %u)",
> +               __LINE__, nodeId);
>      DBUG_PRINT("error", ("Send of reply failed"));
>      DBUG_RETURN(false);
>    }
>  
>    // Setup transporter (transporter responsible for closing sockfd)
> -  bool res = t->connect_server(sockfd);
> +  bool res = t->connect_server(sockfd, msg);
>  
>    if (res && performStates[nodeId] != TransporterRegistry::CONNECTING)
>    {
> +    msg.assfmt("line: %u : Incorrect state for node %u state: %s (%u)",
> +               __LINE__, nodeId,
> +               getPerformStateString(performStates[nodeId]),
> +               performStates[nodeId]);
>      // Connection suceeded, but not connecting anymore, return
>      // false to close the connection
>      DBUG_RETURN(false);
> 
> === modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
> --- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2011-05-12 09:40:20 +0000
> +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2011-06-01 07:51:41 +0000
> @@ -3763,11 +3763,12 @@ MgmtSrvr::getConnectionDbParameter(int n
>  }
>  
>  
> -bool MgmtSrvr::transporter_connect(NDB_SOCKET_TYPE sockfd)
> +bool
> +MgmtSrvr::transporter_connect(NDB_SOCKET_TYPE sockfd, BaseString& msg)
>  {
>    DBUG_ENTER("MgmtSrvr::transporter_connect");
>    TransporterRegistry* tr= theFacade->get_registry();
> -  if (!tr->connect_server(sockfd))
> +  if (!tr->connect_server(sockfd, msg))
>      DBUG_RETURN(false);
>  
>    /*
> 
> === modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
> --- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2011-04-15 08:09:04 +0000
> +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2011-06-01 07:40:49 +0000
> @@ -345,7 +345,7 @@ public:
>    int getConnectionDbParameter(int node1, int node2, int param,
>  			       int *value, BaseString& msg);
>  
> -  bool transporter_connect(NDB_SOCKET_TYPE sockfd);
> +  bool transporter_connect(NDB_SOCKET_TYPE sockfd, BaseString& errormsg);
>  
>    const char *get_connect_address(Uint32 node_id);
>    void get_connected_nodes(NodeBitmask &connected_nodes) const;
> 
> === modified file 'storage/ndb/src/mgmsrv/Services.cpp'
> --- a/storage/ndb/src/mgmsrv/Services.cpp	2011-04-07 10:55:42 +0000
> +++ b/storage/ndb/src/mgmsrv/Services.cpp	2011-06-01 07:40:49 +0000
> @@ -1786,13 +1786,14 @@ void
>  MgmApiSession::transporter_connect(Parser_t::Context &ctx,
>  				   Properties const &args)
>  {
> -  if (!m_mgmsrv.transporter_connect(m_socket))
> +  BaseString errormsg;
> +  if (!m_mgmsrv.transporter_connect(m_socket, errormsg))
>    {
>      // Connection not allowed or failed
>      g_eventLogger->warning("Failed to convert connection "
> -                           "from '%s' to transporter",
> -                           name());
> -
> +                           "from '%s' to transporter: %s",
> +                           name(),
> +                           errormsg.c_str());
>      // Close the socket to indicate failure to other side
>    }
>    else
> 
> No bundle (reason: revision is a merge).
> 

Thread
Ang.: bzr commit into mysql-5.1-telco-7.1 branch (jonas:4233)Magnus BlĂ„udd1 Jun
  • Re: Ang.: bzr commit into mysql-5.1-telco-7.1 branch (jonas:4233)Jonas Oreland1 Jun